forked from verdnatura/salix-front
fix: fixed item packaging type field showing repetitive values
This commit is contained in:
parent
735ee09ef8
commit
4bde0dffa7
|
@ -101,7 +101,7 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'itemPackingTypeFk',
|
name: 'itemPackingTypeFk',
|
||||||
label: t('ticketSale.packaging'),
|
label: t('ticketSale.packaging'),
|
||||||
format: (row) => getItemPackagingType(row),
|
format: (row) => getItemPackagingType(row.ticketSales),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -151,13 +151,18 @@ const setShippedColor = (date) => {
|
||||||
if (difference < 0) return 'success';
|
if (difference < 0) return 'success';
|
||||||
};
|
};
|
||||||
|
|
||||||
const getItemPackagingType = (row) => {
|
const getItemPackagingType = (ticketSales) => {
|
||||||
const packagingType = row?.ticketSales
|
if (!ticketSales || ticketSales.length === 0) return '-';
|
||||||
.map((sale) => sale.item?.itemPackingTypeFk || '-')
|
|
||||||
.filter((value) => value !== '-')
|
|
||||||
.join(', ');
|
|
||||||
|
|
||||||
return dashIfEmpty(packagingType);
|
const packagingTypes = ticketSales
|
||||||
|
.map((sale) => sale.item?.itemPackingTypeFk)
|
||||||
|
.filter((type) => type !== undefined && type !== null);
|
||||||
|
|
||||||
|
const uniquePackagingTypes = [...new Set(packagingTypes)];
|
||||||
|
|
||||||
|
return dashIfEmpty(
|
||||||
|
uniquePackagingTypes.length > 0 ? uniquePackagingTypes.join(', ') : '-'
|
||||||
|
);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue