Merge branch '8958-añadirClasificación' of https://gitea.verdnatura.es/verdnatura/salix-front into 8958-añadirClasificación
gitea/salix-front/pipeline/pr-test This commit looks good
Details
gitea/salix-front/pipeline/pr-test This commit looks good
Details
This commit is contained in:
commit
aad6fe6426
|
@ -132,8 +132,7 @@ const card = toRef(props, 'item');
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
white-space: nowrap;
|
|
||||||
width: 192px;
|
|
||||||
p {
|
p {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ const columns = computed(() => [
|
||||||
url: 'Clients',
|
url: 'Clients',
|
||||||
fields: ['id', 'socialName'],
|
fields: ['id', 'socialName'],
|
||||||
optionLabel: 'socialName',
|
optionLabel: 'socialName',
|
||||||
|
optionValue: 'socialName',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
@ -37,8 +38,11 @@ const columns = computed(() => [
|
||||||
name: 'city',
|
name: 'city',
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
|
inWhere: true,
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'Towns',
|
url: 'Towns',
|
||||||
|
optionValue: 'name',
|
||||||
|
optionLabel: 'name',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
@ -95,7 +99,7 @@ const columns = computed(() => [
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<VnTable
|
<VnTable
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
url="Clients/filter"
|
url="Clients/extendedListFilter"
|
||||||
:table="{
|
:table="{
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
|
|
|
@ -15,7 +15,7 @@ import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescripto
|
||||||
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
|
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
|
||||||
|
import { getItemPackagingType } from '../composables/getItemPackagingType.js';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -161,23 +161,6 @@ const setShippedColor = (date) => {
|
||||||
};
|
};
|
||||||
const rowClick = ({ id }) =>
|
const rowClick = ({ id }) =>
|
||||||
window.open(router.resolve({ params: { id }, name: 'TicketSummary' }).href, '_blank');
|
window.open(router.resolve({ params: { id }, name: 'TicketSummary' }).href, '_blank');
|
||||||
|
|
||||||
const getItemPackagingType = (ticketSales) => {
|
|
||||||
if (!ticketSales?.length) return '-';
|
|
||||||
|
|
||||||
const packagingTypes = ticketSales.reduce((types, sale) => {
|
|
||||||
const { itemPackingTypeFk } = sale.item;
|
|
||||||
if (
|
|
||||||
!types.includes(itemPackingTypeFk) &&
|
|
||||||
(itemPackingTypeFk === 'H' || itemPackingTypeFk === 'V')
|
|
||||||
) {
|
|
||||||
types.push(itemPackingTypeFk);
|
|
||||||
}
|
|
||||||
return types;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return dashIfEmpty(packagingTypes.join(', ') || '-');
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import { getItemPackagingType } from '../getItemPackagingType';
|
||||||
|
|
||||||
|
describe('getItemPackagingType', () => {
|
||||||
|
it('should return "-" if ticketSales is null or undefined', () => {
|
||||||
|
expect(getItemPackagingType(null)).toBe('-');
|
||||||
|
expect(getItemPackagingType(undefined)).toBe('-');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return "-" if ticketSales does not have a length property', () => {
|
||||||
|
const ticketSales = { someKey: 'someValue' }; // No tiene propiedad length
|
||||||
|
expect(getItemPackagingType(ticketSales)).toBe('-');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return unique packaging types as a comma-separated string', () => {
|
||||||
|
const ticketSales = [
|
||||||
|
{ item: { itemPackingTypeFk: 'H' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'V' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'H' } },
|
||||||
|
];
|
||||||
|
expect(getItemPackagingType(ticketSales)).toBe('H, V');
|
||||||
|
});
|
||||||
|
it('should return unique packaging types as a comma-separated string', () => {
|
||||||
|
const ticketSales = [
|
||||||
|
{ item: { itemPackingTypeFk: 'H' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'V' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'H' } },
|
||||||
|
{ item: { itemPackingTypeFk: 'A' } },
|
||||||
|
];
|
||||||
|
expect(getItemPackagingType(ticketSales)).toBe('H, V, A');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return "-" if ticketSales is an empty array', () => {
|
||||||
|
expect(getItemPackagingType([])).toBe('-');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { dashIfEmpty } from 'src/filters';
|
||||||
|
|
||||||
|
export function getItemPackagingType(ticketSales) {
|
||||||
|
if (!ticketSales?.length) return '-';
|
||||||
|
|
||||||
|
const packagingTypes = Array.from(
|
||||||
|
new Set(ticketSales.map(({ item: { itemPackingTypeFk } }) => itemPackingTypeFk)),
|
||||||
|
);
|
||||||
|
|
||||||
|
return dashIfEmpty(packagingTypes.join(', '));
|
||||||
|
}
|
|
@ -8,7 +8,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
@ -59,11 +58,25 @@ const zoneWhere = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getLanded(params) {
|
async function getLanded(params) {
|
||||||
getDate(`Agencies/getLanded`, params);
|
const data = await getDate(`Agencies/getLanded`, params);
|
||||||
|
formData.value.landed = data.landed;
|
||||||
|
const shippedDate = new Date(params.shipped);
|
||||||
|
const landedDate = new Date(data.hour);
|
||||||
|
shippedDate.setHours(
|
||||||
|
landedDate.getHours(),
|
||||||
|
landedDate.getMinutes(),
|
||||||
|
landedDate.getSeconds(),
|
||||||
|
);
|
||||||
|
formData.value.shipped = shippedDate.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getShipped(params) {
|
async function getShipped(params) {
|
||||||
getDate(`Agencies/getShipped`, params);
|
const data = await getDate(`Agencies/getShipped`, params);
|
||||||
|
formData.value.landed = params.landed;
|
||||||
|
const [hours, minutes, seconds] = data.hour.split(':').map(Number);
|
||||||
|
let shippedDate = new Date(data.shipped);
|
||||||
|
shippedDate.setHours(hours, minutes, seconds);
|
||||||
|
formData.value.shipped = shippedDate.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDate(query, params) {
|
async function getDate(query, params) {
|
||||||
|
@ -75,15 +88,8 @@ async function getDate(query, params) {
|
||||||
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||||
|
|
||||||
formData.value.zoneFk = data.zoneFk;
|
formData.value.zoneFk = data.zoneFk;
|
||||||
formData.value.landed = data.landed;
|
|
||||||
const shippedDate = new Date(params.shipped);
|
return data;
|
||||||
const landedDate = new Date(data.hour);
|
|
||||||
shippedDate.setHours(
|
|
||||||
landedDate.getHours(),
|
|
||||||
landedDate.getMinutes(),
|
|
||||||
landedDate.getSeconds(),
|
|
||||||
);
|
|
||||||
formData.value.shipped = shippedDate.toISOString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeZone = async (zoneId) => {
|
const onChangeZone = async (zoneId) => {
|
||||||
|
@ -270,8 +276,6 @@ async function getZone(options) {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('ticketList.client')"
|
:label="t('ticketList.client')"
|
||||||
v-model="clientId"
|
v-model="clientId"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
url="Clients"
|
url="Clients"
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name']"
|
||||||
sort-by="id"
|
sort-by="id"
|
||||||
|
@ -306,16 +310,31 @@ async function getZone(options) {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('basicData.address')"
|
:label="t('basicData.address')"
|
||||||
v-model="addressId"
|
v-model="addressId"
|
||||||
option-value="id"
|
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
:options="addresses"
|
:options="addresses"
|
||||||
hide-selected
|
hide-selected
|
||||||
map-options
|
map-options
|
||||||
:required="true"
|
:required="true"
|
||||||
|
:sort-by="['isActive DESC']"
|
||||||
:rules="validate('basicData.address')"
|
:rules="validate('basicData.address')"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem
|
||||||
|
v-bind="scope.itemProps"
|
||||||
|
:class="{ disabled: !scope.opt.isActive }"
|
||||||
|
>
|
||||||
|
<QItemSection style="min-width: min-content" avatar>
|
||||||
|
<QIcon
|
||||||
|
v-if="
|
||||||
|
scope.opt.isActive &&
|
||||||
|
formData.client.defaultAddressFk === scope.opt.id
|
||||||
|
"
|
||||||
|
size="sm"
|
||||||
|
color="grey"
|
||||||
|
name="star"
|
||||||
|
class="fill-icon"
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel
|
<QItemLabel
|
||||||
:class="{
|
:class="{
|
||||||
|
@ -341,6 +360,9 @@ async function getZone(options) {
|
||||||
{{ scope.opt?.agencyMode?.name }}</span
|
{{ scope.opt?.agencyMode?.name }}</span
|
||||||
>
|
>
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ `#${scope.opt?.id}` }}
|
||||||
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
@ -422,14 +444,6 @@ async function getZone(options) {
|
||||||
:rules="validate('ticketList.shipped')"
|
:rules="validate('ticketList.shipped')"
|
||||||
@update:model-value="setShipped"
|
@update:model-value="setShipped"
|
||||||
/>
|
/>
|
||||||
<VnInputTime
|
|
||||||
:label="t('basicData.shippedHour')"
|
|
||||||
v-model="formData.shipped"
|
|
||||||
:required="true"
|
|
||||||
:rules="validate('basicData.shippedHour')"
|
|
||||||
disabled
|
|
||||||
@update:model-value="setShipped"
|
|
||||||
/>
|
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('basicData.landed')"
|
:label="t('basicData.landed')"
|
||||||
v-model="formData.landed"
|
v-model="formData.landed"
|
||||||
|
|
|
@ -20,6 +20,7 @@ export default {
|
||||||
'isFreezed',
|
'isFreezed',
|
||||||
'isTaxDataChecked',
|
'isTaxDataChecked',
|
||||||
'hasElectronicInvoice',
|
'hasElectronicInvoice',
|
||||||
|
'defaultAddressFk',
|
||||||
'credit',
|
'credit',
|
||||||
],
|
],
|
||||||
include: [
|
include: [
|
||||||
|
|
|
@ -579,7 +579,7 @@ function setReference(data) {
|
||||||
hide-selected
|
hide-selected
|
||||||
required
|
required
|
||||||
@update:model-value="() => onClientSelected(data)"
|
@update:model-value="() => onClientSelected(data)"
|
||||||
:sort-by="'id ASC'"
|
:sort-by="['id ASC']"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -605,7 +605,7 @@ function setReference(data) {
|
||||||
map-options
|
map-options
|
||||||
required
|
required
|
||||||
:disable="!data.clientId"
|
:disable="!data.clientId"
|
||||||
:sort-by="'isActive DESC'"
|
:sort-by="['isActive DESC']"
|
||||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
|
|
@ -13,6 +13,8 @@ export default {
|
||||||
'daysInForward',
|
'daysInForward',
|
||||||
'availabled',
|
'availabled',
|
||||||
'awbFk',
|
'awbFk',
|
||||||
|
'isDelivered',
|
||||||
|
'isReceived',
|
||||||
],
|
],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -408,7 +408,7 @@ const isUnsatisfied = async (reason) => {
|
||||||
|
|
||||||
const resendEmail = async () => {
|
const resendEmail = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
recipient: worker.value[0]?.user?.emailUser?.email,
|
recipient: worker.value?.user?.emailUser?.email,
|
||||||
week: selectedWeekNumber.value,
|
week: selectedWeekNumber.value,
|
||||||
year: selectedDateYear.value,
|
year: selectedDateYear.value,
|
||||||
workerId: Number(route.params.id),
|
workerId: Number(route.params.id),
|
||||||
|
|
|
@ -89,7 +89,7 @@ watch(
|
||||||
v-model="formData.geoFk"
|
v-model="formData.geoFk"
|
||||||
url="Postcodes/location"
|
url="Postcodes/location"
|
||||||
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
|
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
|
||||||
:sort-by="'code ASC'"
|
:sort-by="['code ASC']"
|
||||||
option-value="geoFk"
|
option-value="geoFk"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
:filter-options="['code']"
|
:filter-options="['code']"
|
||||||
|
|
Loading…
Reference in New Issue