loan-app / index.html
SxmsUXUI's picture
Step 4 is a blank page and I cannot proceed - Follow Up Deployment
dec40d6 verified
Raw History Blame Contribute Delete
39.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Loan Application Journey</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.progress-bar {
height: 6px;
transition: width 0.3s ease;
}
.document-preview {
transition: all 0.3s ease;
}
.document-preview:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.dropzone {
border: 2px dashed #cbd5e0;
transition: all 0.3s ease;
}
.dropzone.active {
border-color: #3b82f6;
background-color: #f0f7ff;
}
input[type="file"] {
display: none;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto px-4 py-8 max-w-4xl">
<!-- Progress Bar -->
<div class="mb-10">
<div class="flex justify-between mb-2">
<h2 class="text-xl font-semibold text-gray-800">Loan Application</h2>
<span class="text-sm font-medium text-gray-600">Step <span id="currentStep">1</span> of 5</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div class="progress-bar bg-blue-600 rounded-full h-2.5" style="width: 20%" id="progressBar"></div>
</div>
<!-- Step 1: Personal Information -->
<div id="step1" class="bg-white rounded-xl shadow-md overflow-hidden">
<div class="bg-blue-600 px-6 py-4">
<h1 class="text-xl font-bold text-white">Personal Information</h1>
<p class="text-blue-100 mt-1">Tell us about yourself</p>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">First Name</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Last Name</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Phone Number</label>
<input type="tel" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div class="md:col-span-2">
<label class="block text-sm font-medium text-gray-700 mb-1">Address</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
</div>
<div class="flex justify-end pt-6 border-t border-gray-200">
<button onclick="nextStep()" class="px-6 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-white font-medium transition duration-200">
Next <i class="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
</div>
<!-- Step 2: Financial Information -->
<div id="step2" class="bg-white rounded-xl shadow-md overflow-hidden hidden">
<div class="bg-blue-600 px-6 py-4">
<h1 class="text-xl font-bold text-white">Financial Information</h1>
<p class="text-blue-100 mt-1">Tell us about your financial situation</p>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Employment Status</label>
<select class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option>Employed</option>
<option>Self-employed</option>
<option>Unemployed</option>
<option>Student</option>
<option>Retired</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Annual Income</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Loan Amount</label>
<input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Loan Purpose</label>
<select class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option>Home Improvement</option>
<option>Debt Consolidation</option>
<option>Business Investment</option>
<option>Education</option>
<option>Other</option>
</select>
</div>
</div>
<div class="flex justify-between pt-6 border-t border-gray-200">
<button onclick="prevStep()" class="px-6 py-2 border border-gray-300 rounded-lg text-gray-700 font-medium hover:bg-gray-50 transition duration-200">
<i class="fas fa-arrow-left mr-2"></i> Back
</button>
<button onclick="nextStep()" class="px-6 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-white font-medium transition duration-200">
Next <i class="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
</div>
<!-- Step 3: Document Verification -->
<div id="step3" class="bg-white rounded-xl shadow-md overflow-hidden hidden">
<!-- Card Header -->
<div class="bg-blue-600 px-6 py-4">
<h1 class="text-xl font-bold text-white">Document Verification</h1>
<p class="text-blue-100 mt-1">Upload your bank statements and payslips for verification</p>
</div>
<!-- Card Body -->
<div class="p-6">
<!-- Document Upload Section -->
<div class="mb-8">
<h3 class="text-lg font-semibold text-gray-800 mb-4">Upload Documents</h3>
<!-- Dropzone for Bank Statements -->
<div class="mb-6">
<label class="block text-sm font-medium text-gray-700 mb-2">Bank Statements (Last 3 months)</label>
<div id="bankDropzone" class="dropzone rounded-lg p-6 text-center cursor-pointer">
<div class="flex flex-col items-center justify-center py-8">
<i class="fas fa-file-invoice-dollar text-4xl text-blue-500 mb-3"></i>
<p class="text-gray-600 mb-2">Drag & drop your bank statements here</p>
<p class="text-sm text-gray-500 mb-4">or</p>
<button id="bankUploadBtn" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200">
Browse Files
</button>
<input type="file" id="bankFiles" accept=".pdf,.jpg,.jpeg,.png" multiple>
</div>
</div>
<div id="bankFilesPreview" class="mt-4 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3"></div>
</div>
<!-- Dropzone for Payslips -->
<div class="mb-6">
<label class="block text-sm font-medium text-gray-700 mb-2">Payslips (Last 3 months)</label>
<div id="payslipDropzone" class="dropzone rounded-lg p-6 text-center cursor-pointer">
<div class="flex flex-col items-center justify-center py-8">
<i class="fas fa-money-bill-wave text-4xl text-green-500 mb-3"></i>
<p class="text-gray-600 mb-2">Drag & drop your payslips here</p>
<p class="text-sm text-gray-500 mb-4">or</p>
<button id="payslipUploadBtn" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200">
Browse Files
</button>
<input type="file" id="payslipFiles" accept=".pdf,.jpg,.jpeg,.png" multiple>
</div>
</div>
<div id="payslipFilesPreview" class="mt-4 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3"></div>
</div>
</div>
<!-- Document Verification Section -->
<div class="mb-8">
<h3 class="text-lg font-semibold text-gray-800 mb-4">Document Verification</h3>
<!-- Bank Statement Verification -->
<div class="bg-gray-50 rounded-lg p-4 mb-4">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center">
<i class="fas fa-file-invoice-dollar text-blue-500 mr-3"></i>
<span class="font-medium">Bank Statement Verification</span>
</div>
<span id="bankStatus" class="px-3 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">Pending</span>
</div>
<div class="pl-9">
<div class="mb-2">
<label class="block text-sm text-gray-600 mb-1">Account Holder Name</label>
<input type="text" id="accountName" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="As shown on your bank statement">
</div>
<div class="mb-2">
<label class="block text-sm text-gray-600 mb-1">Account Number</label>
<input type="text" id="accountNumber" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Last 4 digits only">
</div>
<div>
<label class="block text-sm text-gray-600 mb-1">Bank Name</label>
<input type="text" id="bankName" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Your bank's name">
</div>
</div>
</div>
<!-- Payslip Verification -->
<div class="bg-gray-50 rounded-lg p-4">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center">
<i class="fas fa-money-bill-wave text-green-500 mr-3"></i>
<span class="font-medium">Payslip Verification</span>
</div>
<span id="payslipStatus" class="px-3 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">Pending</span>
</div>
<div class="pl-9">
<div class="mb-2">
<label class="block text-sm text-gray-600 mb-1">Employer Name</label>
<input type="text" id="employerName" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="Your employer's name">
</div>
<div class="mb-2">
<label class="block text-sm text-gray-600 mb-1">Monthly Income</label>
<input type="text" id="monthlyIncome" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" placeholder="As shown on your payslip">
</div>
<div>
<label class="block text-sm text-gray-600 mb-1">Pay Date</label>
<input type="date" id="payDate" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
</div>
</div>
</div>
<!-- Document Classification Results -->
<div id="classificationResults" class="hidden mb-8">
<h3 class="text-lg font-semibold text-gray-800 mb-4">Document Classification</h3>
<div class="bg-blue-50 rounded-lg p-4">
<div class="flex items-center">
<i class="fas fa-check-circle text-green-500 text-2xl mr-3"></i>
<div>
<p class="font-medium">We've automatically classified your documents</p>
<p class="text-sm text-gray-600">Review the classification below</p>
</div>
</div>
<div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="bg-white p-3 rounded-lg shadow-sm">
<p class="text-sm font-medium text-gray-700 mb-2">Bank Statements</p>
<div id="bankClassification" class="text-sm text-gray-600"></div>
</div>
<div class="bg-white p-3 rounded-lg shadow-sm">
<p class="text-sm font-medium text-gray-700 mb-2">Payslips</p>
<div id="payslipClassification" class="text-sm text-gray-600"></div>
</div>
</div>
</div>
</div>
<!-- Navigation Buttons -->
<div class="flex justify-between pt-6 border-t border-gray-200">
<button class="px-6 py-2 border border-gray-300 rounded-lg text-gray-700 font-medium hover:bg-gray-50 transition duration-200">
<i class="fas fa-arrow-left mr-2"></i> Back
</button>
<button id="verifyBtn" class="px-6 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-white font-medium transition duration-200">
Verify Documents <i class="fas fa-check ml-2"></i>
</button>
<button id="continueBtn" class="hidden px-6 py-2 bg-green-600 hover:bg-green-700 rounded-lg text-white font-medium transition duration-200">
Continue <i class="fas fa-arrow-right ml-2"></i>
</button>
</div>
</div>
</div>
<!-- Verification Modal -->
<div id="verificationModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl max-w-md w-full mx-4 p-6">
<div class="text-center">
<div class="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
<i class="fas fa-spinner fa-spin text-blue-600 text-2xl"></i>
</div>
<h3 class="text-lg font-semibold text-gray-800 mb-2">Verifying Documents</h3>
<p class="text-gray-600 mb-6">We're analyzing your documents. This may take a few moments...</p>
<div class="w-full bg-gray-200 rounded-full h-2 mb-6">
<div id="verificationProgress" class="bg-blue-600 h-2 rounded-full" style="width: 0%"></div>
</div>
</div>
</div>
</div>
<!-- Step 4: Loan Terms -->
<div id="step4" class="bg-white rounded-xl shadow-md overflow-hidden hidden">
<div class="bg-blue-600 px-6 py-4">
<h1 class="text-xl font-bold text-white">Loan Terms</h1>
<p class="text-blue-100 mt-1">Review and confirm your loan details</p>
</div>
<div class="p-6">
<div class="mb-8">
<h3 class="text-lg font-semibold text-gray-800 mb-4">Loan Summary</h3>
<div class="bg-gray-50 rounded-lg p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<p class="text-sm text-gray-600 mb-1">Loan Amount</p>
<p class="text-xl font-semibold" id="loanAmountDisplay">$10,000</p>
</div>
<div>
<p class="text-sm text-gray-600 mb-1">Interest Rate</p>
<p class="text-xl font-semibold" id="interestRateDisplay">5.99%</p>
</div>
<div>
<p class="text-sm text-gray-600 mb-1">Loan Term</p>
<p class="text-xl font-semibold" id="loanTermDisplay">36 months</p>
</div>
<div>
<p class="text-sm text-gray-600 mb-1">Monthly Payment</p>
<p class="text-xl font-semibold" id="monthlyPaymentDisplay">$304.22</p>
</div>
</div>
</div>
</div>
<div class="mb-8">
<h3 class="text-lg font-semibold text-gray-800 mb-4">Loan Agreement</h3>
<div class="bg-gray-50 rounded-lg p-6 max-h-64 overflow-y-auto">
<h4 class="font-medium mb-2">Loan Terms and Conditions</h4>
<p class="text-sm text-gray-600 mb-4">
By accepting this loan, you agree to the terms and conditions outlined below.
Please read them carefully before proceeding.
</p>
<div class="text-sm text-gray-600 space-y-3">
<p>1. The loan amount of $10,000 will be disbursed to your account within 2 business days.</p>
<p>2. The annual percentage rate (APR) of 5.99% is fixed for the duration of the loan.</p>
<p>3. You agree to make 36 monthly payments of $304.22 each.</p>
<p>4. There is no prepayment penalty if you choose to pay off the loan early.</p>
<p>5. Late payments will incur a fee of $25 or 5% of the payment amount, whichever is less.</p>
<p>6. Failure to make payments may result in collection activities and credit reporting.</p>
</div>
</div>
<div class="mt-4 flex items-center">
<input type="checkbox" id="agreeTerms" class="mr-3 h-5 w-5 text-blue-600 rounded">
<label for="agreeTerms" class="text-sm text-gray-700">
I have read and agree to the loan terms and conditions
</label>
</div>
</div>
<div class="flex justify-between pt-6 border-t border-gray-200">
<button onclick="prevStep()" class="px-6 py-2 border border-gray-300 rounded-lg text-gray-700 font-medium hover:bg-gray-50 transition duration-200">
<i class="fas fa-arrow-left mr-2"></i> Back
</button>
<button onclick="nextStep()" id="acceptLoanBtn" class="px-6 py-2 bg-blue-600 hover:bg-blue-700 rounded-lg text-white font-medium transition duration-200 opacity-50 cursor-not-allowed" disabled>
Accept Loan <i class="fas fa-check ml-2"></i>
</button>
</div>
</div>
</div>
<!-- Step 5: Confirmation -->
<div id="step5" class="bg-white rounded-xl shadow-md overflow-hidden hidden">
<div class="bg-green-600 px-6 py-4">
<h1 class="text-xl font-bold text-white">Application Complete!</h1>
<p class="text-green-100 mt-1">Your loan application has been submitted</p>
</div>
<div class="p-6">
<div class="text-center py-8">
<div class="w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6">
<i class="fas fa-check text-green-600 text-3xl"></i>
</div>
<h3 class="text-xl font-semibold text-gray-800 mb-2">Thank You!</h3>
<p class="text-gray-600 mb-6 max-w-md mx-auto">
Your loan application has been successfully submitted.
We'll review your information and get back to you within 24 hours.
</p>
<div class="bg-gray-50 rounded-lg p-6 max-w-md mx-auto mb-8">
<p class="text-sm text-gray-600 mb-3">Your application reference number:</p>
<p class="text-lg font-mono font-semibold text-blue-600">LN-2023-987654</p>
</div>
<button class="px-6 py-2 bg-green-600 hover:bg-green-700 rounded-lg text-white font-medium transition duration-200">
View Application Status <i class="fas fa-external-link-alt ml-2"></i>
</button>
</div>
</div>
</div>
</div>
<script>
let currentStep = 1;
const totalSteps = 5;
function updateProgressBar() {
const progressPercentage = (currentStep / totalSteps) * 100;
document.getElementById('progressBar').style.width = `${progressPercentage}%`;
document.getElementById('currentStep').textContent = currentStep;
}
function nextStep() {
if (currentStep < totalSteps) {
document.getElementById(`step${currentStep}`).classList.add('hidden');
currentStep++;
document.getElementById(`step${currentStep}`).classList.remove('hidden');
updateProgressBar();
}
}
function prevStep() {
if (currentStep > 1) {
document.getElementById(`step${currentStep}`).classList.add('hidden');
currentStep--;
document.getElementById(`step${currentStep}`).classList.remove('hidden');
updateProgressBar();
}
}
document.addEventListener('DOMContentLoaded', function() {
// Enable accept loan button when terms are agreed
document.getElementById('agreeTerms').addEventListener('change', function() {
document.getElementById('acceptLoanBtn').disabled = !this.checked;
document.getElementById('acceptLoanBtn').classList.toggle('opacity-50', !this.checked);
document.getElementById('acceptLoanBtn').classList.toggle('cursor-not-allowed', !this.checked);
});
updateProgressBar();
// Navigation between steps
document.getElementById('continueBtn').addEventListener('click', nextStep);
// File upload elements
const bankDropzone = document.getElementById('bankDropzone');
const payslipDropzone = document.getElementById('payslipDropzone');
const bankUploadBtn = document.getElementById('bankUploadBtn');
const payslipUploadBtn = document.getElementById('payslipUploadBtn');
const bankFilesInput = document.getElementById('bankFiles');
const payslipFilesInput = document.getElementById('payslipFiles');
const bankFilesPreview = document.getElementById('bankFilesPreview');
const payslipFilesPreview = document.getElementById('payslipFilesPreview');
// Verification elements
const verifyBtn = document.getElementById('verifyBtn');
const continueBtn = document.getElementById('continueBtn');
const verificationModal = document.getElementById('verificationModal');
const verificationProgress = document.getElementById('verificationProgress');
const classificationResults = document.getElementById('classificationResults');
const bankClassification = document.getElementById('bankClassification');
const payslipClassification = document.getElementById('payslipClassification');
const bankStatus = document.getElementById('bankStatus');
const payslipStatus = document.getElementById('payslipStatus');
// Arrays to store uploaded files
let bankStatements = [];
let payslips = [];
// Set up drag and drop for bank statements
setupDropzone(bankDropzone, bankFilesInput, bankFilesPreview, bankStatements, 'bank');
// Set up drag and drop for payslips
setupDropzone(payslipDropzone, payslipFilesInput, payslipFilesPreview, payslips, 'payslip');
// Button click handlers
bankUploadBtn.addEventListener('click', () => bankFilesInput.click());
payslipUploadBtn.addEventListener('click', () => payslipFilesInput.click());
// File input change handlers
bankFilesInput.addEventListener('change', (e) => handleFileSelect(e, bankFilesPreview, bankStatements, 'bank'));
payslipFilesInput.addEventListener('change', (e) => handleFileSelect(e, payslipFilesPreview, payslips, 'payslip'));
// Verify button click handler
verifyBtn.addEventListener('click', verifyDocuments);
// Continue button click handler
continueBtn.addEventListener('click', () => {
alert('Documents verified successfully! Continuing to next step...');
// In a real app, this would navigate to the next step
});
// Helper function to set up dropzone
function setupDropzone(dropzone, fileInput, previewContainer, fileArray, type) {
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
dropzone.addEventListener(eventName, preventDefaults, false);
});
function preventDefaults(e) {
e.preventDefault();
e.stopPropagation();
}
['dragenter', 'dragover'].forEach(eventName => {
dropzone.addEventListener(eventName, highlight, false);
});
['dragleave', 'drop'].forEach(eventName => {
dropzone.addEventListener(eventName, unhighlight, false);
});
function highlight() {
dropzone.classList.add('active');
}
function unhighlight() {
dropzone.classList.remove('active');
}
dropzone.addEventListener('drop', handleDrop, false);
function handleDrop(e) {
const dt = e.dataTransfer;
const files = dt.files;
handleFileSelect({target: {files}}, previewContainer, fileArray, type);
}
}
// Handle file selection (from drag & drop or file input)
function handleFileSelect(event, previewContainer, fileArray, type) {
const files = event.target.files;
if (files.length > 0) {
// Clear previous previews if not multiple selection
if (!event.dataTransfer) {
previewContainer.innerHTML = '';
fileArray = [];
}
for (let i = 0; i < files.length; i++) {
const file = files[i];
fileArray.push(file);
const reader = new FileReader();
reader.onload = function(e) {
const preview = createFilePreview(file, e.target.result, type);
previewContainer.appendChild(preview);
};
if (file.type.match('image.*') || file.type === 'application/pdf') {
if (file.type.match('image.*')) {
reader.readAsDataURL(file);
} else {
// For PDFs, we'll just show an icon
const preview = createFilePreview(file, null, type);
previewContainer.appendChild(preview);
}
}
}
// Update the file array reference
if (type === 'bank') {
bankStatements = fileArray;
} else {
payslips = fileArray;
}
// Enable verify button if we have files
if (bankStatements.length > 0 || payslips.length > 0) {
verifyBtn.disabled = false;
}
}
}
// Create a file preview element
function createFilePreview(file, fileUrl, type) {
const preview = document.createElement('div');
preview.className = 'document-preview bg-white rounded-lg overflow-hidden shadow-sm border border-gray-200';
let previewContent;
if (file.type.match('image.*')) {
previewContent = `
<img src="${fileUrl}" alt="${file.name}" class="w-full h-32 object-contain bg-gray-100">
<div class="p-3">
<p class="text-sm font-medium text-gray-700 truncate">${file.name}</p>
<p class="text-xs text-gray-500">${formatFileSize(file.size)}</p>
</div>
`;
} else if (file.type === 'application/pdf') {
previewContent = `
<div class="w-full h-32 bg-gray-100 flex items-center justify-center">
<i class="fas fa-file-pdf text-4xl text-red-500"></i>
</div>
<div class="p-3">
<p class="text-sm font-medium text-gray-700 truncate">${file.name}</p>
<p class="text-xs text-gray-500">${formatFileSize(file.size)}</p>
</div>
`;
} else {
previewContent = `
<div class="w-full h-32 bg-gray-100 flex items-center justify-center">
<i class="fas fa-file text-4xl text-gray-400"></i>
</div>
<div class="p-3">
<p class="text-sm font-medium text-gray-700 truncate">${file.name}</p>
<p class="text-xs text-gray-500">${formatFileSize(file.size)}</p>
</div>
`;
}
preview.innerHTML = previewContent;
// Add remove button
const removeBtn = document.createElement('button');
removeBtn.className = 'absolute top-2 right-2 bg-white rounded-full p-1 shadow-sm text-red-500 hover:text-red-700';
removeBtn.innerHTML = '<i class="fas fa-times"></i>';
removeBtn.addEventListener('click', (e) => {
e.stopPropagation();
preview.remove();
// Remove from array
if (type === 'bank') {
bankStatements = bankStatements.filter(f => f.name !== file.name);
if (bankStatements.length === 0) {
bankFilesPreview.innerHTML = '';
}
} else {
payslips = payslips.filter(f => f.name !== file.name);
if (payslips.length === 0) {
payslipFilesPreview.innerHTML = '';
}
}
// Disable verify button if no files left
if (bankStatements.length === 0 && payslips.length === 0) {
verifyBtn.disabled = true;
}
});
preview.appendChild(removeBtn);
return preview;
}
// Format file size
function formatFileSize(bytes) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
// Verify documents
function verifyDocuments() {
// Show modal
verificationModal.classList.remove('hidden');
// Simulate verification progress
let progress = 0;
const interval = setInterval(() => {
progress += Math.random() * 10;
if (progress > 100) progress = 100;
verificationProgress.style.width = `${progress}%`;
if (progress === 100) {
clearInterval(interval);
setTimeout(() => {
verificationModal.classList.add('hidden');
showVerificationResults();
}, 500);
}
}, 300);
}
// Show verification results
function showVerificationResults() {
// Update status indicators
bankStatus.textContent = 'Verified';
bankStatus.className = 'px-3 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800';
payslipStatus.textContent = 'Verified';
payslipStatus.className = 'px-3 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800';
// Show classification results
classificationResults.classList.remove('hidden');
// Populate classification details (simulated)
bankClassification.innerHTML = `
<p><i class="fas fa-check-circle text-green-500 mr-1"></i> 3 statements from <span class="font-medium">${document.getElementById('bankName').value || 'Your Bank'}</span></p>
<p><i class="fas fa-check-circle text-green-500 mr-1"></i> Account ending in <span class="font-medium">${document.getElementById('accountNumber').value ? document.getElementById('accountNumber').value.slice(-4) : '****'}</span></p>
`;
payslipClassification.innerHTML = `
<p><i class="fas fa-check-circle text-green-500 mr-1"></i> 3 payslips from <span class="font-medium">${document.getElementById('employerName').value || 'Your Employer'}</span></p>
<p><i class="fas fa-check-circle text-green-500 mr-1"></i> Monthly income: <span class="font-medium">${document.getElementById('monthlyIncome').value || '0'}</span></p>
`;
// Hide verify button and show continue button
verifyBtn.classList.add('hidden');
continueBtn.classList.remove('hidden');
}
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=SxmsUXUI/loan-app" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>