homogenized switch alternative amount

This commit is contained in:
Javier 2016-07-18 11:28:03 -03:00
commit 838038a92e
5 changed files with 64 additions and 81 deletions

View file

@ -0,0 +1,56 @@
<ion-modal-view ng-controller="amountInputController" ng-init=init()>
<ion-content>
<ion-header-bar align-title="center" class="tab-bar" ng-style="{'background-color':index.backgroundColor}">
<div class="left-small">
<a class="p10" ng-click="close()"><span class="text-close" translate>Close</span></a>
</div>
<h1 class="title ellipsis" translate>Enter amount</h1>
<div class="right-small m5r" ng-click="toggleAlternative()">
<a class="postfix" ng-show="showAlternative">{{alternativeIsoCode}}</a>
<a class="postfix" ng-show="!showAlternative">{{unitName}}</a>
</div>
</ion-header-bar>
<div class="send-amount row" ng-style="{'background-color':index.backgroundColor}">
<div class="size-48" ng-show="!showAlternative">{{amount}}</div>
<div class="size-21 text-light" ng-show="!showAlternative">{{amountResult}} {{alternativeIsoCode}}</div>
<div class="size-48" ng-show="showAlternative">${{alternativeAmount}}</div>
<div class="size-21 text-light" ng-show="showAlternative">{{alternativeResult}} {{unitName}}</div>
</div>
<div class="button-content text-center df">
<button class="button expand button-balanced" ng-click="" translate>Request</button>
<button class="button expand button-balanced" ng-click="" translate>Send</button>
</div>
<div class="button-content text-center size-10 df">
<button class="button expand button-stable" ng-click="pushOperator('x')">x</button>
<button class="button expand button-stable" ng-click="pushOperator('/')">/</button>
<button class="button expand button-stable" ng-click="pushOperator('+')">+</button>
<button class="button expand button-stable" ng-click="pushOperator('-')">-</button>
</div>
<div class="m10b">
<div class="button-content text-center df">
<button class="button expand button-light" ng-click="pushDigit('1')">1</button>
<button class="button expand button-light" ng-click="pushDigit('2')">2</button>
<button class="button expand button-light" ng-click="pushDigit('3')">3</button>
</div>
<div class="button-content text-center df">
<button class="button expand button-light" ng-click="pushDigit('4')">4</button>
<button class="button expand button-light" ng-click="pushDigit('5')">5</button>
<button class="button expand button-light" ng-click="pushDigit('6')">6</button>
</div>
<div class="button-content text-center df">
<button class="button expand button-light" ng-click="pushDigit('7')">7</button>
<button class="button expand button-light" ng-click="pushDigit('8')">8</button>
<button class="button expand button-light" ng-click="pushDigit('9')">9</button>
</div>
<div class="button-content text-center df">
<button class="button expand button-light" ng-click="pushDigit('.')">.</button>
<button class="button expand button-light" ng-click="pushDigit('0')">0</button>
<button class="button expand button-light" ng-click="removeDigit()"><i class="icon ion-backspace-outline"></i></button>
</div>
</div>
</ion-content>
</ion-modal-view>

View file

