Input type number. Fix empty gift cards list
This commit is contained in:
parent
02334320d0
commit
210bbc36cc
6 changed files with 33 additions and 45 deletions
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
<div ng-init="amazon.init()">
|
<div ng-init="amazon.init()">
|
||||||
|
|
||||||
<div class="box-notification text-center size-12 text-warning m10t" ng-show="amazon.sandbox">
|
<div class="box-notification text-center size-12 text-warning" ng-show="amazon.sandbox">
|
||||||
<i class="fi-info"></i>
|
<i class="fi-info"></i>
|
||||||
Sandbox version. Only for testing purpose
|
Sandbox version. Only for testing purpose
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center m20b">
|
||||||
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="200">
|
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="200">
|
||||||
<div class="text-left size-12 m10t">
|
<div class="text-left size-12 m10t">
|
||||||
Use your Amazon.com Gift Card* to shop from a huge selection of books, electronics, music, movies, software, apparel, toys, and more.
|
Use your Amazon.com Gift Card* to shop from a huge selection of books, electronics, music, movies, software, apparel, toys, and more.
|
||||||
|
|
@ -38,10 +38,16 @@
|
||||||
ng-submit="buy.createTx()"
|
ng-submit="buy.createTx()"
|
||||||
novalidate>
|
novalidate>
|
||||||
|
|
||||||
<div class="m20v text-center">
|
<label>
|
||||||
<a class="amazon-select-amount" ng-click="buy.setAmount()">-</a>
|
Amount
|
||||||
<span class="amazon-amount">$ {{fiat}}</span>
|
</label>
|
||||||
<a class="amazon-select-amount" ng-click="buy.setAmount(1)">+</a>
|
<div class="input">
|
||||||
|
<input type="number" id="fiat"
|
||||||
|
name="fiat" ng-attr-placeholder="{{'Amount in USD'}}"
|
||||||
|
min="0.01" max="2000"
|
||||||
|
ng-model="fiat" autocomplete="off" required>
|
||||||
|
|
||||||
|
<a class="postfix button black">USD</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('amazonController',
|
angular.module('copayApp.controllers').controller('amazonController',
|
||||||
function($scope, $timeout, $ionicModal, configService, amazonService) {
|
function($scope, $timeout, $ionicModal, lodash, configService, amazonService) {
|
||||||
|
|
||||||
this.init = function() {
|
this.init = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
@ -13,7 +13,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
self.error = err;
|
self.error = err;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.giftCards = gcds;
|
self.giftCards = lodash.isEmpty(gcds) ? null : gcds;
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
});
|
});
|
||||||
|
|
@ -21,6 +21,7 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
};
|
};
|
||||||
|
|
||||||
this.openCardModal = function(card) {
|
this.openCardModal = function(card) {
|
||||||
|
var self = this;
|
||||||
$scope.card = card;
|
$scope.card = card;
|
||||||
|
|
||||||
$ionicModal.fromTemplateUrl('views/modals/amazon-card-details.html', {
|
$ionicModal.fromTemplateUrl('views/modals/amazon-card-details.html', {
|
||||||
|
|
@ -29,5 +30,9 @@ angular.module('copayApp.controllers').controller('amazonController',
|
||||||
$scope.amazonCardDetailsModal = modal;
|
$scope.amazonCardDetailsModal = modal;
|
||||||
$scope.amazonCardDetailsModal.show();
|
$scope.amazonCardDetailsModal.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.$on('UpdateAmazonList', function(event) {
|
||||||
|
self.init();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var client;
|
var client;
|
||||||
var minimumAmount = 5;
|
var limitsAllowed = {
|
||||||
var stepAmount = 1;
|
min: 0.01,
|
||||||
var multiplierAmount = 5;
|
max: 2000
|
||||||
var maximumAmount = 500;
|
};
|
||||||
|
|
||||||
var handleEncryptedWallet = function(client, cb) {
|
var handleEncryptedWallet = function(client, cb) {
|
||||||
if (!walletService.isEncrypted(client)) return cb();
|
if (!walletService.isEncrypted(client)) return cb();
|
||||||
|
|
@ -19,7 +19,6 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
};
|
};
|
||||||
|
|
||||||
this.init = function() {
|
this.init = function() {
|
||||||
$scope.fiat = minimumAmount;
|
|
||||||
var network = configService.getSync().amazon.testnet ? 'testnet' : 'livenet';
|
var network = configService.getSync().amazon.testnet ? 'testnet' : 'livenet';
|
||||||
amazonService.setCredentials(network);
|
amazonService.setCredentials(network);
|
||||||
amazonService.healthCheckRequest();
|
amazonService.healthCheckRequest();
|
||||||
|
|
@ -35,6 +34,14 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.checkLimits = function() {
|
||||||
|
console.log('[buyAmazon.js:37]'); //TODO
|
||||||
|
if ($scope.fiat && $scope.fiat >= limitsAllowed.min && $scope.fiat <= limitsAllowed.max)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
$scope.openWalletsModal = function(wallets) {
|
$scope.openWalletsModal = function(wallets) {
|
||||||
self.error = null;
|
self.error = null;
|
||||||
|
|
||||||
|
|
@ -59,16 +66,6 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setAmount = function(plus) {
|
|
||||||
if (plus && $scope.fiat < maximumAmount ) {
|
|
||||||
stepAmount = stepAmount + 1;
|
|
||||||
$scope.fiat = stepAmount * multiplierAmount;
|
|
||||||
} else if (!plus && $scope.fiat > minimumAmount) {
|
|
||||||
stepAmount = stepAmount - 1;
|
|
||||||
$scope.fiat = stepAmount * multiplierAmount;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.createTx = function() {
|
this.createTx = function() {
|
||||||
self.error = null;
|
self.error = null;
|
||||||
self.errorInfo = null;
|
self.errorInfo = null;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
|
||||||
|
|
||||||
$scope.remove = function() {
|
$scope.remove = function() {
|
||||||
amazonService.saveGiftCard($scope.card, {remove: true}, function(err) {
|
amazonService.saveGiftCard($scope.card, {remove: true}, function(err) {
|
||||||
|
$scope.$emit('UpdateAmazonList');
|
||||||
$scope.cancel();
|
$scope.cancel();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -43,6 +44,7 @@ angular.module('copayApp.controllers').controller('amazonCardDetailsController',
|
||||||
$scope.error = err;
|
$scope.error = err;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$scope.$emit('UpdateAmazonList');
|
||||||
$scope.card = data;
|
$scope.card = data;
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,4 @@
|
||||||
|
|
||||||
.amazon-select-amount {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 3px 15px;
|
|
||||||
background-color: #4B6178;
|
|
||||||
color: #ffffff;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin: 0 5px;
|
|
||||||
&:hover {
|
|
||||||
color: #ffffff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.amazon-amount {
|
|
||||||
display: inline-block;
|
|
||||||
background-color: #E4E8EC;
|
|
||||||
padding: 3px 10px;
|
|
||||||
width: 80px;
|
|
||||||
text-align: center;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ol.amazon-list {
|
ol.amazon-list {
|
||||||
list-style: decimal !important;
|
list-style: decimal !important;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue