2023-12-12 14:58:44 +00:00
|
|
|
<script setup>
|
2023-12-13 15:09:23 +00:00
|
|
|
import { reactive, ref } from 'vue';
|
2023-12-12 14:58:44 +00:00
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
2023-12-13 15:09:23 +00:00
|
|
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
|
|
|
import FetchData from 'components/FetchData.vue';
|
|
|
|
import VnRow from 'components/ui/VnRow.vue';
|
2024-01-02 15:57:13 +00:00
|
|
|
import FormModelPopup from './FormModelPopup.vue';
|
2023-12-13 15:09:23 +00:00
|
|
|
|
2024-01-08 14:32:42 +00:00
|
|
|
const props = defineProps({
|
|
|
|
showEntityField: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2023-12-18 14:57:56 +00:00
|
|
|
const emit = defineEmits(['onDataSaved']);
|
2023-12-13 15:09:23 +00:00
|
|
|
|
2023-12-12 14:58:44 +00:00
|
|
|
const { t } = useI18n();
|
|
|
|
|
2023-12-18 14:57:56 +00:00
|
|
|
const bankEntityFormData = reactive({
|
2023-12-12 14:58:44 +00:00
|
|
|
name: null,
|
|
|
|
bic: null,
|
|
|
|
countryFk: null,
|
|
|
|
id: null,
|
|
|
|
});
|
2023-12-13 15:09:23 +00:00
|
|
|
|
|
|
|
const countriesFilter = {
|
|
|
|
fields: ['id', 'country', 'code'],
|
|
|
|
};
|
|
|
|
|
|
|
|
const countriesOptions = ref([]);
|
|
|
|
|
|
|
|
const onDataSaved = (data) => {
|
|
|
|
emit('onDataSaved', data);
|
2023-12-18 14:57:56 +00:00
|
|
|
};
|
2023-12-12 14:58:44 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-12-13 15:09:23 +00:00
|
|
|
<FetchData
|
|
|
|
url="Countries"
|
|
|
|
:filter="countriesFilter"
|
|
|
|
auto-load
|
2024-01-02 11:47:38 +00:00
|
|
|
@on-fetch="(data) => (countriesOptions = data)"
|
2023-12-13 15:09:23 +00:00
|
|
|
/>
|
2024-01-02 15:57:13 +00:00
|
|
|
<FormModelPopup
|
2023-12-13 15:09:23 +00:00
|
|
|
url-create="bankEntities"
|
|
|
|
model="bankEntity"
|
2024-01-02 15:57:13 +00:00
|
|
|
:title="t('title')"
|
|
|
|
:subtitle="t('subtitle')"
|
|
|
|
:form-initial-data="bankEntityFormData"
|
2023-12-18 14:57:56 +00:00
|
|
|
@on-data-saved="onDataSaved($event)"
|
2023-12-13 15:09:23 +00:00
|
|
|
>
|
2024-01-02 15:57:13 +00:00
|
|
|
<template #form-inputs="{ data, validate }">
|
2023-12-13 15:09:23 +00:00
|
|
|
<VnRow class="row q-gutter-md q-mb-md">
|
|
|
|
<div class="col">
|
|
|
|
<QInput
|
|
|
|
:label="t('name')"
|
|
|
|
v-model="data.name"
|
|
|
|
:rules="validate('bankEntity.name')"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="col">
|
|
|
|
<QInput
|
|
|
|
:label="t('swift')"
|
|
|
|
v-model="data.bic"
|
|
|
|
:rules="validate('bankEntity.bic')"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</VnRow>
|
|
|
|
<VnRow class="row q-gutter-md q-mb-md">
|
|
|
|
<div class="col">
|
|
|
|
<VnSelectFilter
|
|
|
|
:label="t('country')"
|
2023-12-18 14:57:56 +00:00
|
|
|
v-model="data.countryFk"
|
2023-12-13 15:09:23 +00:00
|
|
|
:options="countriesOptions"
|
|
|
|
option-value="id"
|
|
|
|
option-label="country"
|
|
|
|
hide-selected
|
2024-01-31 07:41:21 +00:00
|
|
|
:required="true"
|
2023-12-13 15:09:23 +00:00
|
|
|
:rules="validate('bankEntity.countryFk')"
|
|
|
|
/>
|
|
|
|
</div>
|
2024-01-08 14:32:42 +00:00
|
|
|
<div v-if="showEntityField" class="col">
|
2023-12-18 14:57:56 +00:00
|
|
|
<QInput :label="t('id')" v-model="data.id" />
|
2023-12-13 15:09:23 +00:00
|
|
|
</div>
|
|
|
|
</VnRow>
|
|
|
|
</template>
|
2024-01-02 15:57:13 +00:00
|
|
|
</FormModelPopup>
|
2023-12-12 14:58:44 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<i18n>
|
|
|
|
en:
|
2023-12-12 17:00:56 +00:00
|
|
|
title: New bank entity
|
|
|
|
subtitle: Please, ensure you put the correct data!
|
2023-12-13 15:09:23 +00:00
|
|
|
name: Name *
|
|
|
|
swift: Swift *
|
|
|
|
country: Country
|
|
|
|
id: Entity code
|
2023-12-12 14:58:44 +00:00
|
|
|
es:
|
2023-12-12 17:00:56 +00:00
|
|
|
title: Nueva entidad bancaria
|
|
|
|
subtitle: ¡Por favor, asegúrate de poner los datos correctos!
|
2023-12-13 15:09:23 +00:00
|
|
|
name: Nombre *
|
|
|
|
swift: Swift *
|
|
|
|
country: País
|
|
|
|
id: Código de la entidad
|
2023-12-12 14:58:44 +00:00
|
|
|
</i18n>
|