diff --git a/modules/route/back/methods/route/getTickets.js b/modules/route/back/methods/route/getTickets.js index 9a2f5289a..18e5abaf2 100644 --- a/modules/route/back/methods/route/getTickets.js +++ b/modules/route/back/methods/route/getTickets.js @@ -49,7 +49,8 @@ module.exports = Self => { a.city, am.name AS agencyModeName, u.nickname AS userNickname, - vn.ticketTotalVolume(t.id) AS volume + vn.ticketTotalVolume(t.id) AS volume, + tob.description FROM route r JOIN ticket t ON t.routeFk = r.id LEFT JOIN ticketState ts ON ts.ticketFk = t.id diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index 12928ef01..1789093a7 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -25,6 +25,12 @@ vn-tooltip="Open buscaman" icon="icon-buscaman"> + + @@ -36,6 +42,7 @@ model="model"> + Order Street City @@ -46,6 +53,7 @@ Ticket + @@ -62,6 +70,14 @@ vn-click-stop> + + + + + + + + diff --git a/modules/route/front/tickets/index.js b/modules/route/front/tickets/index.js index 38360794a..f32f02341 100644 --- a/modules/route/front/tickets/index.js +++ b/modules/route/front/tickets/index.js @@ -24,6 +24,16 @@ class Controller extends Section { return highestPriority + 1; } + setHighestPriority(id) { + const highestPriority = this.getHighestPriority(); + const params = {priority: highestPriority}; + const query = `Tickets/${id}/`; + this.$http.patch(query, params).then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + this.$.model.refresh(); + }); + } + setPriority(id, priority) { let params = {priority: priority}; let query = `Tickets/${id}/`; @@ -33,6 +43,17 @@ class Controller extends Section { }); } + deletePriority() { + const lines = this.getSelectedItems(this.tickets); + + for (const line of lines) { + this.$http.patch(`Tickets/${line.id}/`, {priority: null}).then(() => { + this.vnApp.showSuccess(this.$t('Data saved!')); + this.$.model.refresh(); + }); + } + } + getSelectedItems(items) { const selectedItems = []; @@ -61,10 +82,10 @@ class Controller extends Section { let lines = this.getSelectedItems(this.tickets); let url = 'http://gps.buscalia.com/usuario/localizar.aspx?bmi=true&addr='; - lines.forEach(line => { - // if lineOld.street <> line.street - addresses = addresses + '+to:' + line.postalCode + ' ' + line.city + ' ' + line.street; - // lineOld = line + lines.forEach((line, index) => { + const previusLine = lines[index - 1] ? lines[index - 1].street : null; + if (previusLine != line.street) + addresses = addresses + '+to:' + line.postalCode + ' ' + line.city + ' ' + line.street; }); window.open(url + addresses, '_blank'); diff --git a/modules/route/front/tickets/locale/es.yml b/modules/route/front/tickets/locale/es.yml index 6d63b4b6e..caccbfdc5 100644 --- a/modules/route/front/tickets/locale/es.yml +++ b/modules/route/front/tickets/locale/es.yml @@ -13,3 +13,4 @@ The route's vehicle doesn't have a delivery point: El vehículo de la ruta no ti The route doesn't have a vehicle: La ruta no tiene un vehículo Population: Población Unlink selected zone?: Desvincular zona seleccionada? +Delete priority: Borrar orden