97 lines
3.2 KiB
HTML
97 lines
3.2 KiB
HTML
{% load static %}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Request a Quote</title>
|
|
<link rel="stylesheet" href="{% static 'css/quote_upload.css' %}">
|
|
</head>
|
|
|
|
<body>
|
|
<div class="upload-box">
|
|
<h2>Request a Quote</h2>
|
|
<div class="drop-area" id="dropArea">
|
|
<p>Drag & drop files here</p>
|
|
<p>or click to browse</p>
|
|
<input type="file" id="fileInput" multiple>
|
|
</div>
|
|
<div class="file-list" id="fileList"></div>
|
|
<button id="submitBtn" disabled>Submit</button>
|
|
<div class="todo">
|
|
<strong>TODO:</strong> Implement file upload functionality
|
|
</div>
|
|
<footer>
|
|
Hosted by <a href="https://kitsunehosting.net" target="_blank"
|
|
rel="noopener noreferrer">kitsunehosting.net</a>
|
|
</footer>
|
|
</div>
|
|
|
|
<script>
|
|
const dropArea = document.getElementById('dropArea');
|
|
const fileInput = document.getElementById('fileInput');
|
|
const fileList = document.getElementById('fileList');
|
|
const submitBtn = document.getElementById('submitBtn');
|
|
let selectedFiles = [];
|
|
|
|
dropArea.addEventListener('click', () => fileInput.click());
|
|
|
|
dropArea.addEventListener('dragover', (e) => {
|
|
e.preventDefault();
|
|
dropArea.classList.add('dragover');
|
|
});
|
|
|
|
dropArea.addEventListener('dragleave', () => {
|
|
dropArea.classList.remove('dragover');
|
|
});
|
|
|
|
dropArea.addEventListener('drop', (e) => {
|
|
e.preventDefault();
|
|
dropArea.classList.remove('dragover');
|
|
handleFiles(e.dataTransfer.files);
|
|
});
|
|
|
|
fileInput.addEventListener('change', (e) => {
|
|
handleFiles(e.target.files);
|
|
});
|
|
|
|
function handleFiles(files) {
|
|
selectedFiles = Array.from(files);
|
|
displayFiles();
|
|
submitBtn.disabled = selectedFiles.length === 0;
|
|
}
|
|
|
|
function displayFiles() {
|
|
if (selectedFiles.length === 0) {
|
|
fileList.classList.remove('show');
|
|
return;
|
|
}
|
|
fileList.classList.add('show');
|
|
fileList.innerHTML = selectedFiles.map(file =>
|
|
`<div class="file-item">${file.name} (${(file.size / 1024).toFixed(1)} KB)</div>`
|
|
).join('');
|
|
}
|
|
|
|
submitBtn.addEventListener('click', () => {
|
|
// TODO: Submit files to backend
|
|
alert('Upload functionality - TODO');
|
|
});
|
|
|
|
// Attempt to auto-resize the iframe height (if parent allows)
|
|
function postHeight() {
|
|
const height = document.documentElement.scrollHeight;
|
|
try {
|
|
parent.postMessage({ type: 'sedutto-ifr-height', height }, '*');
|
|
} catch (e) {
|
|
// ignore if cross-origin restrictions apply
|
|
}
|
|
}
|
|
window.addEventListener('load', postHeight);
|
|
window.addEventListener('resize', postHeight);
|
|
const mo = new MutationObserver(postHeight);
|
|
mo.observe(document.body, { childList: true, subtree: true });
|
|
</script>
|
|
</body>
|
|
|
|
</html> |