refactor: handle status canceled

This commit is contained in:
Thanaphon Frappet 2025-01-07 11:29:40 +07:00
parent 1fc44abdb4
commit 9590467d0f
2 changed files with 12 additions and 21 deletions

View file

@ -33,16 +33,6 @@ function payCondition(value: string) {
return ''; return '';
} }
function quotationStatus(value: string) {
if (value === 'Issued') return 'quotation.status.Issued';
if (value === 'Accepted') return 'quotation.status.Accepted';
if (value === 'Expired') return 'quotation.status.Expired';
if (value === 'PaymentInProcess') return 'quotation.status.Invoice';
if (value === 'PaymentSuccess') return 'quotation.status.PaymentSuccess';
if (value === 'ProcessComplete') return 'quotation.status.ProcessComplete';
return '';
}
defineEmits<{ defineEmits<{
(e: 'preview', data: any): void; (e: 'preview', data: any): void;
(e: 'view', data: any): void; (e: 'view', data: any): void;
@ -109,21 +99,21 @@ defineEmits<{
</q-td> </q-td>
<q-td v-if="visibleColumns.includes('status')"> <q-td v-if="visibleColumns.includes('status')">
<div class="row" style="min-width: 150px"> <div style="min-width: 150px">
<BadgeComponent <BadgeComponent
:title="$t(quotationStatus(props.row.quotationStatus))" :title="$t(`quotation.status.${props.row.quotationStatus}`)"
:hsla-color="hslaColors[props.row.quotationStatus] || ''" :hsla-color="hslaColors[props.row.quotationStatus] || ''"
/> />
<div v-if="props.row.urgent" class="q-ml-sm" style="font-size: 90%"> <BadgeComponent
<BadgeComponent class="q-ml-xs"
icon="mdi-fire" icon="mdi-fire"
:title="$t('general.urgent2')" v-if="props.row.urgent"
hsla-color="--gray-1-hsl" :title="$t('general.urgent2')"
hsla-background="--red-8-hsl" hsla-color="--gray-1-hsl"
solid hsla-background="--red-8-hsl"
/> solid
</div> />
</div> </div>
</q-td> </q-td>

View file

@ -135,4 +135,5 @@ export const hslaColors: Record<string, string> = {
PaymentInProcess: '--purple-7-hsl', PaymentInProcess: '--purple-7-hsl',
PaymentSuccess: '--green-8-hsl', PaymentSuccess: '--green-8-hsl',
ProcessComplete: '--blue-6-hsl', ProcessComplete: '--blue-6-hsl',
Canceled: '--red-6-hsl',
}; };