diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index db9768a01b470669b37922f9abc6543882db68aa..020ad128a3f4c35f786a6d22224cd58d30cfe767 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -902,34 +902,49 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, UI /** * Identity tx view controller */ -function WotIdentityTxViewController($q, $scope, $filter, $translate, csTx, FileSaver, gpColor, BMA, UIUtils) { +function WotIdentityTxViewController($scope, $timeout, csSettings, $controller, csTx, csWallet, BMA, UIUtils) { 'ngInject'; + // Initialize the super class and extend it. + angular.extend(this, $controller('WotIdentityAbstractCtrl', {$scope: $scope})); + + $scope.formData= {}; $scope.loading = true; $scope.motion = UIUtils.motion.fadeSlideInRight; $scope.$on('$ionicView.enter', function(e, state) { - $scope.formData = { - name:state.stateParams.name, - uid:state.stateParams.uid, - pubkey:state.stateParams.pubkey - }; + $scope.pubkey= state.stateParams.pubkey; + $scope.uid= state.stateParams.uid; // Load account TX data - csTx.load($scope.formData.pubkey) + csTx.load($scope.pubkey) .then(function(result) { console.log(result); // Allow to discover data structure if (result && result.tx && result.tx.history) { - $scope.items = result.tx.history; + $scope.tx = result.tx; + $scope.history = result.tx.history; } $scope.balance = result.balance; - $scope.motion.show(); - $scope.loading = false; + $scope.load($scope.pubkey, true, $scope.uid) + .then(function(){ + $scope.motion.show(); + $scope.loading = false; + }); }); }); + + $scope.downloadHistoryFile = function(options) { + options = options || {}; + options.fromTime = options.fromTime || -1; // default: full history + csTx.downloadHistoryFile($scope.pubkey, options); + }; + + //TODO : + }; + /** * Certifications controller - extend WotIdentityAbstractCtrl */ diff --git a/www/js/services/tx-services.js b/www/js/services/tx-services.js index bb1b9692e42835185790a3fb4330fad05a237e2e..31c990c6962c4232346a5bc6c095120016f81b8f 100644 --- a/www/js/services/tx-services.js +++ b/www/js/services/tx-services.js @@ -169,6 +169,8 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', } // get UD history + // FIXME issue#232 + /* if (csSettings.data.showUDHistory) { jobs.push( BMA.ud.history({pubkey: pubkey}) @@ -186,6 +188,7 @@ angular.module('cesium.tx.services', ['ngApi', 'cesium.bma.services', }, []); })); } + */ // Execute jobs $q.all(jobs) diff --git a/www/templates/wot/view_identity_tx.html b/www/templates/wot/view_identity_tx.html index abd0b63718dd708f9516c1f3207ac9cb8dbf1c4b..11d9b80f1f8630fb7002d88743225e68031f259e 100644 --- a/www/templates/wot/view_identity_tx.html +++ b/www/templates/wot/view_identity_tx.html @@ -8,13 +8,24 @@ <ion-content> - <!-- buttons bar --> - <div class="center padding"> - <div class="buttons"> - <button class="button button-balanced icon-left icon ion-archive" - ng-click="onExportButtonClick()">{{'RML9.BTN_EXPORT' | translate}} - </button> - </div> + <div class="hidden-xs hidden-sm padding text-center" ng-if="!loading"> + + <button class="button button-stable button-small-padding icon ion-loop ink" + ng-click="doUpdate()" + title="{{'COMMON.BTN_REFRESH' | translate}}"> + </button> + + <button class="button button-stable button-small-padding icon ion-android-download ink" + ng-click="downloadHistoryFile()" + title="{{'COMMON.BTN_DOWNLOAD_ACCOUNT_STATEMENT' | translate}}"> + </button> + + <cs-extension-point name="buttons"></cs-extension-point> + + </div> + + <div class="center padding" ng-if="loading"> + <ion-spinner icon="android"></ion-spinner> </div> <div class="list {{motion.ionListClass}}" ng-if="!loading"> @@ -26,17 +37,31 @@ <div class="col"> <!-- the balance --> - <div class="item"> + <div class="item item-divider item-tx"> {{'RML9.VIEW.BALANCE'|translate}} - <div class="badge badge-calm"> + <div class="badge badge-balanced"> {{balance|formatAmount}} <span ng-bind-html="$root.currency.name|currencySymbol"></span> </div> </div> + <span class="item item-divider" ng-if="!loading"> + {{:locale:'ACCOUNT.LAST_TX'|translate}} + <a id="helptip-wallet-tx" style="position: relative; bottom: 0; right: 0px;"> </a> + </span> + <!-- iterate on each TX --> <div class="item item-tx item-icon-left" - ng-repeat="tx in items" - ng-include="'templates/wallet/view_tx.html'"> + ng-repeat="tx in history" + ng-include="'templates/wallet/item_tx.html'"> + </div> + + <div class="item item-text-wrap text-center" ng-if="tx.fromTime > 0"> + <p> + <a ng-click="showMoreTx()">{{:locale:'ACCOUNT.SHOW_MORE_TX'|translate}}</a> + <span class="gray" translate="ACCOUNT.TX_FROM_DATE" translate-values="{fromTime: tx.fromTime}"></span> + <span class="gray">|</span> + <a ng-click="showMoreTx(-1)" translate>ACCOUNT.SHOW_ALL_TX</a> + </p> </div> </div>