feat(ocr) - icn added,

This commit is contained in:
2025-09-05 01:05:13 +05:30
parent 85faef576e
commit 2652cc71a1
5 changed files with 21 additions and 6 deletions

View File

@@ -220,6 +220,7 @@ export const fullOcrPaymentService = {
totalDue: billed, totalDue: billed,
status: "PENDING", // updatePayment will fix it status: "PENDING", // updatePayment will fix it
notes: `OCR import from ${row.sourceFile ?? "Unknown file"}`, notes: `OCR import from ${row.sourceFile ?? "Unknown file"}`,
icn: row.icn ?? "",
}, },
}); });

View File

@@ -290,6 +290,12 @@ export default function PaymentEditModal({
? formatDateToHumanReadable(serviceLines[0]?.procedureDate) ? formatDateToHumanReadable(serviceLines[0]?.procedureDate)
: formatDateToHumanReadable(payment.createdAt)} : formatDateToHumanReadable(payment.createdAt)}
</span> </span>
{payment.icn ? (
<span className="bg-gray-100 text-gray-800 px-2 py-0.5 rounded-full font-medium">
ICN : {payment.icn}
</span>
) : null}
</div> </div>
</div> </div>

View File

@@ -22,6 +22,7 @@ type Row = { __id: number } & Record<string, string | number | null>;
export default function PaymentOCRBlock() { export default function PaymentOCRBlock() {
// UI state // UI state
const fileInputRef = React.useRef<HTMLInputElement>(null);
const [uploadedImages, setUploadedImages] = React.useState<File[]>([]); const [uploadedImages, setUploadedImages] = React.useState<File[]>([]);
const [isDragging, setIsDragging] = React.useState(false); const [isDragging, setIsDragging] = React.useState(false);
const [isExtracting, setIsExtracting] = React.useState(false); const [isExtracting, setIsExtracting] = React.useState(false);
@@ -257,9 +258,12 @@ export default function PaymentOCRBlock() {
setIsDragging(true); setIsDragging(true);
}} }}
onDragLeave={() => setIsDragging(false)} onDragLeave={() => setIsDragging(false)}
onClick={() => onClick={() => {
document.getElementById("image-upload-input")?.click() if (fileInputRef.current) {
fileInputRef.current.value = ""; // ✅ reset before opening
fileInputRef.current.click();
} }
}}
> >
{uploadedImages.length ? ( {uploadedImages.length ? (
<div className="space-y-4"> <div className="space-y-4">
@@ -312,17 +316,20 @@ export default function PaymentOCRBlock() {
</div> </div>
)} )}
<input <input
ref={fileInputRef}
id="image-upload-input" id="image-upload-input"
type="file" type="file"
accept="image/*" accept="image/*"
onChange={handleImageSelect} onChange={(e) => {
handleImageSelect(e);
e.currentTarget.value = "";
}}
className="hidden" className="hidden"
multiple multiple
/> />
</div> </div>
{/* Extract */} {/* Extract */}
<div className="flex justify-end gap-4"> <div className="flex justify-end gap-4">
<Button <Button
className="w-full h-12 gap-2" className="w-full h-12 gap-2"

View File

@@ -751,7 +751,7 @@ export default function PaymentsRecentTable({
isOpen={isDeletePaymentOpen} isOpen={isDeletePaymentOpen}
onConfirm={handleConfirmDeletePayment} onConfirm={handleConfirmDeletePayment}
onCancel={() => setIsDeletePaymentOpen(false)} onCancel={() => setIsDeletePaymentOpen(false)}
entityName={`ClaimID : ${currentPayment?.claimId}`} entityName={`PaymentID : ${currentPayment?.id}`}
/> />
{isEditPaymentOpen && currentPayment && ( {isEditPaymentOpen && currentPayment && (

View File

@@ -217,6 +217,7 @@ model Payment {
totalDue Decimal @db.Decimal(10, 2) totalDue Decimal @db.Decimal(10, 2)
status PaymentStatus @default(PENDING) status PaymentStatus @default(PENDING)
notes String? notes String?
icn String?
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt