feat: refs #7553 added transferClient function
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-08-19 13:03:38 +02:00
parent 23e5072d38
commit 574a2efc92
2 changed files with 52 additions and 34 deletions

View File

@ -89,7 +89,6 @@ const filter = {
const data = ref(useCardDescription());
function ticketFilter(ticket) {
console.log('ticket: ', ticket);
return JSON.stringify({ clientFk: ticket.clientFk });
}
</script>

View File

@ -9,6 +9,8 @@ import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
import VnSmsDialog from 'components/common/VnSmsDialog.vue';
import toDate from 'filters/toDate';
import FormPopup from 'components/FormPopup.vue';
import VnSelect from 'components/common/VnSelect.vue';
const props = defineProps({
ticket: {
@ -24,7 +26,9 @@ const { openReport, sendEmail } = usePrintService();
const ticket = ref(props.ticket);
const ticketId = currentRoute.value.params.id;
const showWeightDialog = ref(false);
const client = ref();
const showTransferDialog = ref(false);
const dialogRef = ref();
const actions = {
clone: async () => {
const opts = { message: t('Ticket cloned'), type: 'positive' };
@ -182,16 +186,54 @@ async function createPdfInvoice() {
}
}
function setWeightToTicket(weight) {
console.log('weight: ', weight);
const { data } = axios.patch(`Tickets/${ticketId}`, {
weight: weight,
});
console.log('data: ', data);
async function transferClient(client) {
const params = {
clientFk: client,
};
const { data } = await axios.patch(`Tickets/${ticketId}/transferClient`, params);
if (data) window.location.reload();
}
</script>
<template>
<QItem @click="showTransferDialog = !showTransferDialog" v-ripple clickable>
<QItemSection avatar>
<QIcon name="content_paste" />
</QItemSection>
<QItemSection>{{ t('Transfer client') }}</QItemSection>
</QItem>
<QDialog ref="dialogRef" v-model="showTransferDialog">
<FormPopup
@on-submit="transferClient(client)"
:title="t('Transfer client')"
:custom-submit-button-label="t('Transfer client')"
:default-cancel-button="false"
>
<template #form-inputs>
<VnSelect
url="Clients"
:fields="['id', 'name']"
option-label="name"
option-value="id"
v-model="client"
:label="t('Client')"
auto-load
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ `#${scope.opt.id} - ` }}
{{ scope.opt.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</template>
</FormPopup>
</QDialog>
<QItem v-ripple clickable>
<QItemSection avatar>
<QIcon name="picture_as_pdf" />
@ -296,30 +338,6 @@ function setWeightToTicket(weight) {
</QItemSection>
<QItemSection>{{ t('To clone ticket') }}</QItemSection>
</QItem>
<QItem @click="showWeightDialog = !showWeightDialog" v-ripple clickable>
<QItemSection avatar>
<QIcon name="content_paste" />
</QItemSection>
<QItemSection>{{ t('Set ticket weight') }}</QItemSection>
</QItem>
<QDialog v-model="showWeightDialog" transition-show="scale" transition-hide="scale">
<QCard>
<QCardSection>
<QInput
v-model="weight"
type="number"
:label="t('Weight')"
@update:model-value="setWeightToTicket"
/>
<QBtn flat v-close-popup class="text-primary">
{{ t('Close') }}
</QBtn>
<QBTn flat @click="setWeightToTicket" class="text-primary">
{{ t('Save') }}
</QBTn>
</QCardSection>
</QCard>
</QDialog>
<template v-if="!ticket.isDeleted">
<QSeparator />
<QItem @click="openConfirmDialog('remove')" v-ripple clickable>
@ -343,7 +361,7 @@ es:
Send CSV: Enviar CSV
Show Proforma: Ver proforma
Delete ticket: Eliminar ticket
Send SMS...: Enviar SMS
Send SMS...: Enviar SMS...
Pending payment: Pago pendiente
Minimum import: Importe mínimo
Notify changes: Notificar cambios
@ -354,5 +372,6 @@ es:
It was not able to clone the ticket: No se pudo clonar el ticket
Regenerate PDF invoice: Regenerar PDF factura
The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado
Set ticket weight: Establecer peso al ticket
Transfer client: Transferir cliente
Client: Cliente
</i18n>