feat: refs #8828 add warehouse filtering for tickets and travels
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Benjamin Esteve 2025-04-03 12:25:11 +02:00
parent 6ef3df2322
commit 84dbf9691e
18 changed files with 133 additions and 22 deletions

View File

@ -156,6 +156,11 @@ 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: {
neq: 0,
},
}"
/> />
<VnSelect <VnSelect
:label="t('globals.warehouseIn')" :label="t('globals.warehouseIn')"
@ -164,6 +169,11 @@ 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: {
neq: 0,
},
}"
/> />
<VnInputDate <VnInputDate
:label="t('globals.shipped')" :label="t('globals.shipped')"

View File

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

View File

@ -162,6 +162,11 @@ 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: {
neq: 0,
},
}"
:fields="['id', 'name']" :fields="['id', 'name']"
sort-by="name ASC" sort-by="name ASC"
hide-selected hide-selected
@ -177,6 +182,11 @@ 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: {
neq: 0,
},
}"
:fields="['id', 'name']" :fields="['id', 'name']"
sort-by="name ASC" sort-by="name ASC"
hide-selected hide-selected

View File

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

View File

@ -46,7 +46,16 @@ 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: {
neq: 0,
},
}"
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,11 @@ onMounted(async () => await getItemPackingTypes());
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: {
neq: 0,
},
}"
auto-load auto-load
/> />
<VnFilterPanel <VnFilterPanel

View File

@ -67,14 +67,12 @@ const onClientSelected = async (formData) => {
const fetchAvailableAgencies = async (formData) => { const fetchAvailableAgencies = async (formData) => {
resetAgenciesSelector(formData); resetAgenciesSelector(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,11 @@ const redirectToTicketList = (_, { id }) => {
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: {
neq: 0,
},
}"
order="name" order="name"
auto-load auto-load
/> />

View File

@ -40,7 +40,7 @@ onBeforeMount(async () => {
function resetAgenciesSelector(formData) { function resetAgenciesSelector(formData) {
agenciesOptions.value = []; agenciesOptions.value = [];
if(formData) formData.agencyModeId = null; if (formData) formData.agencyModeId = null;
} }
const fetchClient = async (formData) => { const fetchClient = async (formData) => {
@ -67,14 +67,12 @@ const onClientSelected = async (formData) => {
const fetchAvailableAgencies = async (formData) => { const fetchAvailableAgencies = async (formData) => {
resetAgenciesSelector(formData); resetAgenciesSelector(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,11 @@ const redirectToTicketList = (_, { id }) => {
<FetchData <FetchData
url="Warehouses" url="Warehouses"
@on-fetch="(data) => (warehousesOptions = data)" @on-fetch="(data) => (warehousesOptions = data)"
:where="{
isForTicket: {
neq: 0,
},
}"
order="name" order="name"
auto-load auto-load
/> />

View File

@ -41,7 +41,16 @@ 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
url="Warehouses"
@on-fetch="(data) => (warehouses = data)"
auto-load
:where="{
isForTicket: {
neq: 0,
},
}"
/>
<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">

View File

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

View File

@ -202,6 +202,11 @@ const columns = computed(() => [
attrs: { attrs: {
url: 'warehouses', url: 'warehouses',
fields: ['id', 'name'], fields: ['id', 'name'],
where: {
isForTicket: {
neq: 0,
},
},
}, },
format: (row) => row.warehouse, format: (row) => row.warehouse,
columnField: { columnField: {
@ -668,9 +673,13 @@ 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: {
neq: 0,
},
}"
@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: { neq: 0 },
},
}, },
inWhere: true, inWhere: true,
}, },

View File

@ -207,6 +207,7 @@ ticketList:
ref: Reference ref: Reference
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,21 @@ 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: {
neq: 0,
},
}"
/> />
<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: {
neq: 0,
},
}"
/> />
<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 !== 0)
"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected
@ -197,7 +199,9 @@ 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 !== 0)
"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected

View File

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

View File

@ -64,6 +64,11 @@ defineExpose({ states });
option-filter="name" option-filter="name"
dense dense
filled filled
:where="{
isDestiny: {
neq: 0,
},
}"
/> />
<VnInputDate <VnInputDate
:label="t('travel.shipped')" :label="t('travel.shipped')"
@ -89,6 +94,11 @@ defineExpose({ states });
option-filter="name" option-filter="name"
dense dense
filled filled
:where="{
isOrigin: {
neq: 0,
},
}"
/> />
<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: { neq: 0 } },
}, },
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: { neq: 0 } },
}, },
format: (row) => row.warehouseOutName, format: (row) => row.warehouseOutName,
columnField: { columnField: {