import React from 'react'; import { exportReportToExcel } from '~/utils/excelExport'; interface ReportViewModalProps { isOpen: boolean; onClose: () => void; report: any; } export default function ReportViewModal({ isOpen, onClose, report }: ReportViewModalProps) { if (!isOpen || !report) return null; return (

Report View

{/* ISO Standard Report Layout */}
); } // Header Section Component function ReportHeader() { return (
{/* border-r border-black */}
Company Logo { e.currentTarget.style.display = 'none'; }} />
Reclamation Work Diary
QF-3.6.1-08
Rev. 1.0
Arab Potash Logo { e.currentTarget.style.display = 'none'; }} />
); } // Report Info Component function ReportInfo({ report }: { report: any }) { return (
Date: {new Date(report.createdDate).toLocaleDateString('en-GB')} Shift No. {report.id}
); } // Dredger Section Component function ReportDredgerSection({ report }: { report: any }) { return (
{report.area.name} Dredger
); } // Location Data Component function ReportLocationData({ report }: { report: any }) { return (
Dredger Location {report.dredgerLocation.name} Dredger Line Length {report.dredgerLineLength}
Reclamation Location {report.reclamationLocation.name} Shore Connection {report.shoreConnection}
Reclamation Height {report.reclamationHeight?.base || 0}m - {(report.reclamationHeight?.extra + report.reclamationHeight?.base || 0 || 0)}m
); } // Pipeline Length Component function ReportPipelineLength({ report }: { report: any }) { return (
Pipeline Length "from Shore Connection" Main extension total Reserve extension total
{report.pipelineLength?.main || 0} {report.pipelineLength?.ext1 || 0} {(report.pipelineLength?.main || 0) + (report.pipelineLength?.ext1 || 0)} {report.pipelineLength?.reserve || 0} {report.pipelineLength?.ext2 || 0} {(report.pipelineLength?.reserve || 0) + (report.pipelineLength?.ext2 || 0)}
); } // Shift Header Component function ReportShiftHeader({ report }: { report: any }) { return (
{report.shift.charAt(0).toUpperCase() + report.shift.slice(1)} Shift
); } // Equipment Statistics Component function ReportEquipmentStats({ report }: { report: any }) { return (
Dozers Exc. Loader Foreman Laborer
{report.stats?.Dozers || 0} {report.stats?.Exc || 0} {report.stats?.Loaders || 0} {report.stats?.Foreman || ''} {report.stats?.Laborer || 0}
); } // Time Sheet Component function ReportTimeSheet({ report }: { report: any }) { return (
{Array.isArray(report.timeSheet) && report.timeSheet.length > 0 ? ( report.timeSheet.map((entry: any, index: number) => ( )) ) : ( )}
Time Sheet From To From To Total Reason
{entry.machine} {entry.from1} {entry.to1} {entry.from2} {entry.to2} {entry.total} {entry.reason}
No time sheet entries
); } // Stoppages Component function ReportStoppages({ report }: { report: any }) { return ( <>
Dredger Stoppages
{Array.isArray(report.stoppages) && report.stoppages.length > 0 ? ( report.stoppages.map((entry: any, index: number) => ( )) ) : ( )}
From To Total Reason Responsible Notes
{entry.from} {entry.to} {entry.total} {entry.reason} {entry.responsible} {entry.note}
No stoppages recorded
); } // Notes Component function ReportNotes({ report }: { report: any }) { return ( <>
Notes & Comments
          {report.notes || 'No additional notes'}
          
); } // Footer Component function ReportFooter() { return (
{/* موقعة لأعمال الصيانة */}
); }