turnero: mostrar minuto de Otro en label de card de toma progresiva
Agrega _mpEffectiveLabel() que añade " - N" al label cuando la sección es Otro y _mpOtroHora tiene valor, mostrando ej: "Toma · Otro - 2". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
815f136dca
commit
ba2728a25f
@@ -1815,6 +1815,10 @@ function _mpBuildSepFirmaMap() {
|
||||
return m;
|
||||
}
|
||||
|
||||
function _mpEffectiveLabel(label) {
|
||||
return (/otro/i.test(label) && _mpOtroHora) ? label + ' - ' + _mpOtroHora : label;
|
||||
}
|
||||
|
||||
function _mpCardHdrHtml(fid, num, label, state) {
|
||||
var badge = state === 'signed'
|
||||
? '<span class="toma-card-badge toma-badge-done"><i class="fas fa-check-circle me-1"></i>Firmado</span>'
|
||||
@@ -1886,7 +1890,7 @@ function _mpRenderCards() {
|
||||
|
||||
var hdr = document.createElement('div');
|
||||
hdr.className = 'toma-card-hdr';
|
||||
hdr.innerHTML = _mpCardHdrHtml(fid, idx + 1, entry.label || '', state);
|
||||
hdr.innerHTML = _mpCardHdrHtml(fid, idx + 1, _mpEffectiveLabel(entry.label || ''), state);
|
||||
if (isSigned) {
|
||||
// Fill hora in header
|
||||
var horaEl = null;
|
||||
@@ -1916,7 +1920,7 @@ function _mpUpdateProgress(signedCount, firmaIds) {
|
||||
|| (function(){ var c=document.getElementById('tc-'+fid); return c&&c.classList.contains('toma-card--signed'); }());
|
||||
var isActive = fid === window._mpPrimeraPendiente && !isSigned;
|
||||
var cls = isSigned ? 'done' : isActive ? 'act' : 'wait';
|
||||
var lbl = ((window._muestrasMap || {})[fid] || {}).label || '';
|
||||
var lbl = _mpEffectiveLabel(((window._muestrasMap || {})[fid] || {}).label || '');
|
||||
return '<span class="mp-step mp-step--' + cls + '" title="' + lbl.replace(/"/g,'"') + '"></span>';
|
||||
}).join('');
|
||||
wrap.innerHTML = '<div class="mp-prog-hdr"><span class="mp-prog-text">Toma <strong>' + signedCount + '</strong> de <strong>' + total + '</strong></span><div class="mp-steps">' + steps + '</div></div>'
|
||||
@@ -1932,7 +1936,7 @@ function _mpRefreshCards(signedFid, nextFid) {
|
||||
var shdr = sc.querySelector('.toma-card-hdr');
|
||||
if (shdr) {
|
||||
var se = window._muestrasMap[signedFid] || {}, snum = (sc.querySelector('.toma-card-num') || {}).textContent || '1';
|
||||
shdr.innerHTML = _mpCardHdrHtml(signedFid, parseInt(snum), se.label || '', 'signed');
|
||||
shdr.innerHTML = _mpCardHdrHtml(signedFid, parseInt(snum), _mpEffectiveLabel(se.label || ''), 'signed');
|
||||
if (se.hora_campo) { var horaEl = sc.querySelector('[name="' + se.hora_campo + '"]'); if (horaEl && horaEl.value) { var hs = shdr.querySelector('.toma-card-hora'); if (hs) hs.textContent = horaEl.value; } }
|
||||
shdr.addEventListener('click', function() { sc.classList.toggle('tc-expanded'); });
|
||||
}
|
||||
@@ -1943,7 +1947,7 @@ function _mpRefreshCards(signedFid, nextFid) {
|
||||
if (nc) {
|
||||
nc.classList.remove('toma-card--locked'); nc.classList.add('toma-card--active');
|
||||
var nhdr = nc.querySelector('.toma-card-hdr');
|
||||
if (nhdr) { var ne = window._muestrasMap[nextFid] || {}, nnum = (nc.querySelector('.toma-card-num') || {}).textContent || '1'; nhdr.innerHTML = _mpCardHdrHtml(nextFid, parseInt(nnum), ne.label || '', 'active'); }
|
||||
if (nhdr) { var ne = window._muestrasMap[nextFid] || {}, nnum = (nc.querySelector('.toma-card-num') || {}).textContent || '1'; nhdr.innerHTML = _mpCardHdrHtml(nextFid, parseInt(nnum), _mpEffectiveLabel(ne.label || ''), 'active'); }
|
||||
setTimeout(function() { nc.scrollIntoView({ behavior:'smooth', block:'center' }); }, 150);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user