diff --git a/src/App.vue b/src/App.vue
index 4f1394559..b928491a3 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -44,6 +44,11 @@ function responseError(error) {
let message = error.message;
let logOut = false;
+ const response = error.response;
+ if (response && response.data.error) {
+ message = response.data.error.message;
+ }
+
switch (error.response?.status) {
case 401:
message = 'login.loginError';
diff --git a/src/components/common/VnSmsDialog.vue b/src/components/common/VnSmsDialog.vue
index f0a782489..acfb704d6 100644
--- a/src/components/common/VnSmsDialog.vue
+++ b/src/components/common/VnSmsDialog.vue
@@ -1,5 +1,5 @@
@@ -57,11 +82,16 @@ const languages = availableLocales.map((locale) => ({ label: t(locale), value: l
{{ t('Send SMS') }}
-
+
-
- This user uses "" as default language
+
+
+
+
+
@@ -111,7 +141,6 @@ const languages = availableLocales.map((locale) => ({ label: t(locale), value: l
stack-label
outlined
autofocus
- dense
>
({ label: t(locale), value: l
-
-
+
+
@@ -141,38 +181,53 @@ const languages = availableLocales.map((locale) => ({ label: t(locale), value: l
transition: background 0.36s;
}
.q-card {
- width: 400px;
+ width: 500px;
}
en:
- Message: Message
+ CustomerDefaultLanguage: This customer uses {locale} as their default language
en: English
es: Spanish
fr: French
templates:
pendingPayment: 'Your order is pending of payment.
Please, enter the website and make the payment with a credit card. Thank you.'
- minAmount: Test 2
+ minAmount: 'A minimum amount of 50€ (VAT excluded) is required for your order
+ { orderId } of { shipped } to receive it without additional shipping costs.'
+ orderChanges: 'Order {orderId} of { shipped }\r
+ { changes }'
es:
+ Send SMS: Enviar SMS
+ CustomerDefaultLanguage: Este cliente utiliza {locale} como idioma por defecto
Language: Idioma
+ Phone: Móvil
+ Subject: Asunto
Message: Mensaje
templates:
pendingPayment: 'Su pedido está pendiente de pago.
Por favor, entre en la página web y efectue el pago con tarjeta. Muchas gracias.'
- minAmount: 'Es necesario un importe mínimo de 50€ (Sin IVA) en su pedido { orderId } del día 08/03/2023 para recibirlo sin portes adicionales.'
+ minAmount: 'Es necesario un importe mínimo de 50€ (Sin IVA) en su pedido
+ { orderId } del día { shipped } para recibirlo sin portes adicionales.'
+ orderChanges: 'Pedido {orderId} día { shipped }
+ { changes }'
en: Inglés
es: Español
fr: Francés
fr:
+ Send SMS: Envoyer SMS
+ CustomerDefaultLanguage: Ce client utilise l'{locale} comme langue par défaut
Language: Langage
+ Phone: Mobile
+ Subject: Affaire
Message: Message
templates:
pendingPayment: 'Votre commande est en attente de paiement.
Veuillez vous connecter sur le site web et effectuer le paiement par carte. Merci beaucoup.'
minAmount: 'Un montant minimum de 50€ (TVA non incluse) est requis pour votre commande
- 4101055 du 03/08/2023 afin de la recevoir sans frais de port supplémentaires.'
+ { orderId } du { shipped } afin de la recevoir sans frais de port supplémentaires.'
+ orderChanges: 'Commande { orderId } du { shipped }\r { changes }'
en: Anglais
es: Espagnol
fr: Français
diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue
index 2d41c36a2..8c94b11d4 100644
--- a/src/components/ui/CardDescriptor.vue
+++ b/src/components/ui/CardDescriptor.vue
@@ -59,9 +59,9 @@ watch(props, async () => {
:to="{ name: `${module}Summary`, params: { id: entity.id } }"
>
- {{
- t('components.cardDescriptor.summary')
- }}
+
+ {{ t('components.cardDescriptor.summary') }}
+
diff --git a/src/pages/Ticket/Card/TicketDescriptor.vue b/src/pages/Ticket/Card/TicketDescriptor.vue
index 385428c3b..91f00d761 100644
--- a/src/pages/Ticket/Card/TicketDescriptor.vue
+++ b/src/pages/Ticket/Card/TicketDescriptor.vue
@@ -24,11 +24,25 @@ const entityId = computed(() => {
const filter = {
include: [
+ {
+ relation: 'address',
+ scope: {
+ fields: ['id', 'name', 'mobile', 'phone'],
+ },
+ },
{
relation: 'client',
scope: {
- fields: ['id', 'name', 'salesPersonFk'],
- include: { relation: 'salesPersonUser' },
+ fields: ['id', 'name', 'salesPersonFk', 'phone', 'mobile'],
+ include: [
+ {
+ relation: 'user',
+ scope: {
+ fields: ['id', 'lang'],
+ },
+ },
+ { relation: 'salesPersonUser' },
+ ],
},
},
{
@@ -125,6 +139,16 @@ function stateColor(state) {
+
+
+ {{ t('This ticket is deleted') }}
+
+
+
+
+es:
+ This ticket is deleted: Este ticket está eliminado
+
\ No newline at end of file
diff --git a/src/pages/Ticket/Card/TicketDescriptorMenu.vue b/src/pages/Ticket/Card/TicketDescriptorMenu.vue
index fa400672e..e7045c6f5 100644
--- a/src/pages/Ticket/Card/TicketDescriptorMenu.vue
+++ b/src/pages/Ticket/Card/TicketDescriptorMenu.vue
@@ -3,13 +3,14 @@ import axios from 'axios';
import { ref } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
-import { useRouter } from 'vue-router';
+import { useRouter, useRoute } from 'vue-router';
import { usePrintService } from 'composables/usePrintService';
-import SendEmailDialog from 'components/common/SendEmailDialog.vue';
+// 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';
-const $props = defineProps({
+const props = defineProps({
ticket: {
type: Object,
required: true,
@@ -17,11 +18,12 @@ const $props = defineProps({
});
const router = useRouter();
+const route = useRoute();
const quasar = useQuasar();
const { t } = useI18n();
const { openReport, sendEmail } = usePrintService();
-const ticket = ref($props.ticket);
+const ticket = ref(props.ticket);
function openDeliveryNote(type = 'deliveryNote', documentType = 'pdf') {
const path = `Tickets/${ticket.value.id}/delivery-note-${documentType}`;
@@ -34,31 +36,63 @@ function openDeliveryNote(type = 'deliveryNote', documentType = 'pdf') {
function sendDeliveryNote(type = 'deliveryNote', documentType = 'pdf') {
const id = ticket.value.id;
const customer = ticket.value.client;
- return sendEmail(`Tickets/${id}/delivery-note-email`, {
+ let pathName = 'delivery-note-email';
+ if (documentType == 'csv') pathName = 'delivery-note-csv-email';
+
+ const path = `Tickets/${id}/${pathName}`;
+ return sendEmail(path, {
recipientId: customer.id,
type: type,
});
}
-// function confirmPickupOrder() {
-// const customer = ticket.value.client;
-// quasar.dialog({
-// component: SendEmailDialog,
-// componentProps: {
-// address: customer.email,
-// send: sendPickupOrder,
-// },
-// });
-// }
+const shipped = toDate(ticket.value.shipped);
+function showSmsDialog(template, customData) {
+ const ticket = props.ticket;
+ const address = ticket.address;
+ const client = ticket.client;
+ const phone =
+ route.params.phone ||
+ address.mobile ||
+ address.phone ||
+ client.mobile ||
+ client.phone;
+
+ const data = {
+ orderId: ticket.id,
+ shipped: shipped,
+ };
+
+ if (typeof customData === 'object') {
+ console.log('merge');
+ Object.assign(data, customData);
+ }
-function sendSms() {
quasar.dialog({
component: VnSmsDialog,
componentProps: {
- phone: '123',
- template: 'pendingPayment'
- }
- })
+ phone: phone,
+ template: template,
+ locale: client.user.lang,
+ send: sendSms,
+ data: data,
+ },
+ });
+}
+
+async function showSmsDialogWithChanges() {
+ const query = `TicketLogs/${route.params.id}/getChanges`;
+ const response = await axios.get(query);
+
+ showSmsDialog('orderChanges', { changes: response.data });
+}
+
+async function sendSms(body) {
+ await axios.post(`Tickets/${route.params.id}/sendSms`, body);
+ quasar.notify({
+ message: 'Notification sent',
+ type: 'positive',
+ });
}
function confirmDelete() {
@@ -70,12 +104,16 @@ function confirmDelete() {
}
async function remove() {
- const id = ticket.value.id;
- await axios.delete(`Claims/${id}`);
+ const id = route.params.id;
+ await axios.post(`Tickets/${id}/setDeleted`);
+
quasar.notify({
- message: t('globals.dataDeleted'),
+ message: t('Ticket deleted'),
type: 'positive',
- icon: 'check',
+ });
+ quasar.notify({
+ message: t('You can undo this action within the first hour'),
+ icon: 'info',
});
await router.push({ name: 'TicketList' });
}
@@ -83,42 +121,27 @@ async function remove() {
-
+
{{ t('Open Delivery Note...') }}
-
+
-
-
-
-
+
{{ t('With prices') }}
-
-
-
- {{ t('Without Prices') }}
+ {{ t('Without prices') }}
-
-
-
{{ t('As CSV') }}
-
-
-
-
- {{ t('Send Delivery Note') }}
-
@@ -132,11 +155,11 @@ async function remove() {
-
+
{{ t('With prices') }}
- {{ t('Without Prices') }}
+ {{ t('Without prices') }}
-
-
-
-
+
{{ t('Pending payment') }}
+
+ {{ t('Minimum amount') }}
+
+
+ {{ t('Order changes') }}
+
-
-
-
-
-
- {{ t('Delete ticket') }}
-
+
+
+
+
+
+
+ {{ t('Delete ticket') }}
+
+
es:
- Delivery Note: Albarán
- Open Delivery Note: Abrir albarán
+ Open Delivery Note...: Abrir albarán...
+ Send Delivery Note...: Enviar albarán...
+ With prices: Con precios
+ Without prices: Sin precios
+ As CSV: Como CSV
+ Open Proforma Invoice: Abrir factura proforma
Delete ticket: Eliminar ticket
+ Send SMS...: Enviar SMS
+ Pending payment: Pago pendiente
+ Minimum amount: Importe mínimo
+ Order changes: Cambios del pedido
+ Ticket deleted: Ticket eliminado
+ You can undo this action within the first hour: Puedes deshacer esta acción dentro de la primera hora
-