30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import type { ElaprDocPrgrsClientResponseDto } from "@/shared/model";
|
|
|
|
export interface ApproverStatusConfig {
|
|
label: string;
|
|
badgeClass: string;
|
|
}
|
|
|
|
export const APPROVER_STATUS_MAP: Record<string, ApproverStatusConfig> = {
|
|
ATRZ_PRGRS_001: { label: "대기", badgeClass: "bg-gray-100 text-gray-700" },
|
|
ATRZ_PRGRS_002: { label: "요청", badgeClass: "bg-yellow-100 text-yellow-700" },
|
|
ATRZ_PRGRS_003: { label: "승인", badgeClass: "bg-green-100 text-green-700" },
|
|
ATRZ_PRGRS_004: { label: "반려", badgeClass: "bg-red-100 text-red-700" },
|
|
ATRZ_PRGRS_999: { label: "결재안함", badgeClass: "bg-blue-100 text-blue-700" },
|
|
};
|
|
|
|
export function sortByAtrzSeqNo(
|
|
list: ElaprDocPrgrsClientResponseDto[],
|
|
): ElaprDocPrgrsClientResponseDto[] {
|
|
return list.slice().sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
|
}
|
|
|
|
export function getApproverStatus(status: string | undefined): ApproverStatusConfig {
|
|
return (
|
|
APPROVER_STATUS_MAP[status ?? ""] ?? {
|
|
label: status || "-",
|
|
badgeClass: "bg-gray-100 text-gray-700",
|
|
}
|
|
);
|
|
}
|