Merge pull request 'fix: refactor createTicket function to use formData directly and remove unused reactive state' (!1737) from hotFix_ticketExpedition into master
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
Reviewed-on: #1737 Reviewed-by: Jon Elias <jon@verdnatura.es>
This commit is contained in:
commit
f72543f533
|
@ -1,5 +1,4 @@
|
|||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
|
@ -30,31 +29,29 @@ const { t } = useI18n();
|
|||
const router = useRouter();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const newTicketFormData = reactive({});
|
||||
const date = new Date();
|
||||
|
||||
const createTicket = async () => {
|
||||
async function createTicket(formData) {
|
||||
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
|
||||
const params = {
|
||||
clientId: $props.ticket.clientFk,
|
||||
landed: newTicketFormData.landed,
|
||||
landed: formData.landed,
|
||||
warehouseId: $props.ticket.warehouseFk,
|
||||
addressId: $props.ticket.addressFk,
|
||||
agencyModeId: $props.ticket.agencyModeFk,
|
||||
routeId: newTicketFormData.routeFk,
|
||||
routeId: formData.routeFk,
|
||||
expeditionIds: expeditionIds,
|
||||
};
|
||||
|
||||
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModelPopup
|
||||
model="expeditionNewTicket"
|
||||
:form-initial-data="newTicketFormData"
|
||||
:form-initial-data="{}"
|
||||
:save-fn="createTicket"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
|
|
Loading…
Reference in New Issue