Warmfix: packaging type field showing repetitive values #856
|
@ -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,21 @@ 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?.length) return '-';
|
||||||
.map((sale) => sale.item?.itemPackingTypeFk || '-')
|
|
||||||
.filter((value) => value !== '-')
|
|
||||||
.join(', ');
|
|
||||||
|
|
||||||
return dashIfEmpty(packagingType);
|
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>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Com sols hi ha H i V. igual tiraria mes per un .some
algo com:
const packagingTypes = []
if(ticketSales.some(sale => sale.item.itemPackingTypeFk == 'H')) packagingTypes.push('H')
if(ticketSales.some(sale => sale.item.itemPackingTypeFk == 'V')) packagingTypes.push('V')