From 2ca99a51ae7f6e2b2c8c898a53174af12bda3968 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 1 Oct 2024 15:12:22 +0200 Subject: [PATCH] fix: refs #7356 transfer ticket method --- src/pages/Ticket/Card/TicketDescriptorMenu.vue | 9 +++++---- src/pages/Ticket/Card/TicketSaleMoreActions.vue | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pages/Ticket/Card/TicketDescriptorMenu.vue b/src/pages/Ticket/Card/TicketDescriptorMenu.vue index 12e03551b..73104fe27 100644 --- a/src/pages/Ticket/Card/TicketDescriptorMenu.vue +++ b/src/pages/Ticket/Card/TicketDescriptorMenu.vue @@ -277,13 +277,14 @@ async function createRefund(withWarehouse) { const params = { ticketsIds: [parseInt(ticketId)], withWarehouse: withWarehouse, + negative: true, }; - const { data } = await axios.post(`Tickets/refund`, params); + const { data } = await axios.post(`Tickets/cloneAll`, params); if (data) { - const refundTicket = data; - - push({ name: 'TicketSale', params: { id: refundTicket[0].id } }); + const [refundTicket] = data; + notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive'); + push({ name: 'TicketSale', params: { id: refundTicket.id } }); } } diff --git a/src/pages/Ticket/Card/TicketSaleMoreActions.vue b/src/pages/Ticket/Card/TicketSaleMoreActions.vue index 94db67be2..2ec519d2d 100644 --- a/src/pages/Ticket/Card/TicketSaleMoreActions.vue +++ b/src/pages/Ticket/Card/TicketSaleMoreActions.vue @@ -44,7 +44,7 @@ const props = defineProps({ }, }); -const router = useRouter(); +const { push } = useRouter(); const { t } = useI18n(); const { dialog } = useQuasar(); const { notify } = useNotify(); @@ -142,7 +142,7 @@ const onCreateClaimAccepted = async () => { try { const params = { ticketId: ticket.value.id, sales: props.sales }; const { data } = await axios.post(`Claims/createFromSales`, params); - router.push({ name: 'ClaimBasicData', params: { id: data.id } }); + push({ name: 'ClaimBasicData', params: { id: data.id } }); } catch (error) { console.error('Error creating claim: ', error); } @@ -169,7 +169,7 @@ const createRefund = async (withWarehouse) => { const { data } = await axios.post('Tickets/cloneAll', params); const [refundTicket] = data; notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive'); - router.push({ name: 'TicketSale', params: { id: refundTicket.id } }); + push({ name: 'TicketSale', params: { id: refundTicket.id } }); } catch (error) { console.error(error); }