SMW-Upload/templates/quote_upload.html

214 lines
5.6 KiB
HTML

<!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>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background: transparent;
}
.upload-box {
width: 100%;
min-height: 100vh;
background: white;
padding: 16px;
display: flex;
flex-direction: column;
}
h2 {
margin-bottom: 20px;
color: #333;
}
.drop-area {
border: 2px dashed #ccc;
border-radius: 4px;
padding: 24px;
text-align: center;
cursor: pointer;
transition: all 0.3s;
}
.drop-area:hover {
border-color: #666;
background: #f9f9f9;
}
.drop-area.dragover {
border-color: #0066cc;
background: #e6f2ff;
}
input[type="file"] {
display: none;
}
.file-list {
margin-top: 20px;
display: none;
}
.file-list.show {
display: block;
}
.file-item {
padding: 10px;
background: #f9f9f9;
margin-bottom: 5px;
border-radius: 4px;
}
button {
margin-top: 20px;
padding: 12px 24px;
background: #0066cc;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
width: 100%;
}
button:hover {
background: #0052a3;
}
button:disabled {
background: #ccc;
cursor: not-allowed;
}
.todo {
margin-top: 20px;
padding: 10px;
background: #fff3cd;
border: 1px solid #ffc107;
border-radius: 4px;
font-size: 14px;
color: #856404;
}
footer {
margin-top: auto;
text-align: center;
font-size: 12px;
color: #888;
}
footer a {
color: #666;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="upload-box">
<h2>Request a Quote</h2>
<div class="drop-area" id="dropArea">
<p>Drag & drop files here</p>
<p style="font-size: 14px; color: #666; margin-top: 10px;">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>