#5447 changed warehouse out filter #397
|
@ -36,24 +36,26 @@ const decrement = (paramsObj, key) => {
|
||||||
paramsObj[key]--;
|
paramsObj[key]--;
|
||||||
};
|
};
|
||||||
|
|
||||||
const warehouseAm = ref([]);
|
const warehousesAm = ref([]);
|
||||||
const warehouses = async () => {
|
const warehouses = async () => {
|
||||||
const warehouses = await axios.get('Warehouses');
|
const warehouses = await axios.get('Warehouses');
|
||||||
const countries = await axios.get('Countries');
|
const countries = await axios.get('Countries');
|
||||||
const continents = await axios.get('Continents');
|
const continents = await axios.get('Continents', {
|
||||||
|
params: {
|
||||||
|
filter: { where: { code: 'AM' } },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const countryContinent = countries.data.reduce((acc, c) => {
|
const countryContinent = countries.data.reduce((acc, c) => {
|
||||||
acc[c.id] = c.continentFk;
|
acc[c.id] = c.continentFk;
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const continentAMId = continents.data.find((continent) => continent.code === 'AM').id;
|
|
||||||
|
|
||||||
const countriesInAM = Object.keys(countryContinent).filter(
|
const countriesInAM = Object.keys(countryContinent).filter(
|
||||||
(countryId) => countryContinent[countryId] === continentAMId.toString()
|
(countryId) => countryContinent[countryId] === continents.data[0].id.toString()
|
||||||
);
|
);
|
||||||
|
|
||||||
warehouseAm.value = warehouses.data.filter((w) =>
|
warehousesAm.value = warehouses.data.filter((w) =>
|
||||||
countriesInAM.includes(w.countryFk.toString())
|
countriesInAM.includes(w.countryFk.toString())
|
||||||
jgallego marked this conversation as resolved
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -178,7 +180,7 @@ warehouses();
|
||||||
:label="t('params.warehouseOutFk')"
|
:label="t('params.warehouseOutFk')"
|
||||||
v-model="params.warehouseOutFk"
|
v-model="params.warehouseOutFk"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
:options="warehouseAm"
|
:options="warehousesAm"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
|
Loading…
Reference in New Issue
Consolelog?