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