From 9105dcf7fee9c4b047c375e79638c8268ebbd132 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Fri, 22 Nov 2024 16:46:05 +0700 Subject: [PATCH] refactor: quotation card badge color & constant --- src/components/05_quotation/TableQuotation.vue | 9 +-------- src/pages/05_quotation/MainPage.vue | 2 ++ src/pages/05_quotation/constants.ts | 9 +++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/05_quotation/TableQuotation.vue b/src/components/05_quotation/TableQuotation.vue index 46f4c3ab..5cc97d46 100644 --- a/src/components/05_quotation/TableQuotation.vue +++ b/src/components/05_quotation/TableQuotation.vue @@ -7,14 +7,7 @@ import { formatNumberDecimal, commaInput } from 'stores/utils'; import BadgeComponent from 'components/BadgeComponent.vue'; import KebabAction from 'components/shared/KebabAction.vue'; -const hslaColors: Record = { - Issued: '--orange-5-hsl', - Accepted: '--pink-6-hsl', - Expired: '--cyan-7-hsl', - PaymentInProcess: '--purple-7-hsl', - PaymentSuccess: '--orange-11-hsl', - ProcessComplete: '--blue-10-hsl', -}; +import { hslaColors } from 'src/pages/05_quotation/constants'; const props = withDefaults( defineProps<{ diff --git a/src/pages/05_quotation/MainPage.vue b/src/pages/05_quotation/MainPage.vue index 9643b8aa..d20b9a42 100644 --- a/src/pages/05_quotation/MainPage.vue +++ b/src/pages/05_quotation/MainPage.vue @@ -11,6 +11,7 @@ import { useNavigator } from 'src/stores/navigator'; import useFlowStore from 'src/stores/flow'; import useMyBranch from 'stores/my-branch'; import { useQuotationForm } from './form'; +import { hslaColors } from './constants'; // NOTE Import Types import { CustomerBranchCreate } from 'stores/customer/types'; @@ -652,6 +653,7 @@ async function storeDataLocal(id: string) { item.row.createdBy.lastName " :total-price="item.row.finalPrice" + :badge-color="hslaColors[item.row.quotationStatus] || ''" @preview="storeDataLocal(item.row.id)" @view=" () => { diff --git a/src/pages/05_quotation/constants.ts b/src/pages/05_quotation/constants.ts index a7a08a9b..691fd179 100644 --- a/src/pages/05_quotation/constants.ts +++ b/src/pages/05_quotation/constants.ts @@ -126,3 +126,12 @@ export const columnQuotation = [ ] satisfies QTableProps['columns']; export const fieldSelectedOption = [{ label: 'general.type', value: 'value' }]; + +export const hslaColors: Record = { + Issued: '--orange-5-hsl', + Accepted: '--pink-6-hsl', + Expired: '--cyan-7-hsl', + PaymentInProcess: '--purple-7-hsl', + PaymentSuccess: '--green-8-hsl', + ProcessComplete: '--blue-6-hsl', +};