diff --git a/src/app/admin/maintenance/[id]/page.tsx b/src/app/admin/maintenance/[id]/page.tsx index e47e12e..a29a792 100644 --- a/src/app/admin/maintenance/[id]/page.tsx +++ b/src/app/admin/maintenance/[id]/page.tsx @@ -282,6 +282,12 @@ export default function MaintenanceDetailPage() { const [showCompleteModal, setShowCompleteModal] = useState(false); const [showPaymentModal, setShowPaymentModal] = useState(false); const [showInvoiceModal, setShowInvoiceModal] = useState(false); + + // AI OCR Simulation States + const [isOcrProcessing, setIsOcrProcessing] = useState(false); + const [ocrComplete, setOcrComplete] = useState(false); + const [ocrFileName, setOcrFileName] = useState(''); + const [ocrStep, setOcrStep] = useState(''); const [showAddNoteModal, setShowAddNoteModal] = useState(false); const [showAddPartModal, setShowAddPartModal] = useState(false); const [partSearch, setPartSearch] = useState(''); @@ -473,77 +479,84 @@ export default function MaintenanceDetailPage() {
{typeLabels[record.type]} • {record.date}
-{record.assignedTo || 'Not assigned'}
- )} -| Part | -Qty | -Unit Price | -Total | -Action | -
|---|---|---|---|---|
| {part.partName} | -- { - const newQty = Math.max(1, parseInt(e.target.value) || 1); - setRecord(prev => prev ? { - ...prev, - partsUsed: prev.partsUsed?.map(p => - p.id === part.id - ? { ...p, quantity: newQty, totalPrice: newQty * p.unitPrice } - : p - ) - } : null); - }} - className="w-16 px-2 py-1 border border-orange-200 rounded text-center text-sm" - /> - | -৳{part.unitPrice.toLocaleString()} | -৳{part.totalPrice.toLocaleString()} | -
- |
-
No parts added
- )} - {record.partsUsed && record.partsUsed.length > 0 && ( -Upload manual invoice receipt
+No file chosen
+Supports PDF, PNG, JPG (e.g. MNT-001-invoice.pdf)
+{ocrStep}
+📄 Document: {ocrFileName}
+🔧 Extracted Parts: 3 items
+⚡ Labor Service Costs: ৳1,800
+💰 Auto Total Synced: ৳6,100
+{record.assignedTo || 'Not assigned'}
+ )} +| Part | +Qty | +Unit Price | +Total | +Action | +
|---|---|---|---|---|
| {part.partName} | ++ { + const newQty = Math.max(1, parseInt(e.target.value) || 1); + setRecord(prev => prev ? { + ...prev, + partsUsed: prev.partsUsed?.map(p => + p.id === part.id + ? { ...p, quantity: newQty, totalPrice: newQty * p.unitPrice } + : p + ) + } : null); + }} + className="w-16 px-2 py-1 border border-orange-200 rounded text-center text-sm" + /> + | +৳{part.unitPrice.toLocaleString()} | +৳{part.totalPrice.toLocaleString()} | +
+ |
+
No parts added
+ )} + {record.partsUsed && record.partsUsed.length > 0 && ( +