import React from 'react'; import { QualityCheck, SafetyCheck, User } from '../types'; import { ShieldCheck, CheckCircle2, XCircle, Clock, Plus, Search, Filter, AlertTriangle, Camera, User as UserIcon, ChevronRight, MoreVertical } from 'lucide-react'; interface QCSafetyProps { qualityChecks: QualityCheck[]; safetyChecks: SafetyCheck[]; users: User[]; } const QCSafety: React.FC = ({ qualityChecks, safetyChecks, users }) => { const [activeTab, setActiveTab] = React.useState<'QUALITY' | 'SAFETY'>('QUALITY'); const getInspectorName = (uid: string) => { return users.find(u => u.uid === uid)?.name || 'Unknown Inspector'; }; return (
{/* Header & Tabs */}
{activeTab === 'QUALITY' ? (
{qualityChecks.map(check => (
{check.status === 'PASSED' ? : check.status === 'FAILED' ? : }

{check.title}

{check.location} • {new Date(check.date).toLocaleDateString()}

{check.items.map((item, idx) => (
{item.isOk ? ( ) : ( )}

{item.description}

{item.remarks &&

{item.remarks}

}
))}
{getInspectorName(check.inspectorUid)}
{check.photos?.length || 0} Photos
))}
) : (
{safetyChecks.map(audit => (
Safety Score

= 90 ? 'text-emerald-600' : audit.score >= 70 ? 'text-amber-600' : 'text-red-600' }`}>{audit.score}%

Safety Audit - {new Date(audit.date).toLocaleDateString()}

Hazards Identified
{audit.hazardsIdentified.map((hazard, idx) => ( {hazard} ))}
Corrective Actions
{audit.correctiveActions.map((action, idx) => ( {action} ))}
{getInspectorName(audit.inspectorUid)}
{audit.status}
))}
)}
); }; export default QCSafety;