Merge branch 'dev' into warmFix_fixedMyEntryTest
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-02-18 11:28:37 +00:00
commit ea872ec246
9 changed files with 1755 additions and 1464 deletions

File diff suppressed because it is too large Load Diff

View File

@ -757,7 +757,7 @@ function cardClick(_, row) {
flat flat
dense dense
:class=" :class="
btn.isPrimary ? 'text-primary-light' : 'color-vn-text ' btn.isPrimary ? 'text-primary-light' : 'color-vn-label'
" "
:style="`visibility: ${ :style="`visibility: ${
((btn.show && btn.show(row)) ?? true) ((btn.show && btn.show(row)) ?? true)
@ -783,7 +783,7 @@ function cardClick(_, row) {
<QCardSection <QCardSection
vertical vertical
class="no-margin no-padding" class="no-margin no-padding"
:class="colsMap.tableActions ? 'w-80' : 'fit'" :class="colsMap.tableActions ? '' : 'fit'"
> >
<!-- Chips --> <!-- Chips -->
<QCardSection <QCardSection
@ -814,7 +814,7 @@ function cardClick(_, row) {
</QCardSection> </QCardSection>
<!-- Fields --> <!-- Fields -->
<QCardSection <QCardSection
class="q-pl-sm q-pr-lg q-py-xs" class="q-pl-sm q-py-xs"
:class="$props.cardClass" :class="$props.cardClass"
> >
<div <div
@ -822,11 +822,11 @@ function cardClick(_, row) {
col, index col, index
) of splittedColumns.cardVisible" ) of splittedColumns.cardVisible"
:key="col.name" :key="col.name"
class="fields"
> >
<VnLv :label="col.label + ':'"> <VnLv :label="col.label + ':'">
<template #value> <template #value>
<span <span
class="q-pl-xs"
@click="stopEventPropagation($event)" @click="stopEventPropagation($event)"
> >
<slot <slot
@ -863,12 +863,12 @@ function cardClick(_, row) {
:icon="btn.icon" :icon="btn.icon"
data-cy="cardBtn" data-cy="cardBtn"
class="q-pa-xs" class="q-pa-xs"
flat
:class=" :class="
btn.isPrimary btn.isPrimary
? 'text-primary-light' ? 'text-primary-light'
: 'color-vn-text ' : 'color-vn-label'
" "
flat
@click="btn.action(row)" @click="btn.action(row)"
/> />
</QCardSection> </QCardSection>
@ -1121,6 +1121,7 @@ es:
.vn-label-value { .vn-label-value {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center;
color: var(--vn-text-color); color: var(--vn-text-color);
.value { .value {
overflow: hidden; overflow: hidden;

View File

@ -38,20 +38,24 @@ onBeforeMount(async () => {
} }
}); });
if (props.baseUrl) { onBeforeRouteUpdate(async (to, from) => {
onBeforeRouteUpdate(async (to, from) => { if (hasRouteParam(to.params)) {
if (hasRouteParam(to.params)) { const { matched } = router.currentRoute.value;
const { matched } = router.currentRoute.value; const { name } = matched.at(-3);
const { name } = matched.at(-3); if (name) {
if (name) { router.push({ name, params: to.params });
router.push({ name, params: to.params });
}
} }
if (to.params.id !== from.params.id) { }
arrayData.store.url = `${props.baseUrl}/${to.params.id}`; const id = to.params.id;
await arrayData.fetch({ append: false, updateRouter: false }); 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 });
} }
function hasRouteParam(params, valueToCheck = ':addressId') { function hasRouteParam(params, valueToCheck = ':addressId') {
return Object.values(params).includes(valueToCheck); return Object.values(params).includes(valueToCheck);

View File

@ -10,7 +10,12 @@ const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
const $attrs = useAttrs(); const $attrs = useAttrs();
const { t } = useI18n(); const { t } = useI18n();
const { isRequired, requiredFieldRule } = useRequired($attrs); const isRequired = computed(() => {
return useRequired($attrs).isRequired;
});
const requiredFieldRule = computed(() => {
return useRequired($attrs).requiredFieldRule;
});
const $props = defineProps({ const $props = defineProps({
modelValue: { modelValue: {

View File

@ -53,3 +53,8 @@ const manaCode = ref(props.manaCode);
/> />
</div> </div>
</template> </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 v-else>
<div class="header">Mana: {{ toCurrency(mana) }}</div> <div class="header">Mana: {{ toCurrency(mana) }}</div>
<div class="q-pa-md"> <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"> <div v-if="newPrice" class="column items-center q-mt-lg">
<span class="text-primary">{{ t('New price') }}</span> <span class="text-primary">{{ t('New price') }}</span>
<span class="text-subtitle1"> <span class="text-subtitle1">
@ -56,9 +59,6 @@ const cancel = () => {
</div> </div>
</div> </div>
</div> </div>
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
<VnUsesMana :mana-code="manaCode" />
</div>
<div class="row"> <div class="row">
<QBtn <QBtn
color="primary" color="primary"

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue'; import { ref } from 'vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'src/components/FormModel.vue'; import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
@ -9,33 +9,23 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n(); const { t } = useI18n();
const agencyFilter = {
fields: ['id', 'name'],
order: 'name ASC',
limit: 30,
};
const agencyOptions = ref([]);
const validAddresses = ref([]); const validAddresses = ref([]);
const addresses = ref([]);
const filterWhere = computed(() => ({ const setFilteredAddresses = (data) => {
id: { inq: validAddresses.value.map((item) => item.addressFk) }, const validIds = new Set(validAddresses.value.map((item) => item.addressFk));
})); addresses.value = data.filter((address) => validIds.has(address.id));
};
</script> </script>
<template> <template>
<FetchData
:filter="agencyFilter"
@on-fetch="(data) => (agencyOptions = data)"
auto-load
url="AgencyModes/isActive"
/>
<FetchData <FetchData
url="RoadmapAddresses" url="RoadmapAddresses"
auto-load auto-load
@on-fetch="(data) => (validAddresses = data)" @on-fetch="(data) => (validAddresses = data)"
/> />
<FormModel :url="`Zones/${$route.params.id}`" auto-load data-key="Zone"> <FetchData url="Addresses" auto-load @on-fetch="setFilteredAddresses" />
<FormModel auto-load model="zone">
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow> <VnRow>
<VnInput <VnInput
@ -45,7 +35,6 @@ const filterWhere = computed(() => ({
v-model="data.name" v-model="data.name"
/> />
</VnRow> </VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
v-model="data.agencyModeFk" v-model="data.agencyModeFk"
@ -128,7 +117,7 @@ const filterWhere = computed(() => ({
v-model="data.addressFk" v-model="data.addressFk"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
url="Addresses" :options="addresses"
:fields="['id', 'nickname']" :fields="['id', 'nickname']"
sort-by="id" sort-by="id"
hide-selected hide-selected