From a52d0fe5f095a8108492e159628ed33b054ba92e Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Thu, 30 Mar 2017 16:56:48 +1100 Subject: [PATCH 01/28] prepare v1.4.10 --- Changelog.md | 8 ++++---- bower.json | 2 +- package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Changelog.md b/Changelog.md index 8403c4bc..0675a20a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,18 +1,18 @@ # Impac! Frontend Changelog -## Unreleased - development in progress +### v1.4.10 | 2017 - Week 14 ------------------------------------------------------------- -------------------------------------------------------------- - -## Released ### v1.4.9 | 2017 - Week 13 #### Adds - [IMPAC-521] Better layout for employee details (and other widgets) +#### Dependencies +- Impac! >= v1.5.3 + ------------------------------------------------------------- diff --git a/bower.json b/bower.json index 1ab6dcdd..579d96db 100755 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "impac-angular", "description": "Impac! Front-End Library", - "version": "1.4.9", + "version": "1.4.10", "main": [ "dist/impac-angular.js", "dist/impac-angular.less", diff --git a/package.json b/package.json index da4ec7c9..837acbbc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "impac-angular", - "version": "1.4.9", + "version": "1.4.10", "author": { "name": "Xaun Lopez", "email": "it@maestrano.com" From e4ae10736cd45126dbf977597af4806a92d017c8 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Thu, 30 Mar 2017 16:57:40 +1100 Subject: [PATCH 02/28] [IMPAC-535] add directive to display more info about currencies --- Changelog.md | 2 ++ .../currency-conversions.directive.coffee | 18 ++++++++++++++ .../currency-conversions.less | 9 +++++++ .../currency-conversions.tmpl.html | 23 ++++++++++++++++++ src/images/currency-conversions.png | Bin 0 -> 1355 bytes src/impac-angular.module.js | 3 ++- src/services/assets/assets.svc.coffee | 1 + 7 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/components/widgets-common/currency-conversions/currency-conversions.directive.coffee create mode 100644 src/components/widgets-common/currency-conversions/currency-conversions.less create mode 100644 src/components/widgets-common/currency-conversions/currency-conversions.tmpl.html create mode 100644 src/images/currency-conversions.png diff --git a/Changelog.md b/Changelog.md index 0675a20a..c70b4df0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,8 @@ ### v1.4.10 | 2017 - Week 14 +#### Adds +- [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) ------------------------------------------------------------- diff --git a/src/components/widgets-common/currency-conversions/currency-conversions.directive.coffee b/src/components/widgets-common/currency-conversions/currency-conversions.directive.coffee new file mode 100644 index 00000000..2ab9b3d7 --- /dev/null +++ b/src/components/widgets-common/currency-conversions/currency-conversions.directive.coffee @@ -0,0 +1,18 @@ +module = angular.module('impac.components.widgets-common.currency-conversions',[]) +module.directive('commonCurrencyConversions', ($templateCache, ImpacAssets) -> + return { + restrict: 'A' + scope: { + fxAmounts: '=' + baseCurrency: '=' + ratesDate: '=' + } + template: $templateCache.get('widgets-common/currency-conversions.tmpl.html') + + link: (scope, element) -> + scope.currencyConversionsIcon = ImpacAssets.get('currencyConversionsIcon') + scope.popoverTemplateUrl = $templateCache.get('widgets-common/details-popover.html') + scope.popoverTitle = "Currency Conversions Info" + scope.formattedRatesDate = moment(scope.ratesDate).format('MMMM Do YYYY') + } +) diff --git a/src/components/widgets-common/currency-conversions/currency-conversions.less b/src/components/widgets-common/currency-conversions/currency-conversions.less new file mode 100644 index 00000000..bfa63a44 --- /dev/null +++ b/src/components/widgets-common/currency-conversions/currency-conversions.less @@ -0,0 +1,9 @@ +.currency-conversions { + img { + width: 15px; + } + + .popover { + width: 350px; + } +} diff --git a/src/components/widgets-common/currency-conversions/currency-conversions.tmpl.html b/src/components/widgets-common/currency-conversions/currency-conversions.tmpl.html new file mode 100644 index 00000000..88d5e80b --- /dev/null +++ b/src/components/widgets-common/currency-conversions/currency-conversions.tmpl.html @@ -0,0 +1,23 @@ + + + + + + diff --git a/src/images/currency-conversions.png b/src/images/currency-conversions.png new file mode 100644 index 0000000000000000000000000000000000000000..f3ce580585d5ce010229f49d5610f3ef6aa28fdb GIT binary patch literal 1355 zcmV-R1+@B!P)WFU8GbZ8()Nlj2>E@cM*00gf|L_t(|+U=V=Ph3Y7 z$A9|>m|bLgbqlC>?!9ZC2Av1J$FVr?9`h%C9YWO^5AC}{Ex(pV&+2t`(kgexo; ze#n+cLuiaFlwd7ZB8Wtc$?|Zq2W2vud-u-Vxp$Yae`$()cX#H@f95>q%vorojW*gi z!N@dW%$&5WGX5cO0PIWq-w|*TxCD#>{lFQZ0DL5$*MMzc3-}Fq0{jHLI<7k_50roz zncSgc`xCei3^r-EI-v}#0(&tguD5ldtJNp|DX7Pg*eTUkCLjY;#E6AW zdJ(t-3<2FhQ6|+T_MjUW0KNnkjtc?9z;ei>=S3wt9lgZ_@PiOg&_3@4K91OWlCU8o zz;4KDpY}LbLENTlWNmE7Ti-jV95B!dFqV>+u_3^#3XKE|GMBQOZ3+Ry0o(po6XFaT z0(K2H#L3#54BlN&6Ucia;Av8nZ04jVC~}|YY;jU zlYpxB{31!0=j!SPfvvn0T@Q&%OT zbVkW=s&k3(Zdkf47Xq@tIqh8yxDbbc8AEJui>`o4ZUVmtv|k&jKn~bZzQ3cawC=5@ z;}D=9QOgc}%o-+NmKE*|Y1sz-o>jhkR(U^Z2!fo`Si0c0r@9VcP3z-!!cn4W#|?+M zqaa+;o*y}|*{#Lk?}2X;CSV76ti8MJLcpl@{JjU^vZRA=wdYT41eaHLH?4a zs>IC{2+(Eiw{?dd678uuylzKf9vH&ZDaq30Ekj@%)l=Q~FEXddIHeh{Ey>}zpcv8j zZvtNlF>z58nUDHjlQ~&g(l<&68!;0K*DZpeZQz~| zsRAl`WSehBB%#X8tAfC3AlC-i_D&B&tIez#T|I)V^Vv5?$XJy z!6+qtKX+RjZ_QSBMP+okFS-h(-vLZUIF1JGw6LRZUqI?@)F1Y9sAMb2T)>W0PieUj#~NsHZZkoPqItwSiqAs}Z+iZ01# zNfI#bDDR>nDH{8*b&Y5#=zIeeSm)oVZ~gZ#si({b9pxMgNWFQ%3&JlUY;Sfln6tWZ zuoAFSy})!e=KE?Z&Q_fx;j1yIUpTfR0k;f&Rgwx+p0*ePcMbh4 Date: Thu, 30 Mar 2017 16:58:08 +1100 Subject: [PATCH 03/28] use new currency-conversions directive in Aged P/R --- Changelog.md | 1 + ...s-aged-payables-receivables.directive.coffee | 17 +++++++++++++++++ .../invoices-aged-payables-receivables.less | 5 +++++ ...invoices-aged-payables-receivables.tmpl.html | 4 ++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index c70b4df0..475f4bdd 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ #### Adds - [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) +- Aged Payables and Receivables to use common-currency-conversions directive ------------------------------------------------------------- diff --git a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee index ae1b43ba..85a359bb 100644 --- a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee +++ b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee @@ -25,6 +25,8 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log # -------------------------------------- w.initContext = -> if $scope.isDataFound = angular.isDefined(w.content) && (!_.isEmpty(w.content.payables) || !_.isEmpty(w.content.receivables)) && !_.isEmpty(w.content.dates) + buildFxTotals() + $scope.ratesDate = moment.now() $scope.unCollapsed = w.metadata.unCollapsed || [] @@ -165,6 +167,21 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log $scope.getSelectLineColor = (elem) -> ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, elem)) if $scope.hasElements() + buildFxTotals = -> + for contact in _.union(w.content.payables.suppliers, w.content.receivables.customers) + contactFxTotals = [] + for fxTotal in contact.fx_totals + unless _.isEmpty(fxTotal) + _.mapKeys fxTotal, (total, currency) -> + if currency != w.metadata.currency + contactFxTotals.push({ + currency: currency, + amount: total.amount, + rate: total.rate + }) + unless _.isEmpty(contactFxTotals) + contact.formattedFxTotals = contactFxTotals + # Chart formating function # -------------------------------------- diff --git a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.less b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.less index 001ba1f3..60444f8a 100644 --- a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.less +++ b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.less @@ -8,4 +8,9 @@ .row.astericks-info { margin-top: 15px; } + + .currency-conversions { + float: right; + margin-left: 3px; + } } diff --git a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html index 946bdc86..041974be 100644 --- a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html +++ b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html @@ -60,7 +60,7 @@

Widget settings

{{supplier.name}}
- {{getTotalSum(supplier) | mnoCurrency : supplier.currency}} + {{getTotalSum(supplier) | mnoCurrency : supplier.currency}}
@@ -101,7 +101,7 @@

Widget settings

