74 lines
3.3 KiB
PHP
74 lines
3.3 KiB
PHP
<?php include __DIR__ . '/../partials/sidebar_importador.php'; ?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>📤 Subir Archivos</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
<style>
|
|
body { font-family: 'Segoe UI', sans-serif; background-color: #f6f8fb; }
|
|
.content { margin-top: 56px; padding: 32px 20px; background-color: #f6f8fb; }
|
|
@media (min-width: 768px) { .content { margin-left: var(--sidebar-width, 280px); } }
|
|
.card { border-radius: 12px; }
|
|
.dropzone { border: 2px dashed #cbd5e1; border-radius: 12px; background: #fff; padding: 32px; text-align: center; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
|
|
.dropzone.dragover { background: #f1f5f9; border-color: #94a3b8; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="content">
|
|
<h4 class="mb-4">📤 Subir archivos al expediente</h4>
|
|
<div class="card p-4 bg-white shadow-sm">
|
|
<form action="/IMPORTADORES/expediente/subir_handler" method="POST" enctype="multipart/form-data" id="formUpload">
|
|
<?php if (isset($pedimento_id)): ?>
|
|
<input type="hidden" name="pedimento_id" value="<?= (int)$pedimento_id ?>">
|
|
<?php else: ?>
|
|
<input type="hidden" name="id_solicitud" value="<?= $id_solicitud ?>">
|
|
<?php endif; ?>
|
|
|
|
<div class="mb-3">
|
|
<div id="dz" class="dropzone">
|
|
<i class="fa-solid fa-cloud-arrow-up fa-2xl mb-2"></i>
|
|
<div class="mb-1">Arrastra y suelta los archivos aquí</div>
|
|
<div class="text-muted small">o haz clic para seleccionar</div>
|
|
<input class="form-control d-none" type="file" name="archivos[]" id="archivo" multiple required>
|
|
</div>
|
|
<div id="fileList" class="mt-3 small text-muted"></div>
|
|
</div>
|
|
|
|
<div class="d-flex gap-2">
|
|
<button type="submit" class="btn btn-success">Subir</button>
|
|
<a href="/IMPORTADORES/expediente/index" class="btn btn-secondary">Cancelar</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
(function(){
|
|
const dz = document.getElementById('dz');
|
|
const input = document.getElementById('archivo');
|
|
const list = document.getElementById('fileList');
|
|
function openPicker(){ input.click(); }
|
|
function updateList(){
|
|
const files = Array.from(input.files || []);
|
|
if (!files.length) { list.textContent = ''; return; }
|
|
list.innerHTML = files.map(f => `• ${f.name} (${(f.size/1024).toFixed(1)} KB)`).join('<br>');
|
|
}
|
|
dz.addEventListener('click', openPicker);
|
|
dz.addEventListener('dragover', (e)=>{ e.preventDefault(); dz.classList.add('dragover'); });
|
|
dz.addEventListener('dragleave', ()=> dz.classList.remove('dragover'));
|
|
dz.addEventListener('drop', (e)=>{
|
|
e.preventDefault(); dz.classList.remove('dragover');
|
|
if (e.dataTransfer?.files?.length){ input.files = e.dataTransfer.files; updateList(); }
|
|
});
|
|
input.addEventListener('change', updateList);
|
|
})();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|