refactor(CheckoutView): use salix for getAgencies
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
gitea/hedera-web/pipeline/pr-beta This commit looks good
Details
This commit is contained in:
parent
9e39809967
commit
e7f4ece0a7
|
@ -198,22 +198,25 @@ const getAddresses = async (clientFk) => {
|
|||
|
||||
const getAgencies = async () => {
|
||||
try {
|
||||
const { results } = await jApi.execQuery(
|
||||
`CALL vn.zone_getAgency(#address, #date);
|
||||
SELECT DISTINCT a.agencyModeFk id, a.description
|
||||
FROM tmp.zoneGetAgency a
|
||||
JOIN vn.deliveryMethod d
|
||||
ON d.id = a.deliveryMethodFk
|
||||
WHERE d.code IN ('AGENCY', 'DELIVERY')
|
||||
AND a.isVisible
|
||||
ORDER BY a.description;
|
||||
DROP TEMPORARY TABLE tmp.zoneGetAgency`,
|
||||
{
|
||||
address: orderForm.value.address,
|
||||
date: new Date(orderForm.value.date)
|
||||
}
|
||||
);
|
||||
agencies.value = results[1].data;
|
||||
const agenciesInZone = await api.get('Agencies/landsThatDay', {
|
||||
params: {
|
||||
addressFk: orderForm.value.address,
|
||||
landed: new Date(orderForm.value.date),
|
||||
}
|
||||
});
|
||||
const deliveryMethods = await api.get('DeliveryMethods');
|
||||
|
||||
const results = agenciesInZone.data
|
||||
.filter(agency => agency.isVisible)
|
||||
.map(agency => ({
|
||||
id: agency.agencyModeFk,
|
||||
description: agency.description,
|
||||
deliveryMethod: deliveryMethods.data.find(dm => dm.id === agency.deliveryMethodFk).code,
|
||||
}))
|
||||
.filter(agency => agency.deliveryMethod === 'AGENCY' || agency.deliveryMethod === 'DELIVERY')
|
||||
.toSorted((a, b) => a.description.localeCompare(b.description));
|
||||
|
||||
agencies.value = results;
|
||||
|
||||
if (agencies.value && agencies.value.length && defaultValues.value) {
|
||||
const found = agencies.value.find(
|
||||
|
|
Loading…
Reference in New Issue