Merge pull request 'feat: refs #8828 add warehouse filtering for tickets and travels' (!1678) from 8828-filterVnSelectWarehouses into dev
gitea/salix-front/pipeline/head This commit looks good Details

Reviewed-on: #1678
Reviewed-by: Pablo Natek <pablone@verdnatura.es>
This commit is contained in:
Benjamin Esteve 2025-04-23 07:19:41 +00:00
commit adfd9eba6f
19 changed files with 103 additions and 29 deletions

View File

@ -156,6 +156,9 @@ const selectTravel = ({ id }) => {
option-label="name" option-label="name"
option-value="id" option-value="id"
v-model="travelFilterParams.warehouseOutFk" v-model="travelFilterParams.warehouseOutFk"
:where="{
isOrigin: true,
}"
/> />
<VnSelect <VnSelect
:label="t('globals.warehouseIn')" :label="t('globals.warehouseIn')"
@ -164,6 +167,9 @@ const selectTravel = ({ id }) => {
option-label="name" option-label="name"
option-value="id" option-value="id"
v-model="travelFilterParams.warehouseInFk" v-model="travelFilterParams.warehouseInFk"
:where="{
isDestiny: true,
}"
/> />
<VnInputDate <VnInputDate
:label="t('globals.shipped')" :label="t('globals.shipped')"

View File

@ -40,6 +40,9 @@ const onDataSaved = (data) => {
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
auto-load auto-load
:where="{
isInventory: true,
}"
/> />
<FormModelPopup <FormModelPopup
url-create="Items/regularize" url-create="Items/regularize"

View File

@ -162,6 +162,9 @@ const entryFilterPanel = ref();
v-model="params.warehouseOutFk" v-model="params.warehouseOutFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
url="Warehouses" url="Warehouses"
:where="{
isOrigin: true,
}"
:fields="['id', 'name']" :fields="['id', 'name']"
sort-by="name ASC" sort-by="name ASC"
hide-selected hide-selected
@ -177,6 +180,9 @@ const entryFilterPanel = ref();
v-model="params.warehouseInFk" v-model="params.warehouseInFk"
@update:model-value="searchFn()" @update:model-value="searchFn()"
url="Warehouses" url="Warehouses"
:where="{
isDestiny: true,
}"
:fields="['id', 'name']" :fields="['id', 'name']"
sort-by="name ASC" sort-by="name ASC"
hide-selected hide-selected

View File

@ -239,6 +239,9 @@ async function getZone(options) {
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
auto-load auto-load
/> />
<FetchData <FetchData

View File

@ -47,7 +47,14 @@ const setUserParams = (params) => {
</script> </script>
<template> <template>
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load /> <FetchData
url="Warehouses"
@on-fetch="(data) => (warehouses = data)"
:where="{
isForTicket: true,
}"
auto-load
/>
<FetchData <FetchData
url="ItemCategories" url="ItemCategories"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }" :filter="{ fields: ['id', 'name'], order: 'name ASC' }"

View File

@ -51,6 +51,9 @@ onMounted(async () => await getItemPackingTypes());
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
auto-load auto-load
/> />
<VnFilterPanel <VnFilterPanel

View File

