update branch

This commit is contained in:
William Buezas 2024-09-02 16:27:54 -03:00
parent 766417bb73
commit a1d67ebc6f
9 changed files with 85 additions and 32 deletions

View File

@ -105,23 +105,18 @@ async function confirm() {
<i18n lang="yaml"> <i18n lang="yaml">
en-US: en-US:
confirm: Confirm
wantToContinue: Are you sure you want to continue? wantToContinue: Are you sure you want to continue?
cancel: Cancel cancel: Cancel
es-ES: es-ES:
confirm: Confirmar
wantToContinue: ¿Seguro que quieres continuar? wantToContinue: ¿Seguro que quieres continuar?
cancel: Cancelar cancel: Cancelar
ca-ES: ca-ES:
confirm: Confirmar
wantToContinue: Segur que vols continuar? wantToContinue: Segur que vols continuar?
cancel: Cancel·lar cancel: Cancel·lar
fr-FR: fr-FR:
confirm: Confirmer
wantToContinue: Êtes-vous sûr de vouloir continuer? wantToContinue: Êtes-vous sûr de vouloir continuer?
cancel: Annuler cancel: Annuler
pt-PT: pt-PT:
confirm: Confirme
wantToContinue: Tem a certeza de que deseja continuar? wantToContinue: Tem a certeza de que deseja continuar?
cancel: Cancelar cancel: Cancelar
</i18n> </i18n>

View File

@ -65,8 +65,11 @@ export default {
'Si us plau carrega una comanda pendent a la cistella o en comença una de nova', 'Si us plau carrega una comanda pendent a la cistella o en comença una de nova',
at: 'a les', at: 'a les',
back: 'Tornar', back: 'Tornar',
next: 'Següent',
remove: 'Esborrar', remove: 'Esborrar',
agency: 'Agència', agency: 'Agència',
noData: 'Sense dades',
confirm: 'Confirmar',
delete: 'Esborrar', delete: 'Esborrar',
reallyDelete: 'Estàs segur que vols esborrar la línia?' reallyDelete: 'Estàs segur que vols esborrar la línia?'
}; };

View File

@ -77,8 +77,11 @@ export default {
loadAnOrder: 'Please load a pending order to the cart or start a new one', loadAnOrder: 'Please load a pending order to the cart or start a new one',
at: 'at', at: 'at',
back: 'Back', back: 'Back',
next: 'Next',
remove: 'Remove', remove: 'Remove',
agency: 'Agency', agency: 'Agency',
noData: 'No data',
confirm: 'Confirm',
delete: 'Delete', delete: 'Delete',
reallyDelete: 'Are you sure you want to delete the line?', reallyDelete: 'Are you sure you want to delete the line?',

View File

@ -84,8 +84,11 @@ export default {
'Por favor carga un pedido pendiente en la cesta o empieza uno nuevo', 'Por favor carga un pedido pendiente en la cesta o empieza uno nuevo',
at: 'a las', at: 'a las',
back: 'Volver', back: 'Volver',
next: 'Siguiente',
remove: 'Borrar', remove: 'Borrar',
agency: 'Agencia', agency: 'Agencia',
noData: 'Sin datos',
confirm: 'Confirmar',
delete: 'Borrar', delete: 'Borrar',
reallyDelete: '¿Estás seguro de que quieres borrar la línea?', reallyDelete: '¿Estás seguro de que quieres borrar la línea?',

View File

@ -65,8 +65,11 @@ export default {
'Veuillez télécharger une commande en attente dans le panier ou en démarrer une nouvelle', 'Veuillez télécharger une commande en attente dans le panier ou en démarrer une nouvelle',
at: 'à', at: 'à',
back: 'Retour', back: 'Retour',
next: 'Suivant',
remove: 'Effacer', remove: 'Effacer',
agency: 'Agence', agency: 'Agence',
noData: 'Aucune donnée',
confirm: 'Confirmer',
delete: 'Effacer', delete: 'Effacer',
reallyDelete: 'Voulez-vous vraiment supprimer la ligne?' reallyDelete: 'Voulez-vous vraiment supprimer la ligne?'
}; };

View File

@ -65,8 +65,11 @@ export default {
loadAnOrder: 'Carregue um pedido pendente no carrinho ou inicie um novo', loadAnOrder: 'Carregue um pedido pendente no carrinho ou inicie um novo',
at: 'às', at: 'às',
back: 'Voltar', back: 'Voltar',
next: 'Seguinte',
remove: 'Eliminar', remove: 'Eliminar',
agency: 'Agência', agency: 'Agência',
noData: 'Sem dados',
confirm: 'Confirme',
delete: 'Eliminar', delete: 'Eliminar',
reallyDelete: 'Tens certeza que queres eliminar esta linha?' reallyDelete: 'Tens certeza que queres eliminar esta linha?'
}; };

