diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index fdcb25ada09862e4796bbd9d8fb53a45f9471f4d..ee4450053d289c6de2d5f293409881b68ab5fcac 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -479,7 +479,7 @@ "STRONG_LEVEL": "Strong <span class=\"hidden-xs \">(6 questions minimum)</span>", "TITLE": "Sign-in and security" }, - "FILE_NAME": "Account statement {{pubkey|formatPubkey}} to {{currentTime|formatDateForFile}}.csv", + "FILE_NAME": "{{currency}} - Account statement {{pubkey|formatPubkey}} to {{currentTime|formatDateForFile}}.csv", "HEADERS": { "TIME": "Date", "AMOUNT": "Amount", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index a6fb16a84637098a9ef6ed30955d72e87506f902..3ea592fb9a97caa4ed7b477b6e93360f54d82994 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -479,7 +479,7 @@ "STRONG_LEVEL": "Strong <span class=\"hidden-xs \">(6 questions minimum)</span>", "TITLE": "Sign-in and security" }, - "FILE_NAME": "Account statement {{pubkey|formatPubkey}} to {{currentTime|formatDateForFile}}.csv", + "FILE_NAME": "{{currency}} - Account statement {{pubkey|formatPubkey}} to {{currentTime|formatDateForFile}}.csv", "HEADERS": { "TIME": "Date", "AMOUNT": "Amount", diff --git a/www/i18n/locale-es-ES.json b/www/i18n/locale-es-ES.json index 35c567a217b6556f3c75be49b1206cdb577293f6..57429cd206ddda53d474b065d2d7b1a1cba36725 100644 --- a/www/i18n/locale-es-ES.json +++ b/www/i18n/locale-es-ES.json @@ -479,7 +479,7 @@ "STRONG_LEVEL": "Alto <span class=\"hidden-xs \">(6 preguntas mÃnimo)</span>", "TITLE": "Cuenta y seguridad" }, - "FILE_NAME": "Encuesta cuenta {{pubkey|formatPubkey}} a {{currentTime|formatDateForFile}}.csv", + "FILE_NAME": "{{currency}} - Encuesta cuenta {{pubkey|formatPubkey}} a {{currentTime|formatDateForFile}}.csv", "HEADERS": { "TIME": "Fecha", "AMOUNT": "Cantidad", diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 1b69134ec7f114e9a4cdec52f8c9b329d902749b..30c995aa835a7b12246c513bd8c90d750c435bbb 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -480,7 +480,7 @@ "STRONG_LEVEL": "Fort <span class=\"hidden-xs \">(6 questions minimum)</span>", "TITLE": "Compte et sécurité" }, - "FILE_NAME": "Relevé du compte {{pubkey|formatPubkey}} au {{currentTime|formatDateForFile}}.csv", + "FILE_NAME": "{{currency}} - Relevé du compte {{pubkey|formatPubkey}} au {{currentTime|formatDateForFile}}.csv", "HEADERS": { "TIME": "Date", "AMOUNT": "Montant", diff --git a/www/i18n/locale-nl-NL.json b/www/i18n/locale-nl-NL.json index 0aa917f0a6ea05a937139e05ae5f7bace2413b10..7cc873b262545a71605c133e4e2194207ea8ddd7 100644 --- a/www/i18n/locale-nl-NL.json +++ b/www/i18n/locale-nl-NL.json @@ -387,7 +387,7 @@ "TITLE": "Voer een pseudoniem in", "HELP": "Een pseudoniem is nodig voor anderen om je te kunnen vinden." }, - "FILE_NAME": "Rekeningafschrift {{pubkey|formatPubkey}} {{currentTime|formatDateForFile}}.csv", + "FILE_NAME": "{{currency}} - Rekeningafschrift {{pubkey|formatPubkey}} {{currentTime|formatDateForFile}}.csv", "HEADERS": { "TIME": "Datum", "AMOUNT": "Bedrag", diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index e3c8ebc2107acccf069e28192dd749e62a7e4dc9..38846e96cef58276bd36cc27e31fa206429828cd 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -575,10 +575,11 @@ function WalletTxController($scope, $filter, $ionicPopover, $state, UIUtils, csW $scope.motion.show({ink: false}); }; - $scope.getDataForAccountStatement = function(options) { - options = options || -1;// all TX (full history) + $scope.downloadHistoryFile = function(options) { + options = options || {}; + options.fromTime = options.fromTime || -1; // default: full history var pubkey = $scope.formData.pubkey; - csTx.downloadAccountStatement(pubkey, options); + csTx.downloadHistoryFile(pubkey, options); }; // Updating wallet data diff --git a/www/js/services/tx-services.js b/www/js/services/tx-services.js index 3ee9230075444bfd638a15333712e908b8611729..bb1b9692e42835185790a3fb4330fad05a237e2e 100644 --- a/www/js/services/tx-services.js +++ b/www/js/services/tx-services.js @@ -83,7 +83,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', lockedOutput.amount = outputAmount; lockedOutputs = lockedOutputs || []; lockedOutputs.push(lockedOutput); - console.debug('[BMA] [TX] has locked output:', lockedOutput); + console.debug('[tx] has locked output:', lockedOutput); return sum + outputAmount; } @@ -337,13 +337,13 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', }); }; - // Download transactions history on current wallet - downloadAccountStatement = function(pubkey, options) { + // Download TX history file + downloadHistoryFile = function(pubkey, options) { - // Load account TX data - fromTime = options; + options = options || {}; + options.fromTime = options.fromTime || -1; - console.debug("[TX] Download transactions history on pubkey: " + pubkey); + console.debug("[tx] Exporting TX history for pubkey [{0}]".format(pubkey.substr(0,8))); return $q.all([ $translate(['ACCOUNT.HEADERS.TIME', @@ -351,16 +351,19 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', 'COMMON.PUBKEY', 'ACCOUNT.HEADERS.AMOUNT', 'ACCOUNT.HEADERS.COMMENT']), + //TODO : Utiliser plutôt csCurency pour avoir le bloc courant BMA.blockchain.current(), - loadData(pubkey, fromTime) + loadData(pubkey, options.fromTime) ]) .then(function(result){ var translations = result[0]; - //TODO : Utiliser plutôt csCurency - var currentTime = (result[1] && result[1].medianTime) || moment().utc().unix(); - result = result[2]; + var currentBlock = result[1]; + var currentTime = (currentBlock && currentBlock.medianTime) || moment().utc().unix(); + var currency = currentBlock && currentBlock.currency; + + result = result[2]; if (!result || !result.tx || !result.tx.history) return; // no TX @@ -368,12 +371,15 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', var formatPubkey = $filter('formatPubkey'); var formatDate = $filter('formatDate'); var formatDateForFile = $filter('formatDateForFile'); + var formatSymbol = $filter('currencySymbolNoHtml'); - var headers = [translations['ACCOUNT.HEADERS.TIME'], + var headers = [ + translations['ACCOUNT.HEADERS.TIME'], translations['COMMON.UID'], translations['COMMON.PUBKEY'], - translations['ACCOUNT.HEADERS.AMOUNT'], - translations['ACCOUNT.HEADERS.COMMENT']]; + translations['ACCOUNT.HEADERS.AMOUNT'] + ' (' + formatSymbol(currency) + ')', + translations['ACCOUNT.HEADERS.COMMENT'] + ]; var content = result.tx.history.reduce(function(res, tx){ return res.concat([ formatDate(tx.time), @@ -385,7 +391,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', }, [headers.join(';') + '\n']); var file = new Blob(content, {type: 'text/plain; charset=utf-8'}); - $translate('ACCOUNT.FILE_NAME', {pubkey: pubkey, currentTime : currentTime}) + $translate('ACCOUNT.FILE_NAME', {currency: currency, pubkey: pubkey, currentTime : currentTime}) .then(function(result){ FileSaver.saveAs(file, result); }) @@ -396,9 +402,9 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', return { id: id, load: loadData, - downloadAccountStatement: downloadAccountStatement, + downloadHistoryFile: downloadHistoryFile, // api extension - api: api, + api: api }; } diff --git a/www/templates/wallet/view_tx.html b/www/templates/wallet/item_tx.html similarity index 85% rename from www/templates/wallet/view_tx.html rename to www/templates/wallet/item_tx.html index 43edb846485be880b4f6cd2fc02842e5f169167c..96dcdbea5c3c228999207016ca7be6c59c0b6faa 100644 --- a/www/templates/wallet/view_tx.html +++ b/www/templates/wallet/item_tx.html @@ -1,14 +1,15 @@ <i class="icon item-image " ng-if="::!tx.avatar" - ng-class="::{'ion-arrow-up-c': tx.isUD, 'ion-person': tx.uid, 'ion-card': !tx.uid && !tx.isUD}"></i> + ng-class="::{'ion-arrow-up-c': tx.isUD, 'ion-person dark': tx.uid, 'ion-card dark': !tx.uid && !tx.isUD}"></i> <i class="avatar" ng-if="::tx.avatar" style="background-image: url({{::tx.avatar.src}})"></i> <div class="row no-padding"> <div class="col no-padding"> - <a class="positive" ui-sref="app.wot_identity({pubkey:tx.pubkey, uid:tx.uid})" ng-if="tx.uid"> + <b class="ion-clock" ng-if="pending"> </b> + <a class="" ui-sref="app.wot_identity({pubkey:tx.pubkey, uid:tx.uid})" ng-if="tx.uid"> {{::tx.name||tx.uid}} </a> - <a class="dark" ui-sref="app.wot_identity({pubkey:tx.pubkey, uid:tx.uid})" ng-if="!tx.uid"> + <a class="gray" ui-sref="app.wot_identity({pubkey:tx.pubkey, uid:tx.uid})" ng-if="!tx.uid"> <i class="ion-key gray"></i> {{::tx.pubkey | formatPubkey}} </a> @@ -30,6 +31,7 @@ title="{{::tx.comment}}">{{::tx.comment}}</p> </div> <div class="col col-10 no-padding"> + <!-- not locked TX --> <span ng-if="::!tx.lockedOutputs" class="badge item-note" ng-class="{'badge-balanced': tx.amount > 0}"> <span ng-bind-html=":rebind:tx.amount| formatAmount"></span> diff --git a/www/templates/wallet/view_wallet_tx.html b/www/templates/wallet/view_wallet_tx.html index e72076efdcd7582ed6bbb8c392dc8b6d966be40a..e0346fe38f6c266581ca91aeb1025efd6b4fb030 100644 --- a/www/templates/wallet/view_wallet_tx.html +++ b/www/templates/wallet/view_wallet_tx.html @@ -43,7 +43,7 @@ </button> <button class="button button-stable button-small-padding icon ion-android-download ink" - ng-click="getDataForAccountStatement()" + ng-click="downloadHistoryFile()" title="{{'COMMON.BTN_DOWNLOAD_ACCOUNT_STATEMENT' | translate}}"> </button> @@ -59,7 +59,7 @@ <div class="row no-padding"> - <div class="col col-15 no-padding hidden-xs hidden-sm"></div> + <div class="col col-15 hidden-xs hidden-sm"> </div> <div class="col"> @@ -80,9 +80,10 @@ {{:locale:'ACCOUNT.PENDING_TX'|translate}} </span> - <div class="item item-tx item-icon-left" - ng-repeat="tx in formData.tx.pendings" - ng-include="'templates/wallet/view_tx.html'"> + <div class="item item-pending item-tx item-icon-left" + ng-repeat="tx in formData.tx.pendings" + ng-init="pending=true;" + ng-include="'templates/wallet/item_tx.html'"> </div> <!-- Last Transactions --> @@ -99,8 +100,7 @@ <div ng-repeat="tx in formData.tx.history" class="item item-tx item-icon-left" - ng-class="::ionItemClass" - ng-include="'templates/wallet/view_tx.html'"> + ng-include="'templates/wallet/item_tx.html'"> </div> <div class="item item-text-wrap text-center" ng-if="formData.tx.fromTime > 0"> <p> @@ -113,7 +113,7 @@ </div> </div> - <div class="col col-15 no-padding hidden-xs hidden-sm"></div> + <div class="col col-15 hidden-xs hidden-sm"> </div> </div>