From 30c6e317986b6c842d24638c2d667b392b2a1d96 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Oct 2026 01:56:36 -0600 Subject: [PATCH] feat(padres): monogramas de iniciales, borde celeste en hijo seleccionado y cabecera superior limpia en subpantallas --- public/css/styles.css | 68 ++++++++++++++++++++++++++++++++++++++++--- public/index.html | 12 ++++---- public/js/app.js | 41 ++++++++++++++++++++++---- 3 files changed, 105 insertions(+), 16 deletions(-) diff --git a/public/css/styles.css b/public/css/styles.css index 47b065d..36cf643 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -2311,15 +2311,75 @@ body.dark-mode .login-tab-btn.active { box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12); } +.parent-child-card.active, .parent-child-card.selected { - border-color: #0284c7; - background: #f0f9ff; - box-shadow: 0 4px 12px rgba(2, 132, 199, 0.18); + border: 2.5px solid #0284c7 !important; + background: #f0f9ff !important; + box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25), 0 6px 16px rgba(2, 132, 199, 0.16) !important; } +body.dark-mode .parent-child-card.active, body.dark-mode .parent-child-card.selected { - background: rgba(2, 132, 199, 0.15); + background: rgba(2, 132, 199, 0.18) !important; + border: 2.5px solid #38bdf8 !important; + box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.28), 0 6px 16px rgba(0, 0, 0, 0.3) !important; +} + +.child-initials-badge { + width: 44px; + height: 44px; + border-radius: 50%; + background: #e0f2fe; + color: #0369a1; + display: flex; + align-items: center; + justify-content: center; + font-weight: 900; + font-size: 1rem; + letter-spacing: 0.5px; + flex-shrink: 0; + border: 2px solid transparent; + transition: all 0.2s ease; +} + +.parent-child-card.active .child-initials-badge, +.parent-child-card.selected .child-initials-badge { + background: linear-gradient(135deg, #0284c7, #0369a1); + color: #ffffff; border-color: #38bdf8; + box-shadow: 0 3px 8px rgba(2, 132, 199, 0.35); +} + +.parent-active-child-avatar-badge { + width: 42px; + height: 42px; + border-radius: 50%; + background: linear-gradient(135deg, #0284c7, #0369a1); + color: #ffffff; + display: flex; + align-items: center; + justify-content: center; + font-weight: 900; + font-size: 1rem; + letter-spacing: 0.5px; + flex-shrink: 0; + box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3); + border: 2px solid #ffffff; +} + +.parentSubViewChildAvatarBadge { + width: 26px; + height: 26px; + border-radius: 50%; + background: linear-gradient(135deg, #0284c7, #0369a1); + color: #ffffff; + font-size: 0.72rem; + font-weight: 900; + display: inline-flex; + align-items: center; + justify-content: center; + letter-spacing: 0.3px; + flex-shrink: 0; } /* Buscador Inteligente en Admin Carga */ diff --git a/public/index.html b/public/index.html index b0932ae..4f04a40 100644 --- a/public/index.html +++ b/public/index.html @@ -836,7 +836,7 @@
- +
ES
Saldo en la cuenta
@@ -957,7 +957,7 @@ Volver
- Hijo + ES Estudiante
@@ -1020,7 +1020,7 @@ Volver
- Hijo + ES Estudiante
@@ -1081,7 +1081,7 @@ Volver
- Hijo + ES Estudiante
@@ -1144,7 +1144,7 @@ Volver
- Hijo + ES Estudiante
@@ -1168,7 +1168,7 @@ Volver
- Hijo + ES Estudiante
diff --git a/public/js/app.js b/public/js/app.js index b24d873..739a5d3 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -2134,6 +2134,17 @@ setInterval(async () => { // FUNCIONES DEL PORTAL DEDICADO DE PADRES // ========================================== +// Helper para obtener iniciales del primer nombre y primer apellido (ej. Mateo Alvarado -> MA, Sofía Jiménez -> SJ) +function getStudentInitials(fullName) { + if (!fullName || typeof fullName !== 'string') return 'ES'; + const clean = fullName.trim().replace(/\s+/g, ' '); + const parts = clean.split(' '); + if (parts.length === 1) { + return parts[0].substring(0, 2).toUpperCase(); + } + return (parts[0].charAt(0) + parts[1].charAt(0)).toUpperCase(); +} + async function loadParentDashboard() { if (!currentUser || currentUser.rol !== 'padre') return; @@ -2161,18 +2172,22 @@ function renderParentDashboardView() { const sectionHijos = document.getElementById('parentChildrenSection'); const containerActive = document.getElementById('parentSelectedChildContainer'); const grid = document.getElementById('parentChildrenGrid'); + const mainDash = document.getElementById('parentChildDashboardMain'); const hijos = (currentUser && currentUser.hijos) ? currentUser.hijos : []; if (hijos.length === 0) { if (bannerNoHijos) bannerNoHijos.style.display = 'block'; + if (sectionHijos) sectionHijos.style.display = 'none'; if (containerActive) containerActive.style.display = 'none'; if (grid) grid.innerHTML = ''; return; } if (bannerNoHijos) bannerNoHijos.style.display = 'none'; + if (sectionHijos) sectionHijos.style.display = 'block'; if (containerActive) containerActive.style.display = 'block'; + if (mainDash) mainDash.style.display = 'block'; // Si no hay hijo seleccionado o el seleccionado ya no existe en la lista, seleccionar el primero if (!currentParentChild || !hijos.some(h => h.id === currentParentChild.id)) { @@ -2182,15 +2197,18 @@ function renderParentDashboardView() { currentParentChild = hijos.find(h => h.id === currentParentChild.id) || hijos[0]; } - // Renderizar tarjetas de hijos en la cuadrícula + // Renderizar tarjetas de hijos en la cuadrícula con monograma de iniciales y borde celeste activo if (grid) { grid.innerHTML = hijos.map(h => { const isSelected = currentParentChild && currentParentChild.id === h.id; const isBlocked = !!h.tarjeta_bloqueada; + const initials = getStudentInitials(h.nombre_completo); return ` -
+
- +
+ ${initials} +
${h.nombre_completo} @@ -2228,7 +2246,9 @@ function selectParentChild(childId) { function openParentSubView(viewKey) { const mainDash = document.getElementById('parentChildDashboardMain'); + const childrenSection = document.getElementById('parentChildrenSection'); if (mainDash) mainDash.style.display = 'none'; + if (childrenSection) childrenSection.style.display = 'none'; const subViews = [ 'parentSubViewSinpe', @@ -2243,8 +2263,9 @@ function openParentSubView(viewKey) { }); if (currentParentChild) { - document.querySelectorAll('.parentSubViewChildAvatar').forEach(img => { - img.src = currentParentChild.foto_url || '/img/avatar_default.png'; + const initials = getStudentInitials(currentParentChild.nombre_completo); + document.querySelectorAll('.parentSubViewChildAvatarBadge').forEach(badge => { + badge.textContent = initials; }); document.querySelectorAll('.parentSubViewChildName').forEach(span => { span.textContent = `${currentParentChild.nombre_completo} (${currentParentChild.grado})`; @@ -2275,7 +2296,9 @@ function openParentSubView(viewKey) { function closeParentSubView() { const mainDash = document.getElementById('parentChildDashboardMain'); + const childrenSection = document.getElementById('parentChildrenSection'); if (mainDash) mainDash.style.display = 'block'; + if (childrenSection) childrenSection.style.display = 'block'; const subViews = [ 'parentSubViewSinpe', @@ -2309,7 +2332,13 @@ function renderActiveChildDetails(child) { const rangeLimit = document.getElementById('rangeParentLimit'); const chkTransfer = document.getElementById('chkParentAllowTransferDirect'); - if (avatar) avatar.src = child.foto_url || '/img/avatar_default.png'; + if (avatar) { + if (avatar.tagName === 'IMG') { + avatar.src = child.foto_url || '/img/avatar_default.png'; + } else { + avatar.textContent = getStudentInitials(child.nombre_completo); + } + } if (name) name.textContent = child.nombre_completo; if (meta) meta.textContent = `${child.grado} - Sección ${child.seccion} • Cód: ${child.codigo_estudiante}`; if (balance) balance.textContent = `₡${(child.saldo_colones || 0).toLocaleString('es-CR')}`;