feat: refs #7553 refs #7356 & #7553 added rest of missing functions in the descriptor menu
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
511d53d109
commit
85bc610298
|
@ -30,7 +30,7 @@ const filter = {
|
||||||
{
|
{
|
||||||
relation: 'address',
|
relation: 'address',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'name', 'mobile', 'phone'],
|
fields: ['id', 'name', 'mobile', 'phone', 'incotermsFk'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ref } from 'vue';
|
import { ref, toRefs } from 'vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
@ -11,6 +11,8 @@ import VnSmsDialog from 'components/common/VnSmsDialog.vue';
|
||||||
import toDate from 'filters/toDate';
|
import toDate from 'filters/toDate';
|
||||||
import FormPopup from 'components/FormPopup.vue';
|
import FormPopup from 'components/FormPopup.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
ticket: {
|
ticket: {
|
||||||
|
@ -24,12 +26,16 @@ const { dialog, notify } = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openReport, sendEmail } = usePrintService();
|
const { openReport, sendEmail } = usePrintService();
|
||||||
|
|
||||||
const ticket = ref(props.ticket);
|
const { ticket } = toRefs(props);
|
||||||
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 showTurnDialog = ref(false);
|
||||||
|
const showChangeTimeDialog = ref(false);
|
||||||
const dialogRef = ref();
|
const dialogRef = ref();
|
||||||
|
const isEditable = ref();
|
||||||
|
const hasInvoicing = ref();
|
||||||
|
const hasPdf = ref();
|
||||||
const actions = {
|
const actions = {
|
||||||
clone: async () => {
|
clone: async () => {
|
||||||
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
||||||
|
@ -187,6 +193,26 @@ async function createPdfInvoice() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeInvoiceDialog() {
|
||||||
|
//TODO: lo de abajo?
|
||||||
|
// if (ticket.value.address?.incotermsFk && !ticket.value.weight && !force)
|
||||||
|
dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
promise: makeInvoice,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function makeInvoice() {
|
||||||
|
console.log(ticket.value);
|
||||||
|
const params = {
|
||||||
|
ticketsIds: [parseInt(ticketId)],
|
||||||
|
};
|
||||||
|
const { data } = await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
|
||||||
|
|
||||||
|
if (data) window.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
async function transferClient(client) {
|
async function transferClient(client) {
|
||||||
const params = {
|
const params = {
|
||||||
clientFk: client,
|
clientFk: client,
|
||||||
|
@ -218,17 +244,65 @@ async function createRefund(withWarehouse) {
|
||||||
withWarehouse: withWarehouse,
|
withWarehouse: withWarehouse,
|
||||||
};
|
};
|
||||||
const { data } = await axios.post(`Tickets/refund`, params);
|
const { data } = await axios.post(`Tickets/refund`, params);
|
||||||
console.log('data: ', data);
|
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
const refundTicket = data;
|
const refundTicket = data;
|
||||||
console.log('refundTicket: ', refundTicket);
|
|
||||||
|
|
||||||
push({ name: 'TicketSale', params: { id: refundTicket[0].id } });
|
push({ name: 'TicketSale', params: { id: refundTicket[0].id } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function changeShippedHour(time) {
|
||||||
|
console.log('time: ', time);
|
||||||
|
const params = {
|
||||||
|
shipped: time,
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await axios.post(`Tickets/${ticketId}/updateEditableTicket`, params);
|
||||||
|
|
||||||
|
if (data) window.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function openRecalculateDialog() {
|
||||||
|
dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('Recalculate components'),
|
||||||
|
message: t('Are you sure you want to recalculate components?'),
|
||||||
|
promise: recalculateComponents,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function recalculateComponents() {
|
||||||
|
await axios.post(`Tickets/${ticketId}/recalculateComponents`);
|
||||||
|
notify({
|
||||||
|
message: t('Data saved'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleFetchData = (data) => {
|
||||||
|
isEditable.value = data;
|
||||||
|
handleInvoiceOutData();
|
||||||
|
};
|
||||||
|
|
||||||
|
async function handleInvoiceOutData() {
|
||||||
|
const { data } = await axios.get(`InvoiceOuts`, {
|
||||||
|
params: {
|
||||||
|
filter: JSON.stringify({ where: { ref: ticket.value.refFk } }),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
hasPdf.value = data[0]?.hasPdf;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
:url="`Tickets/${ticketId}/isEditable`"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="handleFetchData"
|
||||||
|
/>
|
||||||
<QItem @click="showTransferDialog = !showTransferDialog" v-ripple clickable>
|
<QItem @click="showTransferDialog = !showTransferDialog" v-ripple clickable>
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="content_paste" />
|
<QIcon name="content_paste" />
|
||||||
|
@ -268,7 +342,7 @@ async function createRefund(withWarehouse) {
|
||||||
</QDialog>
|
</QDialog>
|
||||||
<QItem @click="showTurnDialog = !showTurnDialog" v-ripple clickable>
|
<QItem @click="showTurnDialog = !showTurnDialog" v-ripple clickable>
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="content_paste" />
|
<QIcon name="vn:calendar" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t('addTurn') }}</QItemSection>
|
<QItemSection>{{ t('addTurn') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -401,6 +475,20 @@ async function createRefund(withWarehouse) {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t('Show Proforma') }}</QItemSection>
|
<QItemSection>{{ t('Show Proforma') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem @click="showChangeTimeDialog = !showChangeTimeDialog" v-ripple clickable>
|
||||||
|
<QItemSection avatar>
|
||||||
|
<QIcon name="schedule" />
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>{{ t('Change shipped hour') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QDialog ref="dialogRef" v-model="showChangeTimeDialog">
|
||||||
|
<FormPopup @on-submit="changeShippedHour(time)" :title="t('Change shipped hour')">
|
||||||
|
<template #form-inputs>
|
||||||
|
<!--TODO: pone el año a 1970, corregir-->
|
||||||
|
<VnInputTime v-model="time" :label="t('Shipped hour')" clearable />
|
||||||
|
</template>
|
||||||
|
</FormPopup>
|
||||||
|
</QDialog>
|
||||||
<QItem v-ripple clickable>
|
<QItem v-ripple clickable>
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="sms" />
|
<QIcon name="sms" />
|
||||||
|
@ -427,11 +515,26 @@ async function createRefund(withWarehouse) {
|
||||||
</QList>
|
</QList>
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem @click="createPdfDialog()" v-ripple clickable>
|
<!--TODO: acabar esta parte, falta la función makeInvoice-->
|
||||||
|
<QItem @click="makeInvoiceDialog()" v-ripple clickable v-if="isEditable">
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="picture_as_pdf" />
|
<QIcon name="picture_as_pdf" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t('Regenerate PDF invoice') }}</QItemSection>
|
<QItemSection>{{ t('Make invoice') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<!--TODO: acabar esta parte, falta el campo hasInvoicing-->
|
||||||
|
<QItem
|
||||||
|
@click="createPdfDialog()"
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
v-if="ticket.refFk !== null && (ticket.hasInvoicing || hasPdf)"
|
||||||
|
>
|
||||||
|
<QItemSection avatar>
|
||||||
|
<QIcon name="picture_as_pdf" />
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>{{
|
||||||
|
hasPdf.value ? t('Regenerate PDF invoice') : t('Generate PDF invoice')
|
||||||
|
}}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
|
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
|
@ -439,6 +542,12 @@ async function createRefund(withWarehouse) {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t('To clone ticket') }}</QItemSection>
|
<QItemSection>{{ t('To clone ticket') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem @click="openRecalculateDialog()" v-ripple clickable>
|
||||||
|
<QItemSection avatar>
|
||||||
|
<QIcon name="refresh" />
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>{{ t('Recalculate components') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem v-ripple clickable>
|
<QItem v-ripple clickable>
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="monetization_on" />
|
<QIcon name="monetization_on" />
|
||||||
|
@ -502,6 +611,7 @@ es:
|
||||||
To clone ticket: Clonar ticket
|
To clone ticket: Clonar ticket
|
||||||
Ticket cloned: Ticked clonado
|
Ticket cloned: Ticked clonado
|
||||||
It was not able to clone the ticket: No se pudo clonar el ticket
|
It was not able to clone the ticket: No se pudo clonar el ticket
|
||||||
|
Generate PDF invoice: Generar PDF factura
|
||||||
Regenerate PDF invoice: Regenerar PDF factura
|
Regenerate PDF invoice: Regenerar PDF factura
|
||||||
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
|
||||||
|
@ -512,4 +622,10 @@ es:
|
||||||
Refund all...: Abonar todo...
|
Refund all...: Abonar todo...
|
||||||
with warehouse: con almacén
|
with warehouse: con almacén
|
||||||
without warehouse: sin almacén
|
without warehouse: sin almacén
|
||||||
|
Make invoice: Crear factura
|
||||||
|
Change shipped hour: Cambiar hora de envío
|
||||||
|
Shipped hour: Hora de envío
|
||||||
|
Recalculate components: Recalcular componentes
|
||||||
|
Are you sure you want to recalculate components?: ¿Seguro que quieres recalcular los componentes?
|
||||||
|
Data saved: Datos guardados
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue