'use client'; // File: components/response-code/CodeImplications.tsx // แสดงผลกระทบของ Response Code ที่เลือก (FR-007) import { AlertTriangle, Clock, DollarSign, FileText, Leaf } from 'lucide-react'; import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'; import { Badge } from '@/components/ui/badge'; import { ResponseCode } from '@/types/review-team'; interface CodeImplicationsProps { responseCode: ResponseCode; } const SEVERITY_VARIANTS = { '3': { variant: 'destructive' as const, label: 'Critical — Document Rejected' }, '1C': { variant: 'default' as const, label: 'High — Contract Implications' }, '1D': { variant: 'default' as const, label: 'High — Alternative Approved' }, '2': { variant: 'default' as const, label: 'Moderate — Revision Required' }, }; export function CodeImplications({ responseCode }: CodeImplicationsProps) { const impl = responseCode.implications; const notifyRoles = responseCode.notifyRoles ?? []; const hasImplications = impl?.affectsSchedule || impl?.affectsCost || impl?.requiresContractReview || impl?.requiresEiaAmendment || notifyRoles.length > 0; if (!hasImplications) return null; const severityInfo = SEVERITY_VARIANTS[responseCode.code as keyof typeof SEVERITY_VARIANTS]; return ( {severityInfo?.label ?? 'Action Required'}
{impl?.affectsSchedule && (
May affect project schedule
)} {impl?.affectsCost && (
Cost impact — QS assessment required
)} {impl?.requiresContractReview && (
Contract review required
)} {impl?.requiresEiaAmendment && (
EIA amendment may be required
)} {notifyRoles.length > 0 && (
Will notify: {notifyRoles.map((role) => ( {role.replace(/_/g, ' ')} ))}
)}
); }