diff --git a/src/components/ui/VnConfirm.vue b/src/components/ui/VnConfirm.vue index 469c17d7..337e6e7e 100644 --- a/src/components/ui/VnConfirm.vue +++ b/src/components/ui/VnConfirm.vue @@ -105,23 +105,18 @@ async function confirm() { en-US: - confirm: Confirm wantToContinue: Are you sure you want to continue? cancel: Cancel es-ES: - confirm: Confirmar wantToContinue: ¿Seguro que quieres continuar? cancel: Cancelar ca-ES: - confirm: Confirmar wantToContinue: Segur que vols continuar? cancel: Cancel·lar fr-FR: - confirm: Confirmer wantToContinue: Êtes-vous sûr de vouloir continuer? cancel: Annuler pt-PT: - confirm: Confirme wantToContinue: Tem a certeza de que deseja continuar? cancel: Cancelar diff --git a/src/i18n/ca-ES/index.js b/src/i18n/ca-ES/index.js index 5a465c44..a22bb3e5 100644 --- a/src/i18n/ca-ES/index.js +++ b/src/i18n/ca-ES/index.js @@ -65,8 +65,11 @@ export default { 'Si us plau carrega una comanda pendent a la cistella o en comença una de nova', at: 'a les', back: 'Tornar', + next: 'Següent', remove: 'Esborrar', agency: 'Agència', + noData: 'Sense dades', + confirm: 'Confirmar', delete: 'Esborrar', reallyDelete: 'Estàs segur que vols esborrar la línia?' }; diff --git a/src/i18n/en-US/index.js b/src/i18n/en-US/index.js index 48fa823f..ddcfe77f 100644 --- a/src/i18n/en-US/index.js +++ b/src/i18n/en-US/index.js @@ -77,8 +77,11 @@ export default { loadAnOrder: 'Please load a pending order to the cart or start a new one', at: 'at', back: 'Back', + next: 'Next', remove: 'Remove', agency: 'Agency', + noData: 'No data', + confirm: 'Confirm', delete: 'Delete', reallyDelete: 'Are you sure you want to delete the line?', diff --git a/src/i18n/es-ES/index.js b/src/i18n/es-ES/index.js index 26b03a15..4e2d4f30 100644 --- a/src/i18n/es-ES/index.js +++ b/src/i18n/es-ES/index.js @@ -84,8 +84,11 @@ export default { 'Por favor carga un pedido pendiente en la cesta o empieza uno nuevo', at: 'a las', back: 'Volver', + next: 'Siguiente', remove: 'Borrar', agency: 'Agencia', + noData: 'Sin datos', + confirm: 'Confirmar', delete: 'Borrar', reallyDelete: '¿Estás seguro de que quieres borrar la línea?', diff --git a/src/i18n/fr-FR/index.js b/src/i18n/fr-FR/index.js index aa5bad50..d9a6ebb2 100644 --- a/src/i18n/fr-FR/index.js +++ b/src/i18n/fr-FR/index.js @@ -65,8 +65,11 @@ export default { 'Veuillez télécharger une commande en attente dans le panier ou en démarrer une nouvelle', at: 'à', back: 'Retour', + next: 'Suivant', remove: 'Effacer', agency: 'Agence', + noData: 'Aucune donnée', + confirm: 'Confirmer', delete: 'Effacer', reallyDelete: 'Voulez-vous vraiment supprimer la ligne?' }; diff --git a/src/i18n/pt-PT/index.js b/src/i18n/pt-PT/index.js index 514cd7a8..77abcd7d 100644 --- a/src/i18n/pt-PT/index.js +++ b/src/i18n/pt-PT/index.js @@ -65,8 +65,11 @@ export default { loadAnOrder: 'Carregue um pedido pendente no carrinho ou inicie um novo', at: 'às', back: 'Voltar', + next: 'Seguinte', remove: 'Eliminar', agency: 'Agência', + noData: 'Sem dados', + confirm: 'Confirme', delete: 'Eliminar', reallyDelete: 'Tens certeza que queres eliminar esta linha?' }; diff --git a/src/lib/filters.js b/src/lib/filters.js index d75ede13..abb27293 100644 --- a/src/lib/filters.js +++ b/src/lib/filters.js @@ -1,5 +1,6 @@ import { i18n } from 'src/boot/i18n'; import { date as qdate, format } from 'quasar'; +import { useAppStore } from 'stores/app'; const { pad } = format; export function currency(val) { @@ -16,14 +17,8 @@ export function date(val, format = 'YYYY-MM-DD') { export const formatDate = (timeStamp, format = 'YYYY-MM-DD') => { if (!timeStamp) return ''; - const { messages, locale } = i18n.global; - - return qdate.formatDate(timeStamp, format, { - days: messages.value[locale.value].date.days, - months: messages.value[locale.value].date.months, - daysShort: messages.value[locale.value].date.daysShort, - monthsShort: messages.value[locale.value].date.monthsShort - }); + const appStore = useAppStore(); + return qdate.formatDate(timeStamp, format, appStore.localeDates); }; /** diff --git a/src/pages/Ecomerce/CheckoutView.vue b/src/pages/Ecomerce/CheckoutView.vue index cf1b9f3d..79a1c1c6 100644 --- a/src/pages/Ecomerce/CheckoutView.vue +++ b/src/pages/Ecomerce/CheckoutView.vue @@ -8,6 +8,7 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import { formatDateTitle, formatDate } from 'src/lib/filters.js'; import useNotify from 'src/composables/useNotify.js'; import { useAppStore } from 'stores/app'; +import { storeToRefs } from 'pinia'; const jApi = inject('jApi'); const { t } = useI18n(); @@ -15,6 +16,7 @@ const route = useRoute(); const router = useRouter(); const { notify } = useNotify(); const appStore = useAppStore(); +const { localeDates } = storeToRefs(appStore); const stepperRef = ref(null); @@ -59,6 +61,7 @@ const steps = { }, { name: 'confirm', + nextButtonLabel: t('confirm'), onBeforeNextStep: async () => { await submit(); } @@ -74,7 +77,11 @@ const steps = { name: 'date', validateStep: () => validateStep('date', t('pleaseSelectADate')) }, - { name: 'address' }, + { + name: 'address', + validateStep: () => + validateStep('address', t('pleaseSelectAnAddress')) + }, { name: 'pickup', validateStep: () => @@ -85,6 +92,7 @@ const steps = { }, { name: 'confirm', + nextButtonLabel: t('confirm'), onBeforeNextStep: async () => { await submit(); } @@ -277,8 +285,6 @@ onMounted(async () => { today.value.setHours(0, 0, 0, 0); if (route.params.id) { - notify(t('rememberReconfiguringImpact'), 'warning'); - const [order] = await jApi.query( `SELECT m.code deliveryMethod, o.sent, o.agencyModeFk, o.addressFk FROM myOrder o @@ -326,7 +332,7 @@ onMounted(async () => { v-if="step.name === 'method'" class="column justify-center items-center" > - + {{ t('receiveOrPickOrder') }}
@@ -347,20 +353,31 @@ onMounted(async () => { v-if="step.name === 'date'" class="flex justify-center items-center" > - + {{ t('orderDateDelivery') }}
+ + {{ + t( + orderForm.method === 'PICKUP' + ? 'addressStepQuestionPickup' + : 'addressStepQuestion' + ) + }} + { v-if="step.name === 'agency'" class="flex justify-center items-center" > - - {{ t('orderDateDelivery') }} + + {{ t('howDoYouWantToReceive') }} { v-if="step.name === 'pickup'" class="flex justify-center items-center" > - + {{ t('pickupWarehouse') }} { v-if="step.name === 'confirm'" class="flex column justify-center items-center" > - + {{ t('confirmData') }}
@@ -431,14 +448,14 @@ onMounted(async () => { flat color="primary" @click="onPreviousStep(stepIndex)" - label="Back" + :label="step.backButtonLabel || t('back')" class="q-ml-sm" :class="{ invisible: currentStep === 'method' }" /> @@ -446,7 +463,14 @@ onMounted(async () => { - + en-US: @@ -468,7 +492,8 @@ en-US: pleaseSelectAWarehouse: Please select a store warehouse: Warehouse pickup: Pickup - rememberReconfiguringImpact: Remember that if you reconfigure your order prices or quantities of your items may change + addressStepQuestion: Where do you want to receive the order? + addressStepQuestionPickup: To which address do you want to associate the order? (Optional) es-ES: receiveOrPickOrder: ¿Quieres recibir o recoger el pedido? receiveOrder: Recibir en mi tienda @@ -488,7 +513,8 @@ es-ES: pleaseSelectAWarehouse: Por favor elige un almacén warehouse: Almacén pickup: Recogida - rememberReconfiguringImpact: Recuerda que si vuelves a configurar el pedido los precios o cantidades de tus artículos podrían cambiar + addressStepQuestion: ¿Dónde quieres recibir el pedido? + addressStepQuestionPickup: ¿A qué dirección quieres asociar el pedido? (Opcional) ca-ES: receiveOrPickOrder: Vols rebre o recollir la comanda? receiveOrder: Rebre en mi tenda @@ -508,7 +534,8 @@ ca-ES: pleaseSelectAWarehouse: Si us plau tria un magatzem warehouse: Magatzem pickup: Recollida - rememberReconfiguringImpact: Recorda que si tornes a configurar la comanda els preus o quantitats dels teus articles podrien canviar + addressStepQuestion: On vols rebre la comanda? + addressStepQuestionPickup: A què direcció vols associar la comanda? (Opcional) fr-FR: receiveOrPickOrder: Voulez-vous recevoir ou récuperer l'ordre? receiveOrder: Livraison à la boutique @@ -528,12 +555,14 @@ fr-FR: pleaseSelectAWarehouse: Veuillez choisir un entrepôt warehouse: Entrepôt pickup: Retrait - rememberReconfiguringImpact: Rappelez-vous que si jamais vous commandez des prix fixés ou les quantités de vos articles pourraient changer + addressStepQuestion: Adresse livraison? + addressStepQuestionPickup: À quelle adresse voulez-vous associer la commande? (Optionnel) pt-PT: receiveOrPickOrder: Queres receber ou levantar a encomenda? receiveOrder: Receber na minha loja pickupInStore: Levantar no armazém orderDateDelivery: Como queres receber a encomenda? + howDoYouWantToReceive: Como queres receber a encomenda? confirmData: Confirme os dados arrival: Chegada orderUpdated: Encomenda actualizada @@ -547,5 +576,6 @@ pt-PT: pleaseSelectAWarehouse: Por favor, escolha um armazém warehouse: Armazém pickup: Recolhida - rememberReconfiguringImpact: Lembre-se que si voltas a configurar a encomenda os preços ou quantidades de ítens poderíam variar + addressStepQuestion: Onde queres receber a encomenda? + addressStepQuestionPickup: Para qual endereço deseja associar o pedido? (Opcional) diff --git a/src/stores/app.js b/src/stores/app.js index 51cdd41d..56a2ce2f 100644 --- a/src/stores/app.js +++ b/src/stores/app.js @@ -1,6 +1,7 @@ import { defineStore } from 'pinia'; import { jApi } from 'boot/axios'; import useNotify from 'src/composables/useNotify.js'; +import { i18n } from 'src/boot/i18n'; const { notify } = useNotify(); @@ -13,7 +14,13 @@ export const useAppStore = defineStore('hedera', { rightDrawerOpen: false, isHeaderMounted: false, menuEssentialLinks: [], - basketOrderId: null + basketOrderId: null, + localeDates: { + days: [], + months: [], + daysShort: [], + monthsShort: [] + } }), actions: { @@ -48,8 +55,19 @@ export const useAppStore = defineStore('hedera', { this.$patch({ imageUrl }); }, + getLocaleDates() { + const { messages, locale } = i18n.global; + this.localeDates = { + days: messages.value[locale.value].date.days, + months: messages.value[locale.value].date.months, + daysShort: messages.value[locale.value].date.daysShort, + monthsShort: messages.value[locale.value].date.monthsShort + }; + }, + async init() { this.getBasketOrderId(); + this.getLocaleDates(); }, getBasketOrderId() {