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">
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
</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',
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?'
};

View File

@ -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?',

View File

@ -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?',

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',
at: 'à',
back: 'Retour',
next: 'Suivant',
remove: 'Effacer',
agency: 'Agence',
noData: 'Aucune donnée',
confirm: 'Confirmer',
delete: 'Effacer',
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',
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?'
};

View File

@ -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);
};
/**

View File

@ -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"
>
<span class="text-h6 text-bold tex q-mb-md text-center">
<span class="text-h6 step-title">
{{ t('receiveOrPickOrder') }}
</span>
<div class="column" style="max-width: max-content">
@ -347,20 +353,31 @@ onMounted(async () => {
v-if="step.name === 'date'"
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') }}
</span>
<QDate
v-model="orderForm.date"
class="margin-auto"
color="accent"
:locale="localeDates"
first-day-of-week="1"
/>
</div>
<!-- Address step -->
<QList
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
v-for="(address, index) in addresses"
:key="index"
@ -386,8 +403,8 @@ onMounted(async () => {
v-if="step.name === 'agency'"
class="flex justify-center items-center"
>
<span class="text-h6 text-bold tex q-mb-md text-center">
{{ t('orderDateDelivery') }}
<span class="text-h6 step-title">
{{ t('howDoYouWantToReceive') }}
</span>
<VnSelect
v-model="orderForm.agency"
@ -400,7 +417,7 @@ onMounted(async () => {
v-if="step.name === 'pickup'"
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') }}
</span>
<VnSelect
@ -415,7 +432,7 @@ onMounted(async () => {
v-if="step.name === 'confirm'"
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') }}
</span>
<div class="column vn-w-xs full-width">
@ -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' }"
/>
<QBtn
@click="onNextStep(stepIndex)"
color="primary"
label="next"
:label="step.nextButtonLabel || t('next')"
/>
</QStepperNavigation>
</QStep>
@ -446,7 +463,14 @@ onMounted(async () => {
</QPage>
</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">
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)
</i18n>

View File

@ -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() {