diff options
Diffstat (limited to 'lib/vendor-investigation')
| -rw-r--r-- | lib/vendor-investigation/table/investigation-table-columns.tsx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/vendor-investigation/table/investigation-table-columns.tsx b/lib/vendor-investigation/table/investigation-table-columns.tsx index 521befa9..a6c1574d 100644 --- a/lib/vendor-investigation/table/investigation-table-columns.tsx +++ b/lib/vendor-investigation/table/investigation-table-columns.tsx @@ -26,6 +26,22 @@ interface GetVendorInvestigationsColumnsProps { openVendorDetailsModal?: (vendorId: number) => void } +// Helper function for investigation method variants +function getMethodVariant(method: string): "default" | "secondary" | "outline" | "destructive" { + switch (method) { + case "PURCHASE_SELF_EVAL": + return "secondary" + case "DOCUMENT_EVAL": + return "outline" + case "PRODUCT_INSPECTION": + return "default" + case "SITE_VISIT_EVAL": + return "destructive" + default: + return "outline" + } +} + export function getColumns({ setRowAction, openVendorDetailsModal, @@ -168,6 +184,17 @@ export function getColumns({ ) } + // Handle investigation method + if (column.id === "investigationMethod") { + if (!value) return "" + + return ( + <Badge variant={getMethodVariant(value as string)}> + {formatEnumValue(value as string)} + </Badge> + ) + } + // Handle evaluation result if (column.id === "evaluationResult") { if (!value) return "" @@ -340,6 +367,8 @@ function getStatusVariant(status: string): "default" | "secondary" | "outline" | } } + + function getResultVariant(result: string): "default" | "secondary" | "outline" | "destructive" { switch (result) { case "APPROVED": |
