diff --git a/src/components/common/VnInputBic.vue b/src/components/common/VnInputBic.vue
new file mode 100644
index 000000000..5f0afd083
--- /dev/null
+++ b/src/components/common/VnInputBic.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+ {{ t('components.iban_tooltip') }}
+
+
+
+
diff --git a/src/pages/Customer/Card/CustomerBillingData.vue b/src/pages/Customer/Card/CustomerBillingData.vue
index cc894d01e..6f83f6535 100644
--- a/src/pages/Customer/Card/CustomerBillingData.vue
+++ b/src/pages/Customer/Card/CustomerBillingData.vue
@@ -9,21 +9,27 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
+import VnInputBic from 'src/components/common/VnInputBic.vue';
const { t } = useI18n();
const route = useRoute();
const bankEntitiesRef = ref(null);
+const bankEntity = ref();
const filter = {
fields: ['id', 'bic', 'name'],
- order: 'bic ASC'
+ order: 'bic ASC',
};
const getBankEntities = (data, formData) => {
bankEntitiesRef.value.fetch();
formData.bankEntityFk = Number(data.id);
};
+
+const autofillSwiftBic = (bankEntityFk) => {
+ bankEntity.value = bankEntityFk;
+};
@@ -43,13 +49,11 @@ const getBankEntities = (data, formData) => {
-
-
-
- {{ t('components.iban_tooltip') }}
-
-
-
+
{
hide-selected
option-label="name"
option-value="id"
- v-model="data.bankEntityFk"
+ v-model="bankEntity"
>
[
{
@@ -162,15 +165,9 @@ function generateCodeUser(worker) {
if (!worker.companyFk) worker.companyFk = user.companyFk;
}
-async function autofillBic(worker) {
- if (!worker || !worker.iban) return;
-
- let bankEntityId = parseInt(worker.iban.substr(4, 4));
- let filter = { where: { id: bankEntityId } };
-
- const { data } = await axios.get(`BankEntities`, { params: { filter } });
- worker.bankEntityFk = data?.[0]?.id ?? undefined;
-}
+const autofillSwiftBic = (bankEntityFk) => {
+ bankEntity.value = bankEntityFk;
+};
!val && delete data.payMethodFk
"
/>
-
-
-
- {{
- t('components.iban_tooltip')
- }}
-
-
-
+ @update-bic="autofillSwiftBic($event)"
+ />