From 3ae520d2470ed481108bb5116333769cfe6347a3 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 21 Jun 2021 09:10:47 +0000 Subject: [PATCH 1/2] 2847 - Driver route now shows item packaging type --- loopback/server/datasources.json | 39 +-- modules/client/front/summary/index.js | 2 + .../reports/driver-route/driver-route.html | 293 +++++++++--------- .../reports/driver-route/driver-route.js | 2 +- .../reports/driver-route/locale/es.yml | 1 + .../reports/driver-route/sql/tickets.sql | 19 +- 6 files changed, 184 insertions(+), 172 deletions(-) diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 87fff60e1..0df03882c 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -18,20 +18,15 @@ "acquireTimeout": 20000 }, "osticket": { - "connector": "vn-mysql", - "database": "vn", - "debug": false, - "host": "localhost", - "port": "3306", - "username": "root", - "password": "root" + "connector": "memory", + "timezone": "local" }, "tempStorage": { "name": "tempStorage", "connector": "loopback-component-storage", - "provider": "filesystem", + "provider": "filesystem", "root": "./storage/tmp", - "maxFileSize": "262144000", + "maxFileSize": "262144000", "allowedContentTypes": [ "application/x-7z-compressed", "application/x-zip-compressed", @@ -41,17 +36,17 @@ "application/zip", "application/rar", "multipart/x-zip", - "image/png", - "image/jpeg", + "image/png", + "image/jpeg", "image/jpg" ] }, "dmsStorage": { "name": "dmsStorage", "connector": "loopback-component-storage", - "provider": "filesystem", + "provider": "filesystem", "root": "./storage/dms", - "maxFileSize": "262144000", + "maxFileSize": "262144000", "allowedContentTypes": [ "application/x-7z-compressed", "application/x-zip-compressed", @@ -61,32 +56,32 @@ "application/zip", "application/rar", "multipart/x-zip", - "image/png", - "image/jpeg", + "image/png", + "image/jpeg", "image/jpg" ] }, "imageStorage": { "name": "imageStorage", "connector": "loopback-component-storage", - "provider": "filesystem", + "provider": "filesystem", "root": "./storage/image", - "maxFileSize": "52428800", + "maxFileSize": "52428800", "allowedContentTypes": [ - "image/png", - "image/jpeg", + "image/png", + "image/jpeg", "image/jpg" ] }, "invoiceStorage": { "name": "invoiceStorage", "connector": "loopback-component-storage", - "provider": "filesystem", + "provider": "filesystem", "root": "./storage/pdfs/invoice", - "maxFileSize": "52428800", + "maxFileSize": "52428800", "allowedContentTypes": [ "application/octet-stream", "application/pdf" ] } -} +} \ No newline at end of file diff --git a/modules/client/front/summary/index.js b/modules/client/front/summary/index.js index 113fd2ab2..8144e9266 100644 --- a/modules/client/front/summary/index.js +++ b/modules/client/front/summary/index.js @@ -59,6 +59,8 @@ class Controller extends Summary { stateColor(ticket) { const ticketState = ticket.ticketState; + if (!ticketState) return; + if (ticketState.code === 'OK') return 'success'; else if (ticketState.code === 'FREE') diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index bad1bf179..1168d18e8 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -1,163 +1,166 @@ - - - - - + + +
- - - -
-
-

{{$t('route')}} {{route.id}}

-
-
{{$t('information')}}
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('route')}}{{route.id}}{{$t('driver')}}{{route.userNickName}}
{{$t('date')}}{{route.created | date('%d-%m-%Y')}}{{$t('vehicle')}}{{route.vehicleTradeMark}} {{route.vehicleModel}}
{{$t('time')}}{{route.time | date('%H:%M')}}{{route.plateNumber}}
{{$t('volume')}}{{route.m3}}{{$t('agency')}}{{route.agencyName}}
-
- - - - - - - - - - - - - - - -
-

Hora inicio

-
-

Hora fin

-
-

Km inicio

-
-

Km fin

-
-
- -
-
-
- -
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - -
{{$t('order')}}{{$t('ticket')}}{{$t('client')}}{{$t('address')}}{{$t('packages')}}
{{ticket.priority}}{{ticket.id}}{{ticket.clientFk}} {{ticket.addressName}} - {{ticket.addressFk.toString().substr(0, ticket.addressFk.toString().length - 3)}} - - {{ticket.addressFk.toString().substr(-3, 3)}} - - {{ticket.packages}}
-
+ + + + + + - - -
+ + + +
+
+

{{$t('route')}} {{route.id}}

