@extends('Admin.layout') @section('content') @php $editLoanDetails = $loan->loan_details ?? []; if (is_string($editLoanDetails)) { $editLoanDetails = json_decode($editLoanDetails, true) ?? []; } if (!is_array($editLoanDetails)) { $editLoanDetails = []; } $loanDocuments = $loanDocuments ?? ($loan->document_collection ?? []); if (is_string($loanDocuments)) { $loanDocuments = json_decode($loanDocuments, true) ?? []; } if (!is_array($loanDocuments)) { $loanDocuments = []; } // Saved files per document key: $loanDocuments[key]['files'] = [ {path, original_name, mime_type, ...} ] $savedFiles = []; foreach ($loanDocuments as $docKey => $docData) { if (is_array($docData) && !empty($docData['files']) && is_array($docData['files'])) { $savedFiles[$docKey] = $docData['files']; } } // Relative public URL (avoids APP_URL host mismatch). $fileUrl = function ($file) { $p = $file['path'] ?? ''; if (preg_match('#^https?://#i', $p)) { return $p; } $p = ltrim(str_replace('\\', '/', $p), '/'); $p = preg_replace('#^(storage/app/public/|public/storage/|public/|storage/)#i', '', $p); return '/storage/' . $p; }; $loanTypes = [ 'Home Loan', 'Loan Against Property', 'House Purchase', 'Construction', 'Plot Purchase', 'Plot + Construction', 'Commercial LAP', 'Commercial Purchase', 'Balance Transfer', 'BT + Topup', 'Business Loan', 'Personal Loan', 'Professional Loan', 'Vehicle Loan', 'Used Car Loan', 'Other', ]; $sections = [ [ 'id' => null, 'icon' => 'ti-id text-primary', 'title' => 'Common Documents - All Cases', 'badge' => ['primary', 'Required for all loan cases'], 'col' => 'col-md-6', 'docs' => [ 'applicant_aadhar' => 'Applicant Aadhar Card', 'applicant_pan' => 'Applicant PAN Card', 'coapplicant_aadhar' => 'Co-Applicant Aadhar Card', 'coapplicant_pan' => 'Co-Applicant PAN Card', 'holder_aadhar' => 'Document Holder Aadhar Card', 'holder_pan' => 'Document Holder PAN Card', 'passport_photos' => 'Passport Size Photos - All Members', 'applicant_bank_statement' => 'Applicant Bank Statement - 1 Year', ], 'headings' => [ 'coapplicant_aadhar' => ['ti-users', 'Co-Applicant Documents'], 'holder_aadhar' => ['ti-file-certificate', 'Document Holder Documents'], 'passport_photos' => ['ti-files', 'Other Common Documents'], ], ], [ 'id' => null, 'icon' => 'ti-home text-primary', 'title' => 'Property Documents', 'badge' => null, 'col' => 'col-md-6 col-xl-4', 'docs' => [ 'sale_deed' => 'Sale Deed', 'mother_deed' => 'Mother Deed', 'encumbrance_certificate' => 'Encumbrance Certificate (EC) - 1987 to Till Date', 'latest_land_tax' => 'Latest Land Tax Receipt', 'latest_property_tax' => 'Latest Property Tax Receipt', 'patta' => 'Patta', 'eb_bill' => 'EB Bill', ], ], [ 'id' => 'takeoverSection', 'icon' => 'ti-transfer text-warning', 'title' => 'Take Over Case Documents', 'badge' => ['warning', 'Applicable for BT / Takeover cases'], 'col' => 'col-md-6 col-xl-4', 'docs' => [ 'old_bank_loan_track' => 'Old Bank Loan Track / Loan Statement', 'foreclosure_letter' => 'Foreclosure Letter', 'original_documents_list' => 'List of Original Documents from Old Bank', ], ], [ 'id' => 'purchaseSection', 'icon' => 'ti-shopping-cart text-info', 'title' => 'Purchase Case Documents', 'badge' => ['info', 'Applicable for purchase cases'], 'col' => 'col-md-6', 'docs' => [ 'buyer_seller_kyc' => 'KYC of Both Parties (Buyer and Seller)', 'sale_agreement' => 'Sale Agreement / Document Details of the Property', ], ], ]; @endphp
R.D FINANCIAL SERVICES | Edit customer document collection