perf: refs #7825 create bank entity
gitea/salix-front/pipeline/pr-dev This commit looks good Details

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 onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
const onDataSaved = (...args) => {
emit('onDataSaved', ...args);
};
onMounted(async () => {

View File

@ -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>