diff --git a/src/components/ui/VnConfirm.vue b/src/components/ui/VnConfirm.vue index fd4860107..4fa374b62 100644 --- a/src/components/ui/VnConfirm.vue +++ b/src/components/ui/VnConfirm.vue @@ -31,6 +31,7 @@ const props = defineProps({ }); defineEmits(['confirm', ...useDialogPluginComponent.emits]); +defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() }); const { dialogRef, onDialogOK } = useDialogPluginComponent(); @@ -68,8 +69,10 @@ async function confirm() { - + + + diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml index 3546d79a0..d29b864b9 100644 --- a/src/i18n/locale/en.yml +++ b/src/i18n/locale/en.yml @@ -102,6 +102,7 @@ globals: item: Item ticket: Ticket campaign: Campaign + weight: Weight pageTitles: logIn: Login summary: Summary diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index 3b31a6778..3d905509d 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -104,6 +104,7 @@ globals: item: Artículo ticket: Ticket campaign: Campaña + weight: Peso pageTitles: logIn: Inicio de sesión summary: Resumen diff --git a/src/pages/Ticket/Card/TicketDescriptorMenu.vue b/src/pages/Ticket/Card/TicketDescriptorMenu.vue index 9a50288a0..4cf4e633f 100644 --- a/src/pages/Ticket/Card/TicketDescriptorMenu.vue +++ b/src/pages/Ticket/Card/TicketDescriptorMenu.vue @@ -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 VnInputNumber from 'src/components/common/VnInputNumber.vue'; +import { useArrayData } from 'src/composables/useArrayData'; const props = defineProps({ ticket: { @@ -21,9 +23,10 @@ const { push, currentRoute } = useRouter(); const { dialog, notify } = useQuasar(); const { t } = useI18n(); const { openReport, sendEmail } = usePrintService(); - +const ticketSummary = useArrayData('TicketSummary'); const ticket = ref(props.ticket); const ticketId = currentRoute.value.params.id; +const weight = ref(); const actions = { clone: async () => { const opts = { message: t('Ticket cloned'), type: 'positive' }; @@ -46,6 +49,25 @@ const actions = { push({ name: 'TicketSummary', params: { id: clonedTicketId } }); } }, + setWeight: async () => { + try { + const invoiceIds = ( + await axios.post(`Tickets/${ticketId}/setWeight`, { + weight: weight.value, + }) + ).data; + + notify({ message: t('Weight set'), type: 'positive' }); + if (invoiceIds.length) + notify({ + message: t('invoiceIds', { invoiceIds: invoiceIds.join() }), + type: 'positive', + }); + await ticketSummary.fetch({ updateRouter: false }); + } catch (e) { + notify({ message: e.message, type: 'negative' }); + } + }, remove: async () => { try { await axios.post(`Tickets/${ticketId}/setDeleted`); @@ -255,6 +277,12 @@ function openConfirmDialog(callback) { {{ t('To clone ticket') }} + + + + + {{ t('Set weight') }} + + + + - +en: + invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}" + es: Open Delivery Note...: Abrir albarán... Send Delivery Note...: Enviar albarán... @@ -284,4 +328,8 @@ es: To clone ticket: Clonar ticket Ticket cloned: Ticked clonado It was not able to clone the ticket: No se pudo clonar el ticket + Set weight: Establecer peso + Weight set: Peso establecido + This ticket may be invoiced, do you want to continue?: Es posible que se facture este ticket, desea continuar? + invoiceIds: "Se han generado las facturas con los siguientes ids: {invoiceIds}" diff --git a/src/pages/Ticket/Card/TicketSummary.vue b/src/pages/Ticket/Card/TicketSummary.vue index 5df9222bf..6af782173 100644 --- a/src/pages/Ticket/Card/TicketSummary.vue +++ b/src/pages/Ticket/Card/TicketSummary.vue @@ -31,8 +31,7 @@ const $props = defineProps({ const entityId = computed(() => $props.id || route.params.id); const summaryRef = ref(); -const ticket = ref(); -const salesLines = ref(null); +const ticket = computed(() => summaryRef.value?.entity); const editableStates = ref([]); const ticketUrl = ref(); const grafanaUrl = 'https://grafana.verdnatura.es'; @@ -40,12 +39,6 @@ const grafanaUrl = 'https://grafana.verdnatura.es'; onMounted(async () => { ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/'; }); -async function setData(data) { - if (data) { - ticket.value = data; - salesLines.value = data.sales; - } -} function formattedAddress() { if (!ticket.value) return ''; @@ -89,7 +82,6 @@ async function changeState(value) { -