import React, { useState, useEffect } from 'react'; import { Camera, FileText, Calendar, User, MapPin } from 'lucide-react'; const CraneInspectionReport = () => { const [inspectionData, setInspectionData] = useState(null); const [loading, setLoading] = useState(true); // Mock data structure that would come from your database const mockInspectionData = { reportInfo: { reportId: "INS-2025-001", craneId: "CR-001", inspectionDate: "2025-06-10", inspector: "John Smith", location: "Platform A", frequency: "3-6 MONTHLY" }, sections: { boom: { title: "Boom", items: [ { id: 1, description: "Check all sheaves for wear, damage, and remove excess builds up of rope grease", photos: ["photo1.jpg", "photo2.jpg"], status: "OK", notes: "Minor grease buildup cleaned" }, { id: 2, description: "Check sheave bearing and pin condition", photos: ["photo3.jpg"], status: "OK", notes: "" }, { id: 3, description: "Visually examine boom cord and lattices for sign of corrosion", photos: ["photo4.jpg"], status: "ATTENTION", notes: "Spot corrosion found on boom cord section 3" }, { id: 4, description: "spot corrosion must be follow up by surface brushing and touch up painting", photos: ["photo5.jpg"], status: "COMPLETED", notes: "Surface brushed and painted" }, { id: 5, description: "Check lubrication and secures of boom pivot/foot pins and lock plate bolts", photos: ["photo6.jpg"], status: "OK", notes: "" }, { id: 6, description: "Check belt tension, wear & tear", photos: ["photo7.jpg"], status: "OK", notes: "" }, { id: 7, description: "Check security of access ladders and walkways", photos: ["photo8.jpg"], status: "OK", notes: "" }, { id: 8, description: "Check swing limit operation", photos: ["photo9.jpg"], status: "OK", notes: "" } ] }, aFrame: { title: "'A' Frame", items: [ { id: 1, description: "Visually inspect the 'A' frame for signs of paint cracking around welds and sign of corrosion", photos: ["photo10.jpg"], status: "OK", notes: "" }, { id: 2, description: "spot corrosion must be follow up by surface brushing and touch up painting", photos: ["photo11.jpg"], status: "N/A", notes: "" }, { id: 3, description: "Check security of 'A' frame bolts", photos: ["photo12.jpg"], status: "OK", notes: "" }, { id: 4, description: "Check maintenance runway beam for defects. Check bolt tightness", photos: ["photo13.jpg"], status: "OK", notes: "" } ] }, wireRopes: { title: "Wire Ropes and Hooks", items: [ { id: 1, description: "Inspect main, auxiliary, boom and pendant wire ropes for wear broken, defect or damage", photos: ["photo14.jpg"], status: "OK", notes: "" }, { id: 2, description: "if broken wire please mention on how many broken wire at what layer/ angle at what strand / lay length", photos: ["photo15.jpg"], status: "N/A", notes: "" }, { id: 3, description: "Ensure ropes are spooled correctly on drums", photos: ["photo16.jpg"], status: "OK", notes: "" }, { id: 4, description: "Examine hoist rope connection to swivel on hook and check safety latch and links", photos: ["photo17.jpg"], status: "OK", notes: "" }, { id: 5, description: "Lubricate wire ropes as necessary", photos: ["photo18.jpg"], status: "COMPLETED", notes: "All wire ropes lubricated" }, { id: 6, description: "Wire rope termination at winch condition", photos: ["photo19.jpg"], status: "OK", notes: "" } ] }, hydraulicSystem: { title: "Hydraulic System", items: [ { id: 1, description: "Check that standby emergency brake release equipment is in good order", photos: ["photo20.jpg"], status: "OK", notes: "" }, { id: 2, description: "Visually inspect hydraulic hoses for leakage and security", photos: ["photo21.jpg"], status: "OK", notes: "" }, { id: 3, description: "Check all hydraulic filter condition", photos: ["photo22.jpg"], status: "REPLACED", notes: "Filter replaced during inspection" }, { id: 4, description: "Check anti cavitation switch and operation", photos: ["photo23.jpg"], status: "OK", notes: "" } ] }, engineRunning: { title: "With Engine Running", items: [ { id: 1, description: "Check that all mounting bolts are tight", photos: ["photo24.jpg"], status: "OK", notes: "" }, { id: 2, description: "Check gearbox oil level. Top up as required./6M", photos: ["photo25.jpg"], status: "TOPPED_UP", notes: "Oil level low, topped up" } ] } } }; // Simulate database fetch useEffect(() => { const fetchInspectionData = async () => { setLoading(true); // Simulate API call setTimeout(() => { setInspectionData(mockInspectionData); setLoading(false); }, 1000); }; fetchInspectionData(); }, []); const getStatusColor = (status) => { switch (status) { case 'OK': return 'text-green-600 bg-green-50'; case 'ATTENTION': return 'text-red-600 bg-red-50'; case 'COMPLETED': return 'text-blue-600 bg-blue-50'; case 'REPLACED': return 'text-purple-600 bg-purple-50'; case 'TOPPED_UP': return 'text-orange-600 bg-orange-50'; case 'N/A': return 'text-gray-600 bg-gray-50'; default: return 'text-gray-600 bg-gray-50'; } }; const InspectionSection = ({ title, items, sectionNumber }) => (
| Photo No | Description | Status | Photo 1 | Photo 2 | Photo 3 |
|---|---|---|---|---|---|
| {item.id} |
{item.description} {item.notes && (Note: {item.notes} )} |
{item.status} |
|
|
|
<<< Click here to key in {title}
Loading inspection report...
For Internal Use - For Internal Distribution Only
Report ID
{inspectionData.reportInfo.reportId}
Inspection Date
{inspectionData.reportInfo.inspectionDate}
Inspector
{inspectionData.reportInfo.inspector}
Location
{inspectionData.reportInfo.location}
Crane ID
{inspectionData.reportInfo.craneId}
For Internal Use - For Internal Distribution Only