@ -1,54 +0,0 @@
<ion-content ng-controller="send2Controller" ng-init=init()>
<ion-header-bar align-title="center" class="tab-bar" ng-style="{'background-color':index.backgroundColor}">
<div class="left-small">
<a class="p10" ng-click="close()"><span class="text-close" translate>Close</span></a>
</div>
<h1 class="title ellipsis" translate>Enter amount</h1>
<div class="right-small m5r" ng-click="toggleAlternative()">
<a class="postfix" ng-show="showAlternative">{{alternativeIsoCode}}</a>
<a class="postfix" ng-show="!showAlternative">{{unitName}}</a>
</div>
</ion-header-bar>
<div class="send-amount row" ng-style="{'background-color':index.backgroundColor}">
<div class="size-48" ng-show="!showAlternative">{{amount}}</div>
<div class="size-21 text-light" ng-show="!showAlternative">{{amountResult}} {{alternativeIsoCode}}</div>
<div class="size-48" ng-show="showAlternative">${{alternativeAmount}}</div>
<div class="size-21 text-light" ng-show="showAlternative">{{alternativeResult}} {{unitName}}</div>
</div>
<div class="button-content text-center df">
<button class="button expand button-balanced" ng-click="" translate>Request</button>
<button class="button expand button-balanced" ng-click="" translate>Send</button>
</div>
<div class="button-content text-center size-10 df">
<button class="button expand button-stable" ng-click="pushOperator('x')">x</button>
<button class="button expand button-stable" ng-click="pushOperator('/')">/</button>
<button class="button expand button-stable" ng-click="pushOperator('+')">+</button>
<button class="button expand button-stable" ng-click="pushOperator('-')">-</button>
</div>
<div class="m10b">
<div class="button-content text-center df">
<button class="button expand button-light" ng-click="pushDigit('1')">1</button>
<button class="button expand button-light" ng-click="pushDigit('2')">2</button>
<button class="button expand button-light" ng-click="pushDigit('3')">3</button>
</div>
<div class="button-content text-center df">
<button class="button expand button-light" ng-click="pushDigit('4')">4</button>
<button class="button expand button-light" ng-click="pushDigit('5')">5</button>
<button class="button expand button-light" ng-click="pushDigit('6')">6</button>
</div>
<div class="button-content text-center df">
<button class="button expand button-light" ng-click="pushDigit('7')">7</button>
<button class="button expand button-light" ng-click="pushDigit('8')">8</button>
<button class="button expand button-light" ng-click="pushDigit('9')">9</button>
</div>
<div class="button-content text-center df">
<button class="button expand button-light" ng-click="pushDigit('.')">.</button>
<button class="button expand button-light" ng-click="pushDigit('0')">0</button>
<button class="button expand button-light" ng-click="removeDigit()"><i class="icon ion-backspace-outline"></i></button>
</div>
</div>
</ion-content>

View file

@ -415,23 +415,15 @@
<i class="icon-checkmark-circle size-14"></i>
</small>
</div>
<div ng-show="!home.canShowAlternative()">
<div>
<label for="amount">
<span translate>Amount</span>
<span translate>Amount</span><span ng-show="showAlternative"> [{{home.alternativeIsoCode}}]</span>
</label>
<div class="input">
<input type="number" id="amount" ng-disabled=" home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)" ignore-mouse-wheel>
<input type="number" id="alternative" name="alternative" ng-model="_alternative" style="display:none">
<a class="postfix button" ng-style="{'background-color':index.backgroundColor}" ng-click="home.showAlternative()">{{home.unitName}}</a>
</div>
</div>
<div ng-show="home.canShowAlternative()">
<label for="alternative"><span translate>Amount</span> [{{ home.alternativeIsoCode }}]
</label>
<div class="input">
<input type="number" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)" ignore-mouse-wheel>
<input type="number" id="amount" name="amount" ng-model="_amount" style="display:none">
<a class="postfix button black" ng-click="home.hideAlternative()"> {{ home.alternativeIsoCode }}</a>
<input type="number" ng-show="!showAlternative" id="amount" ng-disabled="home.lockAmount" name="amount" ng-attr-placeholder="{{'Amount in'|translate}} {{home.unitName}}" ng-model="_amount" valid-amount required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)" ignore-mouse-wheel>
<input type="number" ng-show="showAlternative" id="alternative" ng-disabled="!home.isRateAvailable || home.lockAmount" name="alternative" ng-attr-placeholder="{{'Amount in'|translate}} {{ home.alternativeName }}" ng-model="_alternative" required autocomplete="off" ng-focus="home.formFocus('amount')" ng-blur="home.formFocus(false)" ignore-mouse-wheel>
<a class="postfix button" ng-show="!showAlternative" ng-style="{'background-color':index.backgroundColor}" ng-click="showAlternative = !showAlternative">{{home.unitName}}</a>
<a class="postfix button black" ng-show="showAlternative" ng-click="showAlternative = !showAlternative">{{home.alternativeIsoCode}}</a>
</div>
</div>
</div>

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('send2Controller', function($scope, lodash, configService, go, rateService) {
angular.module('copayApp.controllers').controller('amountInputController', function($scope, lodash, configService, go, rateService) {
var unitToSatoshi;
var satToUnit;
var unitDecimals;

View file

@ -29,6 +29,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
ret.isWindowsPhoneApp = platformInfo.isWP;
ret.countDown = null;
ret.sendMaxInfo = {};
ret.showAlternative = false;
var vanillaScope = ret;
var disableScannerListener = $rootScope.$on('dataScanned', function(event, data) {
@ -232,18 +233,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
// Send
this.canShowAlternative = function() {
return $scope.showAlternative;
};
this.showAlternative = function() {
$scope.showAlternative = true;
};
this.hideAlternative = function() {
$scope.showAlternative = false;
};
this.resetError = function() {
this.error = this.success = null;
};