diff --git a/public/views/modals/inputAmount.html b/public/views/modals/inputAmount.html index 2c1026a8b..343b7e91e 100644 --- a/public/views/modals/inputAmount.html +++ b/public/views/modals/inputAmount.html @@ -21,10 +21,9 @@ Recipient - - - Javier + + {{recipientName}} @@ -121,30 +120,39 @@ - Sending - {{sendingAmount}} {{unitName}} - {{sendingAlternativeAmount}} {{alternativeIsoCode}} + + + Sending + {{sendingAmount}} {{unitName}} + {{sendingAlternativeAmount}} {{alternativeIsoCode}} + + + Fee: Economy (97 bits) + To - - Javier + + {{recipientName}} + From - - Personal Wallet - + + Focused Wallet (Default Wallet) + + Add Memo - + + - + Slide to complete - + diff --git a/public/views/tab-send.html b/public/views/tab-send.html index 8483ebab0..d83939f3d 100644 --- a/public/views/tab-send.html +++ b/public/views/tab-send.html @@ -1,5 +1,5 @@ - + Recipient @@ -7,37 +7,35 @@ - Recently used - - - - - Personal Wallet - - 123,424.91 bits - - - - - Testnet Wallet - - 123,424.91 bits - - - - Contacts - - - Javier - + + + + + + {{item.label}} + + + + + {{item.name || item.alias}} + + {{item.balance || '123,999.91 bits'}} + + diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 5f16acb06..d861c1f44 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -1,8 +1,53 @@ 'use strict'; -angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal) { +angular.module('copayApp.controllers').controller('tabSendController', function($scope, $ionicModal, addressbookService, profileService, configService, lodash) { + + $scope.init = function() { + addressbookService.list(function(err, ab) { + if (err) { + console.log('ERROR:', err); + return; + } + // $scope.contactList = lodash.isEmpty(ab) ? null : ab; + $scope.contactList = [{ + label: 'Javier', + address: '123456' + }, { + label: 'Javier 2', + address: '654321' + }, { + label: 'Javier 3', + address: '7891011' + }, { + label: 'Javier 4', + address: '1101987' + }]; + }); + + var config = configService.getSync(); + config.colorFor = config.colorFor || {}; + config.aliasFor = config.aliasFor || {}; + + // Sanitize empty wallets (fixed in BWC 1.8.1, and auto fixed when wallets completes) + var credentials = lodash.filter(profileService.profile.credentials, 'walletName'); + var ret = lodash.map(credentials, function(c) { + return { + m: c.m, + n: c.n, + name: config.aliasFor[c.walletId] || c.walletName, + id: c.walletId, + color: config.colorFor[c.walletId] || '#4A90E2', + }; + }); + + $scope.wallets = lodash.sortBy(ret, 'name'); + $scope.list = $scope.contactList.concat($scope.wallets); + }; + + $scope.openInputAmountModal = function(recipient) { + $scope.recipientName = recipient.name || recipient.label; + $scope.recipientColor = recipient.color; - $scope.openInputAmountModal = function(addr) { $ionicModal.fromTemplateUrl('views/modals/inputAmount.html', { scope: $scope }).then(function(modal) { @@ -10,15 +55,4 @@ angular.module('copayApp.controllers').controller('tabSendController', function( $scope.inputAmountModal.show(); }); }; - - $scope.options = { - loop: false, - effect: 'fade', - speed: 500, - }; - - $scope.$on("$ionicSlides.slideChangeEnd", function(event, data) { - // note: the indexes are 0-based - console.log('CHANGEDD'); - }); });