0
0
Fork 0

perf: refs #7825 create bank entity

This commit is contained in:
Jon Elias 2024-10-15 13:12:37 +02:00
parent 4b9588c189
commit 15f171da0f
2 changed files with 10 additions and 8 deletions

View File

@ -31,8 +31,8 @@ const countriesFilter = {
const countriesOptions = ref([]); const countriesOptions = ref([]);
const onDataSaved = (formData, requestResponse) => { const onDataSaved = (...args) => {
emit('onDataSaved', formData, requestResponse); emit('onDataSaved', ...args);
}; };
onMounted(async () => { onMounted(async () => {

View File

@ -29,6 +29,7 @@ const postcodesOptions = ref([]);
const user = useState().getUser(); const user = useState().getUser();
const defaultPayMethod = ref(); const defaultPayMethod = ref();
const bankEntitiesRef = ref();
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
@ -93,10 +94,11 @@ onBeforeMount(async () => {
).data?.payMethodFk; ).data?.payMethodFk;
}); });
const handleNewBankEntity = (response, formData) => { async function handleNewBankEntity(data, resp) {
bankEntitiesOptions.value = [...bankEntitiesOptions.value, response]; await bankEntitiesRef.value.fetch();
formData.bankEntityFk = response.id; data.bankEntityFk = resp.id;
}; bankEntitiesOptions.value.push(resp);
}
function handleLocation(data, location) { function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {}; const { town, code, provinceFk, countryFk } = location ?? {};
@ -157,6 +159,7 @@ async function autofillBic(worker) {
auto-load auto-load
/> />
<FetchData <FetchData
ref="bankEntitiesRef"
url="BankEntities" url="BankEntities"
@on-fetch="(data) => (bankEntitiesOptions = data)" @on-fetch="(data) => (bankEntitiesOptions = data)"
auto-load auto-load
@ -325,8 +328,7 @@ async function autofillBic(worker) {
<template #form> <template #form>
<CreateBankEntityForm <CreateBankEntityForm
@on-data-saved=" @on-data-saved="
(_, requestResponse) => (_, resp) => handleNewBankEntity(data, resp)
handleNewBankEntity(requestResponse, data)
" "
/> />
</template> </template>