@@ -136,7 +148,6 @@ const onPostcodeCreated = async () => {
-
{
hide-selected
option-label="name"
option-value="id"
- v-model="data.province"
+ v-model="data.provinceFk"
>
@@ -189,7 +200,7 @@ const onPostcodeCreated = async () => {
hide-selected
option-label="country"
option-value="id"
- v-model="data.country"
+ v-model="data.countryFk"
/>
diff --git a/src/pages/Customer/CustomerCreate.vue b/src/pages/Customer/CustomerCreate.vue
index cfaef0855..310deb71a 100644
--- a/src/pages/Customer/CustomerCreate.vue
+++ b/src/pages/Customer/CustomerCreate.vue
@@ -30,6 +30,7 @@ const newClientForm = reactive({
});
const postcodeFetchDataRef = ref(null);
+const townsFetchDataRef = ref(null);
const workersOptions = ref([]);
const businessTypesOptions = ref([]);
const citiesLocationOptions = ref([]);
@@ -37,8 +38,13 @@ const provincesLocationOptions = ref([]);
const countriesOptions = ref([]);
const postcodesOptions = ref([]);
-const onPostcodeCreated = async () => {
- postcodeFetchDataRef.value.fetch();
+const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formData) => {
+ await postcodeFetchDataRef.value.fetch();
+ await townsFetchDataRef.value.fetch();
+ formData.postcode = code;
+ formData.provinceFk = provinceFk;
+ formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
+ formData.countryFk = countryFk;
};
@@ -60,6 +66,7 @@ const onPostcodeCreated = async () => {
url="BusinessTypes"
/>
(citiesLocationOptions = data)"
auto-load
url="Towns/location"
@@ -78,7 +85,6 @@ const onPostcodeCreated = async () => {
@@ -145,7 +151,7 @@ const onPostcodeCreated = async () => {
>
diff --git a/src/pages/Supplier/Card/SupplierFiscalData.vue b/src/pages/Supplier/Card/SupplierFiscalData.vue
index ebf1b96b6..28ad26961 100644
--- a/src/pages/Supplier/Card/SupplierFiscalData.vue
+++ b/src/pages/Supplier/Card/SupplierFiscalData.vue
@@ -15,6 +15,7 @@ const route = useRoute();
const { t } = useI18n();
const postcodeFetchDataRef = ref(null);
+const townsFetchDataRef = ref(null);
const sageTaxTypesOptions = ref([]);
const sageWithholdingsOptions = ref([]);
const sageTransactionTypesOptions = ref([]);
@@ -24,8 +25,13 @@ const provincesLocationOptions = ref([]);
const townsLocationOptions = ref([]);
const countriesOptions = ref([]);
-const onPostcodeCreated = async () => {
- postcodeFetchDataRef.value.fetch();
+const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formData) => {
+ await postcodeFetchDataRef.value.fetch();
+ await townsFetchDataRef.value.fetch();
+ formData.postCode = code;
+ formData.provinceFk = provinceFk;
+ formData.city = townsLocationOptions.value.find((town) => town.id === townFk).name;
+ formData.countryFk = countryFk;
};
@@ -56,6 +62,7 @@ const onPostcodeCreated = async () => {
auto-load
/>
(townsLocationOptions = data)"
auto-load
url="Towns/location"
@@ -167,19 +174,18 @@ const onPostcodeCreated = async () => {
@@ -282,6 +288,7 @@ const onPostcodeCreated = async () => {
+ {{ data }}
diff --git a/src/pages/Worker/WorkerCreate.vue b/src/pages/Worker/WorkerCreate.vue
index accac7cf2..91d4d454b 100644
--- a/src/pages/Worker/WorkerCreate.vue
+++ b/src/pages/Worker/WorkerCreate.vue
@@ -50,6 +50,7 @@ const newWorkerForm = ref({
});
const postcodeFetchDataRef = ref(null);
+const townsFetchDataRef = ref(null);
const provincesOptions = ref([]);
const townsOptions = ref([]);
const companiesOptions = ref([]);
@@ -66,8 +67,12 @@ const onBankEntityCreated = (data) => {
bankEntitiesOptions.value.push(data);
};
-const onPostcodeCreated = async () => {
- postcodeFetchDataRef.value.fetch();
+const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
+ await postcodeFetchDataRef.value.fetch();
+ await townsFetchDataRef.value.fetch();
+ formData.postcode = code;
+ formData.provinceFk = provinceFk;
+ formData.city = townsOptions.value.find((town) => town.id === townFk).name;
};
onMounted(async () => {
@@ -96,6 +101,7 @@ onMounted(async () => {
auto-load
/>