3888-ticket.expedition_moveExpedition #1097
|
@ -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});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue