pdf-paradise / script.js
skyperlive's picture
Exigences techniques – Développement d’interface de visualisation des données (Data Warehouse) avec ASP.NET
247fca7 verified
Raw History Blame Contribute Delete
2.87 kB
document.addEventListener('DOMContentLoaded', function() {
// PDF Uploader functionality
// Initialize charts if on dashboard page
if (window.location.pathname.includes('dashboard.html')) {
initDashboardCharts();
}
const fileUpload = document.getElementById('file-upload');
const uploadedFilesContainer = document.getElementById('uploaded-files');
const shareBtn = document.getElementById('share-btn');
fileUpload.addEventListener('change', function(e) {
const files = Array.from(e.target.files);
if (files.length > 0) {
uploadedFilesContainer.classList.remove('hidden');
shareBtn.classList.remove('hidden');
uploadedFilesContainer.innerHTML = '<h3 class="text-lg font-medium text-gray-700 mb-2">Your Uploads</h3>';
files.forEach((file, index) => {
if (file.type === 'application/pdf') {
const fileCard = document.createElement('div');
fileCard.className = 'file-card bg-gray-50 rounded-lg p-4 flex items-center justify-between';
fileCard.innerHTML = `
<div class="flex items-center">
<i data-feather="file-text" class="w-6 h-6 text-red-500 mr-3"></i>
<div>
<p class="font-medium text-gray-800 truncate max-w-xs">${file.name}</p>
<p class="text-sm text-gray-500">${(file.size / (1024 * 1024)).toFixed(2)} MB</p>
</div>
</div>
<div class="flex items-center space-x-2">
<button class="text-blue-500 hover:text-blue-700">
<i data-feather="eye" class="w-4 h-4"></i>
</button>
<button class="text-red-500 hover:text-red-700">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
`;
uploadedFilesContainer.appendChild(fileCard);
}
});
feather.replace();
}
});
shareBtn.addEventListener('click', function() {
alert('Sharing functionality would be implemented here!');
});
function initDashboardCharts() {
// Additional chart initialization can be done here if needed
}
});
// Export functionality for dashboard
function exportTo(format) {
console.log(`Exporting to ${format}...`);
// In a real implementation, this would call the backend API
alert(`Exporting data to ${format} format. This would be implemented via backend in a real application.`);
}