feat: group by address in buscaman, delete priority by checked, show notes of tickets
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-06-14 12:36:08 +02:00
parent 189e8dbab3
commit 52e78db9ee
4 changed files with 53 additions and 5 deletions

View File

@ -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

View File

@ -25,6 +25,12 @@
vn-tooltip="Open buscaman"
icon="icon-buscaman">
</vn-button>
<vn-button
disabled="!$ctrl.isChecked"
ng-click="$ctrl.deletePriority()()"
vn-tooltip="Delete priority"
icon="contact_support">
</vn-button>
</vn-tool-bar>
</vn-card>
<vn-card class="vn-mt-lg">
@ -36,6 +42,7 @@
model="model">
</vn-multi-check>
</vn-th>
<vn-th shrink></vn-th>
<vn-th field="priority">Order</vn-th>
<vn-th field="street" expand>Street</vn-th>
<vn-th field="city">City</vn-th>
@ -46,6 +53,7 @@
<vn-th field="id" number>Ticket</vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
<vn-th shrink></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
@ -62,6 +70,14 @@
vn-click-stop>
</vn-check>
</vn-td>
<vn-td>
<vn-icon-button
icon="add_circle"
ng-click="$ctrl.setHighestPriority(ticket.id)"
tabindex="-1"
vn-click-stop>
</vn-icon-button>
</vn-td>
<vn-td>
<vn-input-number
on-change="$ctrl.setPriority(ticket.id, ticket.priority)"
@ -110,6 +126,15 @@
vn-click-stop>
</vn-icon-button>
</vn-td>
<vn-td>
<vn-icon-button
ng-if="::ticket.description"
vn-tooltip="{{::ticket.description}}"
icon="icon-notes"
tabindex="-1"
vn-click-stop>
</vn-icon-button>
</vn-td>
</a>
</vn-tbody>
</vn-table>

View File

@ -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');

View File

@ -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