feat: rediseño elegante estilo OrderEAT con iconos vectoriales, tarjeta refinada de saldo, sede escolar y gestión de alergias

This commit is contained in:
unknown
2026-10-06 00:39:08 -06:00
parent 35868e5cad
commit e15c801dd5
3 changed files with 656 additions and 17 deletions
+320
View File
@@ -3620,3 +3620,323 @@ body.dark-mode .admin-student-row.is-blocked {
.pwa-nav-item.transfer-nav-disabled svg { .pwa-nav-item.transfer-nav-disabled svg {
stroke: #94a3b8 !important; stroke: #94a3b8 !important;
} }
/* ==========================================
REDISEÑO MODERNO (ORDEREAT STYLE - CELESTE EDITION)
========================================== */
/* 1. Selector de Roles Superfinos */
.login-role-selector-wrap {
margin-bottom: 18px;
}
.login-role-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
.login-role-card {
border: 2px solid var(--border, #f1f5f9);
background: var(--bg-main, #f8fafc);
border-radius: 18px;
padding: 14px 8px;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
user-select: none;
}
.login-role-card:hover {
border-color: #cbd5e1;
transform: translateY(-2px);
}
.login-role-icon {
width: 44px;
height: 44px;
border-radius: 14px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
color: #475569;
margin-bottom: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
transition: all 0.2s ease;
}
.login-role-name {
font-size: 0.78rem;
font-weight: 900;
color: #334155;
line-height: 1.2;
}
.login-role-desc {
font-size: 0.65rem;
font-weight: 700;
color: #94a3b8;
margin-top: 2px;
}
.login-role-card.selected {
border-color: #0284c7;
background: #f0f9ff;
box-shadow: 0 4px 14px rgba(2, 132, 199, 0.14);
}
.login-role-card.selected .login-role-icon {
background: #0284c7;
color: #ffffff;
box-shadow: 0 4px 12px rgba(2, 132, 199, 0.28);
}
.login-role-card.selected .login-role-name {
color: #0284c7;
}
.login-role-card.selected .login-role-desc {
color: #0369a1;
}
/* 2. Tarjeta de Saldo Elegante (Estilo OrderEAT) */
.parent-balance-card-refined {
background: #ffffff;
border-radius: 26px;
border: 1px solid var(--border, #e2e8f0);
padding: 22px;
box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(226, 232, 240, 0.8);
margin-bottom: 16px;
position: relative;
overflow: hidden;
background-image: radial-gradient(circle at 100% 0%, rgba(2, 132, 199, 0.06) 0%, transparent 60%),
radial-gradient(circle at 0% 100%, rgba(2, 132, 199, 0.03) 0%, transparent 50%);
}
.parent-balance-header-row {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 6px;
}
.parent-balance-tag-title {
font-size: 0.72rem;
font-weight: 900;
text-transform: uppercase;
letter-spacing: 0.8px;
color: #64748b;
}
.parent-balance-child-pill {
font-size: 0.74rem;
font-weight: 800;
background: #f0f9ff;
color: #0284c7;
border: 1px solid #bae6fd;
padding: 2px 10px;
border-radius: 20px;
display: inline-flex;
align-items: center;
gap: 5px;
}
.parent-balance-grade-pill {
font-size: 0.70rem;
font-weight: 800;
background: #f1f5f9;
color: #475569;
padding: 2px 8px;
border-radius: 6px;
}
.parent-balance-amount-display {
font-size: 2.3rem;
font-weight: 900;
color: #0f172a;
letter-spacing: -0.6px;
margin: 4px 0 12px 0;
display: flex;
align-items: baseline;
}
.parent-balance-amount-display span.decimals {
font-size: 1rem;
font-weight: 700;
color: #94a3b8;
margin-left: 2px;
}
.parent-balance-footer-row {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 14px;
border-top: 1px solid #f1f5f9;
gap: 12px;
}
.parent-balance-limit-info {
font-size: 0.78rem;
color: #64748b;
font-weight: 600;
}
.parent-balance-btn-recharge {
background: #0284c7;
color: #ffffff;
border: none;
font-size: 0.85rem;
font-weight: 900;
padding: 10px 20px;
border-radius: 14px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
box-shadow: 0 4px 14px rgba(2, 132, 199, 0.32);
transition: all 0.2s ease;
}
.parent-balance-btn-recharge:hover {
background: #0369a1;
transform: translateY(-1px);
box-shadow: 0 6px 18px rgba(2, 132, 199, 0.38);
}
.parent-balance-btn-recharge:active {
transform: scale(0.97);
}
/* 3. Selector de Sede Escolar Pill */
.parent-school-selector-pill {
background: #ffffff;
border: 1px solid var(--border, #e2e8f0);
border-radius: 18px;
padding: 10px 16px;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}
/* 4. Menú de Opciones Superfinas Estilo OrderEAT */
.parent-refined-menu-card {
background: #ffffff;
border: 1px solid var(--border, #e2e8f0);
border-radius: 24px;
padding: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
margin-bottom: 16px;
}
.parent-refined-menu-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 14px;
border-radius: 16px;
cursor: pointer;
transition: all 0.15s ease;
border-bottom: 1px solid #f8fafc;
}
.parent-refined-menu-item:last-child {
border-bottom: none;
}
.parent-refined-menu-item:hover {
background: #f8fafc;
}
.parent-refined-item-left {
display: flex;
align-items: center;
gap: 12px;
}
.parent-refined-icon-box {
width: 38px;
height: 38px;
border-radius: 12px;
background: #f0f9ff;
color: #0284c7;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
transition: all 0.2s ease;
}
.parent-refined-icon-box.rose-halo {
background: #fff1f2;
color: #e11d48;
box-shadow: 0 0 0 4px #ffe4e6;
}
.parent-refined-icon-box.gray-box {
background: #f1f5f9;
color: #64748b;
}
.parent-refined-item-title {
font-size: 0.85rem;
font-weight: 800;
color: #1e293b;
}
.parent-refined-item-desc {
font-size: 0.70rem;
color: #64748b;
font-weight: 600;
display: block;
}
.parent-refined-arrow {
color: #cbd5e1;
font-size: 1.1rem;
font-weight: 800;
}
.allergy-tag-pill {
font-size: 0.72rem;
font-weight: 700;
padding: 4px 9px;
border-radius: 8px;
background: #ffffff;
border: 1px solid #fecdd3;
color: #e11d48;
cursor: pointer;
transition: all 0.15s ease;
}
.allergy-tag-pill:hover {
background: #ffe4e6;
transform: translateY(-1px);
}
body.dark-mode .parent-balance-card-refined,
body.dark-mode .parent-school-selector-pill,
body.dark-mode .parent-refined-menu-card {
background: #1e293b;
border-color: #334155;
}
body.dark-mode .parent-balance-amount-display {
color: #f8fafc;
}
body.dark-mode .parent-refined-menu-item:hover {
background: #0f172a;
}
body.dark-mode .parent-refined-item-title {
color: #f1f5f9;
}
+188 -17
View File
@@ -64,6 +64,50 @@
<!-- FORMULARIO 2: REGISTRO DE NUEVOS PADRES --> <!-- FORMULARIO 2: REGISTRO DE NUEVOS PADRES -->
<form id="formRegisterPadre" onsubmit="handleRegisterPadreSubmit(event)" style="display: none;"> <form id="formRegisterPadre" onsubmit="handleRegisterPadreSubmit(event)" style="display: none;">
<!-- SELECTOR DE ROL: "SOY" CON ICONOS SUPERFINOS Y ELEGANTES (SIN EMOJIS) -->
<div class="login-role-selector-wrap">
<label style="font-size: 0.74rem; font-weight: 900; color: #475569; text-transform: uppercase; letter-spacing: 0.6px; display: block; margin-bottom: 8px;">Soy</label>
<div class="login-role-grid">
<div onclick="selectRegisterRole('padre')" id="regRoleCardPadre" class="login-role-card selected">
<div class="login-role-icon">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
<circle cx="9" cy="7" r="3.5"/>
<path d="M3 20v-1.5A4.5 4.5 0 0 1 7.5 14h3A4.5 4.5 0 0 1 15 18.5V20"/>
<circle cx="17.5" cy="7.5" r="2.5"/>
<path d="M15 14a3.5 3.5 0 0 1 5.5 3v3"/>
</svg>
</div>
<span class="login-role-name">Padre</span>
<span class="login-role-desc">o Encargado</span>
</div>
<div onclick="selectRegisterRole('estudiante')" id="regRoleCardEstudiante" class="login-role-card">
<div class="login-role-icon">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1-2.5-2.5Z"/>
<path d="M6 6h10"/>
<path d="M6 10h10"/>
<circle cx="12" cy="15" r="2"/>
</svg>
</div>
<span class="login-role-name">Estudiante</span>
<span class="login-role-desc">Carné QR</span>
</div>
<div onclick="selectRegisterRole('personal')" id="regRoleCardPersonal" class="login-role-card">
<div class="login-role-icon">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
<path d="M6 13.8V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v9.8"/>
<path d="M4 13.8h16a1 1 0 0 1 1 1V20a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5.2a1 1 0 0 1 1-1Z"/>
<line x1="10" y1="18" x2="14" y2="18"/>
</svg>
</div>
<span class="login-role-name">Personal</span>
<span class="login-role-desc">Soda / Caja</span>
</div>
</div>
</div>
<div class="login-form-group"> <div class="login-form-group">
<label for="regNombre">Nombre y Apellidos:</label> <label for="regNombre">Nombre y Apellidos:</label>
<input type="text" id="regNombre" class="login-input" placeholder="Ej: Carlos Alvarado Castro" required autocomplete="name"> <input type="text" id="regNombre" class="login-input" placeholder="Ej: Carlos Alvarado Castro" required autocomplete="name">
@@ -776,30 +820,109 @@
<!-- SECCIÓN DE GESTIÓN DEL HIJO SELECCIONADO --> <!-- SECCIÓN DE GESTIÓN DEL HIJO SELECCIONADO -->
<div id="parentSelectedChildContainer" style="display: none;"> <div id="parentSelectedChildContainer" style="display: none;">
<!-- FICHA ACTIVA DEL HIJO SELECCIONADO --> <!-- TARJETA ELEGANTE DE SALDO EN LA CUENTA (ESTILO ORDEREAT REFINADO) -->
<div class="parent-card" style="border: 2px solid #0284c7; background: linear-gradient(135deg, rgba(2, 132, 199, 0.04), rgba(56, 189, 248, 0.08));"> <div class="parent-balance-card-refined">
<div style="display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px;"> <div class="parent-balance-header-row">
<div style="display: flex; align-items: center; gap: 12px; min-width: 0;"> <div style="display: flex; align-items: center; gap: 10px; min-width: 0;">
<img id="parentActiveChildAvatar" src="" style="width: 50px; height: 50px; border-radius: 50%; border: 3px solid #0284c7; background: white; object-fit: cover;"> <img id="parentActiveChildAvatar" src="" style="width: 40px; height: 40px; border-radius: 50%; border: 2px solid #0284c7; background: white; object-fit: cover; flex-shrink: 0;">
<div style="min-width: 0;"> <div style="min-width: 0;">
<h3 id="parentActiveChildName" style="font-size: 1.1rem; font-weight: 900; margin: 0; color: var(--text-main); word-break: break-word;">Cargando...</h3> <span class="parent-balance-tag-title">Saldo en la cuenta</span>
<span id="parentActiveChildMeta" style="font-size: 0.76rem; color: var(--text-muted); font-weight: 600;">Grado • Carné</span> <div style="display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap;">
<span id="parentActiveChildName" class="parent-balance-child-pill">Cargando...</span>
<span id="parentActiveChildMeta" class="parent-balance-grade-pill">Grado • Carné</span>
</div>
</div> </div>
</div> </div>
<div style="text-align: right;"> <button type="button" onclick="switchToSodaMenuAsParent()" style="background: none; border: none; color: #0284c7; font-size: 0.78rem; font-weight: 800; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 4px;">
<span style="font-size: 0.7rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; display: block;">Saldo Disponible</span> <span>Ver Menú</span>
<span id="parentActiveChildBalance" style="font-size: 1.35rem; font-weight: 900; color: #0284c7;">₡0</span> <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>
</div> </button>
</div> </div>
<div style="display: flex; gap: 8px;"> <div class="parent-balance-amount-display">
<button type="button" onclick="switchToSodaMenuAsParent()" style="width: 100%; padding: 11px; background: #0284c7; color: white; border: none; border-radius: 10px; font-weight: 800; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;"> <span id="parentActiveChildBalance">₡0</span>
<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="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z"/><path d="M3 6h18"/><path d="M16 10a4 4 0 0 1-8 0"/></svg> </div>
<span>Pre-ordenar Merienda / Ver Menú</span>
<div class="parent-balance-footer-row">
<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">
<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> </button>
</div> </div>
</div> </div>
<!-- SELECTOR DE SEDE ESCOLAR ACTIVA -->
<div class="parent-school-selector-pill">
<div style="display: flex; align-items: center; gap: 10px;">
<div style="width: 34px; height: 34px; border-radius: 10px; background: rgba(2, 132, 199, 0.1); color: #0284c7; display: flex; align-items: center; justify-content: center; font-size: 1.1rem;">
🏫
</div>
<div>
<span style="font-size: 0.68rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block;">Sede Escolar Activa</span>
<strong id="parentActiveSchoolNameBadge" style="font-size: 0.85rem; font-weight: 900; color: var(--text-main);">Soda Escolar Central</strong>
</div>
</div>
<span style="font-size: 0.72rem; color: #0284c7; font-weight: 800; background: #f0f9ff; padding: 3px 8px; border-radius: 6px;">● Conectada</span>
</div>
<!-- MENÚ DE ACCIONES RÁPIDAS SUPERFINAS (ESTILO ORDEREAT) -->
<div class="parent-refined-menu-card">
<div onclick="switchToSodaMenuAsParent()" 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"><path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"/><path d="M7 2v20"/><path d="M21 15V2v0a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"/></svg>
</div>
<div>
<span class="parent-refined-item-title">Pre-ordenar Merienda / Ver Menú</span>
<span class="parent-refined-item-desc">Alimentos saludables aprobados por el MEP</span>
</div>
</div>
<span class="parent-refined-arrow">›</span>
</div>
<div onclick="document.getElementById('parentAllergiesCard')?.scrollIntoView({ behavior: 'smooth' })" 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>
</div>
<div>
<span class="parent-refined-item-title" style="color: #e11d48;">Alergias y Restricciones</span>
<span class="parent-refined-item-desc">Veto de golosinas y expediente médico</span>
</div>
</div>
<span class="parent-refined-arrow" style="color: #f43f5e;">›</span>
</div>
<div onclick="document.getElementById('parentDailyLimitCard')?.scrollIntoView({ behavior: 'smooth' })" 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>
</div>
</div>
<span class="parent-refined-arrow">›</span>
</div>
<div onclick="document.getElementById('parentHistoryCard')?.scrollIntoView({ behavior: 'smooth' })" 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>
</div>
<div>
<span class="parent-refined-item-title">Historial de Compras en Soda</span>
<span class="parent-refined-item-desc">Revisar consumos escolares</span>
</div>
</div>
<span class="parent-refined-arrow">›</span>
</div>
</div>
<!-- RECARGA SINPE MÓVIL (DIRECTO EN PANTALLA, NO MODAL) --> <!-- RECARGA SINPE MÓVIL (DIRECTO EN PANTALLA, NO MODAL) -->
<div class="parent-card" style="background: #f0fdf4; border: 1.5px solid #86efac;"> <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; justify-content: space-between; margin-bottom: 12px;">
@@ -850,8 +973,56 @@
</div> </div>
</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;">
<div class="parent-refined-icon-box rose-halo" style="width: 36px; height: 36px;">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" 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>
</div>
<div>
<strong style="color: #9f1239; font-size: 0.95rem; display: block;">Alergias y Restricciones</strong>
<span style="font-size: 0.72rem; color: #e11d48; font-weight: 600;">Expediente de salud y veto de golosinas</span>
</div>
</div>
<span id="parentAllergiesStatusBadge" style="font-size: 0.7rem; color: #e11d48; background: #ffe4e6; font-weight: 800; padding: 3px 8px; border-radius: 6px;">Sin alergias</span>
</div>
<!-- Alergias clínicas -->
<div style="margin-bottom: 14px; background: #fff1f2; border: 1px solid #fecdd3; padding: 12px; border-radius: 14px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<label style="font-size: 0.76rem; font-weight: 800; color: #9f1239; display: block;">Alergias o Intolerancias Médicas:</label>
<span style="font-size: 0.68rem; color: #e11d48; font-weight: 700;">Visible en caja de soda</span>
</div>
<input type="text" id="inputParentStudentAllergies" placeholder="Ej: Maní, Gluten, Lactosa, Mariscos..." style="width: 100%; padding: 9px 12px; border-radius: 10px; border: 1.5px solid #fca5a5; font-size: 0.85rem; font-weight: 700; color: #881337; background: #ffffff; box-sizing: border-box;">
<div style="display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap;">
<button type="button" onclick="addParentAllergyTag('Maní')" class="allergy-tag-pill">+ Maní</button>
<button type="button" onclick="addParentAllergyTag('Gluten')" class="allergy-tag-pill">+ Gluten</button>
<button type="button" onclick="addParentAllergyTag('Lactosa')" class="allergy-tag-pill">+ Lactosa</button>
<button type="button" onclick="addParentAllergyTag('Mariscos')" class="allergy-tag-pill">+ Mariscos</button>
<button type="button" onclick="addParentAllergyTag('Huevo')" class="allergy-tag-pill">+ Huevo</button>
<button type="button" onclick="clearParentAllergies()" class="allergy-tag-pill" style="color: #64748b; background: white; border-color: #cbd5e1;">Ninguna</button>
</div>
</div>
<!-- Toggle Veto de Chucherías / Comida no saludable -->
<div style="display: flex; justify-content: space-between; align-items: center; background: #f8fafc; border: 1px solid #e2e8f0; padding: 12px; border-radius: 14px; margin-bottom: 12px;">
<div>
<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 productos no avalados por el MEP en caja</span>
</div>
<input type="checkbox" id="chkParentBlockJunkFood" onchange="onToggleParentBlockJunkFood(this.checked)" style="width: 22px; height: 22px; cursor: pointer; accent-color: #e11d48;">
</div>
<!-- Botón Guardar Alergias -->
<button type="button" onclick="saveParentAllergiesSettings()" style="width: 100%; padding: 11px; background: linear-gradient(135deg, #e11d48, #be123c); color: white; border: none; border-radius: 12px; font-weight: 800; font-size: 0.86rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 3px 8px rgba(225, 29, 72, 0.25);">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>
<span>Guardar Configuración de Salud</span>
</button>
</div>
<!-- CONFIGURACIÓN DE LÍMITE DIARIO --> <!-- CONFIGURACIÓN DE LÍMITE DIARIO -->
<div class="parent-card" style="background: #f0f9ff; border: 2px solid #38bdf8;"> <div id="parentDailyLimitCard" class="parent-card" style="background: #f0f9ff; border: 2px solid #38bdf8;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;"> <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
<div> <div>
<strong style="font-size: 0.95rem; color: #0369a1; display: inline-flex; align-items: center; gap: 6px;"> <strong style="font-size: 0.95rem; color: #0369a1; display: inline-flex; align-items: center; gap: 6px;">
@@ -930,7 +1101,7 @@
</div> </div>
<!-- HISTORIAL DE COMPRAS RECIENTES --> <!-- HISTORIAL DE COMPRAS RECIENTES -->
<div class="parent-card"> <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;"> <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> <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> <span>Historial de Compras en Soda</span>
+148
View File
@@ -169,6 +169,47 @@ function switchLoginTab(tab) {
} }
} }
let selectedRegisterRole = 'padre';
function selectRegisterRole(role) {
selectedRegisterRole = role;
const cardPadre = document.getElementById('regRoleCardPadre');
const cardEstudiante = document.getElementById('regRoleCardEstudiante');
const cardPersonal = document.getElementById('regRoleCardPersonal');
const errorMsg = document.getElementById('registerErrorMsg');
if (cardPadre) cardPadre.classList.toggle('selected', role === 'padre');
if (cardEstudiante) cardEstudiante.classList.toggle('selected', role === 'estudiante');
if (cardPersonal) cardPersonal.classList.toggle('selected', role === 'personal');
if (window.sounds) window.sounds.playTap();
if (role === 'estudiante') {
if (errorMsg) {
errorMsg.style.background = '#eff6ff';
errorMsg.style.borderColor = '#93c5fd';
errorMsg.style.color = '#1e40af';
errorMsg.innerHTML = '<strong>🎒 Cuenta de Estudiante:</strong> Tu carné y código QR son entregados directamente por el centro educativo. Si ya cuentas con carné o credenciales, toca en <a href="#" onclick="switchLoginTab(\'login\'); return false;" style="color: #0284c7; font-weight: 800; text-decoration: underline;">Iniciar Sesión</a>.';
errorMsg.style.display = 'block';
}
} else if (role === 'personal') {
if (errorMsg) {
errorMsg.style.background = '#fefce8';
errorMsg.style.borderColor = '#fde047';
errorMsg.style.color = '#854d0e';
errorMsg.innerHTML = '<strong>👨‍🍳 Personal de Soda:</strong> Las credenciales de punto de venta y administración son asignadas por la dirección escolar. Por favor ingresa en <a href="#" onclick="switchLoginTab(\'login\'); return false;" style="color: #0284c7; font-weight: 800; text-decoration: underline;">Iniciar Sesión</a>.';
errorMsg.style.display = 'block';
}
} else {
if (errorMsg) {
errorMsg.style.display = 'none';
errorMsg.style.background = '#fee2e2';
errorMsg.style.borderColor = '#fca5a5';
errorMsg.style.color = '#991b1b';
}
}
}
async function handleRegisterPadreSubmit(event) { async function handleRegisterPadreSubmit(event) {
if (event) event.preventDefault(); if (event) event.preventDefault();
const nombre = document.getElementById('regNombre').value.trim(); const nombre = document.getElementById('regNombre').value.trim();
@@ -1993,6 +2034,16 @@ function selectParentChild(childId) {
} }
} }
function focusParentSinpeRecharge() {
const sinpeInput = document.getElementById('inputParentSinpeMonto');
if (sinpeInput) {
sinpeInput.scrollIntoView({ behavior: 'smooth', block: 'center' });
setTimeout(() => {
sinpeInput.focus();
}, 350);
}
}
function renderActiveChildDetails(child) { function renderActiveChildDetails(child) {
if (!child) return; if (!child) return;
@@ -2016,6 +2067,32 @@ function renderActiveChildDetails(child) {
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;
// Actualizar Límite Diario en tarjeta de saldo y nombre de sede activa
const dailyInline = document.getElementById('parentDailyLimitInlineDisplay');
if (dailyInline) dailyInline.textContent = `₡${currentLimit.toLocaleString('es-CR')}`;
const schoolBadge = document.getElementById('parentActiveSchoolNameBadge');
if (schoolBadge) schoolBadge.textContent = child.escuela_nombre || 'Soda Escolar Central';
// Actualizar Alergias y Restricciones
const inputAllergies = document.getElementById('inputParentStudentAllergies');
const chkJunkFood = document.getElementById('chkParentBlockJunkFood');
const allergiesBadge = document.getElementById('parentAllergiesStatusBadge');
const hasAlergias = child.alergias && child.alergias !== 'Ninguna' && child.alergias !== 'Ninguna conocida';
if (inputAllergies) inputAllergies.value = hasAlergias ? child.alergias : '';
if (chkJunkFood) chkJunkFood.checked = !!child.bloquear_chucherias;
if (allergiesBadge) {
if (hasAlergias || child.bloquear_chucherias) {
allergiesBadge.textContent = hasAlergias ? 'Alergias Activas' : 'Veto de Chatarra';
allergiesBadge.style.background = '#ffe4e6';
allergiesBadge.style.color = '#e11d48';
} else {
allergiesBadge.textContent = 'Sin alergias';
allergiesBadge.style.background = '#f1f5f9';
allergiesBadge.style.color = '#64748b';
}
}
// Actualizar datos de la soda/escuela del hijo seleccionado para recargas SINPE // Actualizar datos de la soda/escuela del hijo seleccionado para recargas SINPE
const sinpeNumero = document.getElementById('parentSinpeNumero'); const sinpeNumero = document.getElementById('parentSinpeNumero');
const sinpeEscuela = document.getElementById('parentSinpeEscuelaNombre'); const sinpeEscuela = document.getElementById('parentSinpeEscuelaNombre');
@@ -2246,6 +2323,77 @@ async function onToggleParentTransfer(checked) {
} }
} }
function addParentAllergyTag(tag) {
const input = document.getElementById('inputParentStudentAllergies');
if (!input) return;
let currentVal = input.value.trim();
if (!currentVal) {
input.value = tag;
} else {
const items = currentVal.split(',').map(s => s.trim().toLowerCase());
if (!items.includes(tag.toLowerCase())) {
input.value = currentVal + ', ' + tag;
}
}
if (window.sounds) window.sounds.playTap();
}
function clearParentAllergies() {
const input = document.getElementById('inputParentStudentAllergies');
if (input) input.value = '';
if (window.sounds) window.sounds.playTap();
}
async function onToggleParentBlockJunkFood(checked) {
if (!currentParentChild) return;
try {
const res = await fetch(`/api/estudiantes/${currentParentChild.id}/limite`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ bloquear_chucherias: checked ? 1 : 0 })
});
const data = await res.json();
if (!res.ok) throw new Error(data.error);
currentParentChild.bloquear_chucherias = checked ? 1 : 0;
if (window.sounds) window.sounds.playTap();
renderActiveChildDetails(currentParentChild);
} catch (err) {
alert(`No se pudo actualizar restricción: ${err.message}`);
}
}
async function saveParentAllergiesSettings() {
if (!currentParentChild) return;
const input = document.getElementById('inputParentStudentAllergies');
const chkJunk = document.getElementById('chkParentBlockJunkFood');
const alergiasText = input ? input.value.trim() : '';
const bloquearJunk = chkJunk && chkJunk.checked ? 1 : 0;
try {
const res = await fetch(`/api/estudiantes/${currentParentChild.id}/limite`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
alergias: alergiasText || 'Ninguna conocida',
bloquear_chucherias: bloquearJunk
})
});
const data = await res.json();
if (!res.ok) throw new Error(data.error);
currentParentChild.alergias = alergiasText || 'Ninguna conocida';
currentParentChild.bloquear_chucherias = bloquearJunk;
if (window.sounds) window.sounds.playSuccess();
alert(`Expediente médico de ${currentParentChild.nombre_completo} guardado exitosamente.`);
renderActiveChildDetails(currentParentChild);
} catch (err) {
if (window.sounds) window.sounds.playError();
alert(`Error al guardar alergias: ${err.message}`);
}
}
async function saveParentStudentCredentials() { async function saveParentStudentCredentials() {
if (!currentParentChild) return; if (!currentParentChild) return;
const pinInput = document.getElementById('inputParentStudentPin'); const pinInput = document.getElementById('inputParentStudentPin');