3888-ticket.expedition_moveExpedition #1097
|
@ -42,17 +42,25 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
createTicket(routeFk) {
|
||||
const tomorrow = new Date();
|
||||
const params = {
|
||||
const date = new Date(); // esta fecha hay que preguntarla a Fran Monsalvez
|
||||
const ticketParams = {
|
||||
clientId: this.ticket.clientFk,
|
||||
landed: tomorrow.getDay() + 1,
|
||||
landed: date,
|
||||
addressId: this.ticket.addressFk,
|
||||
agencyModeId: this.ticket.agencyModeFk,
|
||||
warehouseId: this.ticket.warehouseFk
|
||||
};
|
||||
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});
|
||||
|
||||
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.$state.go('ticket.card.summary', {id: res.data.id});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue