From 15f171da0fe58dd80b6945c8fc454d925b075bb3 Mon Sep 17 00:00:00 2001 From: Jon Date: Tue, 15 Oct 2024 13:12:37 +0200 Subject: [PATCH] perf: refs #7825 create bank entity --- src/components/CreateBankEntityForm.vue | 4 ++-- src/pages/Worker/WorkerList.vue | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/CreateBankEntityForm.vue b/src/components/CreateBankEntityForm.vue index 0a3c10f57..a42be6ef8 100644 --- a/src/components/CreateBankEntityForm.vue +++ b/src/components/CreateBankEntityForm.vue @@ -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 () => { diff --git a/src/pages/Worker/WorkerList.vue b/src/pages/Worker/WorkerList.vue index 4b7d028e7..99ea609a1 100644 --- a/src/pages/Worker/WorkerList.vue +++ b/src/pages/Worker/WorkerList.vue @@ -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 />