diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue
index 030ca1388..03cba8ac7 100644
--- a/src/components/CreateNewPostcodeForm.vue
+++ b/src/components/CreateNewPostcodeForm.vue
@@ -108,11 +108,11 @@ watch(
watch(
() => postcodeFormData.provinceFk,
- async (newProvinceFk) => {
+ async (newProvinceFk, oldValueFk) => {
if (Array.isArray(newProvinceFk)) {
newProvinceFk = newProvinceFk[0];
}
- if (newProvinceFk !== postcodeFormData.provinceFk) {
+ if (newProvinceFk !== oldValueFk) {
await townsFetchDataRef.value.fetch({
where: { provinceFk: newProvinceFk },
});
@@ -147,13 +147,7 @@ async function handleCountries(data) {
auto-load
url="Towns/location"
/>
-
+
[
align: 'left',
name: 'itemPackingTypeFk',
label: t('ticketSale.packaging'),
- format: (row) => getItemPackagingType(row),
+ format: (row) => getItemPackagingType(row.ticketSales),
},
{
align: 'right',
@@ -151,13 +151,21 @@ const setShippedColor = (date) => {
if (difference < 0) return 'success';
};
-const getItemPackagingType = (row) => {
- const packagingType = row?.ticketSales
- .map((sale) => sale.item?.itemPackingTypeFk || '-')
- .filter((value) => value !== '-')
- .join(', ');
+const getItemPackagingType = (ticketSales) => {
+ if (!ticketSales?.length) return '-';
- 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(', ') || '-');
};