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 ef5e02b12..4e1c4f406 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -96,6 +96,7 @@ globals:
to: To
notes: Notes
refresh: Refresh
+ weight: Weight
pageTitles:
logIn: Login
summary: Summary
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index 7143bf96f..6415a2930 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -98,6 +98,7 @@ globals:
to: Hasta
notes: Notas
refresh: Actualizar
+ 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 441b547ed..9491579f8 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,7 +49,25 @@ const actions = {
push({ name: 'TicketSummary', params: { id: clonedTicketId } });
}
},
- setWeight: async () => {},
+ 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`);
@@ -261,7 +282,7 @@ function openConfirmDialog(callback) {
{{ t('To clone ticket') }}
-
+
@@ -276,9 +297,25 @@ function openConfirmDialog(callback) {
{{ t('Delete ticket') }}
+
+
+
+
+
-
+en:
+ invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}"
+
es:
Open Delivery Note...: Abrir albarán...
Send Delivery Note...: Enviar albarán...
@@ -297,5 +334,7 @@ es:
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 177384663..a7a541e6d 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) {
setData(data)"
data-key="TicketSummary"
>
@@ -131,7 +123,7 @@ async function changeState(value) {
-
+
-
- {{ ticket.ticketState?.state?.name }}
+
+ {{ entity.ticketState?.state?.name }}
-
+
- {{ ticket.ticketCollections[0]?.collectionFk }}
+ {{ entity.ticketCollections[0]?.collectionFk }}
-
+
-
- {{ dashIfEmpty(ticket.refFk) }}
+
+ {{ dashIfEmpty(entity.refFk) }}
@@ -199,35 +191,35 @@ async function changeState(value) {
/>
-
-
+
+
{{ t('ticket.summary.consigneePhone') }}
-
+
-
+
{{ t('ticket.summary.consigneeMobile') }}
-
+
-
+
{{ t('ticket.summary.clientPhone') }}
-
+
-
+
{{ t('ticket.summary.clientMobile') }}
-
+
-
+
@@ -279,7 +271,7 @@ async function changeState(value) {
:url="ticketUrl + 'sale'"
:text="t('ticket.summary.saleLines')"
/>
-
+
{{ value }}
@@ -420,10 +412,10 @@ async function changeState(value) {
-
+
{{ t('ticket.summary.created') }}
@@ -443,7 +435,7 @@ async function changeState(value) {
:url="ticketUrl + 'service'"
:text="t('ticket.summary.service')"
/>
-
+
{{ t('ticket.summary.quantity') }}