feat: first option to delete and update
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-10-06 11:40:46 +02:00
parent a3a432c753
commit 37601934f5
1 changed files with 12 additions and 4 deletions

View File

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