wip
This commit is contained in:
parent
e99b2745bd
commit
16e8490b30
6 changed files with 330 additions and 90 deletions
|
@ -472,29 +472,40 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
}
|
||||
|
||||
// File upload functionality
|
||||
const uploadBtn = document.querySelector('.btn.primary [class*="fa-upload"]');
|
||||
const fileInput = document.getElementById('file-upload');
|
||||
const uploadButton = document.getElementById('upload-button');
|
||||
const uploadModal = document.querySelector('.upload-modal');
|
||||
|
||||
// Check if we're on upload page or have upload elements
|
||||
if (uploadBtn && fileInput) {
|
||||
uploadBtn.addEventListener('click', function (e) {
|
||||
// Trigger the hidden file input
|
||||
// Hide upload modal by default if it exists
|
||||
if (uploadModal) {
|
||||
uploadModal.style.display = 'none';
|
||||
uploadModal.style.opacity = '0';
|
||||
uploadModal.style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
// Setup upload button
|
||||
if (uploadButton && fileInput) {
|
||||
uploadButton.addEventListener('click', function () {
|
||||
fileInput.click();
|
||||
});
|
||||
|
||||
fileInput.addEventListener('change', function () {
|
||||
if (this.files.length) {
|
||||
if (this.files.length > 0) {
|
||||
// Handle file upload
|
||||
handleFileUpload(this.files);
|
||||
}
|
||||
});
|
||||
|
||||
// Setup drag and drop zone if exists
|
||||
const dropzone = document.getElementById('dropzone');
|
||||
if (dropzone) {
|
||||
setupDragAndDrop(dropzone);
|
||||
}
|
||||
}
|
||||
|
||||
// Close upload modal when close button is clicked
|
||||
const closeButtons = document.querySelectorAll('.upload-modal .close-btn, .upload-modal .modal-close');
|
||||
closeButtons.forEach(btn => {
|
||||
btn.addEventListener('click', function () {
|
||||
if (uploadModal) {
|
||||
uploadModal.classList.remove('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle file upload process
|
||||
function handleFileUpload(files) {
|
||||
// Show progress indicator
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue