Not using amount directive. Removed safety area below All Available Funds button.
This commit is contained in:
parent
97aa7c415e
commit
02f7bcc281
3 changed files with 27 additions and 27 deletions
|
|
@ -9,13 +9,14 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
vm.altCurrencyList = [];
|
vm.altCurrencyList = [];
|
||||||
vm.alternativeAmount = '';
|
vm.alternativeAmount = '';
|
||||||
vm.alternativeUnit = '';
|
vm.alternativeUnit = '';
|
||||||
vm.amountModel = { amount: 0 };
|
vm.amount = '0';
|
||||||
vm.availableFunds = '';
|
vm.availableFunds = '';
|
||||||
vm.fromWalletId = '';
|
vm.fromWalletId = '';
|
||||||
// Use insufficient for logic, as when the amount is invalid, funds being
|
// Use insufficient for logic, as when the amount is invalid, funds being
|
||||||
// either sufficent or insufficient doesn't make sense.
|
// either sufficent or insufficient doesn't make sense.
|
||||||
vm.fundsAreInsufficient = false;
|
vm.fundsAreInsufficient = false;
|
||||||
vm.globalResult = '';
|
vm.globalResult = '';
|
||||||
|
vm.hello = 'hi';
|
||||||
vm.isRequestingSpecificAmount = false;
|
vm.isRequestingSpecificAmount = false;
|
||||||
vm.listComplete = false;
|
vm.listComplete = false;
|
||||||
vm.lastUsedPopularList = [];
|
vm.lastUsedPopularList = [];
|
||||||
|
|
@ -77,9 +78,9 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBeforeEnter(event, data) {
|
function onBeforeEnter(event, data) {
|
||||||
|
|
||||||
initCurrencies();
|
initCurrencies();
|
||||||
|
vm.hello = 'greetings';
|
||||||
if (data.stateParams.shapeshiftOrderId && data.stateParams.shapeshiftOrderId.length > 0) {
|
if (data.stateParams.shapeshiftOrderId && data.stateParams.shapeshiftOrderId.length > 0) {
|
||||||
vm.minShapeshiftAmount = parseFloat(data.stateParams.minShapeshiftAmount);
|
vm.minShapeshiftAmount = parseFloat(data.stateParams.minShapeshiftAmount);
|
||||||
vm.maxShapeshiftAmount = parseFloat(data.stateParams.maxShapeshiftAmount);
|
vm.maxShapeshiftAmount = parseFloat(data.stateParams.maxShapeshiftAmount);
|
||||||
|
|
@ -159,7 +160,7 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
|
|
||||||
// in SAT ALWAYS
|
// in SAT ALWAYS
|
||||||
if ($stateParams.toAmount) {
|
if ($stateParams.toAmount) {
|
||||||
vm.amountModel.amount = (($stateParams.toAmount) * satToUnit).toFixed(unitDecimals);
|
vm.amount = (($stateParams.toAmount) * satToUnit).toFixed(unitDecimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
processAmount();
|
processAmount();
|
||||||
|
|
@ -271,7 +272,7 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
}
|
}
|
||||||
|
|
||||||
function paste(value) {
|
function paste(value) {
|
||||||
vm.amountModel.amount = value;
|
vm.amount = value;
|
||||||
processAmount();
|
processAmount();
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
|
@ -299,7 +300,7 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
|
|
||||||
function changeUnit() {
|
function changeUnit() {
|
||||||
|
|
||||||
vm.amountModel.amount = '0';
|
vm.amount = '0';
|
||||||
|
|
||||||
if (fixedUnit) return;
|
if (fixedUnit) return;
|
||||||
|
|
||||||
|
|
@ -321,32 +322,32 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
};
|
};
|
||||||
|
|
||||||
function pushDigit(digit) {
|
function pushDigit(digit) {
|
||||||
if (vm.amountModel.amount && digit != '.') {
|
if (vm.amount && digit != '.') {
|
||||||
var amountSplitByComma = vm.amountModel.amount.split('.');
|
var amountSplitByComma = vm.amount.split('.');
|
||||||
if (amountSplitByComma.length > 1 && amountSplitByComma[1].length >= LENGTH_AFTER_COMMA_EXPRESSION_LIMIT) return;
|
if (amountSplitByComma.length > 1 && amountSplitByComma[1].length >= LENGTH_AFTER_COMMA_EXPRESSION_LIMIT) return;
|
||||||
if (amountSplitByComma.length == 1 && amountSplitByComma[0].length >= LENGTH_BEFORE_COMMA_EXPRESSION_LIMIT) return;
|
if (amountSplitByComma.length == 1 && amountSplitByComma[0].length >= LENGTH_BEFORE_COMMA_EXPRESSION_LIMIT) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm.amountModel.amount && vm.amountModel.amount.length >= LENGTH_EXPRESSION_LIMIT) return;
|
if (vm.amount && vm.amount.length >= LENGTH_EXPRESSION_LIMIT) return;
|
||||||
if (vm.amountModel.amount.indexOf('.') > -1 && digit == '.') return;
|
if (vm.amount.indexOf('.') > -1 && digit == '.') return;
|
||||||
if (vm.amountModel.amount == '0' && digit == '0') return;
|
if (vm.amount == '0' && digit == '0') return;
|
||||||
if (availableUnits[unitIndex].isFiat && vm.amountModel.amount.indexOf('.') > -1 && vm.amountModel.amount[vm.amountModel.amount.indexOf('.') + 2]) return;
|
if (availableUnits[unitIndex].isFiat && vm.amount.indexOf('.') > -1 && vm.amount[vm.amount.indexOf('.') + 2]) return;
|
||||||
|
|
||||||
if (vm.amountModel.amount == '0' && digit != '.') {
|
if (vm.amount == '0' && digit != '.') {
|
||||||
vm.amountModel.amount = '';
|
vm.amount = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm.amountModel.amount == '' && digit == '.') {
|
if (vm.amount == '' && digit == '.') {
|
||||||
vm.amountModel.amount = '0';
|
vm.amount = '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.amountModel.amount = (vm.amountModel.amount + digit).replace('..', '.');
|
vm.amount = (vm.amount + digit).replace('..', '.');
|
||||||
processAmount();
|
processAmount();
|
||||||
};
|
};
|
||||||
|
|
||||||
function pushOperator(operator) {
|
function pushOperator(operator) {
|
||||||
if (!vm.amountModel.amount || vm.amountModel.amount.length == 0) return;
|
if (!vm.amount || vm.amount.length == 0) return;
|
||||||
vm.amountModel.amount = pushOperator(vm.amountModel.amount);
|
vm.amount = pushOperator(vm.amount);
|
||||||
|
|
||||||
function pushOperator(val) {
|
function pushOperator(val) {
|
||||||
if (!isOperator(lodash.last(val))) {
|
if (!isOperator(lodash.last(val))) {
|
||||||
|
|
@ -368,12 +369,12 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
};
|
};
|
||||||
|
|
||||||
function removeDigit() {
|
function removeDigit() {
|
||||||
vm.amountModel.amount = (vm.amountModel.amount).toString().slice(0, -1);
|
vm.amount = (vm.amount).toString().slice(0, -1);
|
||||||
processAmount();
|
processAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetAmount() {
|
function resetAmount() {
|
||||||
vm.amountModel.amount = vm.alternativeAmount = vm.globalResult = '';
|
vm.amount = vm.alternativeAmount = vm.globalResult = '0';
|
||||||
vm.allowSend = false;
|
vm.allowSend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -393,11 +394,11 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
};
|
};
|
||||||
|
|
||||||
function processAmount() {
|
function processAmount() {
|
||||||
var formatedValue = format(vm.amountModel.amount);
|
var formatedValue = format(vm.amount);
|
||||||
var result = evaluate(formatedValue);
|
var result = evaluate(formatedValue);
|
||||||
|
|
||||||
if (lodash.isNumber(result)) {
|
if (lodash.isNumber(result)) {
|
||||||
vm.globalResult = isExpression(vm.amountModel.amount) ? '= ' + processResult(result) : '';
|
vm.globalResult = isExpression(vm.amount) ? '= ' + processResult(result) : '';
|
||||||
|
|
||||||
if (availableUnits[unitIndex].isFiat) {
|
if (availableUnits[unitIndex].isFiat) {
|
||||||
|
|
||||||
|
|
@ -481,7 +482,7 @@ function amountController(configService, $filter, $ionicHistory, $ionicModal, $i
|
||||||
|
|
||||||
function finish() {
|
function finish() {
|
||||||
var unit = availableUnits[unitIndex];
|
var unit = availableUnits[unitIndex];
|
||||||
var _amount = evaluate(format(vm.amountModel.amount));
|
var _amount = evaluate(format(vm.amount));
|
||||||
var coin = unit.id;
|
var coin = unit.id;
|
||||||
if (unit.isFiat) {
|
if (unit.isFiat) {
|
||||||
coin = availableUnits[altUnitIndex].id;
|
coin = availableUnits[altUnitIndex].id;
|
||||||
|
|
|
||||||
|
|
@ -462,7 +462,6 @@
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
line-height: 2em;
|
line-height: 2em;
|
||||||
margin-bottom: 1.618em;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
.available-funds-amount {
|
.available-funds-amount {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
<div class="send-amount-tool">
|
<div class="send-amount-tool">
|
||||||
<div class="send-amount-tool-input amount">
|
<div class="send-amount-tool-input amount">
|
||||||
<div class="primary-amount"
|
<div class="primary-amount"
|
||||||
ng-class="{long: vm.amountModel.amount.length > 5, 'very-long': vm.amountModel.amount.length > 10}">
|
ng-class="{long: vm.amount.length > 5, 'very-long': vm.amount.length > 10}">
|
||||||
<span class="primary-amount-display text-selectable">{{ vm.amountModel.amount || 0 }}</span><span class="unit">{{vm.unit}}</span>
|
<span class="primary-amount-display text-selectable">{{vm.amount}} {{vm.unit}}</span>
|
||||||
</div>
|
</div>
|
||||||
<span ng-show="vm.globalResult">{{vm.globalResult}} {{vm.unit}}</span>
|
<span ng-show="vm.globalResult">{{vm.globalResult}} {{vm.unit}}</span>
|
||||||
<div class="alternative-amount">
|
<div class="alternative-amount">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue