Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8627-devToTest
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Alex Moreno 2025-02-18 10:34:56 +01:00
commit e514c9cf73
5 changed files with 37 additions and 36 deletions

View File

@ -38,23 +38,17 @@ onBeforeMount(async () => {
}
});
if (props.baseUrl) {
onBeforeRouteUpdate(async (to, from) => {
if (hasRouteParam(to.params)) {
const { matched } = router.currentRoute.value;
const { name } = matched.at(-3);
if (name) {
router.push({ name, params: to.params });
}
}
if (to.params.id !== from.params.id) {
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
await arrayData.fetch({ append: false, updateRouter: false });
}
});
}
function hasRouteParam(params, valueToCheck = ':addressId') {
return Object.values(params).includes(valueToCheck);
onBeforeRouteUpdate(async (to, from) => {
const id = to.params.id;
if (id !== from.params.id) await fetch(id, true);
});
async function fetch(id, append = false) {
const regex = /\/(\d+)/;
if (props.idInWhere) arrayData.store.filter.where = { id };
else if (!regex.test(props.url)) arrayData.store.url = `${props.url}/${id}`;
else arrayData.store.url = props.url.replace(regex, `/${id}`);
await arrayData.fetch({ append, updateRouter: false });
}
</script>
<template>

View File

@ -53,3 +53,8 @@ const manaCode = ref(props.manaCode);
/>
</div>
</template>
<i18n>
es:
Promotion mana: Maná promoción
Claim mana: Maná reclamación
</i18n>

View File

@ -47,7 +47,10 @@ const cancel = () => {
<div v-else>
<div class="header">Mana: {{ toCurrency(mana) }}</div>
<div class="q-pa-md">
<slot />
<slot :popup="QPopupProxyRef" />
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
<VnUsesMana :mana-code="manaCode" />
</div>
<div v-if="newPrice" class="column items-center q-mt-lg">
<span class="text-primary">{{ t('New price') }}</span>
<span class="text-subtitle1">
@ -56,9 +59,6 @@ const cancel = () => {
</div>
</div>
</div>
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
<VnUsesMana :mana-code="manaCode" />
</div>
<div class="row">
<QBtn
color="primary"

View File

@ -133,7 +133,7 @@ const columns = computed(() => [
align: 'left',
label: t('globals.amount'),
name: 'amount',
format: (row) => parseInt(row.amount * row.quantity),
format: (row) => toCurrency(getSaleTotal(row)),
},
{
align: 'left',
@ -331,8 +331,7 @@ const updateDiscount = async (sales, newDiscount = null) => {
};
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
notify('globals.dataSaved', 'positive');
for (let sale of sales) sale.discount = _newDiscount;
edit.value = { ...DEFAULT_EDIT };
tableRef.value.reload();
};
const getNewPrice = computed(() => {
@ -789,21 +788,24 @@ watch(
:mana-code="manaCode"
@save="changeDiscount(row)"
>
<VnInput
v-model.number="edit.discount"
:label="t('ticketSale.discount')"
type="number"
/>
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
<VnUsesMana :mana-code="manaCode" />
</div>
<template #default="{ popup }">
<VnInput
autofocus
@keyup.enter="
() => {
changeDiscount(row);
popup.hide();
}
"
v-model.number="edit.discount"
:label="t('ticketSale.discount')"
type="number"
/>
</template>
</TicketEditManaProxy>
</template>
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
</template>
<template #column-amount="{ row }">
{{ toCurrency(row.quantity * row.price) }}
</template>
</VnTable>
<QPageSticky :offset="[20, 20]" style="z-index: 2">

View File

@ -53,7 +53,7 @@ const showChangePasswordDialog = () => {
</QItemSection>
</QItem>
<QItem
v-if="!worker.user.emailVerified && user.id == worker.id"
v-if="!worker.user.emailVerified && user.id != worker.id"
v-ripple
clickable
@click="showChangePasswordDialog"