Revisión 2.1
This commit is contained in:
@@ -29,6 +29,13 @@
|
||||
.sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
||||
}
|
||||
.card { border-radius: 12px; }
|
||||
/* Forzar z-index más alto para modales anidados */
|
||||
.modal { z-index: 9999 !important; }
|
||||
.modal-backdrop { z-index: 9998 !important; }
|
||||
/* Asegurar que el contenido del modal esté por encima */
|
||||
.modal-dialog { z-index: 10000 !important; position: relative; }
|
||||
/* Opcional: Mejorar la apariencia del overlay */
|
||||
.modal-backdrop.show { opacity: 0.5; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -39,12 +46,20 @@
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Contenedor *</label>
|
||||
<input name="vehiculo" id="vehiculo" class="form-control" required>
|
||||
<div class="d-flex align-items-center">
|
||||
<input name="vehiculo" id="vehiculo" class="form-control" maxlength="20" required>
|
||||
<button type="button" class="btn btn-outline-secondary ms-2" data-bs-toggle="modal" data-bs-target="#infoContenedor" style="border: none;">ℹ️</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Identificador fiscal *</label>
|
||||
<input name="identificador_fiscal" id="identFiscal" class="form-control" required>
|
||||
<label class="form-label">Identificación fiscal *</label>
|
||||
<div class="d-flex align-items-center">
|
||||
<input name="identificador_fiscal" id="ident_fiscal" class="form-control" maxlength="20" required>
|
||||
<button type="button" class="btn btn-outline-secondary ms-2" data-bs-toggle="modal" data-bs-target="#infoIdentificacion" style="border: none;">ℹ️</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Foto (opcional)</label>
|
||||
<input type="file" name="foto" id="foto" class="form-control" accept="image/*">
|
||||
@@ -55,7 +70,7 @@
|
||||
<option value="">Selecciona...</option>
|
||||
<?php foreach($transportistas as $tr): ?>
|
||||
<option value="<?= $tr['id_transportista'] ?>">
|
||||
<?= htmlspecialchars(($tr['clave_identificador'] . ' - ' . $tr['nombre'])) ?>
|
||||
<?= htmlspecialchars(($tr['clave_identificador'] . ' - ' . $tr['nombre'] . ' - ' . $tr['ciudad_nombre'] . ' - ' . $tr['domicilio'])) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@@ -68,38 +83,70 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Modales movidos FUERA del formulario -->
|
||||
<!-- Modal de ayuda - Contenedor -->
|
||||
<div class="modal fade" id="infoContenedor" tabindex="-1" aria-labelledby="infoContenedorLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="infoContenedorLabel">Info - Contenedor</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<strong>• Número económico del vehículo.</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal de ayuda - Identificación Fiscal -->
|
||||
<div class="modal fade" id="infoIdentificacion" tabindex="-1" aria-labelledby="infoIdentificacionLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="infoIdentificacionLabel">Info - Identificación Fiscal</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
• Si el medio de transporte es <strong>vehículo terrestre</strong>, se anotarán las <strong>placas de circulación</strong> del mismo.<br><br>
|
||||
• Si el medio de transporte es <strong>ferrocarril</strong>, se anotará el <strong>número de furgón o plataforma</strong>.<br><br>
|
||||
• Si el medio de transporte es <strong>marítimo</strong>, se anotará el <strong>nombre de la embarcación</strong>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('formTransCrear').addEventListener('submit', function(e) {
|
||||
e.preventDefault(); // Prevenir envío por defecto
|
||||
|
||||
// Campos que validamos:
|
||||
const veh = document.getElementById('vehiculo').value.trim();
|
||||
const fisc = document.getElementById('identFiscal').value.trim();
|
||||
const trans = document.getElementById('transportista').value;
|
||||
const fotoF = document.getElementById('foto').files[0];
|
||||
const vehiculo = document.getElementById('vehiculo').value.trim();
|
||||
const ident_fiscal = document.getElementById('ident_fiscal').value.trim();
|
||||
const transportista = document.getElementById('transportista').value;
|
||||
const fotoF = document.getElementById('foto').files[0];
|
||||
|
||||
// Validaciones de campos obligatorios
|
||||
if (!veh) {
|
||||
e.preventDefault();
|
||||
Swal.fire({ icon:'error', title:'Vehículo requerido', text:'Por favor ingresa el nombre del vehículo.', confirmButtonColor: '#dc3545'});
|
||||
document.querySelector('input[name="veh"]').focus();
|
||||
if (!vehiculo) {
|
||||
Swal.fire({ icon:'error', title:'Contenedor requerido', text:'Por favor ingresa el número económico del vehículo.', confirmButtonColor: '#dc3545'});
|
||||
document.getElementById('vehiculo').focus();
|
||||
return;
|
||||
}
|
||||
if (!fisc) {
|
||||
e.preventDefault();
|
||||
Swal.fire({ icon:'error', title:'Identificador fiscal requerido', text:'Por favor ingresa el identificador fiscal.', confirmButtonColor: '#dc3545' });
|
||||
document.querySelector('input[name="fisc"]').focus();
|
||||
if (!ident_fiscal) {
|
||||
Swal.fire({ icon:'error', title:'Identificación fiscal requerida', text:'Por favor ingresa la identificación fiscal.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('ident_fiscal').focus();
|
||||
return;
|
||||
}
|
||||
if (!trans) {
|
||||
e.preventDefault();
|
||||
if (!transportista) {
|
||||
Swal.fire({ icon:'error', title:'Transportista no seleccionado', text:'Debes elegir un transportista.', confirmButtonColor: '#dc3545' });
|
||||
document.querySelector('input[name="trans"]').focus();
|
||||
document.getElementById('transportista').focus();
|
||||
return;
|
||||
}
|
||||
if (fotoF && fotoF.size > 2 * 1024 * 1024) { // 2 MB
|
||||
e.preventDefault();
|
||||
return Swal.fire({ icon:'error', title:'Foto demasiado grande', text:'La imagen no debe exceder 2 MB.' });
|
||||
}
|
||||
// Si todas las validaciones pasan, el formulario se envía.
|
||||
this.submit();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -41,13 +41,19 @@
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Contenedor *</label>
|
||||
<input name="vehiculo" id="vehEdit" class="form-control"
|
||||
value="<?= htmlspecialchars($t['vehiculo']) ?>" required>
|
||||
<div class="d-flex align-items-center">
|
||||
<input name="vehiculo" id="vehiculo" class="form-control" maxlength="20"
|
||||
value="<?= htmlspecialchars($t['vehiculo']) ?>" required>
|
||||
<button type="button" class="btn btn-outline-secondary ms-2" data-bs-toggle="modal" data-bs-target="#infoContenedor" style="border: none;">ℹ️</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Identificador fiscal *</label>
|
||||
<input name="identificador_fiscal" id="fiscEdit" class="form-control"
|
||||
value="<?= htmlspecialchars($t['identificador_fiscal']) ?>" required>
|
||||
<label class="form-label">Identificación fiscal *</label>
|
||||
<div class="d-flex align-items-center">
|
||||
<input name="identificador_fiscal" id="identificador_fiscal" class="form-control" maxlength="20"
|
||||
value="<?= htmlspecialchars($t['identificador_fiscal']) ?>" required>
|
||||
<button type="button" class="btn btn-outline-secondary ms-2" data-bs-toggle="modal" data-bs-target="#infoIdentificacion" style="border: none;">ℹ️</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Foto actual</label><br>
|
||||
@@ -59,15 +65,15 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Reemplazar foto (opcional)</label>
|
||||
<input type="file" name="foto" id="fotoEdit" class="form-control" accept="image/*">
|
||||
<input type="file" name="foto" id="foto" class="form-control" accept="image/*">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Transportista *</label>
|
||||
<select name="id_transportista" id="trEdit" class="form-select" required>
|
||||
<select name="id_transportista" id="transportista" class="form-select" required>
|
||||
<?php foreach($transportistas as $tr): ?>
|
||||
<option value="<?= $tr['id_transportista'] ?>"
|
||||
<?= $tr['id_transportista']==$t['id_transportista']?'selected':'' ?>>
|
||||
<?= htmlspecialchars($tr['nombre']) ?>
|
||||
<?= htmlspecialchars(($tr['clave_identificador'] . ' - ' . $tr['nombre'] . ' - ' . $tr['ciudad_nombre'] . ' - ' . $tr['domicilio'])) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@@ -80,38 +86,70 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Modales movidos FUERA del formulario -->
|
||||
<!-- Modal de ayuda - Contenedor -->
|
||||
<div class="modal fade" id="infoContenedor" tabindex="-1" aria-labelledby="infoContenedorLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="infoContenedorLabel">Info - Contenedor</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<strong>• Número económico del vehículo.</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal de ayuda - Identificación Fiscal -->
|
||||
<div class="modal fade" id="infoIdentificacion" tabindex="-1" aria-labelledby="infoIdentificacionLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="infoIdentificacionLabel">Info - Identificación Fiscal</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
• Si el medio de transporte es <strong>vehículo terrestre</strong>, se anotarán las <strong>placas de circulación</strong> del mismo.<br><br>
|
||||
• Si el medio de transporte es <strong>ferrocarril</strong>, se anotará el <strong>número de furgón o plataforma</strong>.<br><br>
|
||||
• Si el medio de transporte es <strong>marítimo</strong>, se anotará el <strong>nombre de la embarcación</strong>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('formTransEdit').addEventListener('submit', function(e) {
|
||||
e.preventDefault(); // Prevenir envío por defecto
|
||||
|
||||
// Campos que validamos:
|
||||
const veh = document.getElementById('vehEdit').value.trim();
|
||||
const fisc = document.getElementById('fiscEdit').value.trim();
|
||||
const trans = document.getElementById('trEdit').value;
|
||||
const fotoF = document.getElementById('fotoEdit').files[0];
|
||||
const veh = document.getElementById('vehiculo').value.trim();
|
||||
const fisc = document.getElementById('identificador_fiscal').value.trim();
|
||||
const trans = document.getElementById('transportista').value;
|
||||
const fotoF = document.getElementById('foto').files[0];
|
||||
|
||||
// Validaciones de campos obligatorios
|
||||
if (!veh) {
|
||||
e.preventDefault();
|
||||
Swal.fire({ icon:'error', title:'Vehículo requerido', text:'Por favor ingresa el nombre del vehículo.', confirmButtonColor: '#dc3545'});
|
||||
document.querySelector('input[name="veh"]').focus();
|
||||
Swal.fire({ icon:'error', title:'Contenedor requerido', text:'Por favor ingresa el número económico del vehículo.', confirmButtonColor: '#dc3545'});
|
||||
document.getElementById('vehiculo').focus();
|
||||
return;
|
||||
}
|
||||
if (!fisc) {
|
||||
e.preventDefault();
|
||||
Swal.fire({ icon:'error', title:'Identificador fiscal requerido', text:'Por favor ingresa el identificador fiscal.', confirmButtonColor: '#dc3545' });
|
||||
document.querySelector('input[name="fisc"]').focus();
|
||||
Swal.fire({ icon:'error', title:'Identificación fiscal requerida', text:'Por favor ingresa la identificación fiscal.', confirmButtonColor: '#dc3545' });
|
||||
document.getElementById('identificador_fiscal').focus();
|
||||
return;
|
||||
}
|
||||
if (!trans) {
|
||||
e.preventDefault();
|
||||
Swal.fire({ icon:'error', title:'Transportista no seleccionado', text:'Debes elegir un transportista.', confirmButtonColor: '#dc3545' });
|
||||
document.querySelector('input[name="trans"]').focus();
|
||||
document.getElementById('transportista').focus();
|
||||
return;
|
||||
}
|
||||
if (fotoF && fotoF.size > 2 * 1024 * 1024) { // 2 MB
|
||||
e.preventDefault();
|
||||
return Swal.fire({ icon:'error', title:'Foto demasiado grande', text:'La imagen no debe exceder 2 MB.' });
|
||||
}
|
||||
// Si todas las validaciones pasan, el formulario se envía.
|
||||
this.submit();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<label class="form-label">Archivo CSV *</label>
|
||||
<input type="file" name="csv" accept=".csv" class="form-control" required>
|
||||
</div>
|
||||
<p>Descarga la plantilla y llena las columnas: <code>contenedor, identificador_fiscal, id_transportista</code>.</p>
|
||||
<p>Descarga la plantilla y llena las columnas: <code>contenedor, identificación_fiscal, id_transportista</code>.</p>
|
||||
<a href="/IMPORTADORES/public/downloads/transportes_masivo_template.csv" class="btn btn-outline-secondary mb-3">
|
||||
📥 Descargar plantilla
|
||||
</a><br>
|
||||
|
||||
Reference in New Issue
Block a user