This commit is contained in:
William Buezas 2024-01-22 13:16:35 -03:00
commit 42d41b1350
1 changed files with 10 additions and 11 deletions

View File

@ -1,8 +1,10 @@
<script setup>
import { ref } from 'vue';
import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import axios from 'axios';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
@ -17,18 +19,17 @@ const route = useRoute();
const payMethods = ref([]);
const bankEntitiesOptions = ref([]);
const onBankEntityCreated = (data) => {
bankEntitiesOptions.value.push(data);
onMounted(() => getBankEntities());
const getBankEntities = async () => {
const filter = { fields: ['id', 'bic', 'name'], order: 'bic ASC', limit: 30 };
const { data } = await axios.get('BankEntities', { filter });
bankEntitiesOptions.value = data;
};
</script>
<template>
<fetch-data @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
<FetchData
@on-fetch="(data) => (bankEntitiesOptions = data)"
auto-load
url="BankEntities"
/>
<FormModel
:url-update="`Clients/${route.params.id}`"
@ -73,9 +74,7 @@ const onBankEntityCreated = (data) => {
v-model="data.bankEntityFk"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="onBankEntityCreated($event)"
/>
<CreateBankEntityForm @on-data-saved="getBankEntities()" />
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">