feat: refs #8828 add warehouse filtering for tickets and travels #1678
|
@ -156,6 +156,11 @@ const selectTravel = ({ id }) => {
|
|||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.warehouseOutFk"
|
||||
:where="{
|
||||
isOrigin: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('globals.warehouseIn')"
|
||||
|
@ -164,6 +169,11 @@ const selectTravel = ({ id }) => {
|
|||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.warehouseInFk"
|
||||
:where="{
|
||||
isDestiny: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('globals.shipped')"
|
||||
|
|
|
@ -40,6 +40,11 @@ const onDataSaved = (data) => {
|
|||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
:where="{
|
||||
isInventory: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
<FormModelPopup
|
||||
url-create="Items/regularize"
|
||||
|
|
|
@ -162,6 +162,11 @@ const entryFilterPanel = ref();
|
|||
v-model="params.warehouseOutFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="Warehouses"
|
||||
:where="{
|
||||
isOrigin: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
hide-selected
|
||||
|
@ -177,6 +182,11 @@ const entryFilterPanel = ref();
|
|||
v-model="params.warehouseInFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="Warehouses"
|
||||
:where="{
|
||||
isDestiny: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
hide-selected
|
||||
|
|
|
@ -239,6 +239,11 @@ async function getZone(options) {
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
|
|
|
@ -46,7 +46,16 @@ const setUserParams = (params) => {
|
|||
</script>
|
||||
|
||||
<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
|
||||
url="ItemCategories"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||
|
|
|
@ -51,6 +51,11 @@ onMounted(async () => await getItemPackingTypes());
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel
|
||||
|
|
|
@ -67,14 +67,12 @@ const onClientSelected = async (formData) => {
|
|||
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
const response= await getAgencies(formData, selectedClient.value);
|
||||
const response = await getAgencies(formData, selectedClient.value);
|
||||
if (!response) return;
|
||||
|
||||
const { options, agency } = response
|
||||
if(options)
|
||||
agenciesOptions.value = options;
|
||||
if(agency)
|
||||
formData.agencyModeId = agency;
|
||||
|
||||
const { options, agency } = response;
|
||||
if (options) agenciesOptions.value = options;
|
||||
if (agency) formData.agencyModeId = agency;
|
||||
};
|
||||
|
||||
const redirectToTicketList = (_, { id }) => {
|
||||
|
@ -92,6 +90,11 @@ const redirectToTicketList = (_, { id }) => {
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
order="name"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -40,7 +40,7 @@ onBeforeMount(async () => {
|
|||
|
||||
function resetAgenciesSelector(formData) {
|
||||
agenciesOptions.value = [];
|
||||
if(formData) formData.agencyModeId = null;
|
||||
if (formData) formData.agencyModeId = null;
|
||||
}
|
||||
|
||||
const fetchClient = async (formData) => {
|
||||
|
@ -67,14 +67,12 @@ const onClientSelected = async (formData) => {
|
|||
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
const response= await getAgencies(formData, selectedClient.value);
|
||||
const response = await getAgencies(formData, selectedClient.value);
|
||||
if (!response) return;
|
||||
|
||||
const { options, agency } = response
|
||||
if(options)
|
||||
agenciesOptions.value = options;
|
||||
if(agency)
|
||||
formData.agencyModeId = agency;
|
||||
|
||||
const { options, agency } = response;
|
||||
if (options) agenciesOptions.value = options;
|
||||
if (agency) formData.agencyModeId = agency;
|
||||
};
|
||||
|
||||
const redirectToTicketList = (_, { id }) => {
|
||||
|
@ -86,6 +84,11 @@ const redirectToTicketList = (_, { id }) => {
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
order="name"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -41,7 +41,16 @@ const groupedStates = ref([]);
|
|||
@on-fetch="(data) => (agencies = data)"
|
||||
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"
|
||||
|
|
|
@ -55,6 +55,11 @@ onMounted(async () => {
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel
|
||||
|
|
|
@ -202,6 +202,11 @@ const columns = computed(() => [
|
|||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
where: {
|
||||
isForTicket: {
|
||||
neq: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
format: (row) => row.warehouse,
|
||||
columnField: {
|
||||
|
@ -668,9 +673,13 @@ function setReference(data) {
|
|||
:sort-by="['name']"
|
||||
:label="t('globals.warehouse')"
|
||||
v-model="data.warehouseId"
|
||||
:options="warehousesOptions"
|
||||
hide-selected
|
||||
required
|
||||
:where="{
|
||||
isForTicket: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -102,6 +102,9 @@ const columns = computed(() => [
|
|||
attrs: {
|
||||
url: 'Warehouses',
|
||||
fields: ['id', 'name'],
|
||||
where: {
|
||||
isForTicket: { neq: 0 },
|
||||
},
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
|
|
|
@ -208,6 +208,7 @@ ticketList:
|
|||
hour: Hour
|
||||
rounding: Rounding
|
||||
noVerifiedData: No verified data
|
||||
warehouse: Warehouse
|
||||
purchaseRequest: Purchase request
|
||||
notVisible: Not visible
|
||||
clientFrozen: Client frozen
|
||||
|
|
|
@ -28,13 +28,21 @@ const warehousesOptionsIn = ref([]);
|
|||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptionsOut = data)"
|
||||
auto-load
|
||||
:filter="{ where: { isOrigin: TRUE } }"
|
||||
:where="{
|
||||
isOrigin: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptionsIn = data)"
|
||||
auto-load
|
||||
:filter="{ where: { isDestiny: TRUE } }"
|
||||
:where="{
|
||||
isDestiny: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
<FormModel :url-update="`Travels/${route.params.id}`" model="Travel">
|
||||
<template #form="{ data }">
|
||||
|
|
|
@ -183,7 +183,9 @@ warehouses();
|
|||
<VnSelect
|
||||
:label="t('extraCommunity.filter.warehouseOutFk')"
|
||||
v-model="params.warehouseOutFk"
|
||||
:options="warehousesOptions"
|
||||
:options="
|
||||
warehousesOptions.filter((option) => option.isOrigin !== 0)
|
||||
"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -197,7 +199,9 @@ warehouses();
|
|||
<VnSelect
|
||||
:label="t('extraCommunity.filter.warehouseInFk')"
|
||||
v-model="params.warehouseInFk"
|
||||
:options="warehousesOptions"
|
||||
:options="
|
||||
warehousesOptions.filter((option) => option.isDestiny !== 0)
|
||||
"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
|
|
@ -81,6 +81,11 @@ const redirectToTravelBasicData = (_, { id }) => {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
:where="{
|
||||
isOrigin: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('globals.warehouseIn')"
|
||||
|
@ -89,6 +94,11 @@ const redirectToTravelBasicData = (_, { id }) => {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
:where="{
|
||||
isDestiny: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
|
|
@ -64,6 +64,11 @@ defineExpose({ states });
|
|||
option-filter="name"
|
||||
dense
|
||||
filled
|
||||
:where="{
|
||||
isDestiny: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('travel.shipped')"
|
||||
|
@ -89,6 +94,11 @@ defineExpose({ states });
|
|||
option-filter="name"
|
||||
dense
|
||||
filled
|
||||
:where="{
|
||||
isOrigin: {
|
||||
neq: 0,
|
||||
},
|
||||
}"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('travel.landed')"
|
||||
|
|
|
@ -99,6 +99,7 @@ const columns = computed(() => [
|
|||
fields: ['id', 'name'],
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
where: { isDestiny: { neq: 0 } },
|
||||
},
|
||||
format: (row) => row.warehouseInName,
|
||||
columnField: {
|
||||
|
@ -133,6 +134,7 @@ const columns = computed(() => [
|
|||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
where: { isOrigin: { neq: 0 } },
|
||||
},
|
||||
format: (row) => row.warehouseOutName,
|
||||
columnField: {
|
||||
|
|
|
@ -76,16 +76,13 @@ describe('TicketList', () => {
|
|||
});
|
||||
}).as('ticket');
|
||||
|
||||
cy.get('[data-cy="Warehouse_select"]').type('Warehouse Five');
|
||||
cy.get('.q-menu .q-item').contains('Warehouse Five').click();
|
||||
cy.get('[data-cy="Warehouse_select"]').type('Warehouse One');
|
||||
cy.get('.q-menu .q-item').contains('Warehouse One').click();
|
||||
cy.wait('@ticket').then((interception) => {
|
||||
const data = interception.response.body[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-unavailable').should('exist');
|
||||
cy.get('.icon-isTooLittle').should('exist');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue