Merge branch 'test' 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
a73735f62f
|
@ -132,8 +132,7 @@ const card = toRef(props, 'item');
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
white-space: nowrap;
|
||||
width: 192px;
|
||||
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ const columns = computed(() => [
|
|||
url: 'Clients',
|
||||
fields: ['id', 'socialName'],
|
||||
optionLabel: 'socialName',
|
||||
optionValue: 'socialName',
|
||||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
|
@ -37,8 +38,11 @@ const columns = computed(() => [
|
|||
name: 'city',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
inWhere: true,
|
||||
attrs: {
|
||||
url: 'Towns',
|
||||
optionValue: 'name',
|
||||
optionLabel: 'name',
|
||||
},
|
||||
},
|
||||
cardVisible: true,
|
||||
|
@ -95,7 +99,7 @@ const columns = computed(() => [
|
|||
</VnSubToolbar>
|
||||
<VnTable
|
||||
:data-key="dataKey"
|
||||
url="Clients/filter"
|
||||
url="Clients/extendedListFilter"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
|
|
|
@ -15,7 +15,7 @@ import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescripto
|
|||
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
|
||||
|
||||
import { getItemPackagingType } from '../composables/getItemPackagingType.js';
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
@ -161,23 +161,6 @@ const setShippedColor = (date) => {
|
|||
};
|
||||
const rowClick = ({ id }) =>
|
||||
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>
|
||||
|
||||
<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 VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
@ -59,11 +58,25 @@ const zoneWhere = computed(() => {
|
|||
});
|
||||
|
||||
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) {
|
||||
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) {
|
||||
|
@ -75,15 +88,8 @@ async function getDate(query, params) {
|
|||
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
|
||||
formData.value.zoneFk = data.zoneFk;
|
||||
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();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const onChangeZone = async (zoneId) => {
|
||||
|
@ -270,8 +276,6 @@ async function getZone(options) {
|
|||
<VnSelect
|
||||
:label="t('ticketList.client')"
|
||||
v-model="clientId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
url="Clients"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="id"
|
||||
|
@ -306,16 +310,31 @@ async function getZone(options) {
|
|||
<VnSelect
|
||||
:label="t('basicData.address')"
|
||||
v-model="addressId"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:options="addresses"
|
||||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:sort-by="['isActive DESC']"
|
||||
:rules="validate('basicData.address')"
|
||||
>
|
||||
<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>
|
||||
<QItemLabel
|
||||
:class="{
|
||||
|
@ -341,6 +360,9 @@ async function getZone(options) {
|
|||
{{ scope.opt?.agencyMode?.name }}</span
|
||||
>
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt?.id}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
@ -422,14 +444,6 @@ async function getZone(options) {
|
|||
:rules="validate('ticketList.shipped')"
|
||||
@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
|
||||
:label="t('basicData.landed')"
|
||||
v-model="formData.landed"
|
||||
|
|
|
@ -20,6 +20,7 @@ export default {
|
|||
'isFreezed',
|
||||
'isTaxDataChecked',
|
||||
'hasElectronicInvoice',
|
||||
'defaultAddressFk',
|
||||
'credit',
|
||||
],
|
||||
include: [
|
||||
|
|
|
@ -579,7 +579,7 @@ function setReference(data) {
|
|||
hide-selected
|
||||
required
|
||||
@update:model-value="() => onClientSelected(data)"
|
||||
:sort-by="'id ASC'"
|
||||
:sort-by="['id ASC']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -605,7 +605,7 @@ function setReference(data) {
|
|||
map-options
|
||||
required
|
||||
:disable="!data.clientId"
|
||||
:sort-by="'isActive DESC'"
|
||||
:sort-by="['isActive DESC']"
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
|
|
|
@ -13,6 +13,8 @@ export default {
|
|||
'daysInForward',
|
||||
'availabled',
|
||||
'awbFk',
|
||||
'isDelivered',
|
||||
'isReceived',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
|
|
|
@ -408,7 +408,7 @@ const isUnsatisfied = async (reason) => {
|
|||
|
||||
const resendEmail = async () => {
|
||||
const params = {
|
||||
recipient: worker.value[0]?.user?.emailUser?.email,
|
||||
recipient: worker.value?.user?.emailUser?.email,
|
||||
week: selectedWeekNumber.value,
|
||||
year: selectedDateYear.value,
|
||||
workerId: Number(route.params.id),
|
||||
|
|
|
@ -89,7 +89,7 @@ watch(
|
|||
v-model="formData.geoFk"
|
||||
url="Postcodes/location"
|
||||
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
|
||||
:sort-by="'code ASC'"
|
||||
:sort-by="['code ASC']"
|
||||
option-value="geoFk"
|
||||
option-label="code"
|
||||
:filter-options="['code']"
|
||||
|
|
Loading…
Reference in New Issue