feat: agency in ticketlist sort data

This commit is contained in:
Javier Segarra 2025-02-17 23:08:57 +01:00
parent 7f370dc29c
commit df794391ec
3 changed files with 19 additions and 9 deletions

View File

@ -1,11 +1,11 @@
import axios from 'axios'; import axios from 'axios';
import agency from 'src/router/modules/agency';
export async function getAgencies(formData, client, _filter = {}) { export async function getAgencies(formData, client, _filter = {}) {
if (!formData.warehouseId || !formData.addressId || !formData.landed) return; if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
const filter = { const filter = {
..._filter order: ['name ASC'],
..._filter,
}; };
let defaultAgency = null; let defaultAgency = null;
@ -18,9 +18,11 @@ export async function getAgencies(formData, client, _filter = {}) {
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params }); const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
if(data && client) { if (data && client) {
defaultAgency = data.find((agency) => agency.agencyModeFk === client.defaultAddress.agencyModeFk ); defaultAgency = data.find(
}; (agency) => agency.agencyModeFk === client.defaultAddress.agencyModeFk,
);
}
return {options: data, agency: defaultAgency} return { options: data, agency: defaultAgency };
} }

View File

@ -66,7 +66,12 @@ function validateDateRange(params) {
" "
auto-load auto-load
/> />
<FetchData url="AgencyModes" @on-fetch="(data) => (agencies = data)" auto-load /> <FetchData
url="AgencyModes"
:sort-by="['name ASC']"
@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 />
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"

View File

@ -651,6 +651,9 @@ watch(
{{ scope.opt?.city }} {{ scope.opt?.city }}
</span> </span>
</QItemLabel> </QItemLabel>
<QItemLabel caption>
{{ `#${scope.opt?.id}` }}
</QItemLabel>
</QItemSection> </QItemSection>
</QItem> </QItem>
</template> </template>