+
diff --git a/src/pages/Customer/components/CustomerConsigneeCreate.vue b/src/pages/Customer/components/CustomerConsigneeCreate.vue
index ef01879c2..e4302ed65 100644
--- a/src/pages/Customer/components/CustomerConsigneeCreate.vue
+++ b/src/pages/Customer/components/CustomerConsigneeCreate.vue
@@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';
-
+import VnLocation from 'src/components/common/VnLocation.vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
@@ -20,13 +20,9 @@ const router = useRouter();
const formInitialData = reactive({ isDefaultAddress: false });
-const townsFetchDataRef = ref(null);
-const postcodeFetchDataRef = ref(null);
const urlCreate = ref('');
const postcodesOptions = ref([]);
-const citiesLocationOptions = ref([]);
-const provincesLocationOptions = ref([]);
const agencyModes = ref([]);
const incoterms = ref([]);
const customsAgents = ref([]);
@@ -36,14 +32,6 @@ onBeforeMount(() => {
getCustomsAgents();
});
-const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
- await postcodeFetchDataRef.value.fetch();
- await townsFetchDataRef.value.fetch();
- formData.postalCode = code;
- formData.provinceFk = provinceFk;
- formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
-};
-
const getCustomsAgents = async () => {
const { data } = await axios.get('CustomsAgents');
customsAgents.value = data;
@@ -61,26 +49,16 @@ const toCustomerConsignees = () => {
},
});
};
+function handleLocation(data, location) {
+ const { town, code, provinceFk, countryFk } = location ?? {};
+ data.postalCode = code;
+ data.city = town;
+ data.provinceFk = provinceFk;
+ data.countryFk = countryFk;
+}
- (postcodesOptions = data)"
- auto-load
- ref="postcodeFetchDataRef"
- url="Postcodes/location"
- />
- (citiesLocationOptions = data)"
- auto-load
- ref="townsFetchDataRef"
- url="Towns/location"
- />
- (provincesLocationOptions = data)"
- auto-load
- url="Provinces/location"
- />
(agencyModes = data)"
auto-load
@@ -113,83 +91,17 @@ const toCustomerConsignees = () => {
-
-
-
-
-
-
-
- {{ scope.opt.code }}
-
- {{ scope.opt.code }} -
- {{ scope.opt.town.name }}
- ({{ scope.opt.town.province.name }},
- {{ scope.opt.town.province.country.country }})
-
-
-
-
-
-
-
-
-
-
-
-
- {{ scope.opt.name }}
-
- {{
- `${scope.opt.name}, ${scope.opt.province.name} (${scope.opt.province.country.country})`
- }}
-
-
-
-
-
+ :roles-allowed-to-create="['deliveryAssistant']"
+ :options="postcodesOptions"
+ v-model="data.location"
+ @update:model-value="(location) => handleLocation(data, location)"
+ >
-
-
-
-
-
- {{
- `${scope.opt.name} (${scope.opt.country.country})`
- }}
-
-
-
-
-
{
urlUpdate.value = `Clients/${route.params.id}/updateAddress/${route.params.consigneeId}`;
});
-const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
- await postcodeFetchDataRef.value.fetch();
- await townsFetchDataRef.value.fetch();
- formData.postalCode = code;
- formData.provinceFk = provinceFk;
- formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
-};
-
const getData = async (observations) => {
observationTypes.value = observations;
@@ -97,26 +84,16 @@ const onDataSaved = () => {
};
axios.post('AddressObservations/crud', payload);
};
+function handleLocation(data, location) {
+ const { town, code, provinceFk, countryFk } = location ?? {};
+ data.postalCode = code;
+ data.city = town;
+ data.provinceFk = provinceFk;
+ data.countryFk = countryFk;
+}
- (postcodesOptions = data)"
- auto-load
- url="Postcodes/location"
- />
- (citiesLocationOptions = data)"
- auto-load
- url="Towns/location"
- />
- (provincesLocationOptions = data)"
- auto-load
- url="Provinces/location"
- />
(agencyModes = data)"
auto-load
@@ -168,83 +145,17 @@ const onDataSaved = () => {
-
-
-
-
-
-
-
- {{ scope.opt.code }}
-
- {{ scope.opt.code }} -
- {{ scope.opt.town.name }}
- ({{ scope.opt.town.province.name }},
- {{ scope.opt.town.province.country.country }})
-
-
-
-
-
-
-
-
-
-
-
-
- {{ scope.opt.name }}
-
- {{
- `${scope.opt.name}, ${scope.opt.province.name} (${scope.opt.province.country.country})`
- }}
-
-
-
-
-
+ :roles-allowed-to-create="['deliveryAssistant']"
+ :options="postcodesOptions"
+ v-model="data.location"
+ @update:model-value="(location) => handleLocation(data, location)"
+ >
-
-
-
-
-
- {{
- `${scope.opt.name} (${scope.opt.country.country})`
- }}
-
-
-
-
-
{
:key="index"
class="row q-gutter-md q-mb-md"
>
-
-
-
-
-
-
-
+
+
+
+
+
{
-
-
-
- {{ t('Add note') }}
-
-
-
+
+
+ {{ t('Add note') }}
+
+
diff --git a/src/pages/Shelving/Card/ShelvingSummary.vue b/src/pages/Shelving/Card/ShelvingSummary.vue
index 409329c88..27ef33c34 100644
--- a/src/pages/Shelving/Card/ShelvingSummary.vue
+++ b/src/pages/Shelving/Card/ShelvingSummary.vue
@@ -6,7 +6,7 @@ import { useStateStore } from 'stores/useStateStore';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue';
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
-import VnUserLink from "components/ui/VnUserLink.vue";
+import VnUserLink from 'components/ui/VnUserLink.vue';
const $props = defineProps({
id: {
diff --git a/src/pages/Supplier/Card/SupplierAddressesCreate.vue b/src/pages/Supplier/Card/SupplierAddressesCreate.vue
index 21c0cd61a..69c180e0a 100644
--- a/src/pages/Supplier/Card/SupplierAddressesCreate.vue
+++ b/src/pages/Supplier/Card/SupplierAddressesCreate.vue
@@ -10,6 +10,7 @@ import VnInput from 'src/components/common/VnInput.vue';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import VnRow from 'components/ui/VnRow.vue';
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
+import VnLocation from 'src/components/common/VnLocation.vue';
const { t } = useI18n();
const route = useRoute();
@@ -55,27 +56,16 @@ onMounted(() => {
updateAddressForm(addressData);
}
});
+function handleLocation(data, location) {
+ const { town, code, provinceFk, countryFk } = location ?? {};
+ data.postalCode = code;
+ data.city = town;
+ data.provinceFk = provinceFk;
+ data.countryFk = countryFk;
+}
- (postcodesOptions = data)"
- auto-load
- />
- (provincesOptions = data)"
- auto-load
- url="Provinces"
- />
- (townsLocationOptions = data)"
- auto-load
- url="Towns/location"
- />
{
-
-
-
-
-
-
-
- {{ scope.opt.code }}
- {{ scope.opt.code }} -
- {{ scope.opt.town.name }} ({{
- scope.opt.town.province.name
- }},
- {{
- scope.opt.town.province.country.country
- }})
-
-
-
-
-
-
-
-
-
-
+ v-model="data.location"
+ @update:model-value="
+ (location) => handleLocation(data, location)
+ "
+ >
diff --git a/src/pages/Supplier/Card/SupplierFiscalData.vue b/src/pages/Supplier/Card/SupplierFiscalData.vue
index b26582065..becf6d818 100644
--- a/src/pages/Supplier/Card/SupplierFiscalData.vue
+++ b/src/pages/Supplier/Card/SupplierFiscalData.vue
@@ -21,7 +21,7 @@ const postcodesOptions = ref([]);
function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {};
- data.postcode = code;
+ data.postCode = code;
data.city = town;
data.provinceFk = provinceFk;
data.countryFk = countryFk;