From 1528a3649fc93e1828a177df9eed8a1e40b0d4e5 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 24 Feb 2023 13:42:56 +0100 Subject: [PATCH] Label formatter function --- src/components/ui/VnFilterPanel.vue | 15 ++++++++++++++- src/pages/Customer/CustomerFilter.vue | 4 ++-- src/pages/Ticket/TicketFilter.vue | 26 +++----------------------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 726956772..f09fa7858 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -2,6 +2,7 @@ import { onMounted, ref, computed } from 'vue'; import { useI18n } from 'vue-i18n'; import { useArrayData } from 'composables/useArrayData'; +import toDate from 'filters/toDate'; const { t } = useI18n(); const props = defineProps({ @@ -78,6 +79,18 @@ async function remove(key) { delete store.userParams[key]; await search(); } + +function formatValue(value) { + if (typeof value === 'boolean') { + return value ? t('Yes') : t('No'); + } + + if (isNaN(value) && !isNaN(Date.parse(value))) { + return toDate(value); + } + + return `"${value}"`; +}