Merge branch 'dev' into 7937-claimAgile

This commit is contained in:
Javi Gallego 2025-02-18 12:52:21 +01:00
commit 1a807c495f
11 changed files with 141 additions and 109 deletions

View File

@ -861,6 +861,7 @@ function cardClick(_, row) {
:key="index" :key="index"
:title="btn.title" :title="btn.title"
:icon="btn.icon" :icon="btn.icon"
data-cy="cardBtn"
class="q-pa-xs" class="q-pa-xs"
:class=" :class="
btn.isPrimary btn.isPrimary

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

@ -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

@ -2,6 +2,7 @@
import { onMounted, ref, computed, watch } from 'vue'; import { onMounted, ref, computed, watch } from 'vue';
import { QBtn } from 'quasar'; import { QBtn } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue'; import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue'; import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
@ -22,6 +23,8 @@ import VnPopup from 'src/components/common/VnPopup.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const { openReport } = usePrintService(); const { openReport } = usePrintService();
const route = useRoute();
const tableParams = ref();
const shippedFrom = ref(Date.vnNew()); const shippedFrom = ref(Date.vnNew());
const landedTo = ref(Date.vnNew()); const landedTo = ref(Date.vnNew());
@ -143,7 +146,7 @@ const columns = computed(() => [
sortable: true, sortable: true,
}, },
{ {
label: t('globals.pageTitles.supplier'), label: t('extraCommunity.cargoShip'),
field: 'cargoSupplierNickname', field: 'cargoSupplierNickname',
name: 'cargoSupplierNickname', name: 'cargoSupplierNickname',
align: 'left', align: 'left',
@ -171,7 +174,7 @@ const columns = computed(() => [
? value.reduce((sum, entry) => { ? value.reduce((sum, entry) => {
return sum + (entry.invoiceAmount || 0); return sum + (entry.invoiceAmount || 0);
}, 0) }, 0)
: 0 : 0,
), ),
}, },
{ {
@ -200,7 +203,7 @@ const columns = computed(() => [
sortable: true, sortable: true,
}, },
{ {
label: t('kg'), label: t('extraCommunity.kg'),
field: 'kg', field: 'kg',
name: 'kg', name: 'kg',
align: 'left', align: 'left',
@ -208,7 +211,7 @@ const columns = computed(() => [
sortable: true, sortable: true,
}, },
{ {
label: t('physicKg'), label: t('extraCommunity.physicKg'),
field: 'loadedKg', field: 'loadedKg',
name: 'loadedKg', name: 'loadedKg',
align: 'left', align: 'left',
@ -232,7 +235,7 @@ const columns = computed(() => [
sortable: true, sortable: true,
}, },
{ {
label: t('shipped'), label: t('extraCommunity.shipped'),
field: 'shipped', field: 'shipped',
name: 'shipped', name: 'shipped',
align: 'left', align: 'left',
@ -249,7 +252,7 @@ const columns = computed(() => [
sortable: true, sortable: true,
}, },
{ {
label: t('landed'), label: t('extraCommunity.landed'),
field: 'landed', field: 'landed',
name: 'landed', name: 'landed',
align: 'left', align: 'left',
@ -258,7 +261,7 @@ const columns = computed(() => [
format: (value) => toDate(value), format: (value) => toDate(value),
}, },
{ {
label: t('notes'), label: t('extraCommunity.notes'),
field: '', field: '',
name: 'notes', name: 'notes',
align: 'center', align: 'center',
@ -284,7 +287,7 @@ watch(
if (!arrayData.store.data) return; if (!arrayData.store.data) return;
onStoreDataChange(); onStoreDataChange();
}, },
{ deep: true, immediate: true } { deep: true, immediate: true },
); );
const openReportPdf = () => { const openReportPdf = () => {
@ -451,13 +454,24 @@ const getColor = (percentage) => {
for (const { value, className } of travelKgPercentages.value) for (const { value, className } of travelKgPercentages.value)
if (percentage > value) return className; if (percentage > value) return className;
}; };
const filteredEntries = (entries) => {
if (!tableParams?.value?.entrySupplierFk) return entries;
return entries?.filter(
(entry) => entry.supplierFk === tableParams?.value?.entrySupplierFk,
);
};
watch(route, () => {
tableParams.value = JSON.parse(route.query.table);
});
</script> </script>
<template> <template>
<VnSearchbar <VnSearchbar
data-key="ExtraCommunity" data-key="ExtraCommunity"
:limit="20" :limit="20"
:label="t('searchExtraCommunity')" :label="t('extraCommunity.searchExtraCommunity')"
/> />
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
@ -521,7 +535,7 @@ const getColor = (percentage) => {
? tableColumnComponents[col.name].event( ? tableColumnComponents[col.name].event(
rows[props.rowIndex][col.field], rows[props.rowIndex][col.field],
col.field, col.field,
props.rowIndex props.rowIndex,
) )
: {} : {}
" "
@ -546,7 +560,7 @@ const getColor = (percentage) => {
}, },
{ {
link: ['id', 'cargoSupplierNickname'].includes( link: ['id', 'cargoSupplierNickname'].includes(
col.name col.name,
), ),
}, },
]" ]"
@ -564,9 +578,8 @@ const getColor = (percentage) => {
</component> </component>
</QTd> </QTd>
</QTr> </QTr>
<QTr <QTr
v-for="(entry, index) in props.row.entries" v-for="(entry, index) in filteredEntries(props.row.entries)"
:key="index" :key="index"
:props="props" :props="props"
class="bg-vn-secondary-row cursor-pointer" class="bg-vn-secondary-row cursor-pointer"
@ -598,7 +611,7 @@ const getColor = (percentage) => {
name="warning" name="warning"
color="negative" color="negative"
size="md" size="md"
:title="t('requiresInspection')" :title="t('extraCommunity.requiresInspection')"
> >
</QIcon> </QIcon>
</QTd> </QTd>
@ -709,24 +722,3 @@ const getColor = (percentage) => {
width: max-content; width: max-content;
} }
</style> </style>
<i18n>
en:
searchExtraCommunity: Search for extra community shipping
kg: BI. KG
physicKg: Phy. KG
shipped: W. shipped
landed: W. landed
requiresInspection: Requires inspection
BIP: Boder Inspection Point
notes: Notes
es:
searchExtraCommunity: Buscar por envío extra comunitario
kg: KG Bloq.
physicKg: KG físico
shipped: F. envío
landed: F. llegada
notes: Notas
Open as PDF: Abrir como PDF
requiresInspection: Requiere inspección
BIP: Punto de Inspección Fronteriza
</i18n>

View File

@ -79,7 +79,7 @@ warehouses();
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`extraCommunity.filter.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
</div> </div>
</template> </template>
@ -92,7 +92,7 @@ warehouses();
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
:label="t('params.reference')" :label="t('extraCommunity.filter.reference')"
v-model="params.reference" v-model="params.reference"
is-outlined is-outlined
/> />
@ -103,7 +103,7 @@ warehouses();
<QInput <QInput
v-model="params.totalEntries" v-model="params.totalEntries"
type="number" type="number"
:label="t('params.totalEntries')" :label="t('extraCommunity.filter.totalEntries')"
dense dense
outlined outlined
rounded rounded
@ -133,10 +133,10 @@ warehouses();
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('params.agencyModeFk')" :label="t('extraCommunity.filter.agencyModeFk')"
v-model="params.agencyModeFk" v-model="params.agencyModeFk"
:options="agenciesOptions" :options="agenciesOptions"
option-value="agencyFk" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected
dense dense
@ -148,7 +148,7 @@ warehouses();
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
:label="t('params.shippedFrom')" :label="t('extraCommunity.filter.shippedFrom')"
v-model="params.shippedFrom" v-model="params.shippedFrom"
@update:model-value="searchFn()" @update:model-value="searchFn()"
is-outlined is-outlined
@ -158,7 +158,7 @@ warehouses();
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
:label="t('params.landedTo')" :label="t('extraCommunity.filter.landedTo')"
v-model="params.landedTo" v-model="params.landedTo"
@update:model-value="searchFn()" @update:model-value="searchFn()"
is-outlined is-outlined
@ -168,7 +168,7 @@ warehouses();
<QItem v-if="warehousesByContinent[params.continent]"> <QItem v-if="warehousesByContinent[params.continent]">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('params.warehouseOutFk')" :label="t('extraCommunity.filter.warehouseOutFk')"
v-model="params.warehouseOutFk" v-model="params.warehouseOutFk"
:options="warehousesByContinent[params.continent]" :options="warehousesByContinent[params.continent]"
option-value="id" option-value="id"
@ -183,7 +183,7 @@ warehouses();
<QItem v-else> <QItem v-else>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('params.warehouseOutFk')" :label="t('extraCommunity.filter.warehouseOutFk')"
v-model="params.warehouseOutFk" v-model="params.warehouseOutFk"
:options="warehousesOptions" :options="warehousesOptions"
option-value="id" option-value="id"
@ -198,7 +198,7 @@ warehouses();
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('params.warehouseInFk')" :label="t('extraCommunity.filter.warehouseInFk')"
v-model="params.warehouseInFk" v-model="params.warehouseInFk"
:options="warehousesOptions" :options="warehousesOptions"
option-value="id" option-value="id"
@ -213,6 +213,7 @@ warehouses();
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelectSupplier <VnSelectSupplier
:label="t('extraCommunity.cargoShip')"
v-model="params.cargoSupplierFk" v-model="params.cargoSupplierFk"
hide-selected hide-selected
dense dense
@ -221,10 +222,21 @@ warehouses();
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem>
<QItemSection>
<VnSelectSupplier
v-model="params.entrySupplierFk"
hide-selected
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('params.continent')" :label="t('extraCommunity.filter.continent')"
v-model="params.continent" v-model="params.continent"
:options="continentsOptions" :options="continentsOptions"
option-value="code" option-value="code"
@ -240,30 +252,3 @@ warehouses();
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
<i18n>
en:
params:
id: Id
reference: Reference
totalEntries: Total entries
agencyModeFk: Agency
warehouseInFk: Warehouse In
warehouseOutFk: Warehouse Out
shippedFrom: Shipped from
landedTo: Landed to
cargoSupplierFk: Supplier
continent: Continent out
es:
params:
id: Id
reference: Referencia
totalEntries: Ent. totales
agencyModeFk: Agencia
warehouseInFk: Alm. entrada
warehouseOutFk: Alm. salida
shippedFrom: Llegada desde
landedTo: Llegada hasta
cargoSupplierFk: Proveedor
continent: Cont. Salida
</i18n>

View File

@ -0,0 +1,22 @@
extraCommunity:
cargoShip: Cargo ship
searchExtraCommunity: Search for extra community shipping
kg: BI. KG
physicKg: Phy. KG
shipped: W. shipped
landed: W. landed
requiresInspection: Requires inspection
BIP: Boder Inspection Point
notes: Notes
filter:
id: Id
reference: Reference
totalEntries: Total entries
agencyModeFk: Agency
warehouseInFk: Warehouse In
warehouseOutFk: Warehouse Out
shippedFrom: Shipped from
landedTo: Landed to
cargoSupplierFk: Cargo supplier
continent: Continent out
entrySupplierFk: Supplier

View File

@ -0,0 +1,23 @@
extraCommunity:
cargoShip: Carguera
searchExtraCommunity: Buscar por envío extra comunitario
kg: KG Bloq.
physicKg: KG físico
shipped: F. envío
landed: F. llegada
notes: Notas
Open as PDF: Abrir como PDF
requiresInspection: Requiere inspección
BIP: Punto de Inspección Fronteriza
filter:
id: Id
reference: Referencia
totalEntries: Ent. totales
agencyModeFk: Agencia
warehouseInFk: Alm. entrada
warehouseOutFk: Alm. salida
shippedFrom: Llegada desde
landedTo: Llegada hasta
cargoSupplierFk: Carguera
continent: Cont. Salida
entrySupplierFk: Proveedor

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

@ -8,11 +8,9 @@ describe('EntryMy when is supplier', () => {
}, },
}); });
}); });
it('should open buyLabel when is supplier', () => { it('should open buyLabel when is supplier', () => {
cy.get( cy.dataCy('cardBtn').eq(2).click();
'[to="/null/3"] > .q-card > :nth-child(2) > .q-btn > .q-btn__content > .q-icon'
).click();
cy.dataCy('printLabelsBtn').click(); cy.dataCy('printLabelsBtn').click();
cy.window().its('open').should('be.called'); cy.window().its('open').should('be.called');
}); });