From 7efcadcf0a133a7b6f5bad9ec895d97d0de565f2 Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Mon, 24 Aug 2020 18:36:34 +0200 Subject: [PATCH] [enh] In block search, add a button to show TX [enh] Movement search: add column amount. display time and bloc --- www/plugins/es/i18n/locale-en-GB.json | 2 + www/plugins/es/i18n/locale-en.json | 2 + www/plugins/es/i18n/locale-es-ES.json | 1 + www/plugins/es/i18n/locale-fr-FR.json | 2 + .../es/js/controllers/document-controllers.js | 6 ++- .../es/js/services/document-services.js | 1 + .../es/templates/blockchain/lookup_form.html | 7 ++- .../document/item_document_movement.html | 54 +++++++++++++++++++ .../templates/document/items_documents.html | 9 ++++ 9 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 www/plugins/es/templates/document/item_document_movement.html diff --git a/www/plugins/es/i18n/locale-en-GB.json b/www/plugins/es/i18n/locale-en-GB.json index b54746a51..849a6804a 100644 --- a/www/plugins/es/i18n/locale-en-GB.json +++ b/www/plugins/es/i18n/locale-en-GB.json @@ -220,6 +220,7 @@ "HEADER_BLOCK": "Block #", "HEADER_ISSUER": "Peer owner", "BTN_LAST": "Last blocks", + "BTN_TX": "Transactions", "DISPLAY_QUERY": "View query", "HIDE_QUERY": "Hide query", "TX_SEARCH_FILTER": { @@ -438,6 +439,7 @@ "HEADER_TIME": "Time/Hour", "HEADER_ISSUER": "Issuer", "HEADER_RECIPIENT": "Recipient", + "HEADER_AMOUNT": "Amount", "READ": "Read", "BTN_REMOVE": "Delete this document", "BTN_COMPACT": "Compact", diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json index b54746a51..849a6804a 100644 --- a/www/plugins/es/i18n/locale-en.json +++ b/www/plugins/es/i18n/locale-en.json @@ -220,6 +220,7 @@ "HEADER_BLOCK": "Block #", "HEADER_ISSUER": "Peer owner", "BTN_LAST": "Last blocks", + "BTN_TX": "Transactions", "DISPLAY_QUERY": "View query", "HIDE_QUERY": "Hide query", "TX_SEARCH_FILTER": { @@ -438,6 +439,7 @@ "HEADER_TIME": "Time/Hour", "HEADER_ISSUER": "Issuer", "HEADER_RECIPIENT": "Recipient", + "HEADER_AMOUNT": "Amount", "READ": "Read", "BTN_REMOVE": "Delete this document", "BTN_COMPACT": "Compact", diff --git a/www/plugins/es/i18n/locale-es-ES.json b/www/plugins/es/i18n/locale-es-ES.json index e4f29520d..4a2672734 100644 --- a/www/plugins/es/i18n/locale-es-ES.json +++ b/www/plugins/es/i18n/locale-es-ES.json @@ -54,6 +54,7 @@ "HEADER_TIME": "Fecha/Hora", "HEADER_ISSUER": "Emisor", "HEADER_RECIPIENT": "Destinatario", + "HEADER_AMOUNT": "Importe", "READ": "LeÃdo", "BTN_REMOVE": "Sumprimer este documento", "POPOVER_ACTIONS": { diff --git a/www/plugins/es/i18n/locale-fr-FR.json b/www/plugins/es/i18n/locale-fr-FR.json index 055127de5..f58d502da 100644 --- a/www/plugins/es/i18n/locale-fr-FR.json +++ b/www/plugins/es/i18n/locale-fr-FR.json @@ -220,6 +220,7 @@ "HEADER_BLOCK": "Bloc #", "HEADER_ISSUER": "Noeud émetteur", "BTN_LAST": "Derniers blocs", + "BTN_TX": "Transactions", "DISPLAY_QUERY": "Afficher la requête", "HIDE_QUERY": "Masquer la requête", "TX_SEARCH_FILTER": { @@ -491,6 +492,7 @@ "HEADER_TIME": "Date/Heure", "HEADER_ISSUER": "Emetteur", "HEADER_RECIPIENT": "Destinataire", + "HEADER_AMOUNT": "Montant", "READ": "Lu", "BTN_REMOVE": "Supprimer ce document", "BTN_COMPACT": "Compacter", diff --git a/www/plugins/es/js/controllers/document-controllers.js b/www/plugins/es/js/controllers/document-controllers.js index cafc4fbaf..3920f7207 100644 --- a/www/plugins/es/js/controllers/document-controllers.js +++ b/www/plugins/es/js/controllers/document-controllers.js @@ -46,7 +46,10 @@ function ESDocumentLookupController($scope, $ionicPopover, $location, $timeout, $scope.defaultSizeLimit = $scope.defaultSizeLimit || (UIUtils.screen.isSmall() ? 50 : 100); $scope.helptipPrefix = 'helptip-document'; $scope.compactMode = angular.isDefined($scope.compactMode) ? $scope.compactMode : true; - $scope._source = $scope._source || ["issuer", "hash", "time", "creationTime", "title", "message"]; + $scope._source = $scope._source || ["issuer", "hash", "time", "creationTime", "title", "message", "recipient", + // Movement field: + "medianTime", "amount", "currency", "reference" + ]; $scope.showHeaders = angular.isDefined($scope.showHeaders) ? $scope.showHeaders : true; /** @@ -394,6 +397,7 @@ function ESLastDocumentsController($scope, $controller, $timeout, $state, $filte } options._source = options._source || $scope._source; + options.getTimeFunction = function(doc) { doc.time = doc.creationTime || doc.time; return doc.time; diff --git a/www/plugins/es/js/services/document-services.js b/www/plugins/es/js/services/document-services.js index cba149d99..c654de8e0 100644 --- a/www/plugins/es/js/services/document-services.js +++ b/www/plugins/es/js/services/document-services.js @@ -66,6 +66,7 @@ angular.module('cesium.es.document.services', ['ngResource', 'cesium.platform', function _readSearchHits(res, options) { options.issuerField = options.issuerField || 'pubkey'; + console.log("TODO: ", res); var hits = (res && res.hits && res.hits.hits || []).reduce(function(res, hit) { var doc = hit._source || {}; doc.docType = doc.type; // Save source.type, before replacement diff --git a/www/plugins/es/templates/blockchain/lookup_form.html b/www/plugins/es/templates/blockchain/lookup_form.html index 5699857a0..9cd69eb40 100644 --- a/www/plugins/es/templates/blockchain/lookup_form.html +++ b/www/plugins/es/templates/blockchain/lookup_form.html @@ -66,13 +66,18 @@ </div> <div class=" pull-right hidden-xs hidden-sm"> + <a ng-if="enableFilter" + class="button button-text button-small ink icon ion-card" + ui-sref="app.document_search({index: currency, type: 'movement', q: search.text })"> + {{'BLOCKCHAIN.LOOKUP.BTN_TX' | translate}} + </a> + <a ng-if="enableFilter" class="button button-text button-small ink icon ion-clock" ng-class="{'button-text-positive': search.type=='last'}" ng-click="doSearchLast()"> {{'BLOCKCHAIN.LOOKUP.BTN_LAST' | translate}} </a> - <!--<a class="button button-text button-small ink icon icon-help" ng-click="showHelpModal('join-salt')"> {{'BLOCKCHAIN.LOOKUP.HELP' | translate}} </a>--> diff --git a/www/plugins/es/templates/document/item_document_movement.html b/www/plugins/es/templates/document/item_document_movement.html new file mode 100644 index 000000000..cc19bd031 --- /dev/null +++ b/www/plugins/es/templates/document/item_document_movement.html @@ -0,0 +1,54 @@ +<ion-item id="doc-{{::doc.id}}" + class="item item-document item-icon-left ink {{::ionItemClass}} no-padding-top no-padding-bottom" + ng-click="selectDocument($event, doc)"> + + <i class="icon ion-document stable" ng-if=":rebind:!doc.avatar"></i> + <i class="avatar" ng-if=":rebind:doc.avatar" style="background-image: url('{{:rebind:doc.avatar.src}}')"></i> + + <div class="row no-padding"> + <div class="col"> + <h3 class="dark"> + {{:rebind:doc.medianTime|formatDate}}</h3> + <h4 class="gray" ng-if="doc.reference"> + <span translate>COMMON.BLOCK</span> #{{doc.reference.id | formatInteger}} + </h4> + </div> + + <div class="col"> + <h3> + <a ui-sref="app.wot_identity({pubkey: doc.pubkey, uid: doc.uid})"> + <span class="gray"> + <i class="ion-key"></i> {{:rebind:doc.pubkey|formatPubkey}} + </span> + <span class="positive" ng-if=":rebind:doc.uid"> + <i class="ion-person"></i> {{:rebind:doc.name||doc.uid}} + </span> + </a> + </h3> + </div> + + <!-- recipient --> + <div class="col"> + + <h3 ng-if=":rebind:doc.recipient"> + <a ui-sref="app.wot_identity({pubkey: doc.recipient.pubkey, uid: doc.recipient.uid})"> + <span class="gray"> + <i class="ion-key"></i> {{:rebind:doc.recipient.pubkey|formatPubkey}} + </span> + <span class="positive" ng-if=":rebind:doc.recipient.uid"> + <i class="ion-person"></i> {{:rebind:doc.recipient.name||doc.recipient.uid}} + </span> + </a> + </h3> + </div> + + <!-- amount --> + <div class="col col-10"> + <div class="badge item-note" ng-class=":rebind:{'badge-calm': doc.amount > 0, 'badge-white': doc.amount < 0}"> + {{:rebind:doc.amount|formatAmount: {currency: doc.currency} }} + </div> + + </div> + + </div> +</ion-item> diff --git a/www/plugins/es/templates/document/items_documents.html b/www/plugins/es/templates/document/items_documents.html index 30a8ebcef..ea0b02f37 100644 --- a/www/plugins/es/templates/document/items_documents.html +++ b/www/plugins/es/templates/document/items_documents.html @@ -19,6 +19,12 @@ <cs-sort-icon asc="search.asc" sort="search.sort" toggle="'recipient'"></cs-sort-icon> {{'DOCUMENT.LOOKUP.HEADER_RECIPIENT' | translate}} </a> + <a class="no-padding dark col col-10 col-header" + ng-if=":rebind:expertMode && search.type==='movement'" + ng-click="toggleSort('amount')"> + <cs-sort-icon asc="search.asc" sort="search.sort" toggle="'amount'"></cs-sort-icon> + {{'DOCUMENT.LOOKUP.HEADER_AMOUNT' | translate}} + </a> </div> <div class="padding gray" ng-if=":rebind:!search.loading && !search.results.length" translate> @@ -34,6 +40,9 @@ <div ng-switch-when="profile"> <ng-include src="::'plugins/es/templates/document/item_document_profile.html'"></ng-include> </div> + <div ng-switch-when="movement"> + <ng-include src="::'plugins/es/templates/document/item_document_movement.html'"></ng-include> + </div> <div ng-switch-when="record"> <ng-include ng-if="doc.index === 'page'" src="::'plugins/es/templates/document/item_document_page.html'"></ng-include> <ng-include ng-if="doc.index !== 'page'" src="::'plugins/es/templates/document/item_document.html'"></ng-include> -- GitLab