3888-ticket.expedition_moveExpedition #1097

Merged
vicent merged 26 commits from 3888-ticket.expedition_moveExpedition into dev 2022-11-02 13:54:11 +00:00
1 changed files with 12 additions and 4 deletions
Showing only changes of commit 37601934f5 - Show all commits

View File

@ -42,17 +42,25 @@ class Controller extends Section {
} }
createTicket(routeFk) { createTicket(routeFk) {
const tomorrow = new Date(); const date = new Date(); // esta fecha hay que preguntarla a Fran Monsalvez
const params = { const ticketParams = {
clientId: this.ticket.clientFk, clientId: this.ticket.clientFk,
landed: tomorrow.getDay() + 1, landed: date,
addressId: this.ticket.addressFk, addressId: this.ticket.addressFk,
agencyModeId: this.ticket.agencyModeFk, agencyModeId: this.ticket.agencyModeFk,
warehouseId: this.ticket.warehouseFk warehouseId: this.ticket.warehouseFk
}; };
const query = `Tickets/new`; const query = `Tickets/new`;
this.$http.post(query, params).then(res => { this.$http.post(query, ticketParams).then(res => {
if (routeFk) this.$http.patch(`Tickets/${res.data.id}`, {routeFk: routeFk}); if (routeFk) this.$http.patch(`Tickets/${res.data.id}`, {routeFk: routeFk});
const params = [];
for (let expedition of this.checked)
params.push(expedition.id);
const expeditionParams = {ticketFk: res.data.id};
for (let id of params)
this.$http.patch(`Expeditions/${id}`, expeditionParams);
this.vnApp.showSuccess(this.$t('Data saved!')); this.vnApp.showSuccess(this.$t('Data saved!'));
this.$state.go('ticket.card.summary', {id: res.data.id}); this.$state.go('ticket.card.summary', {id: res.data.id});
}); });