7658-devToTest_2428 #508
|
@ -106,10 +106,7 @@ const totalNewPrice = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const totalDifference = computed(() => {
|
const totalDifference = computed(() => {
|
||||||
return rows.value.reduce(
|
return rows.value.reduce((acc, item) => acc + item.component.difference, 0);
|
||||||
(acc, item) => acc + item.component.difference * item.quantity,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const ticketHaveNegatives = () => {
|
const ticketHaveNegatives = () => {
|
||||||
|
@ -225,6 +222,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
:no-data-label="t('globals.noResults')"
|
:no-data-label="t('globals.noResults')"
|
||||||
|
flat
|
||||||
>
|
>
|
||||||
<template #body-cell-item="{ row }">
|
<template #body-cell-item="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
|
|
|
@ -36,10 +36,10 @@ const companiesOptions = ref([]);
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
const zonesOptions = ref([]);
|
const zonesOptions = ref([]);
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
const _formData = ref($props.formData);
|
const formData = ref($props.formData);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => _formData.value,
|
() => formData.value,
|
||||||
(val) => emit('updateForm', val),
|
(val) => emit('updateForm', val),
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
@ -55,12 +55,12 @@ const agencyByWarehouseFilter = computed(() => ({
|
||||||
const zonesFilter = computed(() => ({
|
const zonesFilter = computed(() => ({
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
order: 'name ASC',
|
order: 'name ASC',
|
||||||
where: _formData.value?.agencyModeFk
|
where: formData.value?.agencyModeFk
|
||||||
? {
|
? {
|
||||||
shipped: _formData.value?.shipped,
|
shipped: formData.value?.shipped,
|
||||||
addressFk: _formData.value?.addressFk,
|
addressFk: formData.value?.addressFk,
|
||||||
agencyModeFk: _formData.value?.agencyModeFk,
|
agencyModeFk: formData.value?.agencyModeFk,
|
||||||
warehouseFk: _formData.value?.warehouseFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
}
|
}
|
||||||
: {},
|
: {},
|
||||||
}));
|
}));
|
||||||
|
@ -71,13 +71,13 @@ const getLanded = async (params) => {
|
||||||
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
|
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||||
if (!validParams) return;
|
if (!validParams) return;
|
||||||
|
|
||||||
_formData.value.zoneFk = null;
|
formData.value.zoneFk = null;
|
||||||
zonesOptions.value = [];
|
zonesOptions.value = [];
|
||||||
const { data } = await axios.get(`Agencies/getLanded`, { params });
|
const { data } = await axios.get(`Agencies/getLanded`, { params });
|
||||||
if (data) {
|
if (data) {
|
||||||
_formData.value.zoneFk = data.zoneFk;
|
formData.value.zoneFk = data.zoneFk;
|
||||||
_formData.value.landed = data.landed;
|
formData.value.landed = data.landed;
|
||||||
_formData.value.shipped = params.shipped;
|
formData.value.shipped = params.shipped;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -91,13 +91,13 @@ const getShipped = async (params) => {
|
||||||
landed.value && addressId.value && agencyModeId.value && warehouseId.value;
|
landed.value && addressId.value && agencyModeId.value && warehouseId.value;
|
||||||
if (!validParams) return;
|
if (!validParams) return;
|
||||||
|
|
||||||
_formData.value.zoneFk = null;
|
formData.value.zoneFk = null;
|
||||||
zonesOptions.value = [];
|
zonesOptions.value = [];
|
||||||
const { data } = await axios.get(`Agencies/getShipped`, { params });
|
const { data } = await axios.get(`Agencies/getShipped`, { params });
|
||||||
if (data) {
|
if (data) {
|
||||||
_formData.value.zoneFk = data.zoneFk;
|
formData.value.zoneFk = data.zoneFk;
|
||||||
_formData.value.landed = params.landed;
|
formData.value.landed = params.landed;
|
||||||
_formData.value.shipped = data.shipped;
|
formData.value.shipped = data.shipped;
|
||||||
} else {
|
} else {
|
||||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||||
}
|
}
|
||||||
|
@ -109,9 +109,9 @@ const getShipped = async (params) => {
|
||||||
|
|
||||||
const onChangeZone = async (zoneId) => {
|
const onChangeZone = async (zoneId) => {
|
||||||
try {
|
try {
|
||||||
_formData.value.agencyModeFk = null;
|
formData.value.agencyModeFk = null;
|
||||||
const { data } = await axios.get(`Zones/${zoneId}`);
|
const { data } = await axios.get(`Zones/${zoneId}`);
|
||||||
_formData.value.agencyModeFk = data.agencyModeFk;
|
formData.value.agencyModeFk = data.agencyModeFk;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
@ -119,9 +119,9 @@ const onChangeZone = async (zoneId) => {
|
||||||
|
|
||||||
const onChangeAddress = async (addressId) => {
|
const onChangeAddress = async (addressId) => {
|
||||||
try {
|
try {
|
||||||
_formData.value.nickname = null;
|
formData.value.nickname = null;
|
||||||
const { data } = await axios.get(`Addresses/${addressId}`);
|
const { data } = await axios.get(`Addresses/${addressId}`);
|
||||||
_formData.value.nickname = data.nickname;
|
formData.value.nickname = data.nickname;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
@ -159,26 +159,26 @@ const clientAddressesList = async (value) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const addressId = computed({
|
const addressId = computed({
|
||||||
get: () => _formData.value?.addressFk,
|
get: () => formData.value?.addressFk,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
if (val != _formData.value?.addressFk) {
|
if (val != formData.value?.addressFk) {
|
||||||
_formData.value.addressFk = val;
|
formData.value.addressFk = val;
|
||||||
onChangeAddress(val);
|
onChangeAddress(val);
|
||||||
getShipped({
|
getShipped({
|
||||||
landed: _formData.value?.landed,
|
landed: formData.value?.landed,
|
||||||
addressFk: val,
|
addressFk: val,
|
||||||
agencyModeFk: _formData.value?.agencyModeFk,
|
agencyModeFk: formData.value?.agencyModeFk,
|
||||||
warehouseFk: _formData.value?.warehouseFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const clientId = computed({
|
const clientId = computed({
|
||||||
get: () => _formData.value?.clientFk,
|
get: () => formData.value?.clientFk,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
_formData.value.clientFk = val;
|
formData.value.clientFk = val;
|
||||||
_formData.value.addressFk = null;
|
formData.value.addressFk = null;
|
||||||
if (!val) return;
|
if (!val) return;
|
||||||
getClientDefaultAddress(val);
|
getClientDefaultAddress(val);
|
||||||
clientAddressesList(val);
|
clientAddressesList(val);
|
||||||
|
@ -186,81 +186,81 @@ const clientId = computed({
|
||||||
});
|
});
|
||||||
|
|
||||||
const landed = computed({
|
const landed = computed({
|
||||||
get: () => _formData.value?.landed,
|
get: () => formData.value?.landed,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
_formData.value.landed = val;
|
formData.value.landed = val;
|
||||||
getShipped({
|
getShipped({
|
||||||
landed: val,
|
landed: val,
|
||||||
addressFk: _formData.value?.addressFk,
|
addressFk: formData.value?.addressFk,
|
||||||
agencyModeFk: _formData.value?.agencyModeFk,
|
agencyModeFk: formData.value?.agencyModeFk,
|
||||||
warehouseFk: _formData.value?.warehouseFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const agencyModeId = computed({
|
const agencyModeId = computed({
|
||||||
get: () => _formData.value.agencyModeFk,
|
get: () => formData.value.agencyModeFk,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
if (val != _formData.value.agencyModeFk) {
|
if (val != formData.value.agencyModeFk) {
|
||||||
_formData.value.agencyModeFk = val;
|
formData.value.agencyModeFk = val;
|
||||||
if (!val) return;
|
if (!val) return;
|
||||||
const agencyMode = agenciesOptions.value.find((a) => a.id == val);
|
const agencyMode = agenciesOptions.value.find((a) => a.id == val);
|
||||||
_formData.value.warehouseFk = agencyMode.warehouseFk;
|
formData.value.warehouseFk = agencyMode.warehouseFk;
|
||||||
|
|
||||||
getLanded({
|
getLanded({
|
||||||
shipped: _formData.value?.shipped,
|
shipped: formData.value?.shipped,
|
||||||
addressFk: _formData.value?.addressFk,
|
addressFk: formData.value?.addressFk,
|
||||||
agencyModeFk: val,
|
agencyModeFk: val,
|
||||||
warehouseFk: _formData.value?.warehouseFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const zoneId = computed({
|
const zoneId = computed({
|
||||||
get: () => _formData.value?.zoneFk,
|
get: () => formData.value?.zoneFk,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
if (val != _formData.value?.zoneFk) {
|
if (val != formData.value?.zoneFk) {
|
||||||
_formData.value.zoneFk = val;
|
formData.value.zoneFk = val;
|
||||||
onChangeZone(val);
|
onChangeZone(val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const warehouseId = computed({
|
const warehouseId = computed({
|
||||||
get: () => _formData.value?.warehouseFk,
|
get: () => formData.value?.warehouseFk,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
if (val != _formData.value?.warehouseFk) {
|
if (val != formData.value?.warehouseFk) {
|
||||||
_formData.value.warehouseFk = val;
|
formData.value.warehouseFk = val;
|
||||||
getShipped({
|
getShipped({
|
||||||
landed: _formData.value?.landed,
|
landed: formData.value?.landed,
|
||||||
addressFk: _formData.value?.addressFk,
|
addressFk: formData.value?.addressFk,
|
||||||
agencyModeFk: _formData.value?.agencyModeFk,
|
agencyModeFk: formData.value?.agencyModeFk,
|
||||||
warehouseFk: val,
|
warehouseFk: val,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (zoneId.value == null) _formData.value.agencyModeFk = null;
|
if (zoneId.value == null) formData.value.agencyModeFk = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const shipped = computed({
|
const shipped = computed({
|
||||||
get: () => _formData.value?.shipped,
|
get: () => formData.value?.shipped,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
if (new Date(_formData.value?.shipped).toDateString() != val.toDateString())
|
if (new Date(formData.value?.shipped).toDateString() != val.toDateString())
|
||||||
val.setHours(0, 0, 0, 0);
|
val.setHours(0, 0, 0, 0);
|
||||||
_formData.value.shipped = val;
|
formData.value.shipped = val;
|
||||||
getLanded({
|
getLanded({
|
||||||
shipped: val,
|
shipped: val,
|
||||||
addressFk: _formData.value?.addressFk,
|
addressFk: formData.value?.addressFk,
|
||||||
agencyModeFk: _formData.value?.agencyModeFk,
|
agencyModeFk: formData.value?.agencyModeFk,
|
||||||
warehouseFk: _formData.value?.warehouseFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const onFormModelInit = () => {
|
const onFormModelInit = () => {
|
||||||
if (_formData.value?.clientFk) clientAddressesList(_formData.value?.clientFk);
|
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
|
||||||
};
|
};
|
||||||
|
|
||||||
const redirectToCustomerAddress = () => {
|
const redirectToCustomerAddress = () => {
|
||||||
|
@ -396,12 +396,12 @@ onMounted(() => onFormModelInit());
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<VnInput :label="t('basicData.alias')" v-model="_formData.nickname" />
|
<VnInput :label="t('basicData.alias')" v-model="formData.nickname" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md no-wrap">
|
<VnRow class="row q-gutter-md q-mb-md no-wrap">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('basicData.company')"
|
:label="t('basicData.company')"
|
||||||
v-model="_formData.companyFk"
|
v-model="formData.companyFk"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
:options="companiesOptions"
|
:options="companiesOptions"
|
||||||
|
@ -447,16 +447,13 @@ onMounted(() => onFormModelInit());
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('basicData.shipped')"
|
:label="t('basicData.shipped')"
|
||||||
v-model="_formData.shipped"
|
v-model="formData.shipped"
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
<VnInputTime
|
<VnInputTime :label="t('basicData.shippedHour')" v-model="formData.shipped" />
|
||||||
:label="t('basicData.shippedHour')"
|
|
||||||
v-model="_formData.shipped"
|
|
||||||
/>
|
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('basicData.landed')"
|
:label="t('basicData.landed')"
|
||||||
v-model="_formData.landed"
|
v-model="formData.landed"
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
Loading…
Reference in New Issue