feat(padres): monogramas de iniciales, borde celeste en hijo seleccionado y cabecera superior limpia en subpantallas
This commit is contained in:
+64
-4
@@ -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 */
|
||||
|
||||
+6
-6
@@ -836,7 +836,7 @@
|
||||
<div class="parent-balance-card-refined">
|
||||
<div class="parent-balance-header-row">
|
||||
<div style="display: flex; align-items: center; gap: 10px; min-width: 0;">
|
||||
<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 id="parentActiveChildAvatar" class="parent-active-child-avatar-badge">ES</div>
|
||||
<div style="min-width: 0;">
|
||||
<span class="parent-balance-tag-title">Saldo en la cuenta</span>
|
||||
<div style="display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap;">
|
||||
@@ -957,7 +957,7 @@
|
||||
<span>Volver</span>
|
||||
</button>
|
||||
<div class="parent-subview-child-tag">
|
||||
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
|
||||
<span class="parentSubViewChildAvatarBadge">ES</span>
|
||||
<span class="parentSubViewChildName">Estudiante</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1020,7 +1020,7 @@
|
||||
<span>Volver</span>
|
||||
</button>
|
||||
<div class="parent-subview-child-tag">
|
||||
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
|
||||
<span class="parentSubViewChildAvatarBadge">ES</span>
|
||||
<span class="parentSubViewChildName">Estudiante</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1081,7 +1081,7 @@
|
||||
<span>Volver</span>
|
||||
</button>
|
||||
<div class="parent-subview-child-tag">
|
||||
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
|
||||
<span class="parentSubViewChildAvatarBadge">ES</span>
|
||||
<span class="parentSubViewChildName">Estudiante</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1144,7 +1144,7 @@
|
||||
<span>Volver</span>
|
||||
</button>
|
||||
<div class="parent-subview-child-tag">
|
||||
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
|
||||
<span class="parentSubViewChildAvatarBadge">ES</span>
|
||||
<span class="parentSubViewChildName">Estudiante</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1168,7 +1168,7 @@
|
||||
<span>Volver</span>
|
||||
</button>
|
||||
<div class="parent-subview-child-tag">
|
||||
<img class="parentSubViewChildAvatar" src="" alt="Hijo">
|
||||
<span class="parentSubViewChildAvatarBadge">ES</span>
|
||||
<span class="parentSubViewChildName">Estudiante</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+35
-6
@@ -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 `
|
||||
<div class="parent-child-card ${isSelected ? 'active' : ''}" onclick="selectParentChild(${h.id})">
|
||||
<div class="parent-child-card ${isSelected ? 'active selected' : ''}" onclick="selectParentChild(${h.id})">
|
||||
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 8px;">
|
||||
<img src="${h.foto_url || '/img/avatar_default.png'}" style="width: 42px; height: 42px; border-radius: 50%; border: 2px solid ${isSelected ? '#0284c7' : 'var(--border)'}; object-fit: cover;">
|
||||
<div class="child-initials-badge ${isSelected ? 'active' : ''}">
|
||||
${initials}
|
||||
</div>
|
||||
<div style="min-width: 0; flex: 1;">
|
||||
<strong style="font-size: 0.9rem; color: var(--text-main); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||
${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')}`;
|
||||
|
||||
Reference in New Issue
Block a user