7658-devToTest_2428 #508

Merged
alexm merged 392 commits from 7658-devToTest_2428 into test 2024-07-02 10:38:20 +00:00
2 changed files with 64 additions and 69 deletions
Showing only changes of commit ea7ee97867 - Show all commits

View File

@ -106,10 +106,7 @@ const totalNewPrice = computed(() => {
});
const totalDifference = computed(() => {
return rows.value.reduce(
(acc, item) => acc + item.component.difference * item.quantity,
0
);
return rows.value.reduce((acc, item) => acc + item.component.difference, 0);
});
const ticketHaveNegatives = () => {
@ -225,6 +222,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
:pagination="{ rowsPerPage: 0 }"
class="full-width q-mt-md"
:no-data-label="t('globals.noResults')"
flat
>
<template #body-cell-item="{ row }">
<QTd>

View File

@ -36,10 +36,10 @@ const companiesOptions = ref([]);
const agenciesOptions = ref([]);
const zonesOptions = ref([]);
const addresses = ref([]);
const _formData = ref($props.formData);
const formData = ref($props.formData);
watch(
() => _formData.value,
() => formData.value,
(val) => emit('updateForm', val),
{ deep: true }
);
@ -55,12 +55,12 @@ const agencyByWarehouseFilter = computed(() => ({
const zonesFilter = computed(() => ({
fields: ['id', 'name'],
order: 'name ASC',
where: _formData.value?.agencyModeFk
where: formData.value?.agencyModeFk
? {
shipped: _formData.value?.shipped,
addressFk: _formData.value?.addressFk,
agencyModeFk: _formData.value?.agencyModeFk,
warehouseFk: _formData.value?.warehouseFk,
shipped: formData.value?.shipped,
addressFk: formData.value?.addressFk,
agencyModeFk: formData.value?.agencyModeFk,
warehouseFk: formData.value?.warehouseFk,
}
: {},
}));
@ -71,13 +71,13 @@ const getLanded = async (params) => {
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
if (!validParams) return;
_formData.value.zoneFk = null;
formData.value.zoneFk = null;
zonesOptions.value = [];
const { data } = await axios.get(`Agencies/getLanded`, { params });
if (data) {
_formData.value.zoneFk = data.zoneFk;
_formData.value.landed = data.landed;
_formData.value.shipped = params.shipped;
formData.value.zoneFk = data.zoneFk;
formData.value.landed = data.landed;
formData.value.shipped = params.shipped;
}
} catch (error) {
console.error(error);
@ -91,13 +91,13 @@ const getShipped = async (params) => {
landed.value && addressId.value && agencyModeId.value && warehouseId.value;
if (!validParams) return;
_formData.value.zoneFk = null;
formData.value.zoneFk = null;
zonesOptions.value = [];
const { data } = await axios.get(`Agencies/getShipped`, { params });
if (data) {
_formData.value.zoneFk = data.zoneFk;
_formData.value.landed = params.landed;
_formData.value.shipped = data.shipped;
formData.value.zoneFk = data.zoneFk;
formData.value.landed = params.landed;
formData.value.shipped = data.shipped;
} else {
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
}
@ -109,9 +109,9 @@ const getShipped = async (params) => {
const onChangeZone = async (zoneId) => {
try {
_formData.value.agencyModeFk = null;
formData.value.agencyModeFk = null;
const { data } = await axios.get(`Zones/${zoneId}`);
_formData.value.agencyModeFk = data.agencyModeFk;
formData.value.agencyModeFk = data.agencyModeFk;
} catch (error) {
console.error(error);
}
@ -119,9 +119,9 @@ const onChangeZone = async (zoneId) => {
const onChangeAddress = async (addressId) => {
try {
_formData.value.nickname = null;
formData.value.nickname = null;
const { data } = await axios.get(`Addresses/${addressId}`);
_formData.value.nickname = data.nickname;
formData.value.nickname = data.nickname;
} catch (error) {
console.error(error);
}
@ -159,26 +159,26 @@ const clientAddressesList = async (value) => {
};
const addressId = computed({
get: () => _formData.value?.addressFk,
get: () => formData.value?.addressFk,
set: (val) => {
if (val != _formData.value?.addressFk) {
_formData.value.addressFk = val;
if (val != formData.value?.addressFk) {
formData.value.addressFk = val;
onChangeAddress(val);
getShipped({
landed: _formData.value?.landed,
landed: formData.value?.landed,
addressFk: val,
agencyModeFk: _formData.value?.agencyModeFk,
warehouseFk: _formData.value?.warehouseFk,
agencyModeFk: formData.value?.agencyModeFk,
warehouseFk: formData.value?.warehouseFk,
});
}
},
});
const clientId = computed({
get: () => _formData.value?.clientFk,
get: () => formData.value?.clientFk,
set: (val) => {
_formData.value.clientFk = val;
_formData.value.addressFk = null;
formData.value.clientFk = val;
formData.value.addressFk = null;
if (!val) return;
getClientDefaultAddress(val);
clientAddressesList(val);
@ -186,81 +186,81 @@ const clientId = computed({
});
const landed = computed({
get: () => _formData.value?.landed,
get: () => formData.value?.landed,
set: (val) => {
_formData.value.landed = val;
formData.value.landed = val;
getShipped({
landed: val,
addressFk: _formData.value?.addressFk,
agencyModeFk: _formData.value?.agencyModeFk,
warehouseFk: _formData.value?.warehouseFk,
addressFk: formData.value?.addressFk,
agencyModeFk: formData.value?.agencyModeFk,
warehouseFk: formData.value?.warehouseFk,
});
},
});
const agencyModeId = computed({
get: () => _formData.value.agencyModeFk,
get: () => formData.value.agencyModeFk,
set: (val) => {
if (val != _formData.value.agencyModeFk) {
_formData.value.agencyModeFk = val;
if (val != formData.value.agencyModeFk) {
formData.value.agencyModeFk = val;
if (!val) return;
const agencyMode = agenciesOptions.value.find((a) => a.id == val);
_formData.value.warehouseFk = agencyMode.warehouseFk;
formData.value.warehouseFk = agencyMode.warehouseFk;
getLanded({
shipped: _formData.value?.shipped,
addressFk: _formData.value?.addressFk,
shipped: formData.value?.shipped,
addressFk: formData.value?.addressFk,
agencyModeFk: val,
warehouseFk: _formData.value?.warehouseFk,
warehouseFk: formData.value?.warehouseFk,
});
}
},
});
const zoneId = computed({
get: () => _formData.value?.zoneFk,
get: () => formData.value?.zoneFk,
set: (val) => {
if (val != _formData.value?.zoneFk) {
_formData.value.zoneFk = val;
if (val != formData.value?.zoneFk) {
formData.value.zoneFk = val;
onChangeZone(val);
}
},
});
const warehouseId = computed({
get: () => _formData.value?.warehouseFk,
get: () => formData.value?.warehouseFk,
set: (val) => {
if (val != _formData.value?.warehouseFk) {
_formData.value.warehouseFk = val;
if (val != formData.value?.warehouseFk) {
formData.value.warehouseFk = val;
getShipped({
landed: _formData.value?.landed,
addressFk: _formData.value?.addressFk,
agencyModeFk: _formData.value?.agencyModeFk,
landed: formData.value?.landed,
addressFk: formData.value?.addressFk,
agencyModeFk: formData.value?.agencyModeFk,
warehouseFk: val,
}).then(() => {
if (zoneId.value == null) _formData.value.agencyModeFk = null;
if (zoneId.value == null) formData.value.agencyModeFk = null;
});
}
},
});
const shipped = computed({
get: () => _formData.value?.shipped,
get: () => formData.value?.shipped,
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);
_formData.value.shipped = val;
formData.value.shipped = val;
getLanded({
shipped: val,
addressFk: _formData.value?.addressFk,
agencyModeFk: _formData.value?.agencyModeFk,
warehouseFk: _formData.value?.warehouseFk,
addressFk: formData.value?.addressFk,
agencyModeFk: formData.value?.agencyModeFk,
warehouseFk: formData.value?.warehouseFk,
});
},
});
const onFormModelInit = () => {
if (_formData.value?.clientFk) clientAddressesList(_formData.value?.clientFk);
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
};
const redirectToCustomerAddress = () => {
@ -396,12 +396,12 @@ onMounted(() => onFormModelInit());
</QIcon>
</template>
</VnSelect>
<VnInput :label="t('basicData.alias')" v-model="_formData.nickname" />
<VnInput :label="t('basicData.alias')" v-model="formData.nickname" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md no-wrap">
<VnSelect
:label="t('basicData.company')"
v-model="_formData.companyFk"
v-model="formData.companyFk"
option-value="id"
option-label="code"
:options="companiesOptions"
@ -447,16 +447,13 @@ onMounted(() => onFormModelInit());
<VnRow class="row q-gutter-md q-mb-md">
<VnInputDate
:label="t('basicData.shipped')"
v-model="_formData.shipped"
v-model="formData.shipped"
:required="true"
/>
<VnInputTime
:label="t('basicData.shippedHour')"
v-model="_formData.shipped"
/>
<VnInputTime :label="t('basicData.shippedHour')" v-model="formData.shipped" />
<VnInputDate
:label="t('basicData.landed')"
v-model="_formData.landed"
v-model="formData.landed"
:required="true"
/>
</VnRow>