forked from verdnatura/salix-front
perf: refs #7825 create bank entity
This commit is contained in:
parent
4b9588c189
commit
15f171da0f
|
@ -31,8 +31,8 @@ const countriesFilter = {
|
|||
|
||||
const countriesOptions = ref([]);
|
||||
|
||||
const onDataSaved = (formData, requestResponse) => {
|
||||
emit('onDataSaved', formData, requestResponse);
|
||||
const onDataSaved = (...args) => {
|
||||
emit('onDataSaved', ...args);
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
|
@ -29,6 +29,7 @@ const postcodesOptions = ref([]);
|
|||
|
||||
const user = useState().getUser();
|
||||
const defaultPayMethod = ref();
|
||||
const bankEntitiesRef = ref();
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -93,10 +94,11 @@ onBeforeMount(async () => {
|
|||
).data?.payMethodFk;
|
||||
});
|
||||
|
||||
const handleNewBankEntity = (response, formData) => {
|
||||
bankEntitiesOptions.value = [...bankEntitiesOptions.value, response];
|
||||
formData.bankEntityFk = response.id;
|
||||
};
|
||||
async function handleNewBankEntity(data, resp) {
|
||||
await bankEntitiesRef.value.fetch();
|
||||
data.bankEntityFk = resp.id;
|
||||
bankEntitiesOptions.value.push(resp);
|
||||
}
|
||||
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
|
@ -157,6 +159,7 @@ async function autofillBic(worker) {
|
|||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
ref="bankEntitiesRef"
|
||||
url="BankEntities"
|
||||
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
||||
auto-load
|
||||
|
@ -325,8 +328,7 @@ async function autofillBic(worker) {
|
|||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
@on-data-saved="
|
||||
(_, requestResponse) =>
|
||||
handleNewBankEntity(requestResponse, data)
|
||||
(_, resp) => handleNewBankEntity(data, resp)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue