feat: revert changes and fix test
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
2c33205cdc
commit
0237a2364d
|
@ -22,6 +22,12 @@ describe('getAddresses', () => {
|
|||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['defaultAddressFk'],
|
||||
include: {
|
||||
relation: 'defaultAddress',
|
||||
scope: {
|
||||
fields: ['id', 'agencyModeFk'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -66,7 +66,7 @@ describe('getAgencies', () => {
|
|||
|
||||
it('should return options and agency when default agency is found', async () => {
|
||||
const formData = { warehouseId: '123', addressId: '456', landed: 'true' };
|
||||
const client = { agencyModeFk: 'Agency1' };
|
||||
const client = { defaultAddress: { agencyModeFk: 'Agency1' } };
|
||||
|
||||
const { options, agency } = await getAgencies(formData, client);
|
||||
|
||||
|
|
|
@ -21,7 +21,9 @@ export async function getAgencies(formData, client, _filter = {}) {
|
|||
});
|
||||
|
||||
if (options && client) {
|
||||
agency = options.find(({ agencyModeFk }) => agencyModeFk === client.agencyModeFk);
|
||||
agency = options.find(
|
||||
({ agencyModeFk }) => agencyModeFk === client.defaultAddress.agencyModeFk,
|
||||
);
|
||||
}
|
||||
|
||||
return { options, agency };
|
||||
|
|
|
@ -22,7 +22,6 @@ import { toTimeFormat } from 'src/filters/date';
|
|||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import { getClient } from 'src/pages/Customer/composables/getClient';
|
||||
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
|
||||
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
|
||||
|
||||
|
@ -272,7 +271,7 @@ const fetchAddresses = async (formData) => {
|
|||
formInitialData.value = { clientId: formData.clientId };
|
||||
if (!data) return;
|
||||
addressesOptions.value = data;
|
||||
selectedClient.value = { ...data[0].client, agencyModeFk: data[0].agencyModeFk };
|
||||
selectedClient.value = data[0].client;
|
||||
formData.addressId = selectedClient.value.defaultAddressFk;
|
||||
formInitialData.value.addressId = formData.addressId;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue