diff --git a/db/changes/10002-lent/00-ticket.sql b/db/changes/10002-lent/00-ticket.sql
new file mode 100644
index 000000000..b98550328
--- /dev/null
+++ b/db/changes/10002-lent/00-ticket.sql
@@ -0,0 +1,11 @@
+DROP TRIGGER IF EXISTS `vn2008`.`TicketsAfterUpdate`;
+
+DELIMITER $$
+USE `vn2008`$$
+CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`TicketsAfterUpdate`
+ AFTER UPDATE ON `Tickets` FOR EACH ROW
+BEGIN
+
+ CALL stock.queueAdd ('ticket', NEW.Id_Ticket, OLD.Id_Ticket);
+END$$
+DELIMITER ;
diff --git a/front/core/components/table/style.scss b/front/core/components/table/style.scss
index 33e2ee06a..0322c6f43 100644
--- a/front/core/components/table/style.scss
+++ b/front/core/components/table/style.scss
@@ -170,7 +170,6 @@ vn-table {
}
}
vn-textfield {
- max-width: 100px;
float: right;
margin: 0!important;
}
diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js
index 2394c3441..cbe7db9f8 100644
--- a/modules/route/back/methods/route/getTickets.js
+++ b/modules/route/back/methods/route/getTickets.js
@@ -25,7 +25,7 @@ module.exports = Self => {
include: [
{relation: 'ticket',
scope: {
- fields: ['id', 'packages', 'warehouseFk', 'nickname', 'clientFk', 'priority'],
+ fields: ['id', 'packages', 'warehouseFk', 'nickname', 'clientFk', 'priority', 'addressFk'],
order: 'priority',
include: [
{
@@ -56,7 +56,7 @@ module.exports = Self => {
{
relation: 'address',
scope: {
- fields: ['id', 'street', 'postcode', 'city'],
+ fields: ['id', 'street', 'postalCode', 'city'],
}
},
diff --git a/modules/route/back/methods/route/guessPriority.js b/modules/route/back/methods/route/guessPriority.js
new file mode 100644
index 000000000..324cf9182
--- /dev/null
+++ b/modules/route/back/methods/route/guessPriority.js
@@ -0,0 +1,28 @@
+module.exports = Self => {
+ Self.remoteMethod('guessPriority', {
+ description: 'Changes automatically the priority of the tickets in a route',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'Guess priority',
+ http: {source: 'path'}
+ }],
+ returns: {
+ type: 'object',
+ root: true
+ },
+ http: {
+ path: `/:id/guessPriority`,
+ verb: 'GET'
+ }
+ });
+
+ Self.guessPriority = async id => {
+ let query = `CALL vn.routeGuessPriority(?)`;
+
+ let options = [id];
+ return await Self.rawSql(query, options);
+ };
+};
diff --git a/modules/route/back/models/route.js b/modules/route/back/models/route.js
index d5febe23e..e3ebabb68 100644
--- a/modules/route/back/models/route.js
+++ b/modules/route/back/models/route.js
@@ -1,4 +1,5 @@
module.exports = Self => {
require('../methods/route/summary')(Self);
require('../methods/route/getTickets')(Self);
+ require('../methods/route/guessPriority')(Self);
};
diff --git a/modules/route/front/index.js b/modules/route/front/index.js
index af8a0b69b..a6530c6b8 100644
--- a/modules/route/front/index.js
+++ b/modules/route/front/index.js
@@ -8,3 +8,4 @@ import './card';
import './create';
import './basic-data';
import './log';
+import './tickets';
diff --git a/modules/route/front/routes.json b/modules/route/front/routes.json
index 9aae910e3..635324267 100644
--- a/modules/route/front/routes.json
+++ b/modules/route/front/routes.json
@@ -6,8 +6,8 @@
"dependencies": ["client", "worker", "ticket"],
"menu": [
{"state": "route.card.basicData", "icon": "settings"},
- {"state": "route.card.log", "icon": "history"}
- ],
+ {"state": "route.card.log", "icon": "history"},
+ {"state": "route.card.tickets", "icon": "icon-ticket"}],
"routes": [
{
"url": "/route",
@@ -16,26 +16,22 @@
"component": "ui-view",
"description": "Routes",
"acl": ["employee"]
- },
- {
+ }, {
"url": "/index?q",
"state": "route.index",
"component": "vn-route-index",
"description": "Routes"
- },
- {
+ }, {
"url": "/create",
"state": "route.create",
"component": "vn-route-create",
"description": "New route"
- },
- {
+ }, {
"url": "/:id",
"state": "route.card",
"abstract": true,
"component": "vn-route-card"
- },
- {
+ }, {
"url": "/summary",
"state": "route.card.summary",
"component": "vn-route-summary",
@@ -43,8 +39,7 @@
"params": {
"route": "$ctrl.route"
}
- },
- {
+ }, {
"url": "/basic-data",
"state": "route.card.basicData",
"component": "vn-route-basic-data",
@@ -53,12 +48,21 @@
"route": "$ctrl.route"
},
"acl": ["delivery"]
- }, {
- "url" : "/log",
- "state": "route.card.log",
- "component": "vn-route-log",
- "description": "Log",
- "acl": ["delivery"]
- }
+ }, {
+ "url" : "/log",
+ "state": "route.card.log",
+ "component": "vn-route-log",
+ "description": "Log",
+ "acl": ["delivery"]
+ }, {
+ "url": "/tickets",
+ "state": "route.card.tickets",
+ "component": "vn-route-tickets",
+ "description": "Tickets",
+ "params": {
+ "route": "$ctrl.route"
+ },
+ "acl": ["delivery"]
+ }
]
}
\ No newline at end of file
diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html
new file mode 100644
index 000000000..df04086e4
--- /dev/null
+++ b/modules/route/front/tickets/index.html
@@ -0,0 +1,114 @@
+