From 2469409068b923be0218249b594930463f6c8c2e Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 15 Jun 2021 13:48:42 +0200 Subject: [PATCH 1/3] 2941 - Monitor changes --- front/core/components/contextmenu/index.js | 6 +- modules/client/front/web-payment/index.html | 2 +- .../monitor/front/index/clients/index.html | 13 ++- modules/monitor/front/index/clients/index.js | 5 +- modules/monitor/front/index/index.html | 14 +--- modules/monitor/front/index/index.js | 18 ++++- modules/monitor/front/index/locale/es.yml | 3 +- modules/monitor/front/index/orders/index.html | 68 +++++++++++----- modules/monitor/front/index/orders/index.js | 44 ++++++++++- modules/monitor/front/index/orders/style.scss | 3 +- .../front/index/search-panel/index.html | 41 +++------- modules/monitor/front/index/style.scss | 79 +++++++++++++------ .../monitor/front/index/tickets/index.html | 4 + 13 files changed, 200 insertions(+), 100 deletions(-) diff --git a/front/core/components/contextmenu/index.js b/front/core/components/contextmenu/index.js index aa2d1a16bb..646df1a0a8 100755 --- a/front/core/components/contextmenu/index.js +++ b/front/core/components/contextmenu/index.js @@ -43,14 +43,14 @@ export default class Contextmenu { get row() { if (!this.target) return null; - return this.target.closest('vn-tr, .vn-tr'); + return this.target.closest('[ng-repeat]'); } get rowIndex() { if (!this.row) return null; + const table = this.row.closest('vn-table, .vn-table'); - const tBody = table.querySelector('vn-tbody, .vn-tbody'); - const rows = tBody.querySelectorAll('vn-tr, .vn-tr'); + const rows = table.querySelectorAll('[ng-repeat]'); return Array.from(rows).findIndex( rowItem => rowItem == this.row diff --git a/modules/client/front/web-payment/index.html b/modules/client/front/web-payment/index.html index 7caa448816..5e09036223 100644 --- a/modules/client/front/web-payment/index.html +++ b/modules/client/front/web-payment/index.html @@ -25,7 +25,7 @@ diff --git a/modules/monitor/front/index/clients/index.html b/modules/monitor/front/index/clients/index.html index f0c1b8f933..9786404fd0 100644 --- a/modules/monitor/front/index/clients/index.html +++ b/modules/monitor/front/index/clients/index.html @@ -10,6 +10,11 @@ Clients on website + + - + @@ -52,12 +57,6 @@ -
- No results -
- - - - - - - - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/modules/monitor/front/index/index.js b/modules/monitor/front/index/index.js index 4807cf1c98..fabe1f82ac 100644 --- a/modules/monitor/front/index/index.js +++ b/modules/monitor/front/index/index.js @@ -2,7 +2,23 @@ import ngModule from '../module'; import Section from 'salix/components/section'; import './style.scss'; +export default class Controller extends Section { + toggle() { + const monitor = this.element.querySelector('vn-horizontal'); + const isHidden = monitor.classList.contains('hidden'); + console.log(monitor); + + if (!isHidden) + monitor.classList.add('hidden'); + else + monitor.classList.remove('hidden'); + } +} + ngModule.vnComponent('vnMonitorIndex', { template: require('./index.html'), - controller: Section + controller: Controller, + require: { + main: '^vnMonitorIndex' + } }); diff --git a/modules/monitor/front/index/locale/es.yml b/modules/monitor/front/index/locale/es.yml index cb94d41a72..41d29064d3 100644 --- a/modules/monitor/front/index/locale/es.yml +++ b/modules/monitor/front/index/locale/es.yml @@ -4,4 +4,5 @@ Recent order actions: Acciones recientes en pedidos Search tickets: Buscar tickets Delete selected elements: Eliminar los elementos seleccionados All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar? -Component lack: Faltan componentes \ No newline at end of file +Component lack: Faltan componentes +Minimize/Maximize: Minimizar/Maximizar \ No newline at end of file diff --git a/modules/monitor/front/index/orders/index.html b/modules/monitor/front/index/orders/index.html index 3dd510dc81..6126e23efa 100644 --- a/modules/monitor/front/index/orders/index.html +++ b/modules/monitor/front/index/orders/index.html @@ -1,4 +1,4 @@ - + + - Date + Date Client - Import + SalesPerson
@@ -47,7 +52,7 @@ - + {{::order.date_send | date: 'dd/MM/yyyy'}} @@ -59,11 +64,18 @@ {{::order.clientName}} - {{::order.import | currency: 'EUR':2}} + + + {{::order.salesPerson | dashIfEmpty}} + + - + {{::order.date_make | date: 'dd/MM/yyyy HH:mm'}} @@ -74,22 +86,11 @@ - - {{::order.salesPerson | dashIfEmpty}} - + {{::order.import | currency: 'EUR':2}} -
- No results -
+ + + + Filter by selection + + + Exclude selection + + + Remove filter + + + Remove all filters + + + Copy value + + + this.$.model.refresh()); } + + chipColor(date) { + const today = new Date(); + today.setHours(0, 0, 0, 0); + + const orderLanded = new Date(date); + orderLanded.setHours(0, 0, 0, 0); + + const difference = today - orderLanded; + + if (difference == 0) + return 'warning'; + if (difference < 0) + return 'success'; + if (difference > 0) + return 'alert'; + } + + exprBuilder(param, value) { + switch (param) { + case 'date_send': + return {[`o.date_send`]: { + between: this.dateRange(value)} + }; + case 'clientFk': + return {[`c.id`]: value}; + case 'salesPersonFk': + return {[`c.${param}`]: value}; + } + } + + dateRange(value) { + const minHour = new Date(value); + minHour.setHours(0, 0, 0, 0); + const maxHour = new Date(value); + maxHour.setHours(23, 59, 59, 59); + + return [minHour, maxHour]; + } } ngModule.vnComponent('vnMonitorSalesOrders', { template: require('./index.html'), - controller: Controller + controller: Controller, + require: { + main: '^vnMonitorIndex' + } }); diff --git a/modules/monitor/front/index/orders/style.scss b/modules/monitor/front/index/orders/style.scss index 8a1c860329..102712eaf9 100644 --- a/modules/monitor/front/index/orders/style.scss +++ b/modules/monitor/front/index/orders/style.scss @@ -2,7 +2,8 @@ vn-monitor-sales-orders { vn-table.scrollable { - max-height: 350px + max-height: 350px; + overflow-x: hidden } vn-table a.vn-tbody { diff --git a/modules/monitor/front/index/search-panel/index.html b/modules/monitor/front/index/search-panel/index.html index d0b77b9dea..dc24c778bf 100644 --- a/modules/monitor/front/index/search-panel/index.html +++ b/modules/monitor/front/index/search-panel/index.html @@ -21,36 +21,17 @@ ng-model="filter.orderFk"> -
- - - - - - Or - - - - - -
+ + + + vn-none > vn-icon { @extend %clickable-light; color: $color-button; font-size: 1.4rem; } - } - .empty-rows { - color: $color-font-secondary; - text-align: center; + + vn-none > .arrow { + transition: transform 200ms; + } } - vn-vertical { - position: fixed; - width: 400px + vn-monitor-sales-clients { + vn-card { + margin-right: 15px; + } + + .header { + padding-right: 15px; + + & > vn-none > .arrow { + display: none + } + } + } + + vn-table.scrollable { + height: 300px } vn-horizontal { flex-wrap: wrap } + + .hidden { + vn-card { + display: none + } + + .header > vn-none > .arrow { + transform: rotate(180deg); + } + } } -@media (max-width:1500px) { +@media (max-width:1150px) { vn-monitor-index { & > vn-horizontal { - flex-direction: column-reverse; + flex-direction: column; + + vn-monitor-sales-clients, + vn-monitor-sales-orders { + width: 100% + } + + vn-monitor-sales-clients { + margin-bottom: 15px + } } - & > vn-horizontal > vn-one { - flex: none; - width: 100%; + vn-monitor-sales-clients { + vn-card { + margin-right: 0 + } - & > vn-vertical { - position: initial; - flex-direction: row; - width: 100%; - - vn-monitor-sales-clients { - margin-right: 15px - } - - vn-table.scrollable { - height: 300px + .header { + padding-right: 0; + + & > vn-none > .arrow { + display: inline-block } } } - } + } } \ No newline at end of file diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index cb7b4f2352..2d4add27a0 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -42,6 +42,7 @@ Province State Zone + Debt Total @@ -134,6 +135,9 @@ {{::ticket.zoneName | dashIfEmpty}} + + {{::ticket.debt | currency: 'EUR': 2}} + {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} -- 2.40.1 From efc9edb3848d4b33d223260d4296b9025a4362ae Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 16 Jun 2021 10:13:06 +0200 Subject: [PATCH 2/3] Fixes --- modules/monitor/front/index/index.js | 1 - modules/monitor/front/index/tickets/index.html | 4 ---- 2 files changed, 5 deletions(-) diff --git a/modules/monitor/front/index/index.js b/modules/monitor/front/index/index.js index fabe1f82ac..2e1b3b1a1d 100644 --- a/modules/monitor/front/index/index.js +++ b/modules/monitor/front/index/index.js @@ -6,7 +6,6 @@ export default class Controller extends Section { toggle() { const monitor = this.element.querySelector('vn-horizontal'); const isHidden = monitor.classList.contains('hidden'); - console.log(monitor); if (!isHidden) monitor.classList.add('hidden'); diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index 2d4add27a0..cb7b4f2352 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -42,7 +42,6 @@ Province State Zone - Debt Total @@ -135,9 +134,6 @@ {{::ticket.zoneName | dashIfEmpty}} - - {{::ticket.debt | currency: 'EUR': 2}} - {{::(ticket.totalWithVat ? ticket.totalWithVat : 0) | currency: 'EUR': 2}} -- 2.40.1 From 3e938fa9fb348c242102559f217e53102e875a85 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 16 Jun 2021 11:15:17 +0200 Subject: [PATCH 3/3] Updated unit tests --- modules/monitor/front/index/tickets/index.spec.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/monitor/front/index/tickets/index.spec.js b/modules/monitor/front/index/tickets/index.spec.js index fc689140a6..8d06b8d7d1 100644 --- a/modules/monitor/front/index/tickets/index.spec.js +++ b/modules/monitor/front/index/tickets/index.spec.js @@ -115,6 +115,14 @@ describe('Component vnMonitorSalesTickets', () => { }); }); + describe('totalPriceColor()', () => { + it('should return "warning" when the ticket amount is less than 50€', () => { + const result = controller.totalPriceColor({totalWithVat: '8.50'}); + + expect(result).toEqual('warning'); + }); + }); + describe('preview()', () => { it('should show the dialog summary', () => { controller.$.summary = {show: () => {}}; -- 2.40.1