0
0
Fork 0

feat: refs #7553 added refund and add turn functions to descriptor

This commit is contained in:
Jon Elias 2024-08-19 13:48:55 +02:00
parent 574a2efc92
commit 511d53d109
1 changed files with 138 additions and 0 deletions

View File

@ -28,6 +28,7 @@ const ticket = ref(props.ticket);
const ticketId = currentRoute.value.params.id; const ticketId = currentRoute.value.params.id;
const client = ref(); const client = ref();
const showTransferDialog = ref(false); const showTransferDialog = ref(false);
const showTurnDialog = ref(false);
const dialogRef = ref(); const dialogRef = ref();
const actions = { const actions = {
clone: async () => { clone: async () => {
@ -195,6 +196,37 @@ async function transferClient(client) {
if (data) window.location.reload(); if (data) window.location.reload();
} }
async function addTurn(day) {
const params = {
ticketFk: parseInt(ticketId),
weekDay: day,
agencyModeFk: ticket.value.agencyModeFk,
};
await axios.patch(`TicketWeeklies`, params);
notify({
message: t('Current ticket deleted and added to shift'),
type: 'positive',
});
window.location.reload();
}
async function createRefund(withWarehouse) {
const params = {
ticketsIds: [parseInt(ticketId)],
withWarehouse: withWarehouse,
};
const { data } = await axios.post(`Tickets/refund`, params);
console.log('data: ', data);
if (data) {
const refundTicket = data;
console.log('refundTicket: ', refundTicket);
push({ name: 'TicketSale', params: { id: refundTicket[0].id } });
}
}
</script> </script>
<template> <template>
<QItem @click="showTransferDialog = !showTransferDialog" v-ripple clickable> <QItem @click="showTransferDialog = !showTransferDialog" v-ripple clickable>
@ -234,6 +266,75 @@ async function transferClient(client) {
</template> </template>
</FormPopup> </FormPopup>
</QDialog> </QDialog>
<QItem @click="showTurnDialog = !showTurnDialog" v-ripple clickable>
<QItemSection avatar>
<QIcon name="content_paste" />
</QItemSection>
<QItemSection>{{ t('addTurn') }}</QItemSection>
</QItem>
<QDialog ref="dialogRef" v-model="showTurnDialog">
<FormPopup
@on-submit="addTurn"
:title="t('What is the day of receipt of the ticket?')"
:default-submit-button="false"
:default-cancel-button="false"
style="text-align: center"
>
<template #form-inputs>
<QBtnGroup spread>
<QBtn
:label="t('weekdays.mon')"
color="primary"
@click="addTurn(0)"
v-ripple
class="weekdaysBtn"
/>
<QBtn
:label="t('weekdays.tue')"
color="primary"
@click="addTurn(1)"
v-ripple
class="weekdaysBtn"
/>
<QBtn
:label="t('weekdays.wed')"
color="primary"
@click="addTurn(2)"
v-ripple
class="weekdaysBtn"
/>
<QBtn
:label="t('weekdays.thu')"
color="primary"
@click="addTurn(3)"
v-ripple
class="weekdaysBtn"
/>
<QBtn
:label="t('weekdays.fri')"
color="primary"
@click="addTurn(4)"
v-ripple
class="weekdaysBtn"
/>
<QBtn
:label="t('weekdays.sat')"
color="primary"
@click="addTurn(5)"
v-ripple
class="weekdaysBtn"
/>
<QBtn
:label="t('weekdays.sun')"
color="primary"
@click="addTurn(6)"
v-ripple
class="weekdaysBtn"
/>
</QBtnGroup>
</template>
</FormPopup>
</QDialog>
<QItem v-ripple clickable> <QItem v-ripple clickable>
<QItemSection avatar> <QItemSection avatar>
<QIcon name="picture_as_pdf" /> <QIcon name="picture_as_pdf" />
@ -338,6 +439,29 @@ async function transferClient(client) {
</QItemSection> </QItemSection>
<QItemSection>{{ t('To clone ticket') }}</QItemSection> <QItemSection>{{ t('To clone ticket') }}</QItemSection>
</QItem> </QItem>
<QItem v-ripple clickable>
<QItemSection avatar>
<QIcon name="monetization_on" />
</QItemSection>
<QItemSection>{{ t('Refund all...') }}</QItemSection>
<QItemSection side>
<QIcon name="keyboard_arrow_right" />
</QItemSection>
<QMenu anchor="top end" self="top start" auto-close bordered>
<QList>
<QItem v-ripple clickable @click="createRefund(true)">
<QItemSection>
{{ t('with warehouse') }}
</QItemSection>
</QItem>
<QItem v-ripple clickable @click="createRefund(false)">
<QItemSection>
{{ t('without warehouse') }}
</QItemSection>
</QItem>
</QList>
</QMenu>
</QItem>
<template v-if="!ticket.isDeleted"> <template v-if="!ticket.isDeleted">
<QSeparator /> <QSeparator />
<QItem @click="openConfirmDialog('remove')" v-ripple clickable> <QItem @click="openConfirmDialog('remove')" v-ripple clickable>
@ -349,7 +473,15 @@ async function transferClient(client) {
</template> </template>
</template> </template>
<style lang="scss" scoped>
.weekdaysBtn {
margin: 1%;
}
</style>
<i18n> <i18n>
en:
addTurn: Add turn
es: es:
Show Delivery Note...: Ver albarán... Show Delivery Note...: Ver albarán...
Send Delivery Note...: Enviar albarán... Send Delivery Note...: Enviar albarán...
@ -374,4 +506,10 @@ es:
The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado
Transfer client: Transferir cliente Transfer client: Transferir cliente
Client: Cliente Client: Cliente
addTurn: Añadir a turno
What is the day of receipt of the ticket?: ¿Cuál es el día de preparación del pedido?
Current ticket deleted and added to shift: Ticket actual eliminado y añadido al turno
Refund all...: Abonar todo...
with warehouse: con almacén
without warehouse: sin almacén
</i18n> </i18n>