jws-frontend/src/pages/11_credit-note/constants.ts
2025-01-20 15:03:32 +07:00

78 lines
2 KiB
TypeScript

import { QTableProps } from 'quasar';
import { CreditNote, CreditNoteStatus } from 'src/stores/credit-note';
import { formatNumberDecimal } from 'src/stores/utils';
export const taskStatusOpts = [
{
status: CreditNoteStatus.Pending,
name: `creditNote.status.${CreditNoteStatus.Pending}`,
},
{
status: CreditNoteStatus.Success,
name: `creditNote.status.${CreditNoteStatus.Success}`,
},
];
export const pageTabs = [
{ label: CreditNoteStatus.Pending, value: CreditNoteStatus.Pending },
{ label: CreditNoteStatus.Success, value: CreditNoteStatus.Success },
];
export enum Status {
taskOrder = 'taskOrder',
receiveTaskOrder = 'receiveTaskOrder',
sendTaskOrder = 'sendTaskOrder',
payment = 'payment',
goodReceipt = 'goodReceipt',
}
export const columns = [
{
name: 'order',
align: 'center',
label: 'general.order',
field: (data: CreditNote & { _index: number; _page: number }) =>
data._page * (data._index + 1),
},
{
name: 'code',
align: 'center',
label: 'creditNote.label.code',
field: (data: CreditNote) => data.code,
},
{
name: 'quotationCode',
align: 'center',
label: 'creditNote.label.quotationCode',
field: (data: CreditNote) => data.quotation.code,
},
{
name: 'quotationWorkName',
align: 'center',
label: 'creditNote.label.quotationWorkName',
field: (data: CreditNote) => data.quotation.workName,
},
{
name: 'quotationPayment',
align: 'center',
label: 'creditNote.label.quotationPayment',
field: (data: CreditNote) => data.quotation.payCondition,
},
{
name: 'creditNoteValue',
align: 'center',
label: 'creditNote.label.value',
field: (data: CreditNote) => formatNumberDecimal(data.value),
},
{
name: '#action',
align: 'center',
label: '',
field: (_) => '#action',
},
] as const satisfies QTableProps['columns'];
export const hslaColors: Record<string, string> = {
Pending: '--orange-5-hsl',
Success: '--blue-6-hsl',
};