forked from verdnatura/salix-front
changes
This commit is contained in:
parent
bf19ce630d
commit
207a5a5908
|
@ -28,8 +28,8 @@ const countriesOptions = ref([]);
|
||||||
const provincesOptions = ref([]);
|
const provincesOptions = ref([]);
|
||||||
const townsLocationOptions = ref([]);
|
const townsLocationOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = () => {
|
const onDataSaved = (dataSaved) => {
|
||||||
emit('onDataSaved');
|
emit('onDataSaved', dataSaved);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onCityCreated = async () => {
|
const onCityCreated = async () => {
|
||||||
|
|
|
@ -42,8 +42,8 @@ const { t } = useI18n();
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
const onDataSaved = () => {
|
const onDataSaved = (dataSaved) => {
|
||||||
emit('onDataSaved');
|
emit('onDataSaved', dataSaved);
|
||||||
closeForm();
|
closeForm();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ const closeForm = () => {
|
||||||
:default-actions="false"
|
:default-actions="false"
|
||||||
:url-create="urlCreate"
|
:url-create="urlCreate"
|
||||||
:model="model"
|
:model="model"
|
||||||
@on-data-saved="onDataSaved()"
|
@on-data-saved="onDataSaved($event)"
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<span ref="closeButton" class="close-icon" v-close-popup>
|
<span ref="closeButton" class="close-icon" v-close-popup>
|
||||||
|
|
|
@ -28,10 +28,11 @@ const formInitialData = reactive({
|
||||||
customsAgentFk: null,
|
customsAgentFk: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const townsFetchDataRef = ref(null);
|
||||||
|
const postcodeFetchDataRef = ref(null);
|
||||||
const agencyModes = ref([]);
|
const agencyModes = ref([]);
|
||||||
const incoterms = ref([]);
|
const incoterms = ref([]);
|
||||||
const customsAgents = ref([]);
|
const customsAgents = ref([]);
|
||||||
const postcodeFetchDataRef = ref(null);
|
|
||||||
const citiesLocationOptions = ref([]);
|
const citiesLocationOptions = ref([]);
|
||||||
const provincesLocationOptions = ref([]);
|
const provincesLocationOptions = ref([]);
|
||||||
const postcodesOptions = ref([]);
|
const postcodesOptions = ref([]);
|
||||||
|
@ -41,18 +42,24 @@ onBeforeMount(() => {
|
||||||
urlCreate.value = `Clients/${route.params.id}/createAddress`;
|
urlCreate.value = `Clients/${route.params.id}/createAddress`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const onPostcodeCreated = async () => {
|
const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
|
||||||
postcodeFetchDataRef.value.fetch();
|
await postcodeFetchDataRef.value.fetch();
|
||||||
|
await townsFetchDataRef.value.fetch();
|
||||||
|
formData.postalCode = code;
|
||||||
|
formData.provinceFk = provinceFk;
|
||||||
|
formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
ref="postcodeFetchDataRef"
|
||||||
@on-fetch="(data) => (postcodesOptions = data)"
|
@on-fetch="(data) => (postcodesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Postcodes/location"
|
url="Postcodes/location"
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
ref="townsFetchDataRef"
|
||||||
@on-fetch="(data) => (citiesLocationOptions = data)"
|
@on-fetch="(data) => (citiesLocationOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Towns/location"
|
url="Towns/location"
|
||||||
|
@ -110,7 +117,7 @@ const onPostcodeCreated = async () => {
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CustomerCreateNewPostcode
|
<CustomerCreateNewPostcode
|
||||||
@on-data-saved="onPostcodeCreated($event)"
|
@on-data-saved="onPostcodeCreated($event, data)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -43,43 +44,38 @@ const toCustomerConsigneeEdit = () => {
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<div v-for="(item, index) in rows" :key="index">
|
<QCard
|
||||||
<div
|
v-for="(item, index) in rows"
|
||||||
:class="{
|
:key="index"
|
||||||
'consignees-card': true,
|
:class="['consignees-card', { 'q-mb-md': rows.length - 1 !== index }]"
|
||||||
'q-mb-md': index + 1 === rows.length ? false : true,
|
@click="toCustomerConsigneeEdit()"
|
||||||
}"
|
>
|
||||||
>
|
<div class="consignees-card-icon">
|
||||||
<div class="consignees-card-icon">
|
<QIcon name="star" size="md" color="primary" />
|
||||||
<QIcon name="star" size="md" color="primary" />
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="text-weight-bold q-mb-sm">
|
||||||
|
{{ item.nickname }} - #{{ item.id }}
|
||||||
</div>
|
</div>
|
||||||
|
<div>{{ item.street }}</div>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
{{ item.postalCode }} - {{ item.city }},
|
||||||
<div class="text-weight-bold">
|
{{ setProvince(item.provinceFk) }}
|
||||||
{{ item.nickname }} - #{{ item.id }}
|
</div>
|
||||||
</div>
|
<div class="flex">
|
||||||
<div>{{ item.street }}</div>
|
<VnLv
|
||||||
<div>
|
:label="t('Is equalizated')"
|
||||||
{{ item.postalCode }} - {{ item.city }},
|
:value="item.isEqualizated"
|
||||||
{{ setProvince(item.provinceFk) }}
|
class="row q-mr-lg"
|
||||||
</div>
|
/>
|
||||||
</div>
|
<VnLv
|
||||||
<div class="flex">
|
:label="t('Is logiflora allowed')"
|
||||||
<QCheckbox
|
:value="item.isLogifloraAllowed"
|
||||||
:label="t('Is equalizated')"
|
class="row"
|
||||||
v-model="item.isEqualizated"
|
/>
|
||||||
class="q-mr-lg"
|
|
||||||
@click.stop="toCustomerConsigneeEdit()"
|
|
||||||
/>
|
|
||||||
<QCheckbox
|
|
||||||
:label="t('Is logiflora allowed')"
|
|
||||||
v-model="item.isLogifloraAllowed"
|
|
||||||
@click.stop="toCustomerConsigneeEdit()"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</QCard>
|
||||||
<QPageSticky :offset="[18, 18]">
|
<QPageSticky :offset="[18, 18]">
|
||||||
<QBtn
|
<QBtn
|
||||||
@click.stop="toCustomerConsigneeCreate()"
|
@click.stop="toCustomerConsigneeCreate()"
|
||||||
|
@ -102,6 +98,11 @@ const toCustomerConsigneeEdit = () => {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--vn-light-gray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.consignees-card-icon {
|
.consignees-card-icon {
|
||||||
margin: 0 15px 0 5px;
|
margin: 0 15px 0 5px;
|
||||||
|
|
Loading…
Reference in New Issue