View File

@ -1,5 +1,6 @@
import { i18n } from 'src/boot/i18n'; import { i18n } from 'src/boot/i18n';
import { date as qdate, format } from 'quasar'; import { date as qdate, format } from 'quasar';
import { useAppStore } from 'stores/app';
const { pad } = format; const { pad } = format;
export function currency(val) { export function currency(val) {
@ -16,14 +17,8 @@ export function date(val, format = 'YYYY-MM-DD') {
export const formatDate = (timeStamp, format = 'YYYY-MM-DD') => { export const formatDate = (timeStamp, format = 'YYYY-MM-DD') => {
if (!timeStamp) return ''; if (!timeStamp) return '';
const { messages, locale } = i18n.global; const appStore = useAppStore();
return qdate.formatDate(timeStamp, format, appStore.localeDates);
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
});
}; };
/** /**

View File

@ -8,6 +8,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
import { formatDateTitle, formatDate } from 'src/lib/filters.js'; import { formatDateTitle, formatDate } from 'src/lib/filters.js';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { useAppStore } from 'stores/app'; import { useAppStore } from 'stores/app';
import { storeToRefs } from 'pinia';
const jApi = inject('jApi'); const jApi = inject('jApi');
const { t } = useI18n(); const { t } = useI18n();
@ -15,6 +16,7 @@ const route = useRoute();
const router = useRouter(); const router = useRouter();
const { notify } = useNotify(); const { notify } = useNotify();
const appStore = useAppStore(); const appStore = useAppStore();
const { localeDates } = storeToRefs(appStore);
const stepperRef = ref(null); const stepperRef = ref(null);
@ -59,6 +61,7 @@ const steps = {
}, },
{ {
name: 'confirm', name: 'confirm',
nextButtonLabel: t('confirm'),
onBeforeNextStep: async () => { onBeforeNextStep: async () => {
await submit(); await submit();
} }
@ -74,7 +77,11 @@ const steps = {
name: 'date', name: 'date',
validateStep: () => validateStep('date', t('pleaseSelectADate')) validateStep: () => validateStep('date', t('pleaseSelectADate'))
}, },
{ name: 'address' }, {
name: 'address',
validateStep: () =>
validateStep('address', t('pleaseSelectAnAddress'))
},
{ {
name: 'pickup', name: 'pickup',
validateStep: () => validateStep: () =>
@ -85,6 +92,7 @@ const steps = {
}, },
{ {
name: 'confirm', name: 'confirm',
nextButtonLabel: t('confirm'),
onBeforeNextStep: async () => { onBeforeNextStep: async () => {
await submit(); await submit();
} }
@ -277,8 +285,6 @@ onMounted(async () => {
today.value.setHours(0, 0, 0, 0); today.value.setHours(0, 0, 0, 0);
if (route.params.id) { if (route.params.id) {
notify(t('rememberReconfiguringImpact'), 'warning');
const [order] = await jApi.query( const [order] = await jApi.query(
`SELECT m.code deliveryMethod, o.sent, o.agencyModeFk, o.addressFk `SELECT m.code deliveryMethod, o.sent, o.agencyModeFk, o.addressFk
FROM myOrder o FROM myOrder o
@ -326,7 +332,7 @@ onMounted(async () => {
v-if="step.name === 'method'" v-if="step.name === 'method'"
class="column justify-center items-center" class="column justify-center items-center"
> >
<span class="text-h6 text-bold tex q-mb-md text-center"> <span class="text-h6 step-title">
{{ t('receiveOrPickOrder') }} {{ t('receiveOrPickOrder') }}
</span> </span>
<div class="column" style="max-width: max-content"> <div class="column" style="max-width: max-content">
@ -347,20 +353,31 @@ onMounted(async () => {
v-if="step.name === 'date'" v-if="step.name === 'date'"
class="flex justify-center items-center" class="flex justify-center items-center"
> >
<span class="text-h6 text-bold tex q-mb-md text-center"> <span class="text-h6 step-title">
{{ t('orderDateDelivery') }} {{ t('orderDateDelivery') }}
</span> </span>
<QDate <QDate
v-model="orderForm.date" v-model="orderForm.date"
class="margin-auto" class="margin-auto"
color="accent" color="accent"
:locale="localeDates"
first-day-of-week="1"
/> />
</div> </div>
<!-- Address step --> <!-- Address step -->
<QList <QList
v-if="step.name === 'address'" v-if="step.name === 'address'"
class="vn-w-xs q-gutter-y-sm" class="vn-w-xs q-gutter-y-sm column"
> >
<span class="text-h6 step-title">
{{
t(
orderForm.method === 'PICKUP'
? 'addressStepQuestionPickup'
: 'addressStepQuestion'
)
}}
</span>
<QItem <QItem
v-for="(address, index) in addresses" v-for="(address, index) in addresses"
:key="index" :key="index"
@ -386,8 +403,8 @@ onMounted(async () => {
v-if="step.name === 'agency'" v-if="step.name === 'agency'"
class="flex justify-center items-center" class="flex justify-center items-center"
> >
<span class="text-h6 text-bold tex q-mb-md text-center"> <span class="text-h6 step-title">
{{ t('orderDateDelivery') }} {{ t('howDoYouWantToReceive') }}
</span> </span>
<VnSelect <VnSelect
v-model="orderForm.agency" v-model="orderForm.agency"
@ -400,7 +417,7 @@ onMounted(async () => {
v-if="step.name === 'pickup'" v-if="step.name === 'pickup'"
class="flex justify-center items-center" class="flex justify-center items-center"
> >
<span class="text-h6 text-bold tex q-mb-md text-center"> <span class="text-h6 step-title">
{{ t('pickupWarehouse') }} {{ t('pickupWarehouse') }}
</span> </span>
<VnSelect <VnSelect
@ -415,7 +432,7 @@ onMounted(async () => {
v-if="step.name === 'confirm'" v-if="step.name === 'confirm'"
class="flex column justify-center items-center" class="flex column justify-center items-center"
> >
<span class="text-h6 text-bold tex q-mb-md text-center"> <span class="text-h6 step-title">
{{ t('confirmData') }} {{ t('confirmData') }}
</span> </span>
<div class="column vn-w-xs full-width"> <div class="column vn-w-xs full-width">
@ -431,14 +448,14 @@ onMounted(async () => {
flat flat
color="primary" color="primary"
@click="onPreviousStep(stepIndex)" @click="onPreviousStep(stepIndex)"
label="Back" :label="step.backButtonLabel || t('back')"
class="q-ml-sm" class="q-ml-sm"
:class="{ invisible: currentStep === 'method' }" :class="{ invisible: currentStep === 'method' }"
/> />
<QBtn <QBtn
@click="onNextStep(stepIndex)" @click="onNextStep(stepIndex)"
color="primary" color="primary"
label="next" :label="step.nextButtonLabel || t('next')"
/> />
</QStepperNavigation> </QStepperNavigation>
</QStep> </QStep>
@ -446,7 +463,14 @@ onMounted(async () => {
</QPage> </QPage>
</template> </template>
<style lang="scss" scoped></style> <style lang="scss" scoped>
.step-title {
min-width: 100%;
margin-bottom: 16px;
text-align: center;
font-weight: bold;
}
</style>
<i18n lang="yaml"> <i18n lang="yaml">
en-US: en-US:
@ -468,7 +492,8 @@ en-US:
pleaseSelectAWarehouse: Please select a store pleaseSelectAWarehouse: Please select a store
warehouse: Warehouse warehouse: Warehouse
pickup: Pickup 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: es-ES:
receiveOrPickOrder: ¿Quieres recibir o recoger el pedido? receiveOrPickOrder: ¿Quieres recibir o recoger el pedido?
receiveOrder: Recibir en mi tienda receiveOrder: Recibir en mi tienda
@ -488,7 +513,8 @@ es-ES:
pleaseSelectAWarehouse: Por favor elige un almacén pleaseSelectAWarehouse: Por favor elige un almacén
warehouse: Almacén warehouse: Almacén
pickup: Recogida 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: ca-ES:
receiveOrPickOrder: Vols rebre o recollir la comanda? receiveOrPickOrder: Vols rebre o recollir la comanda?
receiveOrder: Rebre en mi tenda receiveOrder: Rebre en mi tenda
@ -508,7 +534,8 @@ ca-ES:
pleaseSelectAWarehouse: Si us plau tria un magatzem pleaseSelectAWarehouse: Si us plau tria un magatzem
warehouse: Magatzem warehouse: Magatzem
pickup: Recollida 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: fr-FR:
receiveOrPickOrder: Voulez-vous recevoir ou récuperer l'ordre? receiveOrPickOrder: Voulez-vous recevoir ou récuperer l'ordre?
receiveOrder: Livraison à la boutique receiveOrder: Livraison à la boutique
@ -528,12 +555,14 @@ fr-FR:
pleaseSelectAWarehouse: Veuillez choisir un entrepôt pleaseSelectAWarehouse: Veuillez choisir un entrepôt
warehouse: Entrepôt warehouse: Entrepôt
pickup: Retrait 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: pt-PT:
receiveOrPickOrder: Queres receber ou levantar a encomenda? receiveOrPickOrder: Queres receber ou levantar a encomenda?
receiveOrder: Receber na minha loja receiveOrder: Receber na minha loja
pickupInStore: Levantar no armazém pickupInStore: Levantar no armazém
orderDateDelivery: Como queres receber a encomenda? orderDateDelivery: Como queres receber a encomenda?
howDoYouWantToReceive: Como queres receber a encomenda?
confirmData: Confirme os dados confirmData: Confirme os dados
arrival: Chegada arrival: Chegada
orderUpdated: Encomenda actualizada orderUpdated: Encomenda actualizada
@ -547,5 +576,6 @@ pt-PT:
pleaseSelectAWarehouse: Por favor, escolha um armazém pleaseSelectAWarehouse: Por favor, escolha um armazém
warehouse: Armazém warehouse: Armazém
pickup: Recolhida 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)
</i18n> </i18n>

View File

@ -1,6 +1,7 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { jApi } from 'boot/axios'; import { jApi } from 'boot/axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import { i18n } from 'src/boot/i18n';
const { notify } = useNotify(); const { notify } = useNotify();
@ -13,7 +14,13 @@ export const useAppStore = defineStore('hedera', {
rightDrawerOpen: false, rightDrawerOpen: false,
isHeaderMounted: false, isHeaderMounted: false,
menuEssentialLinks: [], menuEssentialLinks: [],
basketOrderId: null basketOrderId: null,
localeDates: {
days: [],
months: [],
daysShort: [],
monthsShort: []
}
}), }),
actions: { actions: {
@ -48,8 +55,19 @@ export const useAppStore = defineStore('hedera', {
this.$patch({ imageUrl }); 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() { async init() {
this.getBasketOrderId(); this.getBasketOrderId();
this.getLocaleDates();
}, },
getBasketOrderId() { getBasketOrderId() {