From 9402f368f64acdb711b7904770257a24f9cf5bde Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 30 Jul 2020 12:51:19 +0200 Subject: [PATCH] ticket index and zone descriptor refactor --- db/dump/fixtures.sql | 2 +- modules/ticket/back/methods/ticket/filter.js | 16 +++++++------ modules/ticket/front/card/index.js | 18 +++++++++----- modules/ticket/front/index/index.html | 24 ++++++++++++++----- modules/ticket/front/routes.json | 2 +- .../zone/front/descriptor-popover/index.html | 4 ++++ .../zone/front/descriptor-popover/index.js | 9 +++++++ modules/zone/front/descriptor/index.html | 4 ---- modules/zone/front/descriptor/index.js | 16 +++++++++++++ modules/zone/front/index.js | 1 + 10 files changed, 71 insertions(+), 25 deletions(-) create mode 100644 modules/zone/front/descriptor-popover/index.html create mode 100644 modules/zone/front/descriptor-popover/index.js diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index a1018ab5a..9aaae957b 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -556,7 +556,7 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF (12, 1, 1, 1, 1, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 1, CURDATE()), (13, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, 3, CURDATE()), (14, 1, 2, 1, NULL, CURDATE(), CURDATE(), 104, 'Malibu Point', 4, NULL, 0, 9, CURDATE()), - (15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, 3, CURDATE()), + (15, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'An incredibly long alias for testing purposes', 125, NULL, 0, 3, CURDATE()), (16, 1, 7, 1, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()), (17, 1, 7, 2, 6, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, 3, CURDATE()), (18, 1, 4, 4, 4, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, 12, CURDATE()), diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 28de7b8ee..801563b93 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -203,14 +203,16 @@ module.exports = Self => { am.id AS agencyModeFk, st.name AS state, wk.lastName AS salesPerson, - ts.stateFk as stateFk, - ts.alertLevel as alertLevel, - ts.code as alertLevelCode, - u.nickname userNickname, + ts.stateFk AS stateFk, + ts.alertLevel AS alertLevel, + ts.code AS alertLevelCode, + u.name AS userName, c.salesPersonFk, - z.hour zoneLanding, - HOUR(z.hour) zoneHour, - MINUTE(z.hour) zoneMinute, + z.hour AS zoneLanding, + HOUR(z.hour) AS zoneHour, + MINUTE(z.hour) AS zoneMinute, + z.name AS zoneName, + z.id AS zoneFk, CAST(z.hour AS CHAR) AS hour FROM ticket t LEFT JOIN zone z ON z.id = t.zoneFk diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index 843bc9f4a..5b3c3c405 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -5,19 +5,25 @@ class Controller extends ModuleCard { reload() { let filter = { include: [ - {relation: 'address'}, - {relation: 'ship'}, - {relation: 'stowaway'}, + { + relation: 'address'}, + { + relation: 'ship'}, + { + relation: 'stowaway'}, { relation: 'warehouse', scope: {fields: ['name']} - }, { + }, + { relation: 'invoiceOut', scope: {fields: ['id']} - }, { + }, + { relation: 'agencyMode', scope: {fields: ['name']} - }, { + }, + { relation: 'client', scope: { fields: [ diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 6f3079a29..b0aff5b91 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -21,7 +21,7 @@ Alias Province State - Agency + Zone Warehouse Invoice Closure @@ -66,21 +66,23 @@ {{::ticket.id}} - + - {{::ticket.userNickname | dashIfEmpty}} + {{::ticket.userName | dashIfEmpty}} - + {{::ticket.shipped | date: 'dd/MM/yyyy'}} {{::ticket.shipped | date: 'HH:mm'}} - + {{::ticket.nickname}} @@ -92,7 +94,14 @@ {{ticket.state}} - {{::ticket.agencyMode}} + + + {{::ticket.zoneName | dashIfEmpty}} + + {{::ticket.warehouse}} {{::ticket.refFk | dashIfEmpty}} {{::ticket.zoneLanding | date: 'HH:mm'}} @@ -155,6 +164,9 @@ + + diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index ac398c49e..cb1701008 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -3,7 +3,7 @@ "name": "Tickets", "icon": "icon-ticket", "validations": true, - "dependencies": ["worker", "item", "client", "route", "invoiceOut"], + "dependencies": ["worker", "item", "client", "route", "invoiceOut", "zone"], "menus": { "main": [ {"state": "ticket.index", "icon": "icon-ticket"}, diff --git a/modules/zone/front/descriptor-popover/index.html b/modules/zone/front/descriptor-popover/index.html new file mode 100644 index 000000000..7e4e8f5d8 --- /dev/null +++ b/modules/zone/front/descriptor-popover/index.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/modules/zone/front/descriptor-popover/index.js b/modules/zone/front/descriptor-popover/index.js new file mode 100644 index 000000000..a21232e41 --- /dev/null +++ b/modules/zone/front/descriptor-popover/index.js @@ -0,0 +1,9 @@ +import ngModule from '../module'; +import DescriptorPopover from 'salix/components/descriptor-popover'; + +class Controller extends DescriptorPopover {} + +ngModule.vnComponent('vnZoneDescriptorPopover', { + slotTemplate: require('./index.html'), + controller: Controller +}); diff --git a/modules/zone/front/descriptor/index.html b/modules/zone/front/descriptor/index.html index d4d3eca7b..355028c98 100644 --- a/modules/zone/front/descriptor/index.html +++ b/modules/zone/front/descriptor/index.html @@ -16,10 +16,6 @@
- - diff --git a/modules/zone/front/descriptor/index.js b/modules/zone/front/descriptor/index.js index 5e365e0ac..08ada0606 100644 --- a/modules/zone/front/descriptor/index.js +++ b/modules/zone/front/descriptor/index.js @@ -10,6 +10,22 @@ class Controller extends Descriptor { this.entity = value; } + loadData() { + const filter = { + include: [ + { + relation: 'agencyMode', + scope: { + fields: ['name'], + } + } + ] + }; + + return this.getData(`Zones/${this.id}`, {filter}) + .then(res => this.entity = res.data); + } + onDelete() { const $t = this.$translate.instant; const today = new Date(); diff --git a/modules/zone/front/index.js b/modules/zone/front/index.js index 76a6fdd9b..26c491709 100644 --- a/modules/zone/front/index.js +++ b/modules/zone/front/index.js @@ -6,6 +6,7 @@ import './delivery-days'; import './summary'; import './card'; import './descriptor'; +import './descriptor-popover'; import './search-panel'; import './create'; import './basic-data'; -- 2.40.1