fix+polish: restaurar filtro DATE en DELETE rips, fallback PHP_INT_MAX en guardar_toma, pulir chip Otro (number/min/pre-carga), limpiar interval resumen
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
18c683ed9b
commit
1d8e461b3e
@@ -393,7 +393,7 @@ try {
|
||||
|
||||
// Consumir el cache: solo eliminar, no reinsertar, para que no recargue en una segunda visita
|
||||
$pdo->prepare(
|
||||
"DELETE FROM rips_examenes_pendientes WHERE numero_documento = ?"
|
||||
"DELETE FROM rips_examenes_pendientes WHERE numero_documento = ? AND DATE(created_at) = CURDATE()"
|
||||
)->execute([$numDoc]);
|
||||
|
||||
} catch (\Throwable $eRips) {
|
||||
|
||||
@@ -97,7 +97,7 @@ foreach ($esquema as $campo) {
|
||||
$horaFija = sprintf('%02d:%02d:00', $h, $min);
|
||||
} elseif (stripos($separadorLabel, 'Otro') !== false) {
|
||||
$otroVal = trim((string)($datosMerge['_otro_hora'] ?? ''));
|
||||
if (is_numeric($otroVal)) $minutos = (int)$otroVal;
|
||||
$minutos = is_numeric($otroVal) ? (int)$otroVal : PHP_INT_MAX;
|
||||
}
|
||||
}
|
||||
$firmasCampos[] = ['id' => $campo['id'], 'minutos' => $minutos, 'hora_fija' => $horaFija];
|
||||
|
||||
+22
-10
@@ -640,7 +640,8 @@ function _addExamWizardHtml(string $cid): string {
|
||||
.mp-chip.active { background:#1e3a5f;border-color:#1e3a5f;color:#fff;font-weight:600; }
|
||||
.mp-chip.signed { background:#f0fdf4;border-color:#86efac;color:#166534;cursor:default; }
|
||||
.mp-chip:not(.signed):not(:disabled):hover { border-color:#1e3a5f; }
|
||||
.mp-chip-otro-inp { display:none;width:100px;vertical-align:middle;margin-left:.3rem; }
|
||||
.mp-chip-otro-inp { display:none;width:72px;vertical-align:middle;margin-left:.3rem; }
|
||||
.mp-chip-otro-unit { vertical-align:middle;margin-left:.2rem;font-size:.8rem;color:#64748b; }
|
||||
.mp-cfg-gtitle { font-weight:700;font-size:.88rem;color:#1e3a5f;margin-bottom:.5rem;
|
||||
border-left:3px solid <?= htmlspecialchars($docColor) ?>;padding-left:.5rem; }
|
||||
.mp-cfg-item { border:1.5px solid #e5e7eb;border-radius:8px;padding:.35rem .6rem;
|
||||
@@ -1344,6 +1345,7 @@ var _mpExamOptions = <?= json_encode($_examOptions, JSON_UNESCAPED_UNICODE) ?>
|
||||
var _mpTomasConfig = <?= json_encode($_tomasConfig, JSON_UNESCAPED_UNICODE) ?>;
|
||||
var _mpCfgToken = <?= json_encode($tokenTurnero, JSON_UNESCAPED_UNICODE) ?>;
|
||||
var _mpModoTurnero = <?= json_encode($modoTurnero && $embebido) ?>;
|
||||
var _mpOtroHora = <?= json_encode($datosCliente['_otro_hora'] ?? null, JSON_UNESCAPED_UNICODE) ?>;
|
||||
|
||||
function _mpGuardarConfig(config, examType, onOk, onErr, extra) {
|
||||
var base = window.location.href.split('/ver_formulario_enviado.php')[0];
|
||||
@@ -1396,8 +1398,12 @@ function _mpShowCfgPanel(examName, groups, isModify) {
|
||||
+ (isSigned ? ' disabled title="Ya firmada"' : '') + '>'
|
||||
+ chipLbl + (isSigned ? ' <i class="fas fa-check ms-1 small"></i>' : '') + '</button>';
|
||||
if (isOtro) {
|
||||
html += '<input type="text" class="form-control form-control-sm mp-chip-otro-inp"'
|
||||
+ ' placeholder="Hora..."' + (isActive ? ' style="display:inline-block"' : '') + '>';
|
||||
var otroVal = (isActive && _mpOtroHora) ? _mpOtroHora : '';
|
||||
html += '<input type="number" class="form-control form-control-sm mp-chip-otro-inp"'
|
||||
+ ' placeholder="min" min="1" step="1"'
|
||||
+ (otroVal ? ' value="' + otroVal + '"' : '')
|
||||
+ (isActive ? ' style="display:inline-block"' : '') + '>'
|
||||
+ '<span class="mp-chip-otro-unit' + (isActive ? '' : ' d-none') + '">min</span>';
|
||||
}
|
||||
}
|
||||
html += '</div></div>';
|
||||
@@ -1418,9 +1424,14 @@ document.addEventListener('click', function(e) {
|
||||
chk.checked = !chk.checked;
|
||||
chip.classList.toggle('active', chk.checked);
|
||||
if (chip.dataset.otro) {
|
||||
var inp = chip.nextElementSibling;
|
||||
if (inp && inp.classList.contains('mp-chip-otro-inp'))
|
||||
var inp = chip.nextElementSibling;
|
||||
var unit = inp && inp.nextElementSibling;
|
||||
if (inp && inp.classList.contains('mp-chip-otro-inp')) {
|
||||
inp.style.display = chk.checked ? 'inline-block' : 'none';
|
||||
if (unit && unit.classList.contains('mp-chip-otro-unit'))
|
||||
unit.classList.toggle('d-none', !chk.checked);
|
||||
if (chk.checked) setTimeout(function() { inp.focus(); }, 50);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1588,17 +1599,17 @@ document.getElementById('mp-cfg-iniciar').addEventListener('click', function() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Validar que "Otro" tenga hora ingresada
|
||||
// Validar que "Otro" tenga minutos ingresados
|
||||
var otroHora = '';
|
||||
var otroBtn = document.querySelector('#mp-cfg-grupos .mp-chip[data-otro="1"]');
|
||||
if (otroBtn) {
|
||||
var otroChk = document.getElementById(otroBtn.getAttribute('data-target'));
|
||||
if (otroChk && otroChk.checked) {
|
||||
var otroInp = otroBtn.nextElementSibling;
|
||||
if (otroInp && otroInp.classList.contains('mp-chip-otro-inp')) otroHora = otroInp.value.trim();
|
||||
if (!otroHora) {
|
||||
var otroInp = otroBtn.parentElement.querySelector('.mp-chip-otro-inp');
|
||||
if (otroInp) otroHora = otroInp.value.trim();
|
||||
if (!otroHora || isNaN(parseInt(otroHora)) || parseInt(otroHora) < 1) {
|
||||
document.getElementById('mp-cfg-msg').innerHTML =
|
||||
'<span class="text-danger"><i class="fas fa-exclamation-circle me-1"></i>Ingrese la hora para la toma "Otro".</span>';
|
||||
'<span class="text-danger"><i class="fas fa-exclamation-circle me-1"></i>Ingrese los minutos para la toma "Otro" (ej: 2).</span>';
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2218,6 +2229,7 @@ function _mpMostrarResumen(examType, segs) {
|
||||
if (el) el.textContent = left;
|
||||
if (left <= 0) clearInterval(tick);
|
||||
}, 1000);
|
||||
window.addEventListener('unload', function() { clearInterval(tick); });
|
||||
// Ocultar countdown si queda
|
||||
var cd = document.getElementById('mp-countdown');
|
||||
if (cd) { clearInterval(cd._mpTick); cd.remove(); }
|
||||
|
||||
Reference in New Issue
Block a user