feat(padres): rediseño estetico y compacto del widget de limite diario (Opcion A), switches estilo iOS y contencion a 620px

This commit is contained in:
unknown
2026-10-07 12:25:34 -06:00
parent 91dd1d0196
commit 8c1d3f43fe
4 changed files with 249 additions and 45 deletions
+11
View File
@@ -368,6 +368,17 @@
margin-bottom: 16px !important; margin-bottom: 16px !important;
} }
/* Contención ergonómica de formularios y ajustes en desktop (máx 620px) */
.parent-subview:not(#parentSubViewMenu) .parent-card {
max-width: 620px !important;
width: 100% !important;
box-sizing: border-box !important;
}
#parentSubViewMenu .parent-card {
max-width: 100% !important;
}
/* Ocultar botón Volver en escritorio ya que la barra lateral siempre está visible */ /* Ocultar botón Volver en escritorio ya que la barra lateral siempre está visible */
.parent-subview-back-btn { .parent-subview-back-btn {
display: none !important; display: none !important;
+153
View File
@@ -5256,4 +5256,157 @@ body.dark-mode .parent-nav-box-icon {
border-color: #334155; border-color: #334155;
} }
/* --------------------------------------------------------------------------
COMPONENTES ESTÉTICOS MODERNOS PARA PORTAL DE PADRES (FINTECH / SAAS)
-------------------------------------------------------------------------- */
.parent-compact-stage-card {
max-width: 620px;
width: 100%;
box-sizing: border-box;
}
/* Switch Toggle Moderno Estilo iOS */
.switch-saas {
position: relative;
display: inline-block;
width: 48px;
height: 26px;
flex-shrink: 0;
cursor: pointer;
margin: 0;
}
.switch-saas input {
opacity: 0;
width: 0;
height: 0;
position: absolute;
}
.switch-saas-slider {
position: absolute;
cursor: pointer;
inset: 0;
background-color: #cbd5e1;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
border-radius: 26px;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
.switch-saas-slider:before {
position: absolute;
content: "";
height: 20px;
width: 20px;
left: 3px;
bottom: 3px;
background-color: #ffffff;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
border-radius: 50%;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.switch-saas input:checked + .switch-saas-slider {
background-color: #0284c7;
}
.switch-saas input:checked + .switch-saas-slider.rose {
background-color: #e11d48;
}
.switch-saas input:checked + .switch-saas-slider:before {
transform: translateX(22px);
}
body.dark-mode .switch-saas-slider {
background-color: #334155;
}
body.dark-mode .switch-saas-slider:before {
background-color: #f1f5f9;
}
/* Range Slider Estilizado para Límites */
.saas-range-slider {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 8px;
border-radius: 8px;
background: #e0f2fe;
outline: none;
transition: background 0.2s;
margin: 10px 0 6px 0;
}
body.dark-mode .saas-range-slider {
background: #1e293b;
}
.saas-range-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 22px;
height: 22px;
border-radius: 50%;
background: #0284c7;
cursor: pointer;
box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
border: 2.5px solid #ffffff;
transition: transform 0.15s ease, background 0.15s;
}
.saas-range-slider::-webkit-slider-thumb:hover {
transform: scale(1.15);
background: #0369a1;
}
.saas-range-slider::-moz-range-thumb {
width: 22px;
height: 22px;
border-radius: 50%;
background: #0284c7;
cursor: pointer;
box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
border: 2.5px solid #ffffff;
}
/* Píldoras de Monto Preestablecido */
.limit-preset-pill {
padding: 8px 10px;
font-size: 0.82rem;
font-weight: 800;
border-radius: 10px;
border: 1.5px solid #bae6fd;
background: #ffffff;
color: #0369a1;
cursor: pointer;
transition: all 0.15s ease;
display: inline-flex;
align-items: center;
justify-content: center;
}
.limit-preset-pill:hover {
background: #e0f2fe;
border-color: #0284c7;
color: #0284c7;
transform: translateY(-1px);
}
.limit-preset-pill:active {
transform: translateY(0);
}
body.dark-mode .limit-preset-pill {
background: #0f172a;
border-color: #334155;
color: #38bdf8;
}
body.dark-mode .limit-preset-pill:hover {
background: #1e293b;
border-color: #38bdf8;
}
+72 -42
View File
@@ -12,8 +12,8 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="SiboPay"> <meta name="apple-mobile-web-app-title" content="SiboPay">
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="/css/styles.css?v=11.2"> <link rel="stylesheet" href="/css/styles.css?v=11.3">
<link rel="stylesheet" href="/css/desktop.css?v=2.1"> <link rel="stylesheet" href="/css/desktop.css?v=2.2">
<style> <style>
/* Transiciones suaves */ /* Transiciones suaves */
.fade-enter { animation: fadeIn 0.2s ease-in-out; } .fade-enter { animation: fadeIn 0.2s ease-in-out; }
@@ -1278,7 +1278,10 @@
<strong style="font-size: 0.84rem; color: #1e293b; display: block;">Veto de Comida Chatarra / Golosinas</strong> <strong style="font-size: 0.84rem; color: #1e293b; display: block;">Veto de Comida Chatarra / Golosinas</strong>
<span style="font-size: 0.70rem; color: #64748b; display: block; margin-top: 2px;">Bloquea confites, gaseosas y comida chatarra en caja</span> <span style="font-size: 0.70rem; color: #64748b; display: block; margin-top: 2px;">Bloquea confites, gaseosas y comida chatarra en caja</span>
</div> </div>
<input type="checkbox" id="chkParentBlockJunkFood" onchange="onToggleParentBlockJunkFood(this.checked)" style="width: 22px; height: 22px; cursor: pointer; accent-color: #e11d48;"> <label class="switch-saas" title="Bloquear comida chatarra">
<input type="checkbox" id="chkParentBlockJunkFood" onchange="onToggleParentBlockJunkFood(this.checked)">
<span class="switch-saas-slider rose"></span>
</label>
</div> </div>
<!-- Botón Guardar Alergias --> <!-- Botón Guardar Alergias -->
@@ -1302,54 +1305,81 @@
</div> </div>
</div> </div>
<div id="parentDailyLimitCard" class="parent-card" style="background: #f0f9ff; border: 2px solid #38bdf8; margin-bottom: 12px;"> <!-- TARJETA ÚNICA DE LÍMITE DIARIO Y TRANSFERENCIAS (COMPACTA, ESTÉTICA Y FINTECH) -->
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;"> <div id="parentDailyLimitCard" class="parent-card" style="background: var(--card-bg, #ffffff); border: 1.5px solid #bae6fd; box-shadow: 0 4px 16px rgba(2, 132, 199, 0.06); padding: 22px; border-radius: 18px; margin-bottom: 14px;">
<div> <!-- Cabecera con Icono y Badge -->
<strong style="font-size: 0.95rem; color: #0369a1; display: inline-flex; align-items: center; gap: 6px;"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px;">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> <div style="display: flex; align-items: center; gap: 10px;">
<span>Límite de Gasto Máximo Diario</span> <div style="width: 40px; height: 40px; border-radius: 11px; background: #e0f2fe; color: #0284c7; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0;">
</strong> 🛡️
<span style="font-size: 0.74rem; color: #64748b; display: block; margin-top: 2px;">Monto máximo que el estudiante puede gastar por día</span> </div>
<div>
<strong style="font-size: 0.98rem; color: var(--text-main); display: block; line-height: 1.2;">Límite de Gasto Diario</strong>
<span style="font-size: 0.74rem; color: var(--text-muted); display: block; margin-top: 2px;">Tope de consumo por jornada escolar</span>
</div>
</div>
<div style="text-align: right;">
<span id="lblParentDailyLimitDisplay" style="font-size: 1.15rem; color: #0284c7; font-weight: 900; background: #f0f9ff; border: 1.5px solid #bae6fd; padding: 5px 14px; border-radius: 10px; display: inline-block; letter-spacing: -0.3px;">₡3.000 / día</span>
</div> </div>
<span id="lblParentDailyLimitDisplay" style="font-size: 1.1rem; color: #0284c7; font-weight: 900; background: white; border: 1.5px solid #bae6fd; padding: 4px 12px; border-radius: 8px;">₡3.000</span>
</div> </div>
<div style="display: flex; gap: 8px; margin-bottom: 10px;"> <!-- Selector de Montos Rápidos (Pills) -->
<div style="position: relative; flex: 1;"> <div style="margin-bottom: 14px;">
<span style="position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-weight: 900; color: #0284c7; font-size: 1.1rem;">₡</span> <span style="display: block; font-size: 0.72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;">Montos sugeridos:</span>
<input type="tel" inputmode="numeric" pattern="[0-9]*" id="inputParentCustomLimit" placeholder="Ej: 3000" style="width: 100%; padding: 10px 10px 10px 30px; border-radius: 10px; border: 2px solid #0284c7; font-size: 1.1rem; font-weight: 900; color: #0f172a; background: white; box-sizing: border-box;"> <div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;">
<button type="button" onclick="setParentLimitPreset(1500)" class="limit-preset-pill">₡1.500</button>
<button type="button" onclick="setParentLimitPreset(2500)" class="limit-preset-pill">₡2.500</button>
<button type="button" onclick="setParentLimitPreset(3500)" class="limit-preset-pill">₡3.500</button>
<button type="button" onclick="setParentLimitPreset(5000)" class="limit-preset-pill">₡5.000</button>
</div> </div>
<button type="button" onclick="saveParentCustomLimit()" style="padding: 10px 16px; background: linear-gradient(135deg, #0284c7, #0369a1); color: white; border: none; border-radius: 10px; font-weight: 900; font-size: 0.85rem; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35); display: inline-flex; align-items: center; gap: 6px;"> </div>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>
<span>Guardar</span> <!-- Barra Deslizadora Compacta y Estilizada -->
<div style="background: var(--bg-main, #f8fafc); border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;">
<div style="display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; font-weight: 800; color: var(--text-muted);">
<span>Ajuste rápido:</span>
<span style="color: #0284c7; font-weight: 900;">Arrastra la barra</span>
</div>
<input type="range" id="rangeParentLimit" class="saas-range-slider" min="1000" max="10000" step="500" value="3000" oninput="onParentLimitSliderChange(this.value)">
<div style="display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); font-weight: 700;">
<span>₡1.000 min</span>
<span>₡5.000</span>
<span>₡10.000 max</span>
</div>
</div>
<!-- Input Manual y Botón Guardar en Fila Compacta -->
<div style="display: flex; gap: 8px; align-items: center; margin-bottom: 18px;">
<div style="position: relative; flex: 1;">
<span style="position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-weight: 900; color: #0284c7; font-size: 1.05rem;">₡</span>
<input type="tel" inputmode="numeric" pattern="[0-9]*" id="inputParentCustomLimit" placeholder="Ej: 3000" oninput="onParentLimitInputChange(this.value)" style="width: 100%; height: 42px; padding: 0 12px 0 32px; border-radius: 10px; border: 1.5px solid var(--border, #cbd5e1); font-size: 1.05rem; font-weight: 900; color: var(--text-main); background: var(--card-bg, #ffffff); box-sizing: border-box; outline: none;">
</div>
<button type="button" onclick="saveParentCustomLimit()" class="btn-saas btn-saas-primary" style="height: 42px; padding: 0 20px; font-size: 0.85rem; font-weight: 800; border-radius: 10px; white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="20 6 9 17 4 12"/></svg>
<span>Guardar Límite</span>
</button> </button>
</div> </div>
<div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 10px;"> <!-- Divisor Separador Elegante -->
<button type="button" onclick="setParentLimitPreset(1500)" class="stock-btn-quick">₡1.500</button> <div style="border-top: 1px solid var(--border, #e2e8f0); margin: 18px 0 16px 0;"></div>
<button type="button" onclick="setParentLimitPreset(2500)" class="stock-btn-quick">₡2.500</button>
<button type="button" onclick="setParentLimitPreset(3500)" class="stock-btn-quick">₡3.500</button>
<button type="button" onclick="setParentLimitPreset(5000)" class="stock-btn-quick">₡5.000</button>
</div>
<input type="range" id="rangeParentLimit" min="1000" max="10000" step="500" value="3000" oninput="onParentLimitSliderChange(this.value)" style="width: 100%;"> <!-- REGLA DE PERMISOS: TRANSFERENCIAS ENTRE COMPAÑEROS CON SWITCH TIPO IOS -->
<div style="display: flex; justify-content: space-between; font-size: 0.7rem; color: #64748b; margin-top: 2px;"> <div style="display: flex; justify-content: space-between; align-items: center; gap: 14px;">
<span>₡1.000 min</span> <div style="display: flex; align-items: center; gap: 10px; min-width: 0;">
<span>₡10.000 max</span> <div style="width: 36px; height: 36px; border-radius: 10px; background: rgba(2, 132, 199, 0.08); color: #0284c7; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0;">
🔄
</div>
<div>
<strong style="font-size: 0.88rem; color: var(--text-main); display: block; line-height: 1.25;">Transferencias entre Compañeros</strong>
<span style="font-size: 0.72rem; color: var(--text-muted); display: block; margin-top: 2px;">Permitir transferir saldo a compañeros de clase</span>
</div>
</div>
<label class="switch-saas" title="Activar o desactivar transferencias">
<input type="checkbox" id="chkParentAllowTransferDirect" onchange="onToggleParentTransfer(this.checked)" checked>
<span class="switch-saas-slider"></span>
</label>
</div> </div>
</div> </div>
<!-- PERMISOS DE TRANSFERENCIA ENTRE COMPAÑEROS -->
<div class="parent-card" style="display: flex; justify-content: space-between; align-items: center;">
<div>
<strong style="font-size: 0.88rem; color: var(--text-main); display: inline-flex; align-items: center; gap: 6px;">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
<span>Transferencias entre Compañeros</span>
</strong>
<span style="font-size: 0.74rem; color: var(--text-muted); display: block; margin-top: 2px;">Permitir transferir saldo a compañeros de clase</span>
</div>
<input type="checkbox" id="chkParentAllowTransferDirect" onchange="onToggleParentTransfer(this.checked)" style="width: 24px; height: 24px; cursor: pointer; accent-color: #0284c7;" checked>
</div>
</div> </div>
<!-- 4. SUB-PANTALLA: HISTORIAL DE COMPRAS --> <!-- 4. SUB-PANTALLA: HISTORIAL DE COMPRAS -->
@@ -2752,6 +2782,6 @@
<script src="/js/sounds.js?v=9.6"></script> <script src="/js/sounds.js?v=9.6"></script>
<script src="/js/jsQR.js"></script> <script src="/js/jsQR.js"></script>
<script src="/js/food-icons.js?v=1.1"></script> <script src="/js/food-icons.js?v=1.1"></script>
<script src="/js/app.js?v=11.1"></script> <script src="/js/app.js?v=11.2"></script>
</body> </body>
</html> </html>
+13 -3
View File
@@ -2834,7 +2834,7 @@ function renderActiveChildDetails(child) {
if (balance) balance.textContent = `₡${(child.saldo_colones || 0).toLocaleString('es-CR')}`; if (balance) balance.textContent = `₡${(child.saldo_colones || 0).toLocaleString('es-CR')}`;
const currentLimit = child.limite_diario_colones || 3000; const currentLimit = child.limite_diario_colones || 3000;
if (lblLimit) lblLimit.textContent = `₡${currentLimit.toLocaleString('es-CR')}`; if (lblLimit) lblLimit.textContent = `₡${currentLimit.toLocaleString('es-CR')} / día`;
if (inputCustomLimit) inputCustomLimit.value = currentLimit; if (inputCustomLimit) inputCustomLimit.value = currentLimit;
if (rangeLimit) rangeLimit.value = currentLimit; if (rangeLimit) rangeLimit.value = currentLimit;
if (chkTransfer) chkTransfer.checked = child.permitir_transferencias !== 0; if (chkTransfer) chkTransfer.checked = child.permitir_transferencias !== 0;
@@ -3644,7 +3644,7 @@ function setParentLimitPreset(amt) {
const lbl = document.getElementById('lblParentDailyLimitDisplay'); const lbl = document.getElementById('lblParentDailyLimitDisplay');
if (input) input.value = amt; if (input) input.value = amt;
if (range) range.value = amt; if (range) range.value = amt;
if (lbl) lbl.textContent = `₡${parseInt(amt, 10).toLocaleString('es-CR')}`; if (lbl) lbl.textContent = `₡${parseInt(amt, 10).toLocaleString('es-CR')} / día`;
if (window.sounds) window.sounds.playTap(); if (window.sounds) window.sounds.playTap();
} }
@@ -3652,7 +3652,17 @@ function onParentLimitSliderChange(val) {
const input = document.getElementById('inputParentCustomLimit'); const input = document.getElementById('inputParentCustomLimit');
const lbl = document.getElementById('lblParentDailyLimitDisplay'); const lbl = document.getElementById('lblParentDailyLimitDisplay');
if (input) input.value = val; if (input) input.value = val;
if (lbl) lbl.textContent = `₡${parseInt(val, 10).toLocaleString('es-CR')}`; if (lbl) lbl.textContent = `₡${parseInt(val, 10).toLocaleString('es-CR')} / día`;
}
function onParentLimitInputChange(val) {
const range = document.getElementById('rangeParentLimit');
const lbl = document.getElementById('lblParentDailyLimitDisplay');
const num = parseInt(val, 10);
if (!isNaN(num) && num > 0) {
if (range) range.value = num;
if (lbl) lbl.textContent = `₡${num.toLocaleString('es-CR')} / día`;
}
} }
async function saveParentCustomLimit() { async function saveParentCustomLimit() {