+
+
{{$t('information')}}
+
- - - - + + + + - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - +
{{$t('street')}}{{ticket.street}}{{$t('postcode')}}{{ticket.postalCode}}{{$t('route')}}{{route.id}}{{$t('driver')}}{{route.userNickName}}
{{$t('city')}}{{ticket.city}}{{$t('date')}}{{route.created | date('%d-%m-%Y')}}{{$t('vehicle')}}{{route.vehicleTradeMark}} {{route.vehicleModel}}
{{$t('time')}}{{route.time | date('%H:%M')}}{{route.plateNumber}}
{{$t('volume')}}{{route.m3}} {{$t('agency')}}{{ticket.ticketAgency}}
{{$t('mobile')}}{{ticket.mobile}}{{$t('phone')}}{{ticket.phone}}
{{$t('warehouse')}}{{ticket.warehouseName}}{{$t('salesPerson')}}{{ticket.salesPersonName}}
{{$t('import')}}{{ticket.import | currency('EUR', $i18n.locale)}}{{route.agencyName}}
-
-

{{ticket.description}}

-

{{$t('stowaway')}}: {{ticket.shipFk}}

+
+ + + + + + + + + + + + + + + +
+

Hora inicio

+
+

Hora fin

+
+

Km inicio

+
+

Km fin

+
+
+ +
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
{{$t('order')}}{{$t('ticket')}}{{$t('client')}}{{$t('address')}}{{$t('packages')}}{{$t('packagingType')}}
{{ticket.priority}}{{ticket.id}}{{ticket.clientFk}} {{ticket.addressName}} + {{ticket.addressFk.toString().substr(0, + ticket.addressFk.toString().length - 3)}} + + {{ticket.addressFk.toString().substr(-3, 3)}} + + {{ticket.packages}}{{ticket.itemPackingTypes}}
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('street')}}{{ticket.street}}{{$t('postcode')}}{{ticket.postalCode}}
{{$t('city')}}{{ticket.city}}{{$t('agency')}}{{ticket.ticketAgency}}
{{$t('mobile')}}{{ticket.mobile}}{{$t('phone')}}{{ticket.phone}}
{{$t('warehouse')}}{{ticket.warehouseName}}{{$t('salesPerson')}}{{ticket.salesPersonName}}
{{$t('import')}}{{ticket.import | currency('EUR', $i18n.locale)}}
+
+

{{ticket.description}}

+

{{$t('stowaway')}}: {{ticket.shipFk}}

+
+
+
- - - -
- +
+ + + +
+ + \ No newline at end of file diff --git a/print/templates/reports/driver-route/driver-route.js b/print/templates/reports/driver-route/driver-route.js index 39b5d44e9..0b2638239 100755 --- a/print/templates/reports/driver-route/driver-route.js +++ b/print/templates/reports/driver-route/driver-route.js @@ -30,7 +30,7 @@ module.exports = { return this.rawSqlFromDef('routes', [routesId]); }, fetchTickets(routesId) { - return this.rawSqlFromDef('tickets', [routesId]); + return this.rawSqlFromDef('tickets', [routesId, routesId]); } }, components: { diff --git a/print/templates/reports/driver-route/locale/es.yml b/print/templates/reports/driver-route/locale/es.yml index 7b86f527f..4f0f3ac3c 100644 --- a/print/templates/reports/driver-route/locale/es.yml +++ b/print/templates/reports/driver-route/locale/es.yml @@ -10,6 +10,7 @@ order: Orden client: Cliente address: Consignatario packages: Bultos +packagingType: Encajado street: Dirección postcode: Código Postal city: Ciudad diff --git a/print/templates/reports/driver-route/sql/tickets.sql b/print/templates/reports/driver-route/sql/tickets.sql index 1bdaf31a5..8806a0473 100644 --- a/print/templates/reports/driver-route/sql/tickets.sql +++ b/print/templates/reports/driver-route/sql/tickets.sql @@ -18,8 +18,9 @@ SELECT am.name ticketAgency, tob.description, s.shipFk, - u.nickName salesPersonName -FROM route r + u.nickName salesPersonName, + ipkg.itemPackingTypes +FROM route r LEFT JOIN ticket t ON t.routeFk = r.id LEFT JOIN address a ON a.id = t.addressFk LEFT JOIN client c ON c.id = t.clientFk @@ -30,5 +31,15 @@ FROM route r LEFT JOIN warehouse wh ON wh.id = t.warehouseFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk LEFT JOIN stowaway s ON s.id = t.id -WHERE r.id IN(?) -ORDER BY t.priority, t.id \ No newline at end of file + LEFT JOIN ( + SELECT t.id AS ticketFk, + GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes + FROM route r + JOIN ticket t ON t.routeFk = r.id + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + WHERE r.id IN (?) + GROUP BY t.id + ) ipkg ON ipkg.ticketFk = t.id +WHERE r.id IN (?) +ORDER BY t.priority, t.id; \ No newline at end of file From 2643d79781b064f8ad8be7c9c4f14711218629ae Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 1 Jul 2021 08:41:04 +0200 Subject: [PATCH 2/2] Reformat rollback --- print/templates/reports/driver-route/driver-route.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index 1168d18e8..eed85e1d7 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -1,6 +1,5 @@ - @@ -155,12 +154,13 @@ - +
- \ No newline at end of file