import React from 'react';
import { Form } from "@remix-run/react";
interface ReportFormModalProps {
isOpen: boolean;
onClose: () => void;
isEditing: boolean;
isSubmitting: boolean;
editingReport: any;
actionData: any;
areas: any[];
dredgerLocations: any[];
reclamationLocations: any[];
foremen: any[];
equipment: any[];
timeSheetEntries: any[];
stoppageEntries: any[];
addTimeSheetEntry: () => void;
removeTimeSheetEntry: (id: string) => void;
updateTimeSheetEntry: (id: string, field: string, value: string) => void;
addStoppageEntry: () => void;
removeStoppageEntry: (id: string) => void;
updateStoppageEntry: (id: string, field: string, value: string) => void;
}
export default function ReportFormModal({
isOpen,
onClose,
isEditing,
isSubmitting,
editingReport,
actionData,
areas,
dredgerLocations,
reclamationLocations,
foremen,
equipment,
timeSheetEntries,
stoppageEntries,
addTimeSheetEntry,
removeTimeSheetEntry,
updateTimeSheetEntry,
addStoppageEntry,
removeStoppageEntry,
updateStoppageEntry
}: ReportFormModalProps) {
if (!isOpen) return null;
return (
{isEditing ? "Edit Report" : "Create New Report"}
{/* Enhanced Modal Footer */}
);
}
// Basic Information Component
function BasicInformation({ editingReport, actionData, areas, dredgerLocations, reclamationLocations }: any) {
return (
Basic Information
{actionData?.errors?.shift && (
{actionData.errors.shift}
)}
{actionData?.errors?.areaId && (
{actionData.errors.areaId}
)}
{actionData?.errors?.dredgerLocationId && (
{actionData.errors.dredgerLocationId}
)}
{actionData?.errors?.reclamationLocationId && (
{actionData.errors.reclamationLocationId}
)}
{actionData?.errors?.dredgerLineLength && (
{actionData.errors.dredgerLineLength}
)}
{actionData?.errors?.shoreConnection && (
{actionData.errors.shoreConnection}
)}
);
}
// Reclamation Height Component
function ReclamationHeight({ editingReport }: any) {
return (
);
}
// Pipeline Length Component
function PipelineLength({ editingReport }: any) {
return (
);
}
// Equipment Statistics Component
function EquipmentStatistics({ editingReport, foremen }: any) {
return (
);
}
// TimeSheet Section Component
function TimeSheetSection({ timeSheetEntries, equipment, addTimeSheetEntry, removeTimeSheetEntry, updateTimeSheetEntry }: any) {
return (
Equipments Time Sheet
Track Equipment working hours and maintenance periods
{timeSheetEntries.length === 0 ? (
No Equipment entries yet
Click "Add Equipment Entry" to start tracking Equipment hours
) : (
{timeSheetEntries.map((entry: any, index: number) => (
Entry #{index + 1}
))}
)}
);
}
// Stoppages Section Component
function StoppagesSection({ stoppageEntries, addStoppageEntry, removeStoppageEntry, updateStoppageEntry }: any) {
return (
Operation Stoppages
Record operational interruptions and downtime
{stoppageEntries.length === 0 ? (
No stoppages recorded
Click "Add Stoppage" to record operational interruptions
) : (
{stoppageEntries.map((entry: any, index: number) => (
Stoppage #{index + 1}
))}
)}
);
}
// Notes Section Component
function NotesSection({ editingReport }: any) {
return (
Additional Notes
);
}