feat(padres): separar opciones en pantallas dedicadas con boton volver y limpiar panel principal

This commit is contained in:
unknown
2026-10-06 01:42:32 -06:00
parent f94fef3041
commit d5f0502f6f
3 changed files with 495 additions and 268 deletions
+83
View File
@@ -4110,3 +4110,86 @@ body.dark-mode .recreopay-inapp-toast-title {
body.dark-mode .recreopay-inapp-toast-body {
color: #cbd5e1;
}
/* ==========================================
SUB-PANTALLAS DEDICADAS DEL PORTAL DE PADRES
========================================== */
.parent-subview {
animation: fadeInSubView 0.2s ease-out;
}
@keyframes fadeInSubView {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.parent-subview-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
padding: 4px 2px;
}
.parent-subview-back-btn {
background: var(--card-bg, #ffffff);
border: 1.5px solid var(--border, #e2e8f0);
color: var(--text-main, #0f172a);
font-size: 0.84rem;
font-weight: 800;
border-radius: 12px;
padding: 8px 14px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
transition: all 0.15s ease;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.parent-subview-back-btn:hover {
background: var(--bg-hover, #f1f5f9);
border-color: #0284c7;
color: #0284c7;
transform: translateX(-2px);
}
.parent-subview-child-tag {
display: inline-flex;
align-items: center;
gap: 8px;
background: rgba(2, 132, 199, 0.08);
border: 1px solid rgba(2, 132, 199, 0.2);
border-radius: 20px;
padding: 4px 10px 4px 4px;
color: #0284c7;
font-size: 0.78rem;
font-weight: 800;
}
.parent-subview-child-tag img {
width: 24px;
height: 24px;
border-radius: 50%;
object-fit: cover;
border: 1.5px solid #0284c7;
background: white;
}
body.dark-mode .parent-subview-back-btn {
background: #1e293b;
border-color: #334155;
color: #f8fafc;
}
body.dark-mode .parent-subview-back-btn:hover {
background: #334155;
color: #38bdf8;
border-color: #38bdf8;
}
+118 -37
View File
@@ -830,6 +830,8 @@
<!-- SECCIÓN DE GESTIÓN DEL HIJO SELECCIONADO -->
<div id="parentSelectedChildContainer" style="display: none;">
<!-- PANTALLA PRINCIPAL DEL HIJO (TERMINA EN EL MENÚ DE ACCIONES) -->
<div id="parentChildDashboardMain">
<!-- TARJETA ELEGANTE DE SALDO EN LA CUENTA (ESTILO ORDEREAT REFINADO) -->
<div class="parent-balance-card-refined">
<div class="parent-balance-header-row">
@@ -857,7 +859,7 @@
<div class="parent-balance-limit-info">
Límite Diario: <strong id="parentDailyLimitInlineDisplay" style="color: #0284c7;">₡3.000</strong>
</div>
<button type="button" onclick="focusParentSinpeRecharge()" class="parent-balance-btn-recharge">
<button type="button" onclick="openParentSubView('sinpe')" class="parent-balance-btn-recharge">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
<span>Recargar Saldo</span>
</button>
@@ -893,7 +895,7 @@
<span class="parent-refined-arrow">›</span>
</div>
<div onclick="document.getElementById('parentAllergiesCard')?.scrollIntoView({ behavior: 'smooth' })" class="parent-refined-menu-item">
<div onclick="openParentSubView('alergias')" class="parent-refined-menu-item">
<div class="parent-refined-item-left">
<div class="parent-refined-icon-box rose-halo">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
@@ -906,20 +908,20 @@
<span class="parent-refined-arrow" style="color: #f43f5e;">›</span>
</div>
<div onclick="document.getElementById('parentDailyLimitCard')?.scrollIntoView({ behavior: 'smooth' })" class="parent-refined-menu-item">
<div onclick="openParentSubView('limites')" class="parent-refined-menu-item">
<div class="parent-refined-item-left">
<div class="parent-refined-icon-box">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/></svg>
</div>
<div>
<span class="parent-refined-item-title">Límite Diario de Gasto</span>
<span class="parent-refined-item-desc">Control presupuestario de compras</span>
<span class="parent-refined-item-desc">Control presupuestario y transferencias</span>
</div>
</div>
<span class="parent-refined-arrow">›</span>
</div>
<div onclick="document.getElementById('parentHistoryCard')?.scrollIntoView({ behavior: 'smooth' })" class="parent-refined-menu-item">
<div onclick="openParentSubView('historial')" class="parent-refined-menu-item">
<div class="parent-refined-item-left">
<div class="parent-refined-icon-box">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="4" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
@@ -931,9 +933,35 @@
</div>
<span class="parent-refined-arrow">›</span>
</div>
<div onclick="openParentSubView('credenciales')" class="parent-refined-menu-item">
<div class="parent-refined-item-left">
<div class="parent-refined-icon-box">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
</div>
<div>
<span class="parent-refined-item-title">Seguridad y PIN Escolar</span>
<span class="parent-refined-item-desc">PIN de 4 dígitos y contraseña del carné</span>
</div>
</div>
<span class="parent-refined-arrow">›</span>
</div>
</div>
</div>
<!-- 1. SUB-PANTALLA: RECARGA SINPE MÓVIL -->
<div id="parentSubViewSinpe" class="parent-subview" style="display: none;">
<div class="parent-subview-header">
<button type="button" onclick="closeParentSubView()" class="parent-subview-back-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>
<span>Volver</span>
</button>
<div class="parent-subview-child-tag">
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
<span class="parentSubViewChildName">Estudiante</span>
</div>
</div>
<!-- RECARGA SINPE MÓVIL (DIRECTO EN PANTALLA, NO MODAL) -->
<div class="parent-card" style="background: #f0fdf4; border: 1.5px solid #86efac;">
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;">
<div style="display: flex; align-items: center; gap: 10px;">
@@ -982,8 +1010,21 @@
<div id="parentSinpePendingList" style="display: flex; flex-direction: column; gap: 6px;"></div>
</div>
</div>
</div>
<!-- 2. SUB-PANTALLA: ALERGIAS Y SALUD -->
<div id="parentSubViewAlergias" class="parent-subview" style="display: none;">
<div class="parent-subview-header">
<button type="button" onclick="closeParentSubView()" class="parent-subview-back-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>
<span>Volver</span>
</button>
<div class="parent-subview-child-tag">
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
<span class="parentSubViewChildName">Estudiante</span>
</div>
</div>
<!-- TARJETA DE ALERGIAS Y RESTRICCIONES (ESTILO ORDEREAT SALUDABLE) -->
<div id="parentAllergiesCard" class="parent-card" style="background: #ffffff; border: 1.5px solid #fecdd3; border-radius: 20px; box-shadow: 0 4px 14px rgba(225, 29, 72, 0.05);">
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;">
<div style="display: flex; align-items: center; gap: 10px;">
@@ -1030,9 +1071,22 @@
<span>Guardar Configuración de Salud</span>
</button>
</div>
</div>
<!-- CONFIGURACIÓN DE LÍMITE DIARIO -->
<div id="parentDailyLimitCard" class="parent-card" style="background: #f0f9ff; border: 2px solid #38bdf8;">
<!-- 3. SUB-PANTALLA: LÍMITE DIARIO Y TRANSFERENCIAS -->
<div id="parentSubViewLimites" class="parent-subview" style="display: none;">
<div class="parent-subview-header">
<button type="button" onclick="closeParentSubView()" class="parent-subview-back-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>
<span>Volver</span>
</button>
<div class="parent-subview-child-tag">
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
<span class="parentSubViewChildName">Estudiante</span>
</div>
</div>
<div id="parentDailyLimitCard" class="parent-card" style="background: #f0f9ff; border: 2px solid #38bdf8; margin-bottom: 12px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
<div>
<strong style="font-size: 0.95rem; color: #0369a1; display: inline-flex; align-items: center; gap: 6px;">
@@ -1080,45 +1134,72 @@
</div>
<input type="checkbox" id="chkParentAllowTransferDirect" onchange="onToggleParentTransfer(this.checked)" style="width: 24px; height: 24px; cursor: pointer; accent-color: #0284c7;" checked>
</div>
<!-- SEGURIDAD Y PIN ESCOLAR -->
<div class="parent-card" style="border: 1.5px dashed var(--border);">
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 10px;">
<div style="width: 32px; height: 32px; border-radius: 8px; background: rgba(51, 65, 85, 0.1); color: #334155; display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
</div>
<div>
<strong style="font-size: 0.9rem; color: var(--text-main); display: block;">Credenciales del Estudiante</strong>
<span style="font-size: 0.74rem; color: var(--text-muted);">Restablece el PIN o la contraseña de acceso escolar</span>
<!-- 4. SUB-PANTALLA: HISTORIAL DE COMPRAS -->
<div id="parentSubViewHistorial" class="parent-subview" style="display: none;">
<div class="parent-subview-header">
<button type="button" onclick="closeParentSubView()" class="parent-subview-back-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>
<span>Volver</span>
</button>
<div class="parent-subview-child-tag">
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
<span class="parentSubViewChildName">Estudiante</span>
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px;">
<div>
<label style="display: block; font-size: 0.74rem; font-weight: 800; color: var(--text-muted); margin-bottom: 3px;">Nuevo PIN (4 dígitos):</label>
<input type="password" inputmode="numeric" maxlength="4" id="inputParentStudentPin" placeholder="1234" style="width: 100%; padding: 9px; border-radius: 8px; border: 1.5px solid var(--border); font-weight: 900; letter-spacing: 2px; text-align: center; box-sizing: border-box; background: var(--card-bg); color: var(--text-main);">
<div id="parentHistoryCard" class="parent-card">
<h4 style="font-size: 0.95rem; font-weight: 900; color: var(--text-main); margin-bottom: 12px; display: flex; align-items: center; gap: 8px;">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/></svg>
<span>Historial Detallado de Compras</span>
</h4>
<div id="parentStudentHistoryList" style="font-size: 0.85rem; color: var(--text-muted);">
Sin compras recientes registradas.
</div>
<div>
<label style="display: block; font-size: 0.74rem; font-weight: 800; color: var(--text-muted); margin-bottom: 3px;">Nueva Contraseña:</label>
<input type="text" id="inputParentStudentPass" placeholder="Ej: 1234" style="width: 100%; padding: 9px; border-radius: 8px; border: 1.5px solid var(--border); font-weight: 800; box-sizing: border-box; background: var(--card-bg); color: var(--text-main);">
</div>
</div>
<button type="button" onclick="saveParentStudentCredentials()" style="width: 100%; padding: 10px; background: #334155; color: white; border: none; border-radius: 8px; font-weight: 800; font-size: 0.82rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;">
<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>
<!-- 5. SUB-PANTALLA: SEGURIDAD Y CREDENCIALES -->
<div id="parentSubViewCredenciales" class="parent-subview" style="display: none;">
<div class="parent-subview-header">
<button type="button" onclick="closeParentSubView()" class="parent-subview-back-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"/><polyline points="12 19 5 12 12 5"/></svg>
<span>Volver</span>
</button>
<div class="parent-subview-child-tag">
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
<span class="parentSubViewChildName">Estudiante</span>
</div>
</div>
<div class="parent-card" style="border: 1.5px solid var(--border);">
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 14px;">
<div style="width: 38px; height: 38px; border-radius: 10px; background: rgba(51, 65, 85, 0.1); color: #334155; display: flex; align-items: center; justify-content: center; flex-shrink: 0;">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
</div>
<div>
<strong style="font-size: 0.95rem; color: var(--text-main); display: block;">Credenciales de Acceso Escolar</strong>
<span style="font-size: 0.74rem; color: var(--text-muted);">Restablece el PIN de 4 dígitos o contraseña de tu hijo</span>
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px;">
<div>
<label style="display: block; font-size: 0.76rem; font-weight: 800; color: var(--text-muted); margin-bottom: 4px;">Nuevo PIN (4 dígitos):</label>
<input type="password" inputmode="numeric" maxlength="4" id="inputParentStudentPin" placeholder="1234" style="width: 100%; padding: 11px; border-radius: 10px; border: 1.5px solid var(--border); font-weight: 900; letter-spacing: 3px; text-align: center; box-sizing: border-box; background: var(--card-bg); color: var(--text-main); font-size: 1.05rem;">
</div>
<div>
<label style="display: block; font-size: 0.76rem; font-weight: 800; color: var(--text-muted); margin-bottom: 4px;">Nueva Contraseña:</label>
<input type="text" id="inputParentStudentPass" placeholder="Ej: 1234" style="width: 100%; padding: 11px; border-radius: 10px; border: 1.5px solid var(--border); font-weight: 800; box-sizing: border-box; background: var(--card-bg); color: var(--text-main); font-size: 0.95rem;">
</div>
</div>
<button type="button" onclick="saveParentStudentCredentials()" style="width: 100%; padding: 12px; background: #334155; color: white; border: none; border-radius: 10px; font-weight: 800; font-size: 0.88rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>
<span>Guardar Nuevas Credenciales</span>
</button>
</div>
<!-- HISTORIAL DE COMPRAS RECIENTES -->
<div id="parentHistoryCard" class="parent-card">
<h4 style="font-size: 0.9rem; font-weight: 900; color: var(--text-main); margin-bottom: 10px; display: 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"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/></svg>
<span>Historial de Compras en Soda</span>
</h4>
<div id="parentStudentHistoryList" style="font-size: 0.8rem; color: var(--text-muted);">
Sin compras recientes registradas.
</div>
</div>
</div>
</div>
+70 -7
View File
@@ -2220,19 +2220,81 @@ function selectParentChild(childId) {
const found = hijos.find(h => h.id === childId);
if (found) {
currentParentChild = found;
closeParentSubView();
renderParentDashboardView();
if (window.sounds) window.sounds.playTap();
}
}
function focusParentSinpeRecharge() {
const sinpeInput = document.getElementById('inputParentSinpeMonto');
if (sinpeInput) {
sinpeInput.scrollIntoView({ behavior: 'smooth', block: 'center' });
setTimeout(() => {
sinpeInput.focus();
}, 350);
function openParentSubView(viewKey) {
const mainDash = document.getElementById('parentChildDashboardMain');
if (mainDash) mainDash.style.display = 'none';
const subViews = [
'parentSubViewSinpe',
'parentSubViewAlergias',
'parentSubViewLimites',
'parentSubViewHistorial',
'parentSubViewCredenciales'
];
subViews.forEach(id => {
const el = document.getElementById(id);
if (el) el.style.display = 'none';
});
if (currentParentChild) {
document.querySelectorAll('.parentSubViewChildAvatar').forEach(img => {
img.src = currentParentChild.foto_url || '/img/avatar_default.png';
});
document.querySelectorAll('.parentSubViewChildName').forEach(span => {
span.textContent = `${currentParentChild.nombre_completo} (${currentParentChild.grado})`;
});
}
let targetId = '';
if (viewKey === 'sinpe') targetId = 'parentSubViewSinpe';
else if (viewKey === 'alergias') targetId = 'parentSubViewAlergias';
else if (viewKey === 'limites') targetId = 'parentSubViewLimites';
else if (viewKey === 'historial') targetId = 'parentSubViewHistorial';
else if (viewKey === 'credenciales') targetId = 'parentSubViewCredenciales';
const targetEl = document.getElementById(targetId);
if (targetEl) {
targetEl.style.display = 'block';
}
if (viewKey === 'sinpe' && currentParentChild) {
loadParentSinpeRequests(currentParentChild.id);
} else if (viewKey === 'historial' && currentParentChild) {
loadActiveChildHistory(currentParentChild.id);
}
window.scrollTo({ top: 0, behavior: 'smooth' });
if (window.sounds) window.sounds.playTap();
}
function closeParentSubView() {
const mainDash = document.getElementById('parentChildDashboardMain');
if (mainDash) mainDash.style.display = 'block';
const subViews = [
'parentSubViewSinpe',
'parentSubViewAlergias',
'parentSubViewLimites',
'parentSubViewHistorial',
'parentSubViewCredenciales'
];
subViews.forEach(id => {
const el = document.getElementById(id);
if (el) el.style.display = 'none';
});
window.scrollTo({ top: 0, behavior: 'smooth' });
if (window.sounds) window.sounds.playTap();
}
function focusParentSinpeRecharge() {
openParentSubView('sinpe');
}
function renderActiveChildDetails(child) {
@@ -2654,6 +2716,7 @@ function returnToParentDashboard() {
if (viewPadres) viewPadres.style.display = 'block';
if (appContainer) appContainer.style.display = 'none';
if (bottomNav) bottomNav.style.display = 'none';
closeParentSubView();
loadParentDashboard();
}