@ -70,11 +70,9 @@ const fetchAvailableAgencies = async (formData) => {
const response = await getAgencies(formData, selectedClient.value); const response = await getAgencies(formData, selectedClient.value);
if (!response) return; if (!response) return;
const { options, agency } = response const { options, agency } = response;
if(options) if (options) agenciesOptions.value = options;
agenciesOptions.value = options; if (agency) formData.agencyModeId = agency;
if(agency)
formData.agencyModeId = agency;
}; };
const redirectToTicketList = (_, { id }) => { const redirectToTicketList = (_, { id }) => {
@ -92,6 +90,9 @@ const redirectToTicketList = (_, { id }) => {
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
order="name" order="name"
auto-load auto-load
/> />

View File

@ -70,11 +70,9 @@ const fetchAvailableAgencies = async (formData) => {
const response = await getAgencies(formData, selectedClient.value); const response = await getAgencies(formData, selectedClient.value);
if (!response) return; if (!response) return;
const { options, agency } = response const { options, agency } = response;
if(options) if (options) agenciesOptions.value = options;
agenciesOptions.value = options; if (agency) formData.agencyModeId = agency;
if(agency)
formData.agencyModeId = agency;
}; };
const redirectToTicketList = (_, { id }) => { const redirectToTicketList = (_, { id }) => {
@ -86,6 +84,9 @@ const redirectToTicketList = (_, { id }) => {
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
order="name" order="name"
auto-load auto-load
/> />

View File

@ -41,8 +41,19 @@ const groupedStates = ref([]);
@on-fetch="(data) => (agencies = data)" @on-fetch="(data) => (agencies = data)"
auto-load auto-load
/> />
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load /> <FetchData
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> url="Warehouses"
@on-fetch="(data) => (warehouses = data)"
auto-load
:where="{
isForTicket: true,
}"
/>
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:unremovableParams="['from', 'to']"
>
<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(`params.${tag.label}`) }}: </strong>

View File

@ -55,6 +55,9 @@ onMounted(async () => {
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: true,
}"
auto-load auto-load
/> />
<VnFilterPanel <VnFilterPanel

View File

@ -204,6 +204,9 @@ const columns = computed(() => [
attrs: { attrs: {
url: 'warehouses', url: 'warehouses',
fields: ['id', 'name'], fields: ['id', 'name'],
where: {
isForTicket: true,
},
}, },
format: (row) => row.warehouse, format: (row) => row.warehouse,
columnField: { columnField: {
@ -670,9 +673,11 @@ function setReference(data) {
:sort-by="['name']" :sort-by="['name']"
:label="t('globals.warehouse')" :label="t('globals.warehouse')"
v-model="data.warehouseId" v-model="data.warehouseId"
:options="warehousesOptions"
hide-selected hide-selected
required required
:where="{
isForTicket: true,
}"
@update:model-value="() => fetchAvailableAgencies(data)" @update:model-value="() => fetchAvailableAgencies(data)"
/> />
</div> </div>

View File

@ -102,6 +102,9 @@ const columns = computed(() => [
attrs: { attrs: {
url: 'Warehouses', url: 'Warehouses',
fields: ['id', 'name'], fields: ['id', 'name'],
where: {
isForTicket: true,
},
}, },
inWhere: true, inWhere: true,
}, },

View File

@ -208,6 +208,7 @@ ticketList:
hour: Hour hour: Hour
rounding: Rounding rounding: Rounding
noVerifiedData: No verified data noVerifiedData: No verified data
warehouse: Warehouse
purchaseRequest: Purchase request purchaseRequest: Purchase request
notVisible: Not visible notVisible: Not visible
clientFrozen: Client frozen clientFrozen: Client frozen

View File

@ -28,13 +28,17 @@ const warehousesOptionsIn = ref([]);
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptionsOut = data)" @on-fetch="(data) => (warehousesOptionsOut = data)"
auto-load auto-load
:filter="{ where: { isOrigin: TRUE } }" :where="{
isOrigin: true,
}"
/> />
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptionsIn = data)" @on-fetch="(data) => (warehousesOptionsIn = data)"
auto-load auto-load
:filter="{ where: { isDestiny: TRUE } }" :where="{
isDestiny: true,
}"
/> />
<FormModel :url-update="`Travels/${route.params.id}`" model="Travel"> <FormModel :url-update="`Travels/${route.params.id}`" model="Travel">
<template #form="{ data }"> <template #form="{ data }">

View File

@ -183,7 +183,9 @@ warehouses();
<VnSelect <VnSelect
:label="t('extraCommunity.filter.warehouseOutFk')" :label="t('extraCommunity.filter.warehouseOutFk')"
v-model="params.warehouseOutFk" v-model="params.warehouseOutFk"
:options="warehousesOptions" :options="
warehousesOptions.filter((option) => option.isOrigin === true)
"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected
@ -197,7 +199,11 @@ warehouses();
<VnSelect <VnSelect
:label="t('extraCommunity.filter.warehouseInFk')" :label="t('extraCommunity.filter.warehouseInFk')"
v-model="params.warehouseInFk" v-model="params.warehouseInFk"
:options="warehousesOptions" :options="
warehousesOptions.filter(
(option) => option.isDestiny === true,
)
"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected

View File

@ -81,6 +81,9 @@ const redirectToTravelBasicData = (_, { id }) => {
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected
:where="{
isOrigin: true,
}"
/> />
<VnSelect <VnSelect
:label="t('globals.warehouseIn')" :label="t('globals.warehouseIn')"
@ -89,6 +92,9 @@ const redirectToTravelBasicData = (_, { id }) => {
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected
:where="{
isDestiny: true,
}"
/> />
</VnRow> </VnRow>
</template> </template>

View File

@ -64,6 +64,9 @@ defineExpose({ states });
option-filter="name" option-filter="name"
dense dense
filled filled
:where="{
isDestiny: true,
}"
/> />
<VnInputDate <VnInputDate
:label="t('travel.shipped')" :label="t('travel.shipped')"
@ -89,6 +92,9 @@ defineExpose({ states });
option-filter="name" option-filter="name"
dense dense
filled filled
:where="{
isOrigin: true,
}"
/> />
<VnInputDate <VnInputDate
:label="t('travel.landed')" :label="t('travel.landed')"

View File

@ -99,6 +99,7 @@ const columns = computed(() => [
fields: ['id', 'name'], fields: ['id', 'name'],
optionLabel: 'name', optionLabel: 'name',
optionValue: 'id', optionValue: 'id',
where: { isDestiny: true },
}, },
format: (row) => row.warehouseInName, format: (row) => row.warehouseInName,
columnField: { columnField: {
@ -133,6 +134,7 @@ const columns = computed(() => [
attrs: { attrs: {
url: 'warehouses', url: 'warehouses',
fields: ['id', 'name'], fields: ['id', 'name'],
where: { isOrigin: true },
}, },
format: (row) => row.warehouseOutName, format: (row) => row.warehouseOutName,
columnField: { columnField: {

View File

@ -76,16 +76,13 @@ describe('TicketList', () => {
}); });
}).as('ticket'); }).as('ticket');
cy.get('[data-cy="Warehouse_select"]').type('Warehouse Five'); cy.get('[data-cy="Warehouse_select"]').type('Warehouse One');
cy.get('.q-menu .q-item').contains('Warehouse Five').click(); cy.get('.q-menu .q-item').contains('Warehouse One').click();
cy.wait('@ticket').then((interception) => { cy.wait('@ticket').then((interception) => {
const data = interception.response.body[1]; const data = interception.response.body[0];
expect(data.hasComponentLack).to.equal(1); expect(data.hasComponentLack).to.equal(1);
expect(data.isTooLittle).to.equal(1);
expect(data.hasItemShortage).to.equal(1);
}); });
cy.get('.icon-components').should('exist'); cy.get('.icon-components').should('exist');
cy.get('.icon-unavailable').should('exist'); cy.get('.icon-unavailable').should('exist');
cy.get('.icon-isTooLittle').should('exist');
}); });
}); });