{{customer.name}}
- {{getTotalSum(customer) | mnoCurrency : customer.currency}} + {{getTotalSum(customer) | mnoCurrency : customer.currency}}
From 9422ae54f6c9d743fd7f8dcea22cf224722169f0 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Mon, 3 Apr 2017 17:25:43 +1000 Subject: [PATCH 04/28] popover styling --- .../currency-conversions/currency-conversions.less | 6 ++++-- .../currency-conversions/currency-conversions.tmpl.html | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/widgets-common/currency-conversions/currency-conversions.less b/src/components/widgets-common/currency-conversions/currency-conversions.less index bfa63a44..ae765e4a 100644 --- a/src/components/widgets-common/currency-conversions/currency-conversions.less +++ b/src/components/widgets-common/currency-conversions/currency-conversions.less @@ -1,9 +1,11 @@ .currency-conversions { img { width: 15px; + cursor: pointer; } - .popover { - width: 350px; + &.popover .popover-title { + background-color: black; + color: white; } } diff --git a/src/components/widgets-common/currency-conversions/currency-conversions.tmpl.html b/src/components/widgets-common/currency-conversions/currency-conversions.tmpl.html index 88d5e80b..1f051df6 100644 --- a/src/components/widgets-common/currency-conversions/currency-conversions.tmpl.html +++ b/src/components/widgets-common/currency-conversions/currency-conversions.tmpl.html @@ -1,5 +1,5 @@ - + @@ -19,5 +19,5 @@

The rates used correspond to those for {{ formattedRatesDate }}.

-

The rate used correspond to the rate for {{ formattedRatesDate }}.

+

The rate used corresponds to the rate for {{ formattedRatesDate }}.

From a5037201b87fb4822e1a34df495f577e9bf91b9b Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Mon, 3 Apr 2017 17:26:03 +1000 Subject: [PATCH 05/28] add currency info to invoices list --- .../invoices-list.directive.coffee | 24 ++++++++++++++++--- .../widgets/invoices-list/invoices-list.less | 18 +++++++++++++- .../invoices-list/invoices-list.tmpl.html | 14 +++++++---- 3 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/components/widgets/invoices-list/invoices-list.directive.coffee b/src/components/widgets/invoices-list/invoices-list.directive.coffee index c50a911a..2ff87cc8 100644 --- a/src/components/widgets/invoices-list/invoices-list.directive.coffee +++ b/src/components/widgets/invoices-list/invoices-list.directive.coffee @@ -36,6 +36,8 @@ module.controller('WidgetInvoicesListCtrl', ($scope, $q, $sce, $filter, ImpacUti $scope.defaultFrom = $filter('date')(datesRange[0], 'yyyy-MM-dd') $scope.defaultTo = $filter('date')(datesRange[1], 'yyyy-MM-dd') initInvoicesTooltips(w.content.entities) + buildFxTotals() + $scope.ratesDate = moment.now() # No need to put this under initContext because it won't change after a settings update @@ -59,18 +61,34 @@ module.controller('WidgetInvoicesListCtrl', ($scope, $q, $sce, $filter, ImpacUti _.each(entity.invoices, (i) -> txn = if i.transaction_no != "" then " (" + i.transaction_no + ")" else "" + invCurrency = Object.keys(i.fx_totals)[0] + formattedInvoiced = $filter('mnoCurrency')(i.fx_totals[invCurrency].invoiced, invCurrency, true) if (i.tooltip_status == "partially paid") - paid = " (" + $filter('mnoCurrency')(i.paid,i.currency,true) + " over " + $filter('mnoCurrency')(i.invoiced,i.currency,true) + ")" + formattedPaid = $filter('mnoCurrency')(i.fx_totals[invCurrency].paid, invCurrency, true) + amountDetail = " (#{formattedPaid} on #{formattedInvoiced})" else - paid = " (" + $filter('mnoCurrency')(i.invoiced,i.currency,true) + ")" + amountDetail = " (#{formattedInvoiced})" - tooltip.push("#" + count + txn + " - " + i.tooltip_status + paid) + tooltip.push("#" + count + txn + " - " + i.tooltip_status + amountDetail) count++ ) $scope.invoiceTooltips[entity.id] = $sce.trustAsHtml(tooltip.join("
")) ) + buildFxTotals = -> + for contact in w.content.entities + contactFxTotals = [] + _.mapKeys contact.fx_totals, (total, currency) -> + if currency != w.metadata.currency + contactFxTotals.push({ + currency: currency, + amount: total.invoiced, + rate: total.rate + }) + unless _.isEmpty(contactFxTotals) + contact.formattedFxTotals = contactFxTotals + # Widget is ready: can trigger the "wait for settings to be ready" # -------------------------------------- diff --git a/src/components/widgets/invoices-list/invoices-list.less b/src/components/widgets/invoices-list/invoices-list.less index ef3eef9a..45279063 100644 --- a/src/components/widgets/invoices-list/invoices-list.less +++ b/src/components/widgets/invoices-list/invoices-list.less @@ -1,3 +1,19 @@ .analytics .widget-item .content.invoices-list { .simple-list-widget(); -} \ No newline at end of file + + .currency-conversions { + float: right; + margin-right: 3px; + margin-top: -2px; + } + + .fa.fa-info-circle { + float: right; + font-size: 15px; + } + + .right-column { + padding-left: 0px; + padding-right: 0px; + } +} diff --git a/src/components/widgets/invoices-list/invoices-list.tmpl.html b/src/components/widgets/invoices-list/invoices-list.tmpl.html index 1c013f27..002dde5a 100644 --- a/src/components/widgets/invoices-list/invoices-list.tmpl.html +++ b/src/components/widgets/invoices-list/invoices-list.tmpl.html @@ -32,7 +32,7 @@

Widget settings

-
+
{{entity.name}}
@@ -41,7 +41,10 @@

Widget settings

{{entity.total_invoiced | mnoCurrency : entity.currency}}
-
+
+ + +
@@ -55,12 +58,15 @@

Widget settings

-
+
{{entity.name}}
{{entity.total_paid | mnoCurrency : entity.currency}}
{{entity.total_due | mnoCurrency : entity.currency}}
{{entity.total_invoiced | mnoCurrency : entity.currency}}
-
+
+ + +
From b5474a52f3f3299d9d4f80674cef275dfcceb1ba Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Tue, 4 Apr 2017 15:15:32 +1000 Subject: [PATCH 06/28] update global style for pre --- .../widgets/hr-employee-details/hr-employee-details.less | 8 -------- src/stylesheets/globals.less | 3 +++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/components/widgets/hr-employee-details/hr-employee-details.less b/src/components/widgets/hr-employee-details/hr-employee-details.less index 6b4d5de8..0fda36ba 100644 --- a/src/components/widgets/hr-employee-details/hr-employee-details.less +++ b/src/components/widgets/hr-employee-details/hr-employee-details.less @@ -6,14 +6,6 @@ @media (min-width: @screen-md-min) { max-height: 200px; } .scrollable(); } - pre { - font-size: 12px; - padding: 0px; - margin: 1px 0px 8px 0px; - border: none; - white-space: normal; - overflow: hidden; - } .right-panel { .details-container { @media (min-width: @screen-md-min) { max-height: 220px; } diff --git a/src/stylesheets/globals.less b/src/stylesheets/globals.less index b6ab1c2b..a54b692b 100644 --- a/src/stylesheets/globals.less +++ b/src/stylesheets/globals.less @@ -80,6 +80,9 @@ body { padding: 0px; margin: 1px 0px 8px 0px; border: none; + white-space: pre-wrap; + word-wrap: break-word; + overflow: hidden; } .widget-item .content, kpis-bar .kpi { From a58322c2b45955a40c8b08a89b54fa5b9bf3f999 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Tue, 4 Apr 2017 15:15:58 +1000 Subject: [PATCH 07/28] refactor employee_details + add currency-conversions info --- .../sales-customer-details.directive.coffee | 57 ++++++++++++------- .../sales-customer-details.less | 9 ++- .../sales-customer-details.tmpl.html | 31 ++++++---- 3 files changed, 63 insertions(+), 34 deletions(-) diff --git a/src/components/widgets/sales-customer-details/sales-customer-details.directive.coffee b/src/components/widgets/sales-customer-details/sales-customer-details.directive.coffee index fe496f19..a04e2336 100644 --- a/src/components/widgets/sales-customer-details/sales-customer-details.directive.coffee +++ b/src/components/widgets/sales-customer-details/sales-customer-details.directive.coffee @@ -10,6 +10,7 @@ module.controller('WidgetSalesCustomerDetailsCtrl', ($scope, $q) -> $scope.timePeriodDeferred = $q.defer() $scope.widthDeferred = $q.defer() $scope.paramSelectorDeferred = $q.defer() + $scope.ratesDate = moment.now() settingsPromises = [ $scope.orgDeferred.promise @@ -18,35 +19,16 @@ module.controller('WidgetSalesCustomerDetailsCtrl', ($scope, $q) -> $scope.paramSelectorDeferred.promise ] - # Widget specific methods # -------------------------------------- w.initContext = -> $scope.isDataFound = w.content? && !_.isEmpty(w.content.customers) if $scope.isDataFound + setSelectedCustomer() $scope.customersOptions = _.map(w.content.customers, (e) -> - { - value: e.uid, - label: e.name, - } + { value: e.uid, label: e.name } ) - $scope.selectedCustomer = { - value: $scope.getCustomer().uid, - label: $scope.getCustomer().name, - } - - $scope.getCustomer = -> - return false unless $scope.isDataFound - - if w.metadata && w.metadata.customer_uid - customer = angular.copy(_.find(w.content.customers, (e) -> - e.uid == w.metadata.customer_uid - ) || w.content.customers[0]) - else - customer = angular.copy(w.content.customers[0]) - - return customer $scope.formatAddress = (anAddress) -> return anAddress.replace(/, /g,',\n') if angular.isDefined(anAddress) @@ -57,6 +39,39 @@ module.controller('WidgetSalesCustomerDetailsCtrl', ($scope, $q) -> $scope.getToDate = -> return w.content.to if $scope.isDataFound + setSelectedCustomer = -> + return false unless $scope.isDataFound + unless w.metadata && w.metadata.customer_uid + return $scope.selectedCustomer = angular.copy(w.content.customers[0]) + + customer = _.find(w.content.customers, (c) -> + c.uid == w.metadata.customer_uid + ) || w.content.customers[0] + + $scope.selectedCustomer = angular.copy(customer) + setSelectedCustomerId() + buildFxTotals() + + setSelectedCustomerId = -> + return false unless (cust = $scope.selectedCustomer) + $scope.selectedCustomerId = { value: cust.uid, label: cust.name } + + buildFxTotals = -> + return false unless (cust = $scope.selectedCustomer) + + invoicedFxTotals = [] ; dueFxTotals = [] ; paidFxTotals = [] + + if _.some(cust.fx_totals, (total, currency) -> currency != w.metadata.currency) + _.mapKeys cust.fx_totals, (total, currency) -> + baseTotal = { rate: total.rate, currency: currency } + invoicedFxTotals.push(angular.merge({ amount: total.invoiced }, baseTotal)) if total.invoiced != 0 + paidFxTotals.push(angular.merge({ amount: total.paid }, baseTotal)) if total.paid != 0 + dueFxTotals.push(angular.merge({ amount: total.due }, baseTotal)) if total.due != 0 + + cust.invoicedFxTotals = invoicedFxTotals unless _.isEmpty(invoicedFxTotals) + cust.paidFxTotals = paidFxTotals unless _.isEmpty(paidFxTotals) + cust.dueFxTotals = dueFxTotals unless _.isEmpty(dueFxTotals) + # Widget is ready: can trigger the "wait for settigns to be ready" # -------------------------------------- diff --git a/src/components/widgets/sales-customer-details/sales-customer-details.less b/src/components/widgets/sales-customer-details/sales-customer-details.less index 82b7fb1a..13fcf3bc 100644 --- a/src/components/widgets/sales-customer-details/sales-customer-details.less +++ b/src/components/widgets/sales-customer-details/sales-customer-details.less @@ -5,13 +5,13 @@ font-size: 12px; .details-container { padding: 0px; - @media (min-width: @screen-md-min) { max-height: 200px; } + @media (min-width: @screen-md-min) { max-height: 194px; } overflow-y: auto; overflow-x: hidden; } .right-panel { .details-container { - @media (min-width: @screen-md-min) { max-height: 208px; } + @media (min-width: @screen-md-min) { max-height: 230px; } } .legend { margin-bottom: 5px; @@ -22,4 +22,9 @@ margin-bottom: 10px; font-size: 14px; } + + .currency-conversions { + float: left; + margin-right: 3px; + } } diff --git a/src/components/widgets/sales-customer-details/sales-customer-details.tmpl.html b/src/components/widgets/sales-customer-details/sales-customer-details.tmpl.html index 2c11a56a..cf5aad08 100644 --- a/src/components/widgets/sales-customer-details/sales-customer-details.tmpl.html +++ b/src/components/widgets/sales-customer-details/sales-customer-details.tmpl.html @@ -18,32 +18,32 @@

Widget settings

-
+
-
{{getCustomer().email || '-'}}
+
{{selectedCustomer.email || '-'}}
-
{{getCustomer().phone || '-'}}
+
{{selectedCustomer.phone || '-'}}
-
{{getCustomer().website || '-'}}
+
{{selectedCustomer.website || '-'}}
-
{{getCustomer().contact || '-'}}
+
{{selectedCustomer.contact || '-'}}
-
{{getCustomer().city || '-'}}
+
{{selectedCustomer.city || '-'}}
-
{{getCustomer().country || '-'}}
+
{{selectedCustomer.country || '-'}}
@@ -52,22 +52,31 @@

Widget settings

-
{{formatAddress(getCustomer().full_address) || '-'}}
+
{{formatAddress(selectedCustomer.full_address) || '-'}}
From {{getFromDate() | date : 'd MMM yyyy'}} to {{getToDate() | date : 'd MMM yyyy'}}:
-
{{getCustomer().total_invoiced | mnoCurrency : getCustomer().currency}}
+
+ +
{{selectedCustomer.total_invoiced | mnoCurrency : selectedCustomer.currency}}
+
-
{{getCustomer().total_paid | mnoCurrency : getCustomer().currency}}
+
+ +
{{selectedCustomer.total_paid | mnoCurrency : selectedCustomer.currency}}
+
-
{{getCustomer().total_due | mnoCurrency : getCustomer().currency}}
+
+ +
{{selectedCustomer.total_due | mnoCurrency : selectedCustomer.currency}}
+
From 1de3af13a87c3f169a4d00b32faa3df2265fd22b Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Tue, 4 Apr 2017 13:56:18 +0100 Subject: [PATCH 08/28] [IMPAC-262] Fix incorrect tooltip values --- .../sales-new-vs-existing-customers.directive.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/widgets/sales-new-vs-existing-customers/sales-new-vs-existing-customers.directive.coffee b/src/components/widgets/sales-new-vs-existing-customers/sales-new-vs-existing-customers.directive.coffee index bae5a179..df8c63fb 100644 --- a/src/components/widgets/sales-new-vs-existing-customers/sales-new-vs-existing-customers.directive.coffee +++ b/src/components/widgets/sales-new-vs-existing-customers/sales-new-vs-existing-customers.directive.coffee @@ -66,10 +66,13 @@ module.controller('WidgetSalesNewVsExistingCustomersCtrl', ($scope, $q, ChartFor $scope.shouldDisplayCurrency = () -> $scope.isDataFound && $scope.displayType.value.indexOf('count') < 0 + # Calculate a percentage based on absolute values for representing on a piegraph. $scope.calculatePercentage = (sliceType) -> - Math.round( - w.content.summary[$scope.displayType.value][sliceType] / w.content.summary[$scope.displayType.value].total * 100 - ) + values = + new: Math.abs w.content.summary[$scope.displayType.value].new + existing: Math.abs w.content.summary[$scope.displayType.value].existing + values.totals = values.new + values.existing + return Math.round values[sliceType] / values.totals * 100 # Chart formating function # -------------------------------------- From 192cbfed0ca00bdaaab0c0b35b5fbf2f61a09469 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Tue, 4 Apr 2017 14:44:36 +0100 Subject: [PATCH 09/28] Update Changelog for impac-262 --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 475f4bdd..f30e0194 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ ### v1.4.10 | 2017 - Week 14 #### Adds +- [IMPAC-262] Fix new vs existing customer widget incorrect tooltip values - [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) - Aged Payables and Receivables to use common-currency-conversions directive From 7b554e372de498b70b3884e05c334a50d4aee7bf Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Thu, 30 Mar 2017 22:18:20 +0100 Subject: [PATCH 10/28] [IMPAC-397] Enforce at least 1 opp-funnel option selection --- ...ales-opportunities-funnel.directive.coffee | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/widgets/sales-opportunities-funnel/sales-opportunities-funnel.directive.coffee b/src/components/widgets/sales-opportunities-funnel/sales-opportunities-funnel.directive.coffee index 8eeeb8f9..474902ea 100644 --- a/src/components/widgets/sales-opportunities-funnel/sales-opportunities-funnel.directive.coffee +++ b/src/components/widgets/sales-opportunities-funnel/sales-opportunities-funnel.directive.coffee @@ -40,11 +40,13 @@ module.controller('WidgetSalesOpportunitiesFunnelCtrl', ($scope, $q, ChartFormat ) return total? && total > 0 + # Get number of assignees count in the statusOption (a.k.a sales stage, e.g 'Open') getFilteredTotal = (opps, assignees) -> return _.reduce(opps, (total=0, opp) -> if opp.assignee_id in assignees then total + 1 else total , 0) + # Gets ordered, selected assignee ids getOrderedAssigneeIds = (assigneesOptions) -> return _.map(_.filter(assigneesOptions, (assigneeOption) -> return assigneeOption.selected @@ -63,17 +65,23 @@ module.controller('WidgetSalesOpportunitiesFunnelCtrl', ($scope, $q, ChartFormat # Parameter which define showing 'Apply to all similar widgets' checkbox $scope.hasReach = true; + # Options for settings-params-picker, allowing users to remove and/or order status section display $scope.statusOptions = [] angular.forEach w.content.opps_per_sales_stage, (value, status) -> # Sales stage will be ticked if has been selected before OR if no status is selected at all isSelected = _.isEmpty(sales_stage_selection.values) || ( status in sales_stage_selection.values ) $scope.statusOptions.push({label: status, selected: isSelected}) + # Enforce at least 1 statusOption to be selected on init + $scope.statusOptions[0].selected = true if $scope.statusOptions[0] && !_.any($scope.statusOptions, 'selected') && !_.isEmpty(w.content.opps_per_sales_stage) + # Options for settings-params-picker, allowing users to remove and/or order assignee right-panel display $scope.assigneesOptions = [] angular.forEach w.content.assignees, (obj, index) -> # Assignee will be ticked if has been selected before OR if no assignee is selected at all isSelected = _.isEmpty(assignees_selection.values) || ( obj.id in assignees_selection.values ) $scope.assigneesOptions.push({label: obj.name, selected: isSelected, value: obj.id}) + # Enforce at least 1 assigneeOption to be selected on init + $scope.assigneesOptions[0].selected = true if $scope.assigneesOptions[0] && !_.any($scope.assigneesOptions, 'selected') && !_.isEmpty(w.content.assignees) # TODO: should it be managed in a service? in the widget directive? Must isLoading and isDataFound be bound to the widget object or to the scope? w.processError = (error) -> @@ -119,13 +127,17 @@ module.controller('WidgetSalesOpportunitiesFunnelCtrl', ($scope, $q, ChartFormat $scope.getSelectedOpportunities = -> if $scope.isDataFound && $scope.selectedStatus && w.content.opps_per_sales_stage[$scope.selectedStatus] assignees = getOrderedAssigneeIds($scope.assigneesOptions) + # select opps with selected assignees filteredOpps = _.filter w.content.opps_per_sales_stage[$scope.selectedStatus].opps, (opportunity) -> return opportunity.assignee_id in assignees + # Group opps by assignee oppGroups = _.groupBy filteredOpps, 'assignee_id' + # Sort grouped opps by assigneesOptions order sortedOppGroups = [] angular.forEach $scope.assigneesOptions, (assigneeOption) -> - sortedOppGroups.push({ assigneeName: assigneeOption.label, opps: oppGroups[assigneeOption.value]}) if oppGroups[assigneeOption.value] + assigneeId = assigneeOption.value + sortedOppGroups.push(assigneeName: assigneeOption.label, opps: oppGroups[assigneeId]) if oppGroups[assigneeId] return sortedOppGroups else @@ -184,7 +196,7 @@ module.controller('WidgetSalesOpportunitiesFunnelCtrl', ($scope, $q, ChartFormat selectedStatusSetting.initialize = -> $scope.selectedStatus = w.metadata.selected_status if !_.isEmpty(w.content) && angular.isDefined(w.content.opps_per_sales_stage[w.metadata.selected_status]) selectedStatusSetting.initialized = true - $scope.updateRightView(); + $scope.updateRightView() selectedStatusSetting.toMetadata = -> {selected_status: $scope.selectedStatus} @@ -198,7 +210,7 @@ module.controller('WidgetSalesOpportunitiesFunnelCtrl', ($scope, $q, ChartFormat max=0 assignees = getOrderedAssigneeIds($scope.assigneesOptions) - angular.forEach $scope.statusOptions, (statusOption) -> + angular.forEach $scope.statusOptions, (statusOption) -> value = getFilteredTotal(w.content.opps_per_sales_stage[statusOption.label].opps, assignees) max = value if statusOption.selected && angular.isDefined(value) && value > max @@ -216,6 +228,9 @@ module.controller('WidgetSalesOpportunitiesFunnelCtrl', ($scope, $q, ChartFormat coloredWidth: {width: "#{coloredWidth}%"} statusWidth: {width: "#{statusWidth}%"} } if statusOption.selected && angular.isDefined(value) && value > 0 + else + # Something has gone wrong, fail safe display no data found (this shouldn't happen). + $scope.isDataFound = false # Widget is ready: can trigger the "wait for settigns to be ready" # -------------------------------------- From 41af7e41206ab760c9dbf78edde0f98ac5bdd129 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Tue, 4 Apr 2017 14:46:19 +0100 Subject: [PATCH 11/28] Update changelog for impac-397 --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 475f4bdd..f180c1b2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ ### v1.4.10 | 2017 - Week 14 #### Adds +- [IMPAC-397] Enforce at least 1 opportunities funnel widget option selection - [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) - Aged Payables and Receivables to use common-currency-conversions directive From d8a850cea7a624626397b3804d04a699df630e05 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Mon, 3 Apr 2017 18:01:49 +0100 Subject: [PATCH 12/28] [IMPAC-536] fix param selector css bleed --- src/components/widget/widget.less | 4 ++++ .../editable-title/editable-title.less | 2 +- .../editable-title/editable-title.tmpl.html | 20 ++++++++++--------- .../param-selector/param-selector.less | 10 ++++++++-- .../param-selector/param-selector.tmpl.html | 4 ++-- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/components/widget/widget.less b/src/components/widget/widget.less index 94ed79bc..9865ad66 100644 --- a/src/components/widget/widget.less +++ b/src/components/widget/widget.less @@ -22,6 +22,10 @@ flex-direction: row; z-index: 4; + + .editable-title { + flex: 1; + } } .widget-item { diff --git a/src/components/widgets-common/editable-title/editable-title.less b/src/components/widgets-common/editable-title/editable-title.less index f613d488..4fa41c40 100644 --- a/src/components/widgets-common/editable-title/editable-title.less +++ b/src/components/widgets-common/editable-title/editable-title.less @@ -1,4 +1,4 @@ -.analytics .widget-item { +.analytics .widget-item .common-editable-title { .editable-title { width: 100%; flex: 1; diff --git a/src/components/widgets-common/editable-title/editable-title.tmpl.html b/src/components/widgets-common/editable-title/editable-title.tmpl.html index 84ec90ed..cc90fc23 100644 --- a/src/components/widgets-common/editable-title/editable-title.tmpl.html +++ b/src/components/widgets-common/editable-title/editable-title.tmpl.html @@ -1,12 +1,14 @@ - +
+ - + - -
- {{ parentWidget.name }} + +
+ {{ parentWidget.name }} +
diff --git a/src/components/widgets-settings/param-selector/param-selector.less b/src/components/widgets-settings/param-selector/param-selector.less index b9312a31..77313d3e 100644 --- a/src/components/widgets-settings/param-selector/param-selector.less +++ b/src/components/widgets-settings/param-selector/param-selector.less @@ -29,10 +29,16 @@ overflow-x: hidden; .box-shadow(rgb(0, 0, 0) 0px 3px 15px -3px); - div { + .param-selector-label { padding: 3px 5px; + .font(inherit,500,black); + cursor: text; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + line-height: 1.9; } - div:hover { + .param-selector-label:hover { cursor: pointer; background-color: @impac-widget-param-selector-color; color: white; diff --git a/src/components/widgets-settings/param-selector/param-selector.tmpl.html b/src/components/widgets-settings/param-selector/param-selector.tmpl.html index cb410a06..d5eabde5 100644 --- a/src/components/widgets-settings/param-selector/param-selector.tmpl.html +++ b/src/components/widgets-settings/param-selector/param-selector.tmpl.html @@ -1,8 +1,8 @@ {{selected.label | titleize | truncate : getTruncateValue() : "..." : false}}
-
+
{{option.label | titleize}}
- \ No newline at end of file + From 44f105c038b5ff773f4dfbb7134a0bc509b885f9 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Tue, 4 Apr 2017 14:47:16 +0100 Subject: [PATCH 13/28] Update changelog for impac-536 --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 475f4bdd..37ac16ee 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ ### v1.4.10 | 2017 - Week 14 #### Adds +- [IMPAC-536] fix param selector css bleed - [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) - Aged Payables and Receivables to use common-currency-conversions directive From a6c32afebf92b3dc7cd20241ba8865396901d75f Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Mon, 3 Apr 2017 14:28:48 +0100 Subject: [PATCH 14/28] [IMPAC-498] widget improve drill-down saved ids --- .../accounts-cash-summary.directive.coffee | 15 +++++++---- .../accounts-cash-summary.tmpl.html | 2 +- .../accounts-profit-and-loss.directive.coffee | 21 +++++++++------ .../accounts-profit-and-loss.tmpl.html | 2 +- .../hr-payroll-summary.directive.coffee | 15 ++++++----- ...aged-payables-receivables.directive.coffee | 23 +++++++++------- ...voices-aged-payables-receivables.tmpl.html | 4 +-- .../sales-comparison.directive.coffee | 22 +++++++++------ .../sales-comparison.tmpl.html | 2 +- .../sales-performance.directive.coffee | 27 +++++++------------ 10 files changed, 74 insertions(+), 59 deletions(-) diff --git a/src/components/widgets/accounts-cash-summary/accounts-cash-summary.directive.coffee b/src/components/widgets/accounts-cash-summary/accounts-cash-summary.directive.coffee index f0b55c06..8e52399b 100644 --- a/src/components/widgets/accounts-cash-summary/accounts-cash-summary.directive.coffee +++ b/src/components/widgets/accounts-cash-summary/accounts-cash-summary.directive.coffee @@ -39,7 +39,8 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv # Attempt to find the selectedElement by statement account id angular.forEach(w.content.summary, (statement) -> $scope.selectedElement ||= _.find(statement.accounts, (account)-> - account.id == w.metadata.selectedElement + account.category = statement.name + getIdentifier(account) == w.metadata.selectedElement ) if statement.accounts? ) sortData() @@ -80,7 +81,7 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv element.name.replace(/_/g, " ") if element? && element.name? - $scope.toggleSelectedElement = (element) -> + $scope.toggleSelectedElement = (element, statement=null) -> if $scope.isSelected(element) $scope.selectedElement = null if w.isExpanded() @@ -89,6 +90,7 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv ImpacWidgetsSvc.updateWidgetSettings(w,false) else $scope.selectedElement = angular.copy(element) + $scope.selectedElement.category = statement.name if statement w.format() if !w.isExpanded() w.toggleExpanded() @@ -97,8 +99,7 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv $scope.isSelected = (element) -> element? && $scope.selectedElement? && ( - matcher = (if element.id? then 'id' else 'name') - $scope.selectedElement[matcher] == element[matcher] + getIdentifier($scope.selectedElement) == getIdentifier(element) ) $scope.toggleCollapsed = (element) -> @@ -176,6 +177,10 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv $scope.sortedColumn = col sortData() + getIdentifier = (element)-> + matcher = (if element.id? then 'id' else 'name') + if element.category then "#{element.category}-#{element[matcher]}" else element[matcher] + # Mini-settings # -------------------------------------- @@ -198,7 +203,7 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv selectedElementSetting.toMetadata = -> return {selectedElement: null} unless $scope.selectedElement? - {selectedElement: $scope.selectedElement.id || $scope.selectedElement.name } + {selectedElement: getIdentifier($scope.selectedElement) } w.settings.push(selectedElementSetting) diff --git a/src/components/widgets/accounts-cash-summary/accounts-cash-summary.tmpl.html b/src/components/widgets/accounts-cash-summary/accounts-cash-summary.tmpl.html index 2f3329bf..0f9d2248 100644 --- a/src/components/widgets/accounts-cash-summary/accounts-cash-summary.tmpl.html +++ b/src/components/widgets/accounts-cash-summary/accounts-cash-summary.tmpl.html @@ -61,7 +61,7 @@

Widget settings

-
+
{{account.name}}
diff --git a/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.directive.coffee b/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.directive.coffee index ff3daf17..50740cb6 100644 --- a/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.directive.coffee +++ b/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.directive.coffee @@ -66,7 +66,10 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter for statement in w.content.summary if statement.accounts? # Attempt to find element by statement account id - foundElem ||= _.find(statement.accounts, (account) -> account.account_id == sElem) + foundElem ||= _.find(statement.accounts, (account) -> + account.category = statement.name + getIdentifier(account) == sElem + ) $scope.selectedElements.push(foundElem) if foundElem @@ -108,11 +111,10 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter # ---> # TODO selectedElement and collapsed should be factorized as settings or 'commons' - $scope.toggleSelectedElement = (element) -> + $scope.toggleSelectedElement = (element, statement) -> if $scope.isSelected(element) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - matcher = (if element.account_id? then 'account_id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -120,6 +122,7 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter else ImpacWidgetsSvc.updateWidgetSettings(w,false) else + element.category = statement.name if statement $scope.selectedElements ||= [] $scope.selectedElements.push(element) w.format() @@ -130,8 +133,7 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter $scope.isSelected = (element) -> element? && _.any($scope.selectedElements, (sElem) -> - matcher = (if element.account_id? then 'account_id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) $scope.toggleCollapsed = (element) -> @@ -153,6 +155,10 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 + + getIdentifier = (element)-> + matcher = (if element.account_id? then 'account_id' else 'name') + if element.category then "#{element.category}-#{element[matcher]}" else element[matcher] # <--- sortAccountsBy = (getElem) -> @@ -242,8 +248,7 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter selectedElementsSetting.toMetadata = -> # Build simple array of identifiers for metadata storage selectedElementsMetadata = _.map($scope.selectedElements, (element)-> - matcher = (if element.account_id? then 'account_id' else 'name') - element[matcher] + getIdentifier(element) ) {selectedElements: selectedElementsMetadata} diff --git a/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.tmpl.html b/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.tmpl.html index 7ceed840..69e2fa18 100644 --- a/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.tmpl.html +++ b/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.tmpl.html @@ -61,7 +61,7 @@

Widget settings

-
+
{{account.name}}
diff --git a/src/components/widgets/hr-payroll-summary/hr-payroll-summary.directive.coffee b/src/components/widgets/hr-payroll-summary/hr-payroll-summary.directive.coffee index 0efc0353..e72fa636 100644 --- a/src/components/widgets/hr-payroll-summary/hr-payroll-summary.directive.coffee +++ b/src/components/widgets/hr-payroll-summary/hr-payroll-summary.directive.coffee @@ -39,7 +39,7 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, angular.forEach(w.content.summary, (statement) -> if statement.employees? # Attempt to find element by statement employee id - foundElem ||= _.find(statement.employees, (employee)-> employee.id == sElem) + foundElem ||= _.find(statement.employees, (employee)-> getIdentifier(employee) == sElem) ) $scope.selectedElements.push(foundElem) if foundElem @@ -104,8 +104,7 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, $scope.toggleSelectedElement = (element) -> if $scope.isSelected(element) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - matcher = (if element.id? then 'id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -123,8 +122,7 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, $scope.isSelected = (element) -> element? && _.any($scope.selectedElements, (sElem) -> - matcher = (if element.id? then 'id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) $scope.toggleCollapsed = (element) -> @@ -146,6 +144,10 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 + + getIdentifier = (element)-> + matcher = (if element.id? then 'id' else 'name') + element[matcher] # <--- sortEmployeesBy = (getElem) -> @@ -254,8 +256,7 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, selectedElementsSetting.toMetadata = -> # Build simple array of identifiers for metadata storage selectedElementsMetadata = _.map($scope.selectedElements, (element)-> - matcher = (if element.id? then 'id' else 'name') - element[matcher] + getIdentifier(element) ) {selectedElements: selectedElementsMetadata} diff --git a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee index 85a359bb..8eca0d94 100644 --- a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee +++ b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee @@ -39,12 +39,14 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log # Attempt to find element by supplier id foundElem = _.find(w.content.payables.suppliers, (supplier)-> - supplier.id == sElem + supplier.category = 'payables' + getIdentifier(supplier) == sElem ) if !foundElem # Attempt to find element by customer id foundElem = _.find(w.content.receivables.customers, (customer)-> - customer.id == sElem + customer.category = 'receivables' + getIdentifier(customer) == sElem ) if !foundElem $scope.selectedElements.push(foundElem) if foundElem @@ -82,11 +84,10 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log # ---> # TODO selectedElement and collapsed should be factorized as settings or 'commons' - $scope.toggleSelectedElement = (element) -> + $scope.toggleSelectedElement = (element, category=null) -> if $scope.isSelected(element) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - matcher = (if element.id? then 'id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -95,6 +96,7 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log ImpacWidgetsSvc.updateWidgetSettings(w,false) else $scope.selectedElements ||= [] + element.category = category if category $scope.selectedElements.push(element) w.format() if !w.isExpanded() @@ -104,8 +106,7 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log $scope.isSelected = (element) -> element? && _.any($scope.selectedElements, (sElem) -> - matcher = (if element.id? then 'id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) $scope.toggleCollapsed = (element) -> @@ -127,6 +128,11 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 + + getIdentifier = (element)-> + matcher = (if element.id? then 'id' else 'name') + if element.category then "#{element.category}-#{element[matcher]}" else element[matcher] + # <--- sortBy = (data, getElem) -> @@ -240,8 +246,7 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log selectedElementsSetting.toMetadata = -> # Build simple array of identifiers for metadata storage selectedElementsMetadata = _.map($scope.selectedElements, (element)-> - matcher = (if element.id? then 'id' else 'name') - element[matcher] + getIdentifier(element) ) {selectedElements: selectedElementsMetadata} diff --git a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html index 041974be..2d4503ec 100644 --- a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html +++ b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html @@ -55,7 +55,7 @@

Widget settings

-
+
{{supplier.name}}
@@ -96,7 +96,7 @@

Widget settings

-
+
{{customer.name}}
diff --git a/src/components/widgets/sales-comparison/sales-comparison.directive.coffee b/src/components/widgets/sales-comparison/sales-comparison.directive.coffee index 90cfb632..fb4f6ca8 100644 --- a/src/components/widgets/sales-comparison/sales-comparison.directive.coffee +++ b/src/components/widgets/sales-comparison/sales-comparison.directive.coffee @@ -61,7 +61,10 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat angular.forEach(w.content.sales_comparison, (statement) -> if statement.sales? # Attempt to find element by sale id - foundElem ||= _.find(statement.sales, (sale)-> sale.id == sElem) + foundElem ||= _.find(statement.sales, (sale)-> + sale.category = statement.name + getIdentifier(sale) == sElem + ) ) $scope.selectedElements.push(foundElem) if foundElem @@ -81,11 +84,10 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat # ---> # TODO selectedElement and collapsed should be factorized as settings or 'commons' - $scope.toggleSelectedElement = (element) -> + $scope.toggleSelectedElement = (element, statement=null) -> if $scope.isSelected(element) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - matcher = (if element.id? then 'id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -93,6 +95,7 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat else ImpacWidgetsSvc.updateWidgetSettings(w,false) else + element.category = statement.name if statement $scope.selectedElements ||= [] $scope.selectedElements.push(element) w.format() @@ -103,8 +106,7 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat $scope.isSelected = (element) -> element? && _.any($scope.selectedElements, (sElem) -> - matcher = (if element.id? then 'id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) $scope.toggleCollapsed = (element) -> @@ -129,6 +131,11 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat $scope.getSelectLineColor = (elem) -> ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, elem)) if $scope.hasElements() + + getIdentifier = (element)-> + matcher = (if element.id? then 'id' else 'name') + if element.category then "#{element.category}-#{element[matcher]}" else element[matcher] + # <--- # Chart formating function @@ -214,8 +221,7 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat selectedElementsSetting.toMetadata = -> # Build simple array of identifiers for metadata storage selectedElementsMetadata = _.map($scope.selectedElements, (element)-> - matcher = (if element.id? then 'id' else 'name') - element[matcher] + getIdentifier(element) ) {selectedElements: selectedElementsMetadata} diff --git a/src/components/widgets/sales-comparison/sales-comparison.tmpl.html b/src/components/widgets/sales-comparison/sales-comparison.tmpl.html index b2033aac..1fd70c69 100644 --- a/src/components/widgets/sales-comparison/sales-comparison.tmpl.html +++ b/src/components/widgets/sales-comparison/sales-comparison.tmpl.html @@ -59,7 +59,7 @@

Widget settings

-
+
{{sale.name}}
diff --git a/src/components/widgets/sales-performance/sales-performance.directive.coffee b/src/components/widgets/sales-performance/sales-performance.directive.coffee index 4a7ab126..ebbb6fa9 100644 --- a/src/components/widgets/sales-performance/sales-performance.directive.coffee +++ b/src/components/widgets/sales-performance/sales-performance.directive.coffee @@ -33,16 +33,8 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma unless _.isEmpty(w.metadata.selectedElements) $scope.selectedElements = [] angular.forEach(w.metadata.selectedElements, (sElem) -> - # Attempt to find element by statement name - foundElem = _.find(w.content.assignees, (statement)-> statement.name == sElem) - - unless foundElem - angular.forEach(w.content.summary, (statement) -> - if statement.accounts? - # Attempt to find element by statement account id - foundElem ||= _.find(statement.accounts, (account)-> account.id == sElem) - ) - + # Attempt to find element by assignee name + foundElem = _.find(w.content.assignees, (assignee)-> getIdentifier(assignee) == sElem) $scope.selectedElements.push(foundElem) if foundElem ) # Parameter which define showing 'Apply to all similar widgets' checkbox @@ -98,8 +90,7 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma $scope.toggleSelectedElement = (element) -> if $scope.isSelected(element) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - matcher = (if element.id? then 'id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -117,16 +108,19 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma $scope.isSelected = (element) -> element? && _.any($scope.selectedElements, (sElem) -> - matcher = (if element.id? then 'id' else 'name') - sElem[matcher] == element[matcher] + getIdentifier(sElem) == getIdentifier(element) ) $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 + getIdentifier = (element)-> + matcher = (if element.id? then 'id' else 'name') + element[matcher] + # <--- + $scope.getSelectLineColor = (elem) -> ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, elem)) if $scope.hasElements() - # <--- # Chart formating function # -------------------------------------- @@ -166,8 +160,7 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma selectedElementsSetting.toMetadata = -> # Build simple array of identifiers for metadata storage selectedElementsMetadata = _.map($scope.selectedElements, (element)-> - matcher = (if element.id? then 'id' else 'name') - element[matcher] + getIdentifier(element) ) {selectedElements: selectedElementsMetadata} From 03da3d5d45949b55cc2a3d308c2cbd47ddb71e66 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Tue, 4 Apr 2017 14:48:20 +0100 Subject: [PATCH 15/28] Update changelog for impac-498 --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 475f4bdd..b35ec5bd 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ ### v1.4.10 | 2017 - Week 14 #### Adds +- [IMPAC-498] improve widget drill-down selection saved ids - [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) - Aged Payables and Receivables to use common-currency-conversions directive From b91735f7dcc2d2234b776ddd9f29375381703018 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Wed, 5 Apr 2017 12:08:53 +1000 Subject: [PATCH 16/28] show currency info on sales widgets --- .../sales-comparison.directive.coffee | 29 ++++++++++++++++++ .../sales-comparison/sales-comparison.less | 3 ++ .../sales-comparison.tmpl.html | 1 + .../sales-list/sales-list.directive.coffee | 30 ++++++++++++++++++- .../widgets/sales-list/sales-list.less | 3 ++ .../widgets/sales-list/sales-list.tmpl.html | 1 + .../sales-top-customers.directive.coffee | 18 +++++++++++ .../sales-top-customers.less | 3 ++ .../sales-top-customers.tmpl.html | 14 +++++++-- 9 files changed, 98 insertions(+), 4 deletions(-) diff --git a/src/components/widgets/sales-comparison/sales-comparison.directive.coffee b/src/components/widgets/sales-comparison/sales-comparison.directive.coffee index 90cfb632..44177458 100644 --- a/src/components/widgets/sales-comparison/sales-comparison.directive.coffee +++ b/src/components/widgets/sales-comparison/sales-comparison.directive.coffee @@ -51,6 +51,9 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat w.metadata && w.metadata.criteria == o.value ) || $scope.criteriaOptions[0]) + buildFxTotals() + $scope.ratesDate = moment.now() + unless _.isEmpty(w.metadata.selectedElements) $scope.selectedElements = [] angular.forEach(w.metadata.selectedElements, (sElem) -> @@ -192,6 +195,32 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat $scope.sortedColumn = col sortData() + buildFxTotals = -> + for groupedSales in w.content.sales_comparison + for sale in groupedSales.sales + sale.formattedFxTotals = {} + netSaleFxTotals = [] + grossSaleFxTotals = [] + unless _.isEmpty(sale.fx_totals) + _.mapKeys sale.fx_totals, (total, currency) -> + for grossAmount in total['net_value_sold'] + unless grossAmount == 0 || currency == w.metadata.currency + netSaleFxTotals.push({ + currency: currency, + amount: grossAmount, + rate: total.rate + }) + for netAmount in total['gross_value_sold'] + unless netAmount == 0 || currency == w.metadata.currency + grossSaleFxTotals.push({ + currency: currency, + amount: netAmount, + rate: total.rate + }) + + sale.formattedFxTotals['net_value_sold'] = netSaleFxTotals unless _.isEmpty(netSaleFxTotals) + sale.formattedFxTotals['gross_value_sold'] = grossSaleFxTotals unless _.isEmpty(grossSaleFxTotals) + # Mini-settings # -------------------------------------- unCollapsedSetting = {} diff --git a/src/components/widgets/sales-comparison/sales-comparison.less b/src/components/widgets/sales-comparison/sales-comparison.less index 8fcc839c..9b969eb6 100644 --- a/src/components/widgets/sales-comparison/sales-comparison.less +++ b/src/components/widgets/sales-comparison/sales-comparison.less @@ -6,4 +6,7 @@ .right-panel .widget-lines-container { max-height: 250px; } + .currency-conversions { + img { margin-top: -2px; } + } } diff --git a/src/components/widgets/sales-comparison/sales-comparison.tmpl.html b/src/components/widgets/sales-comparison/sales-comparison.tmpl.html index b2033aac..c5c8c4ad 100644 --- a/src/components/widgets/sales-comparison/sales-comparison.tmpl.html +++ b/src/components/widgets/sales-comparison/sales-comparison.tmpl.html @@ -67,6 +67,7 @@

Widget settings

{{getTotalForPeriod(sale)}}
+ {{getTotalForPeriod(sale) | mnoCurrency : sale.currency}}
diff --git a/src/components/widgets/sales-list/sales-list.directive.coffee b/src/components/widgets/sales-list/sales-list.directive.coffee index 3f9c726d..15b5c3f6 100644 --- a/src/components/widgets/sales-list/sales-list.directive.coffee +++ b/src/components/widgets/sales-list/sales-list.directive.coffee @@ -23,7 +23,9 @@ module.controller('WidgetSalesListCtrl', ($scope, $q, ChartFormatterSvc, ImpacWi # Widget specific methods # -------------------------------------- w.initContext = -> - $scope.isDataFound = angular.isDefined(w.content) && !_.isEmpty(w.content.summary) + if $scope.isDataFound = angular.isDefined(w.content) && !_.isEmpty(w.content.summary) + buildFxTotals() + $scope.ratesDate = moment.now() $scope.filterOptions = [ {label: 'value sold (incl. taxes)', value: 'gross_value_sold'}, @@ -82,6 +84,32 @@ module.controller('WidgetSalesListCtrl', ($scope, $q, ChartFormatterSvc, ImpacWi $scope.sortedColumn = col sortData() + buildFxTotals = -> + for groupedSales in w.content.summary + for sale in groupedSales.products + sale.formattedFxTotals = {} + netSaleFxTotals = [] + grossSaleFxTotals = [] + unless _.isEmpty(sale.fx_totals) + _.mapKeys sale.fx_totals, (total, currency) -> + grossAmount = total['net_value_sold'] + unless grossAmount == 0 || currency == w.metadata.currency + netSaleFxTotals.push({ + currency: currency, + amount: grossAmount, + rate: total.rate + }) + netAmount = total['gross_value_sold'] + unless netAmount == 0 || currency == w.metadata.currency + grossSaleFxTotals.push({ + currency: currency, + amount: netAmount, + rate: total.rate + }) + + sale.formattedFxTotals['net_value_sold'] = netSaleFxTotals unless _.isEmpty(netSaleFxTotals) + sale.formattedFxTotals['gross_value_sold'] = grossSaleFxTotals unless _.isEmpty(grossSaleFxTotals) + # Mini-settings # -------------------------------------- unCollapsedSetting = {} diff --git a/src/components/widgets/sales-list/sales-list.less b/src/components/widgets/sales-list/sales-list.less index adf55754..bd7262a1 100644 --- a/src/components/widgets/sales-list/sales-list.less +++ b/src/components/widgets/sales-list/sales-list.less @@ -10,4 +10,7 @@ .selector { margin-bottom: 4px; } + .currency-conversions { + img { margin-top: -2px; } + } } diff --git a/src/components/widgets/sales-list/sales-list.tmpl.html b/src/components/widgets/sales-list/sales-list.tmpl.html index d17f6f7e..46e9879d 100644 --- a/src/components/widgets/sales-list/sales-list.tmpl.html +++ b/src/components/widgets/sales-list/sales-list.tmpl.html @@ -64,6 +64,7 @@

Widget settings

{{product.total}}
+ {{product.total | mnoCurrency : product.currency}}
diff --git a/src/components/widgets/sales-top-customers/sales-top-customers.directive.coffee b/src/components/widgets/sales-top-customers/sales-top-customers.directive.coffee index 6e10d306..a4c00b9e 100644 --- a/src/components/widgets/sales-top-customers/sales-top-customers.directive.coffee +++ b/src/components/widgets/sales-top-customers/sales-top-customers.directive.coffee @@ -47,6 +47,9 @@ module.controller('WidgetSalesTopCustomersCtrl', ($scope, $q, $filter, ImpacUtil $scope.defaultFrom = $filter('date')(datesRange[0], 'yyyy-MM-dd') $scope.defaultTo = $filter('date')(datesRange[1], 'yyyy-MM-dd') + buildFxTotals() + $scope.ratesDate = moment.now() + fields = [ { @@ -54,6 +57,8 @@ module.controller('WidgetSalesTopCustomersCtrl', ($scope, $q, $filter, ImpacUtil showCurrency: true getValue: (entity) -> entity.total_invoiced + getFormattedFxTotals: (entity) -> + entity.formattedFxTotals } { label: '# tr' @@ -91,6 +96,19 @@ module.controller('WidgetSalesTopCustomersCtrl', ($scope, $q, $filter, ImpacUtil return [] unless $scope.isDataFound $filter('orderBy')( w.content.entities, ( (entity) -> $scope.getHeaderField().getValue(entity) ), true ) + buildFxTotals = -> + for contact in w.content.entities + contactFxTotals = [] + _.mapKeys contact.fx_totals, (total, currency) -> + if currency != w.metadata.currency + contactFxTotals.push({ + currency: currency, + amount: total.invoiced, + rate: total.rate + }) + unless _.isEmpty(contactFxTotals) + contact.formattedFxTotals = contactFxTotals + # Widget is ready: can trigger the "wait for settings to be ready" # -------------------------------------- diff --git a/src/components/widgets/sales-top-customers/sales-top-customers.less b/src/components/widgets/sales-top-customers/sales-top-customers.less index a39a0943..01182954 100644 --- a/src/components/widgets/sales-top-customers/sales-top-customers.less +++ b/src/components/widgets/sales-top-customers/sales-top-customers.less @@ -12,4 +12,7 @@ // Will allow the params selectors to be displayed on top of the container (without being cut on the right) .row > [class*='col-'] { position: static; } } + .currency-conversions { + img { margin-top: -2px; } + } } diff --git a/src/components/widgets/sales-top-customers/sales-top-customers.tmpl.html b/src/components/widgets/sales-top-customers/sales-top-customers.tmpl.html index 9cf3139f..f7801759 100644 --- a/src/components/widgets/sales-top-customers/sales-top-customers.tmpl.html +++ b/src/components/widgets/sales-top-customers/sales-top-customers.tmpl.html @@ -45,14 +45,22 @@

Widget settings

{{entity.name}}
- {{ getHeaderField().getValue(entity) | mnoCurrency : entity.currency }} - {{ getHeaderField().getValue(entity) }} + + + {{ getHeaderField().getValue(entity) | mnoCurrency : entity.currency }} + + + {{ getHeaderField().getValue(entity) }} +
- {{field.label}}: {{field.getValue(entity) | mnoCurrency : entity.currency}} + + {{field.label}}: {{field.getValue(entity) | mnoCurrency : entity.currency}} + + {{field.label}}: {{field.getValue(entity)}}
From f55e605da1372d9652c411b6a54347afe5ed0297 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Wed, 5 Apr 2017 18:36:41 +0100 Subject: [PATCH 17/28] [IMPAC-527] sales seg minor display improvs --- Changelog.md | 1 + .../sales-segmented-turnover.directive.coffee | 6 +++--- .../sales-segmented-turnover.tmpl.html | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index 475f4bdd..052b3f03 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ ### v1.4.10 | 2017 - Week 14 #### Adds +- [IMPAC-527] sales segmented minor display improvements: add currency to graph tooltip, & improve price range legend bootstrap col spacing for larger numbers - [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) - Aged Payables and Receivables to use common-currency-conversions directive diff --git a/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.directive.coffee b/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.directive.coffee index ea5ba7e6..0cff78d5 100644 --- a/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.directive.coffee +++ b/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.directive.coffee @@ -46,10 +46,10 @@ module.controller('WidgetSalesSegmentedTurnoverCtrl', ($scope, $q, $filter, Char $scope.getColorByIndex = (index) -> ChartFormatterSvc.getColor(index) - $scope.getRangeLabel = (aLabel) -> + $scope.getRangeLabel = (aLabel, ISOmode=false) -> prices = aLabel.split('-') _.map(prices, (price) -> - $filter('mnoCurrency')(price,w.content.currency,false) + $filter('mnoCurrency')(price,w.content.currency,ISOmode) ).join(' - ') $scope.getMaxRange = -> @@ -69,7 +69,7 @@ module.controller('WidgetSalesSegmentedTurnoverCtrl', ($scope, $q, $filter, Char if $scope.isDataFound barData = { labels: _.map(w.content.ranges, (elem) -> - elem.label + $scope.getRangeLabel(elem.label, true) ), values: _.map(w.content.ranges, (elem) -> elem.value diff --git a/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.tmpl.html b/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.tmpl.html index 7e5496ed..f3e3ec3e 100644 --- a/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.tmpl.html +++ b/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.tmpl.html @@ -33,10 +33,10 @@

Widget settings

-
+
{{getRangeLabel(range.label)}}
-
+
{{range.percentage}}%
From d794424458f188b1283e57399855d46268eb9018 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Thu, 6 Apr 2017 10:36:48 +1000 Subject: [PATCH 18/28] adapt sales list front following api change --- .../sales-list/sales-list.directive.coffee | 22 +++++-------------- .../widgets/sales-list/sales-list.tmpl.html | 2 +- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/components/widgets/sales-list/sales-list.directive.coffee b/src/components/widgets/sales-list/sales-list.directive.coffee index 15b5c3f6..96488cfb 100644 --- a/src/components/widgets/sales-list/sales-list.directive.coffee +++ b/src/components/widgets/sales-list/sales-list.directive.coffee @@ -87,28 +87,18 @@ module.controller('WidgetSalesListCtrl', ($scope, $q, ChartFormatterSvc, ImpacWi buildFxTotals = -> for groupedSales in w.content.summary for sale in groupedSales.products - sale.formattedFxTotals = {} - netSaleFxTotals = [] - grossSaleFxTotals = [] + saleFxTotals = [] unless _.isEmpty(sale.fx_totals) _.mapKeys sale.fx_totals, (total, currency) -> - grossAmount = total['net_value_sold'] - unless grossAmount == 0 || currency == w.metadata.currency - netSaleFxTotals.push({ + amount = total['amount'] + unless amount == 0 || currency == w.metadata.currency + saleFxTotals.push({ currency: currency, - amount: grossAmount, - rate: total.rate - }) - netAmount = total['gross_value_sold'] - unless netAmount == 0 || currency == w.metadata.currency - grossSaleFxTotals.push({ - currency: currency, - amount: netAmount, + amount: amount, rate: total.rate }) - sale.formattedFxTotals['net_value_sold'] = netSaleFxTotals unless _.isEmpty(netSaleFxTotals) - sale.formattedFxTotals['gross_value_sold'] = grossSaleFxTotals unless _.isEmpty(grossSaleFxTotals) + sale.formattedFxTotals = saleFxTotals unless _.isEmpty(saleFxTotals) # Mini-settings # -------------------------------------- diff --git a/src/components/widgets/sales-list/sales-list.tmpl.html b/src/components/widgets/sales-list/sales-list.tmpl.html index 46e9879d..ca2bb534 100644 --- a/src/components/widgets/sales-list/sales-list.tmpl.html +++ b/src/components/widgets/sales-list/sales-list.tmpl.html @@ -64,7 +64,7 @@

Widget settings

{{product.total}}
- + {{product.total | mnoCurrency : product.currency}}
From 5fdcfb25603589d95bd356f59fd5a2404b96854b Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Thu, 6 Apr 2017 18:31:31 +0100 Subject: [PATCH 19/28] [IMPAC-498] refactor drill-down ids improvements --- .../accounts-cash-summary.directive.coffee | 100 +++++++++------- .../accounts-cash-summary.tmpl.html | 4 +- .../accounts-profit-and-loss.directive.coffee | 77 ++++++------ .../accounts-profit-and-loss.tmpl.html | 4 +- .../hr-payroll-summary.directive.coffee | 74 +++++++----- .../hr-payroll-summary.tmpl.html | 4 +- ...aged-payables-receivables.directive.coffee | 81 +++++++------ ...voices-aged-payables-receivables.tmpl.html | 36 +++--- .../sales-comparison.directive.coffee | 112 ++++++++++-------- .../sales-comparison.tmpl.html | 4 +- .../sales-performance.directive.coffee | 51 ++++---- 11 files changed, 302 insertions(+), 245 deletions(-) diff --git a/src/components/widgets/accounts-cash-summary/accounts-cash-summary.directive.coffee b/src/components/widgets/accounts-cash-summary/accounts-cash-summary.directive.coffee index 8e52399b..19295d94 100644 --- a/src/components/widgets/accounts-cash-summary/accounts-cash-summary.directive.coffee +++ b/src/components/widgets/accounts-cash-summary/accounts-cash-summary.directive.coffee @@ -35,14 +35,9 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv $scope.selectedElement = _.find(w.content.summary, (statement)-> statement.name == w.metadata.selectedElement ) - if !$scope.selectedElement - # Attempt to find the selectedElement by statement account id - angular.forEach(w.content.summary, (statement) -> - $scope.selectedElement ||= _.find(statement.accounts, (account)-> - account.category = statement.name - getIdentifier(account) == w.metadata.selectedElement - ) if statement.accounts? - ) + # Attempt to find the selectedElement by statement account id + $scope.selectedElement ||= fetchElement(w.content.summary) + sortData() $scope.getLastDate = -> @@ -80,9 +75,18 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv $scope.getName = (element) -> element.name.replace(/_/g, " ") if element? && element.name? + $scope.sort = (col) -> + if $scope.sortedColumn == col + $scope.ascending = !$scope.ascending + else + $scope.ascending = true + $scope.sortedColumn = col + sortData() - $scope.toggleSelectedElement = (element, statement=null) -> - if $scope.isSelected(element) + # ---> + # TODO selectedElement and collapsed should be factorized as settings or 'commons' + $scope.toggleSelectedElement = (element, statementName = null) -> + if $scope.isSelected(element, statementName) $scope.selectedElement = null if w.isExpanded() w.toggleExpanded() @@ -90,16 +94,16 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv ImpacWidgetsSvc.updateWidgetSettings(w,false) else $scope.selectedElement = angular.copy(element) - $scope.selectedElement.category = statement.name if statement + $scope.selectedElement.category = statementName w.format() if !w.isExpanded() w.toggleExpanded() else ImpacWidgetsSvc.updateWidgetSettings(w,false) - $scope.isSelected = (element) -> + $scope.isSelected = (element, statementName = null) -> element? && $scope.selectedElement? && ( - getIdentifier($scope.selectedElement) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, $scope.selectedElement) ) $scope.toggleCollapsed = (element) -> @@ -123,6 +127,44 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv $scope.getSelectLineColor = (elem) -> ChartFormatterSvc.getColor(0) + fetchElement = (statements)-> + for statement in statements + continue unless statement.accounts? + element = _.find(statement.accounts, (acc) -> getIdentifier(acc, statement.name) == w.metadata.selectedElement) + if element? + element = angular.merge(angular.copy(element), category: statement.name) + return element + + matchElementToSelectedElement = (element, elementCategory = null, sElem)-> + getIdentifier(element, elementCategory) == getIdentifier(sElem) + + getIdentifier = (element, category = null)-> + id = element.id || element.name + category ||= element.category + return id unless category + "#{category}-#{id}" + + # <--- + + sortAccountsBy = (getElem) -> + angular.forEach(w.content.summary, (sElem) -> + if sElem.accounts + sElem.accounts.sort (a, b) -> + res = if getElem(a) > getElem(b) then 1 + else if getElem(a) < getElem(b) then -1 + else 0 + res *= -1 unless $scope.ascending + return res + ) + + sortData = -> + if $scope.sortedColumn == 'account' + sortAccountsBy( (el) -> el.name ) + else if $scope.sortedColumn == 'total' + sortAccountsBy( (el) -> $scope.getLastValue(el) ) + else if $scope.sortedColumn == 'variance' + sortAccountsBy( (el) -> $scope.getLastVariance(el) ) + # Chart formating function # -------------------------------------- $scope.drawTrigger = $q.defer() @@ -150,38 +192,6 @@ module.controller('WidgetAccountsCashSummaryCtrl', ($scope, $q, ChartFormatterSv # calls chart.draw() $scope.drawTrigger.notify(chartData) - sortAccountsBy = (getElem) -> - angular.forEach(w.content.summary, (sElem) -> - if sElem.accounts - sElem.accounts.sort (a, b) -> - res = if getElem(a) > getElem(b) then 1 - else if getElem(a) < getElem(b) then -1 - else 0 - res *= -1 unless $scope.ascending - return res - ) - - sortData = -> - if $scope.sortedColumn == 'account' - sortAccountsBy( (el) -> el.name ) - else if $scope.sortedColumn == 'total' - sortAccountsBy( (el) -> $scope.getLastValue(el) ) - else if $scope.sortedColumn == 'variance' - sortAccountsBy( (el) -> $scope.getLastVariance(el) ) - - $scope.sort = (col) -> - if $scope.sortedColumn == col - $scope.ascending = !$scope.ascending - else - $scope.ascending = true - $scope.sortedColumn = col - sortData() - - getIdentifier = (element)-> - matcher = (if element.id? then 'id' else 'name') - if element.category then "#{element.category}-#{element[matcher]}" else element[matcher] - - # Mini-settings # -------------------------------------- unCollapsedSetting = {} diff --git a/src/components/widgets/accounts-cash-summary/accounts-cash-summary.tmpl.html b/src/components/widgets/accounts-cash-summary/accounts-cash-summary.tmpl.html index 0f9d2248..cd139f4f 100644 --- a/src/components/widgets/accounts-cash-summary/accounts-cash-summary.tmpl.html +++ b/src/components/widgets/accounts-cash-summary/accounts-cash-summary.tmpl.html @@ -61,7 +61,7 @@

Widget settings

-
+
{{account.name}}
@@ -72,7 +72,7 @@

Widget settings

{{getLastVariance(account)}}
-
+
diff --git a/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.directive.coffee b/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.directive.coffee index 50740cb6..5bc1b889 100644 --- a/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.directive.coffee +++ b/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.directive.coffee @@ -57,19 +57,11 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter unless _.isEmpty(w.metadata.selectedElements) $scope.selectedElements = [] - - for sElem in w.metadata.selectedElements + for sElemId in w.metadata.selectedElements # Attempt to find element by statement name - foundElem = _.find(w.content.summary, (statement) -> statement.name == sElem) - - unless foundElem - for statement in w.content.summary - if statement.accounts? - # Attempt to find element by statement account id - foundElem ||= _.find(statement.accounts, (account) -> - account.category = statement.name - getIdentifier(account) == sElem - ) + foundElem = _.find(w.content.summary, (statement) -> statement.name == sElemId) + # Attempt to find element by statement account id + foundElem ||= fetchElement(w.content.summary, sElemId) $scope.selectedElements.push(foundElem) if foundElem @@ -109,12 +101,20 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter $scope.getName = (element) -> element.name.replace(/_/g, " ") if element? && element.name? + $scope.sort = (col) -> + if $scope.sortedColumn == col + $scope.ascending = !$scope.ascending + else + $scope.ascending = true + $scope.sortedColumn = col + sortData() + # ---> # TODO selectedElement and collapsed should be factorized as settings or 'commons' - $scope.toggleSelectedElement = (element, statement) -> - if $scope.isSelected(element) + $scope.toggleSelectedElement = (element, statementName = null) -> + if $scope.isSelected(element, statementName) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, sElem) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -122,18 +122,19 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter else ImpacWidgetsSvc.updateWidgetSettings(w,false) else - element.category = statement.name if statement + selectedElement = angular.copy(element) + selectedElement.category = statementName $scope.selectedElements ||= [] - $scope.selectedElements.push(element) + $scope.selectedElements.push(selectedElement) w.format() if !w.isExpanded() w.toggleExpanded() else ImpacWidgetsSvc.updateWidgetSettings(w,false) - $scope.isSelected = (element) -> + $scope.isSelected = (element, statementName = null) -> element? && _.any($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, sElem) ) $scope.toggleCollapsed = (element) -> @@ -153,12 +154,32 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter else return true + $scope.getSelectLineColor = (element, statementName = null) -> + sElem = _.find($scope.selectedElements, (sElem)-> + matchElementToSelectedElement(element, statementName, sElem) + ) + ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, sElem)) if $scope.hasElements() + $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 - getIdentifier = (element)-> - matcher = (if element.account_id? then 'account_id' else 'name') - if element.category then "#{element.category}-#{element[matcher]}" else element[matcher] + matchElementToSelectedElement = (element, elementCategory = null, sElem)-> + getIdentifier(element, elementCategory) == getIdentifier(sElem) + + fetchElement = (statements, sElemId)-> + for statement in statements + continue unless statement.accounts? + element = _.find(statement.accounts, (acc) -> getIdentifier(acc, statement.name) == sElemId) + if element? + element = angular.merge(angular.copy(element), category: statement.name) + return element + + getIdentifier = (element, category = null)-> + id = element.id || element.name + category ||= element.category + return id unless category + "#{category}-#{id}" + # <--- sortAccountsBy = (getElem) -> @@ -178,18 +199,6 @@ module.controller('WidgetAccountsProfitAndLossCtrl', ($scope, $q, ChartFormatter else if $scope.sortedColumn == 'total' sortAccountsBy( (el) -> $scope.getAmount(el) ) - $scope.sort = (col) -> - if $scope.sortedColumn == col - $scope.ascending = !$scope.ascending - else - $scope.ascending = true - $scope.sortedColumn = col - sortData() - - $scope.getSelectLineColor = (elem) -> - ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, elem)) if $scope.hasElements() - - # Chart formating function # -------------------------------------- $scope.drawTrigger = $q.defer() diff --git a/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.tmpl.html b/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.tmpl.html index 69e2fa18..c2462e4f 100644 --- a/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.tmpl.html +++ b/src/components/widgets/accounts-profit-and-loss/accounts-profit-and-loss.tmpl.html @@ -61,7 +61,7 @@

Widget settings

-
+
{{account.name}}
@@ -69,7 +69,7 @@

Widget settings

{{getAmount(account) | mnoCurrency : account.currency}}
-
+
diff --git a/src/components/widgets/hr-payroll-summary/hr-payroll-summary.directive.coffee b/src/components/widgets/hr-payroll-summary/hr-payroll-summary.directive.coffee index e72fa636..e513a62e 100644 --- a/src/components/widgets/hr-payroll-summary/hr-payroll-summary.directive.coffee +++ b/src/components/widgets/hr-payroll-summary/hr-payroll-summary.directive.coffee @@ -31,19 +31,13 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, unless _.isEmpty(w.metadata.selectedElements) $scope.selectedElements = [] - angular.forEach(w.metadata.selectedElements, (sElem) -> + for sElemId in w.metadata.selectedElements # Attempt to find element by statement name - foundElem = _.find(w.content.summary, (statement)-> statement.name == sElem) - - unless foundElem - angular.forEach(w.content.summary, (statement) -> - if statement.employees? - # Attempt to find element by statement employee id - foundElem ||= _.find(statement.employees, (employee)-> getIdentifier(employee) == sElem) - ) + foundElem = _.find(w.content.summary, (statement)-> statement.name == sElemId) + # Attempt to find element by statement employee id + foundElem ||= fetchElement(w.content.summary, sElemId) $scope.selectedElements.push(foundElem) if foundElem - ) w.width = 6 unless $scope.selectedElements? && $scope.selectedElements.length > 0 sortData() @@ -99,12 +93,20 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, else return $filter('date')(date, 'MMM') + $scope.sort = (col) -> + if $scope.sortedColumn == col + $scope.ascending = !$scope.ascending + else + $scope.ascending = true + $scope.sortedColumn = col + sortData() + # ---> # TODO selectedElement and collapsed should be factorized as settings or 'commons' - $scope.toggleSelectedElement = (element) -> - if $scope.isSelected(element) + $scope.toggleSelectedElement = (element, statementName = null) -> + if $scope.isSelected(element, statementName) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, sElem) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -112,17 +114,19 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, else ImpacWidgetsSvc.updateWidgetSettings(w,false) else + selectedElement = angular.copy(element) + selectedElement.category = statementName $scope.selectedElements ||= [] - $scope.selectedElements.push(element) + $scope.selectedElements.push(selectedElement) w.format() if !w.isExpanded() w.toggleExpanded() else ImpacWidgetsSvc.updateWidgetSettings(w,false) - $scope.isSelected = (element) -> + $scope.isSelected = (element, statementName = null) -> element? && _.any($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, sElem) ) $scope.toggleCollapsed = (element) -> @@ -145,9 +149,29 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 - getIdentifier = (element)-> - matcher = (if element.id? then 'id' else 'name') - element[matcher] + $scope.getSelectLineColor = (element, statementName = null) -> + sElem = _.find($scope.selectedElements, (sElem)-> + matchElementToSelectedElement(element, statementName, sElem) + ) + ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, sElem)) if $scope.hasElements() + + matchElementToSelectedElement = (element, elementCategory = null, sElem)-> + getIdentifier(element, elementCategory) == getIdentifier(sElem) + + fetchElement = (statements, sElemId)-> + for statement in statements + continue unless statement.employees? + element = _.find(statement.employees, (e) -> getIdentifier(e, statement.name) == sElemId) + if element? + element = angular.merge(angular.copy(element), category: statement.name) + return element + + getIdentifier = (element, category = null)-> + id = element.id || element.name + category ||= element.category + return id unless category + "#{category}-#{id}" + # <--- sortEmployeesBy = (getElem) -> @@ -167,18 +191,6 @@ module.controller('WidgetHrPayrollSummaryCtrl', ($scope, $q, ChartFormatterSvc, else if $scope.sortedColumn == 'total' sortEmployeesBy( (el) -> $scope.getLastValue(el) ) - $scope.sort = (col) -> - if $scope.sortedColumn == col - $scope.ascending = !$scope.ascending - else - $scope.ascending = true - $scope.sortedColumn = col - sortData() - - $scope.getSelectLineColor = (elem) -> - ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, elem)) if $scope.hasElements() - - # Chart formating function # -------------------------------------- $scope.drawTrigger = $q.defer() diff --git a/src/components/widgets/hr-payroll-summary/hr-payroll-summary.tmpl.html b/src/components/widgets/hr-payroll-summary/hr-payroll-summary.tmpl.html index 7e2d1d19..c2bab3e1 100644 --- a/src/components/widgets/hr-payroll-summary/hr-payroll-summary.tmpl.html +++ b/src/components/widgets/hr-payroll-summary/hr-payroll-summary.tmpl.html @@ -55,7 +55,7 @@

Widget settings

-
+
{{employee.name}}
@@ -63,7 +63,7 @@

Widget settings

{{getLastValue(employee) | mnoCurrency : employee.currency}}
-
+
diff --git a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee index 8eca0d94..f25e0d32 100644 --- a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee +++ b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.directive.coffee @@ -28,29 +28,21 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log buildFxTotals() $scope.ratesDate = moment.now() + $scope.payables = w.content.payables + $scope.receivables = w.content.receivables + $scope.unCollapsed = w.metadata.unCollapsed || [] unless _.isEmpty(w.metadata.selectedElements) $scope.selectedElements = [] - angular.forEach(w.metadata.selectedElements, (sElem) -> + for sElemId in w.metadata.selectedElements + statements = [$scope.payables, $scope.receivables] # Attempt to find element by content type name - foundElem = w.content.payables if sElem == "aged_payables" - foundElem = w.content.receivables if sElem == "aged_receivables" && !foundElem - - # Attempt to find element by supplier id - foundElem = _.find(w.content.payables.suppliers, (supplier)-> - supplier.category = 'payables' - getIdentifier(supplier) == sElem - ) if !foundElem - - # Attempt to find element by customer id - foundElem = _.find(w.content.receivables.customers, (customer)-> - customer.category = 'receivables' - getIdentifier(customer) == sElem - ) if !foundElem + foundElem = _.find(statements, (statement)-> statement.name == sElemId) + # Attempt to find element by supplier & customer id + foundElem ||= fetchElement(statements, sElemId) $scope.selectedElements.push(foundElem) if foundElem - ) w.width = 6 unless $scope.selectedElements? && $scope.selectedElements.length > 0 sortData() @@ -82,12 +74,20 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log idx = _.findIndex(element.totals, (invoice) -> invoice != 0) return w.content.dates[idx] || null + $scope.sort = (col) -> + if $scope.sortedColumn == col + $scope.ascending = !$scope.ascending + else + $scope.ascending = true + $scope.sortedColumn = col + sortData() + # ---> # TODO selectedElement and collapsed should be factorized as settings or 'commons' - $scope.toggleSelectedElement = (element, category=null) -> - if $scope.isSelected(element) + $scope.toggleSelectedElement = (element, statementName = null) -> + if $scope.isSelected(element, statementName) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, sElem) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -96,7 +96,7 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log ImpacWidgetsSvc.updateWidgetSettings(w,false) else $scope.selectedElements ||= [] - element.category = category if category + element.category = statementName if statementName $scope.selectedElements.push(element) w.format() if !w.isExpanded() @@ -104,9 +104,9 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log else ImpacWidgetsSvc.updateWidgetSettings(w,false) - $scope.isSelected = (element) -> + $scope.isSelected = (element, statementName = null) -> element? && _.any($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, sElem) ) $scope.toggleCollapsed = (element) -> @@ -126,12 +126,32 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log else return true + $scope.getSelectLineColor = (element, statementName = null) -> + sElem = _.find($scope.selectedElements, (sElem)-> + matchElementToSelectedElement(element, statementName, sElem) + ) + ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, sElem)) if $scope.hasElements() + $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 - getIdentifier = (element)-> - matcher = (if element.id? then 'id' else 'name') - if element.category then "#{element.category}-#{element[matcher]}" else element[matcher] + matchElementToSelectedElement = (element, elementCategory = null, sElem)-> + getIdentifier(element, elementCategory) == getIdentifier(sElem) + + fetchElement = (statements, sElemId)-> + for statement in statements + elements = statement.suppliers || statement.customers + continue if _.isEmpty(elements) + element = _.find(elements, (elem) -> getIdentifier(elem, statement.name) == sElemId) + if element? + element = angular.merge(angular.copy(element), category: statement.name) + return element + + getIdentifier = (element, category = null)-> + id = element.id || element.name + category ||= element.category + return id unless category + "#{category}-#{id}" # <--- @@ -162,17 +182,6 @@ module.controller('WidgetInvoicesAgedPayablesReceivablesCtrl', ($scope, $q, $log sortBy(w.content.payables.suppliers, sortByInvoiceCallback) sortBy(w.content.receivables.customers, sortByInvoiceCallback) - $scope.sort = (col) -> - if $scope.sortedColumn == col - $scope.ascending = !$scope.ascending - else - $scope.ascending = true - $scope.sortedColumn = col - sortData() - - $scope.getSelectLineColor = (elem) -> - ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, elem)) if $scope.hasElements() - buildFxTotals = -> for contact in _.union(w.content.payables.suppliers, w.content.receivables.customers) contactFxTotals = [] diff --git a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html index 2d4503ec..d85200d2 100644 --- a/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html +++ b/src/components/widgets/invoices-aged-payables-receivables/invoices-aged-payables-receivables.tmpl.html @@ -40,22 +40,22 @@

Widget settings

-
- +
+
-
+
Aged Payables
-
- {{getTotalSum(widget.content.payables) | mnoCurrency : widget.content.payables.currency}} +
+ {{getTotalSum(payables) | mnoCurrency : payables.currency}}
-
+
-
+
-
+
{{supplier.name}}
@@ -68,7 +68,7 @@

Widget settings

-
+
@@ -81,22 +81,22 @@

Widget settings

-
- +
+
-
+
Aged Receivables
-
- {{getTotalSum(widget.content.receivables) | mnoCurrency : widget.content.receivables.currency}} +
+ {{getTotalSum(receivables) | mnoCurrency : receivables.currency}}
-
+
-
+
-
+
{{customer.name}}
@@ -109,7 +109,7 @@

Widget settings

-
+
diff --git a/src/components/widgets/sales-comparison/sales-comparison.directive.coffee b/src/components/widgets/sales-comparison/sales-comparison.directive.coffee index fb4f6ca8..9b688039 100644 --- a/src/components/widgets/sales-comparison/sales-comparison.directive.coffee +++ b/src/components/widgets/sales-comparison/sales-comparison.directive.coffee @@ -53,22 +53,13 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat unless _.isEmpty(w.metadata.selectedElements) $scope.selectedElements = [] - angular.forEach(w.metadata.selectedElements, (sElem) -> + for sElemId in w.metadata.selectedElements # Attempt to find element by statement name - foundElem = _.find(w.content.sales_comparison, (statement)-> statement.name == sElem) - - unless foundElem - angular.forEach(w.content.sales_comparison, (statement) -> - if statement.sales? - # Attempt to find element by sale id - foundElem ||= _.find(statement.sales, (sale)-> - sale.category = statement.name - getIdentifier(sale) == sElem - ) - ) + foundElem = _.find(w.content.sales_comparison, (statement)-> statement.name == sElemId) + # Attempt to find element by element by sale id + foundElem ||= fetchElement(w.content.sales_comparison, sElemId) $scope.selectedElements.push(foundElem) if foundElem - ) sortData() $scope.getLastDate = -> @@ -82,12 +73,20 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat $scope.getElementChartColor = (index) -> ChartFormatterSvc.getColor(index) + $scope.sort = (col) -> + if $scope.sortedColumn == col + $scope.ascending = !$scope.ascending + else + $scope.ascending = true + $scope.sortedColumn = col + sortData() + # ---> # TODO selectedElement and collapsed should be factorized as settings or 'commons' - $scope.toggleSelectedElement = (element, statement=null) -> - if $scope.isSelected(element) + $scope.toggleSelectedElement = (element, statementName = null) -> + if $scope.isSelected(element, statementName) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, sElem) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -95,18 +94,19 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat else ImpacWidgetsSvc.updateWidgetSettings(w,false) else - element.category = statement.name if statement + selectedElement = angular.copy(element) + selectedElement.category = statementName $scope.selectedElements ||= [] - $scope.selectedElements.push(element) + $scope.selectedElements.push(selectedElement) w.format() if !w.isExpanded() w.toggleExpanded() else ImpacWidgetsSvc.updateWidgetSettings(w,false) - $scope.isSelected = (element) -> + $scope.isSelected = (element, statementName = null) -> element? && _.any($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, statementName, sElem) ) $scope.toggleCollapsed = (element) -> @@ -129,15 +129,48 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 - $scope.getSelectLineColor = (elem) -> - ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, elem)) if $scope.hasElements() + $scope.getSelectLineColor = (element, statementName = null) -> + sElem = _.find($scope.selectedElements, (sElem)-> + matchElementToSelectedElement(element, statementName, sElem) + ) + ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, sElem)) if $scope.hasElements() + + matchElementToSelectedElement = (element, elementCategory = null, sElem)-> + getIdentifier(element, elementCategory) == getIdentifier(sElem) - getIdentifier = (element)-> - matcher = (if element.id? then 'id' else 'name') - if element.category then "#{element.category}-#{element[matcher]}" else element[matcher] + fetchElement = (statements, sElemId)-> + for statement in statements + continue unless statement.sales? + element = _.find(statement.sales, (sale) -> getIdentifier(sale, statement.name) == sElemId) + if element? + element = angular.merge(angular.copy(element), category: statement.name) + return element + + getIdentifier = (element, category = null)-> + id = element.id || element.name + category ||= element.category + return id unless category + "#{category}-#{id}" # <--- + sortAccountsBy = (getElem) -> + angular.forEach(w.content.sales_comparison, (sElem) -> + if sElem.sales + sElem.sales.sort (a, b) -> + res = if getElem(a) > getElem(b) then 1 + else if getElem(a) < getElem(b) then -1 + else 0 + res *= -1 unless $scope.ascending + return res + ) + + sortData = -> + if $scope.sortedColumn == 'sales' + sortAccountsBy( (el) -> el.name ) + else if $scope.sortedColumn == 'total' + sortAccountsBy( (el) -> $scope.getTotalForPeriod(el) ) + # Chart formating function # -------------------------------------- $scope.drawTrigger = $q.defer() @@ -174,31 +207,6 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat # calls chart.draw() $scope.drawTrigger.notify(chartData) - sortAccountsBy = (getElem) -> - angular.forEach(w.content.sales_comparison, (sElem) -> - if sElem.sales - sElem.sales.sort (a, b) -> - res = if getElem(a) > getElem(b) then 1 - else if getElem(a) < getElem(b) then -1 - else 0 - res *= -1 unless $scope.ascending - return res - ) - - sortData = -> - if $scope.sortedColumn == 'sales' - sortAccountsBy( (el) -> el.name ) - else if $scope.sortedColumn == 'total' - sortAccountsBy( (el) -> $scope.getTotalForPeriod(el) ) - - $scope.sort = (col) -> - if $scope.sortedColumn == col - $scope.ascending = !$scope.ascending - else - $scope.ascending = true - $scope.sortedColumn = col - sortData() - # Mini-settings # -------------------------------------- unCollapsedSetting = {} @@ -220,8 +228,8 @@ module.controller('WidgetSalesComparisonCtrl', ($scope, $q, $filter, ChartFormat selectedElementsSetting.toMetadata = -> # Build simple array of identifiers for metadata storage - selectedElementsMetadata = _.map($scope.selectedElements, (element)-> - getIdentifier(element) + selectedElementsMetadata = _.map($scope.selectedElements, (sElem)-> + getIdentifier(sElem) ) {selectedElements: selectedElementsMetadata} diff --git a/src/components/widgets/sales-comparison/sales-comparison.tmpl.html b/src/components/widgets/sales-comparison/sales-comparison.tmpl.html index 1fd70c69..a47b8efc 100644 --- a/src/components/widgets/sales-comparison/sales-comparison.tmpl.html +++ b/src/components/widgets/sales-comparison/sales-comparison.tmpl.html @@ -59,7 +59,7 @@

Widget settings

-
+
{{sale.name}}
@@ -70,7 +70,7 @@

Widget settings

{{getTotalForPeriod(sale) | mnoCurrency : sale.currency}}
-
+
diff --git a/src/components/widgets/sales-performance/sales-performance.directive.coffee b/src/components/widgets/sales-performance/sales-performance.directive.coffee index ebbb6fa9..fc9ce93f 100644 --- a/src/components/widgets/sales-performance/sales-performance.directive.coffee +++ b/src/components/widgets/sales-performance/sales-performance.directive.coffee @@ -32,11 +32,12 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma unless _.isEmpty(w.metadata.selectedElements) $scope.selectedElements = [] - angular.forEach(w.metadata.selectedElements, (sElem) -> + for sElemId in w.metadata.selectedElements # Attempt to find element by assignee name - foundElem = _.find(w.content.assignees, (assignee)-> getIdentifier(assignee) == sElem) + foundElem = _.find(w.content.assignees, (assignee)-> getIdentifier(assignee) == sElemId) + $scope.selectedElements.push(foundElem) if foundElem - ) + # Parameter which define showing 'Apply to all similar widgets' checkbox $scope.hasReach = true $scope.closedWonOptions = _.compact _.map w.content.sales_stages.won, (stage) -> @@ -85,12 +86,18 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma theDate = theDate.split(' ')[0] return formatDate(theDate) + $scope.getElementChartColor = (index) -> + ChartFormatterSvc.getColor(index) + + $scope.no_sales_stages_selected = -> + w.content && w.content.sales_stages && w.content.sales_stages.won.length == 0 && w.content.sales_stages.lost.length == 0 + # ---> # TODO selectedElement and collapsed should be factorized as settings or 'commons' $scope.toggleSelectedElement = (element) -> if $scope.isSelected(element) $scope.selectedElements = _.reject($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, sElem) ) w.format() if w.isExpanded() && $scope.selectedElements.length == 0 @@ -98,8 +105,9 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma else ImpacWidgetsSvc.updateWidgetSettings(w, false, true) else + selectedElement = angular.copy(element) $scope.selectedElements ||= [] - $scope.selectedElements.push(element) + $scope.selectedElements.push(selectedElement) w.format() if !w.isExpanded() w.toggleExpanded() @@ -108,19 +116,25 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma $scope.isSelected = (element) -> element? && _.any($scope.selectedElements, (sElem) -> - getIdentifier(sElem) == getIdentifier(element) + matchElementToSelectedElement(element, sElem) ) $scope.hasElements = -> $scope.selectedElements? && $scope.selectedElements.length > 0 + $scope.getSelectLineColor = (element) -> + sElem = _.find($scope.selectedElements, (sElem)-> + matchElementToSelectedElement(element, sElem) + ) + ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, sElem)) if $scope.hasElements() + + matchElementToSelectedElement = (element, sElem)-> + getIdentifier(element) == getIdentifier(sElem) + getIdentifier = (element)-> - matcher = (if element.id? then 'id' else 'name') - element[matcher] - # <--- + element.id || element.name - $scope.getSelectLineColor = (elem) -> - ChartFormatterSvc.getColor(_.indexOf($scope.selectedElements, elem)) if $scope.hasElements() + # <--- # Chart formating function # -------------------------------------- @@ -151,7 +165,8 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma # calls chart.draw() $scope.drawTrigger.notify(chartData) - # Mini-setting + # Mini-settings + # -------------------------------------- selectedElementsSetting = {initialized:false} selectedElementsSetting.initialize = -> @@ -159,20 +174,14 @@ module.controller('WidgetSalesPerformanceCtrl', ($scope, $q, $filter, ChartForma selectedElementsSetting.toMetadata = -> # Build simple array of identifiers for metadata storage - selectedElementsMetadata = _.map($scope.selectedElements, (element)-> - getIdentifier(element) + selectedElementsMetadata = _.map($scope.selectedElements, (sElem)-> + getIdentifier(sElem) ) {selectedElements: selectedElementsMetadata} - $scope.getElementChartColor = (index) -> - ChartFormatterSvc.getColor(index) - - $scope.no_sales_stages_selected = -> - w.content && w.content.sales_stages && w.content.sales_stages.won.length == 0 && w.content.sales_stages.lost.length == 0 - + w.settings.push(selectedElementsSetting) - w.settings.push(selectedElementsSetting) # Widget is ready: can trigger the "wait for settigns to be ready" # -------------------------------------- $scope.widgetDeferred.resolve(settingsPromises) From 2954058cdc6e88b6030fc85632b00f043eac89d6 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Fri, 7 Apr 2017 15:11:53 +0100 Subject: [PATCH 20/28] Add loader for KPIs on delete --- Changelog.md | 1 + src/components/kpi/kpi.directive.coffee | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 475f4bdd..c904dd13 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,7 @@ #### Adds - [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) +- Add loader for KPIs on delete - Aged Payables and Receivables to use common-currency-conversions directive ------------------------------------------------------------- diff --git a/src/components/kpi/kpi.directive.coffee b/src/components/kpi/kpi.directive.coffee index c9422c0a..c90dea81 100644 --- a/src/components/kpi/kpi.directive.coffee +++ b/src/components/kpi/kpi.directive.coffee @@ -160,7 +160,8 @@ angular $scope.deleteKpi = -> return if $scope.kpi.static - ImpacKpisSvc.delete($scope.kpi).then ((success) -> $scope.onDelete()) + $scope.kpi.isLoading = true + ImpacKpisSvc.delete($scope.kpi).then((success) -> $scope.onDelete()).finally(-> $scope.kpi.isLoading = false) $scope.isTriggered = -> $scope.kpi.layout? && $scope.kpi.layout.triggered From 0aacbeb263f9d3245c2c117447be839792e9cdda Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Tue, 11 Apr 2017 15:12:45 +1000 Subject: [PATCH 21/28] Update Changelog.md --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index d0a453ba..6b84ef0e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,6 @@ # Impac! Frontend Changelog -### v1.4.10 | 2017 - Week 14 +### v1.4.10 | 2017 - Week 15 #### Adds - [IMPAC-527] sales segmented minor display improvements: add currency to graph tooltip, & improve price range legend bootstrap col spacing for larger numbers From 320f34bfa0ca5a4234d69b642c2bac39ac882362 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Thu, 13 Apr 2017 14:50:28 +0100 Subject: [PATCH 22/28] [IMPAC-537] Fix widget content css issues --- Changelog.md | 1 + src/components/widget/widget.less | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Changelog.md b/Changelog.md index 2d90d10e..c6828bee 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ - Add loader for KPIs on delete #### Fixes +- [IMPAC-537] Fix widget content css issues: .widget-lines bootstrap cols & widget content overflow - [IMPAC-262] Fix new vs existing customer widget incorrect tooltip values - [IMPAC-397] Enforce at least 1 opportunities funnel widget option selection - [IMPAC-498] Improve widget drill-down selection saved ids diff --git a/src/components/widget/widget.less b/src/components/widget/widget.less index 9865ad66..808428dc 100644 --- a/src/components/widget/widget.less +++ b/src/components/widget/widget.less @@ -36,6 +36,7 @@ border: @impac-widget-border; border-top: none; background-color: @impac-widget-background-color; + overflow: none; vertical-align: top; .box-shadow(0px 1px 8px -4px); @@ -119,3 +120,8 @@ } } } + +// Fix overflow for large sums/text in .widget-lines-container tables +.widget-item .widget-lines-container .widget-line > [class*='col-'] { + overflow-wrap: break-word; +} From b250e6910c0e727e44e57f24424467613a5fdb58 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Tue, 18 Apr 2017 10:43:32 +1000 Subject: [PATCH 23/28] fix widget overflow --- src/components/widget/widget.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/widget/widget.less b/src/components/widget/widget.less index 808428dc..69b16d6c 100644 --- a/src/components/widget/widget.less +++ b/src/components/widget/widget.less @@ -36,7 +36,7 @@ border: @impac-widget-border; border-top: none; background-color: @impac-widget-background-color; - overflow: none; + overflow: hidden; vertical-align: top; .box-shadow(0px 1px 8px -4px); From abdec56c17ea80f778db5a645b51e560fc219880 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Tue, 18 Apr 2017 11:15:39 +1000 Subject: [PATCH 24/28] Update Changelog.md --- Changelog.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index c6828bee..2caccf28 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,19 +1,21 @@ # Impac! Frontend Changelog -### v1.4.10 | 2017 - Week 15 +### v1.4.10 | 2017 - Week 16 #### Adds - [IMPAC-527] sales segmented minor display improvements: add currency to graph tooltip, & improve price range legend bootstrap col spacing for larger numbers +- [IMPAC-529] Sales Comparison to use common-currency-conversions +- [IMPAC-530] Aged Sales to use common-currency-conversions - [IMPAC-534] Aged Payables and Receivables to use common-currency-conversions directive - [IMPAC-535] common-currency-conversions (directive to display more information on currency conversions) - Add loader for KPIs on delete #### Fixes -- [IMPAC-537] Fix widget content css issues: .widget-lines bootstrap cols & widget content overflow - [IMPAC-262] Fix new vs existing customer widget incorrect tooltip values - [IMPAC-397] Enforce at least 1 opportunities funnel widget option selection - [IMPAC-498] Improve widget drill-down selection saved ids - [IMPAC-536] fix param selector css bleed +- [IMPAC-537] Fix widget content css issues: .widget-lines bootstrap cols & widget content overflow ------------------------------------------------------------- From 2c9033e850ab1a8ca40caebe7e9cb7bf50e10ac3 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Wed, 19 Apr 2017 15:57:51 +1000 Subject: [PATCH 25/28] fix top-buttons --- src/components/widget/widget.less | 4 ---- .../editable-title/editable-title.less | 13 +++++------- .../editable-title/editable-title.tmpl.html | 20 +++++++++---------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/components/widget/widget.less b/src/components/widget/widget.less index 69b16d6c..5ac8f8e1 100644 --- a/src/components/widget/widget.less +++ b/src/components/widget/widget.less @@ -22,10 +22,6 @@ flex-direction: row; z-index: 4; - - .editable-title { - flex: 1; - } } .widget-item { diff --git a/src/components/widgets-common/editable-title/editable-title.less b/src/components/widgets-common/editable-title/editable-title.less index 4fa41c40..4ec8f1a8 100644 --- a/src/components/widgets-common/editable-title/editable-title.less +++ b/src/components/widgets-common/editable-title/editable-title.less @@ -1,10 +1,8 @@ -.analytics .widget-item .common-editable-title { - .editable-title { - width: 100%; - flex: 1; - overflow: hidden; - height: 22px; - } +.analytics .widget-item .editable-title { + width: 100%; + flex: 1; + overflow: hidden; + height: 22px; .title { text-transform: @impac-widget-title-text-transform; @@ -45,5 +43,4 @@ } } } - // } } diff --git a/src/components/widgets-common/editable-title/editable-title.tmpl.html b/src/components/widgets-common/editable-title/editable-title.tmpl.html index cc90fc23..84ec90ed 100644 --- a/src/components/widgets-common/editable-title/editable-title.tmpl.html +++ b/src/components/widgets-common/editable-title/editable-title.tmpl.html @@ -1,14 +1,12 @@ -
- + - + - -
- {{ parentWidget.name }} -
+ +
+ {{ parentWidget.name }}
From eb72cc681b53f505f9a7e1917d5c0941ff301c23 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Wed, 19 Apr 2017 16:10:00 +1000 Subject: [PATCH 26/28] [IMPAC-537] fix balance sheet content out --- src/components/widget/widget.less | 1 - .../widgets/accounts-balance-sheet/accounts-balance-sheet.less | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/widget/widget.less b/src/components/widget/widget.less index 5ac8f8e1..66be32a6 100644 --- a/src/components/widget/widget.less +++ b/src/components/widget/widget.less @@ -32,7 +32,6 @@ border: @impac-widget-border; border-top: none; background-color: @impac-widget-background-color; - overflow: hidden; vertical-align: top; .box-shadow(0px 1px 8px -4px); diff --git a/src/components/widgets/accounts-balance-sheet/accounts-balance-sheet.less b/src/components/widgets/accounts-balance-sheet/accounts-balance-sheet.less index c6cbdc10..1efd4f44 100644 --- a/src/components/widgets/accounts-balance-sheet/accounts-balance-sheet.less +++ b/src/components/widgets/accounts-balance-sheet/accounts-balance-sheet.less @@ -2,7 +2,7 @@ .tall-widget(); .widget-lines-container { .scrollable(scroll); - max-height: 515px; + max-height: 490px; @media (max-width: @screen-xs-max) { .row.widget-line { &:not(:last-child) { border-bottom: dashed 1px @impac-widget-borders-color; } From 8c0561d9a76afeab609d33271c4e93cddf385699 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Wed, 19 Apr 2017 16:15:56 +1000 Subject: [PATCH 27/28] [IMPAC-550] fix customer selection (customer details) --- .../sales-customer-details.directive.coffee | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/widgets/sales-customer-details/sales-customer-details.directive.coffee b/src/components/widgets/sales-customer-details/sales-customer-details.directive.coffee index a04e2336..ecde8236 100644 --- a/src/components/widgets/sales-customer-details/sales-customer-details.directive.coffee +++ b/src/components/widgets/sales-customer-details/sales-customer-details.directive.coffee @@ -41,12 +41,13 @@ module.controller('WidgetSalesCustomerDetailsCtrl', ($scope, $q) -> setSelectedCustomer = -> return false unless $scope.isDataFound - unless w.metadata && w.metadata.customer_uid - return $scope.selectedCustomer = angular.copy(w.content.customers[0]) - customer = _.find(w.content.customers, (c) -> - c.uid == w.metadata.customer_uid - ) || w.content.customers[0] + if w.metadata && w.metadata.customer_uid + customer = _.find(w.content.customers, (c) -> + c.uid == w.metadata.customer_uid + ) + + customer ||= w.content.customers[0] $scope.selectedCustomer = angular.copy(customer) setSelectedCustomerId() From df76e345f137da6af4232b57c3034af8de131f08 Mon Sep 17 00:00:00 2001 From: Cesar Tonnoir Date: Wed, 19 Apr 2017 16:23:08 +1000 Subject: [PATCH 28/28] [IMPAC-551] fix sales by price range css glitches --- .../sales-segmented-turnover.less | 11 ++++++++++- .../sales-segmented-turnover.tmpl.html | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.less b/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.less index 6045d311..8fa3a6a7 100644 --- a/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.less +++ b/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.less @@ -15,4 +15,13 @@ font-size: 11px; } } -} \ No newline at end of file + + .right-panel { + h3 { + margin: 15px 10px 5px 10px; + text-align: center; + } + + .fa.fa-info-circle { float: left; } + } +} diff --git a/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.tmpl.html b/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.tmpl.html index f3e3ec3e..e122ab48 100644 --- a/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.tmpl.html +++ b/src/components/widgets/sales-segmented-turnover/sales-segmented-turnover.tmpl.html @@ -45,8 +45,8 @@

Widget settings

- -

{{getMaxRange().percentage.toFixed()}}% of your revenue comes from products sold at an average price between {{getMaxRange().label.split('-')[0] | mnoCurrency : widget.content.currency}} and {{getMaxRange().label.split('-')[1] | mnoCurrency : widget.content.currency}}.

+ +

{{getMaxRange().percentage.toFixed()}}% of your revenue comes from products sold at an average price between {{getMaxRange().label.split('-')[0] | mnoCurrency : widget.content.currency}} and {{getMaxRange().label.split('-')[1] | mnoCurrency : widget.content.currency}}.

{{getAnalysis()}}