feat(estudiantes): reemplazar robots por monogramas de iniciales en la tarjeta del estudiante, carnés, transferencias y POS
This commit is contained in:
+11
-1
@@ -92,6 +92,16 @@
|
|||||||
<script>
|
<script>
|
||||||
let allStudents = [];
|
let allStudents = [];
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/estudiantes');
|
const res = await fetch('/api/estudiantes');
|
||||||
@@ -127,7 +137,7 @@
|
|||||||
|
|
||||||
<!-- CUERPO DEL CARNÉ -->
|
<!-- CUERPO DEL CARNÉ -->
|
||||||
<div class="carnet-body">
|
<div class="carnet-body">
|
||||||
<img class="carnet-photo" src="${est.foto_url}" alt="${est.nombre_completo}">
|
<div class="carnet-photo">${getStudentInitials(est.nombre_completo)}</div>
|
||||||
|
|
||||||
<div class="carnet-details">
|
<div class="carnet-details">
|
||||||
<div class="carnet-name">${est.nombre_completo}</div>
|
<div class="carnet-name">${est.nombre_completo}</div>
|
||||||
|
|||||||
+78
-3
@@ -243,10 +243,77 @@ body.dark-mode .wallet-card:not([class*="theme-"]) {
|
|||||||
width: 58px;
|
width: 58px;
|
||||||
height: 58px;
|
height: 58px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: 3px solid rgba(255, 255, 255, 0.8);
|
border: 3px solid rgba(255, 255, 255, 0.85);
|
||||||
background: white;
|
background: linear-gradient(135deg, #0284c7, #0369a1);
|
||||||
|
color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 1.35rem;
|
||||||
|
font-weight: 900;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
||||||
|
flex-shrink: 0;
|
||||||
|
text-shadow: 0 1px 3px rgba(0,0,0,0.25);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.student-avatar img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
box-shadow: 0 4px 10px rgba(0,0,0,0.15);
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transfer-target-avatar-badge {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid #10b981;
|
||||||
|
background: linear-gradient(135deg, #10b981, #059669);
|
||||||
|
color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 1.15rem;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 3px 8px rgba(16, 185, 129, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-selected-avatar-badge {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2.5px solid #0284c7;
|
||||||
|
background: linear-gradient(135deg, #0284c7, #0369a1);
|
||||||
|
color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 1.15rem;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-preview-avatar-badge {
|
||||||
|
width: 58px;
|
||||||
|
height: 58px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2.5px solid #0284c7;
|
||||||
|
background: linear-gradient(135deg, #0284c7, #0369a1);
|
||||||
|
color: #ffffff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 1.35rem;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.student-meta h2 {
|
.student-meta h2 {
|
||||||
@@ -1499,6 +1566,14 @@ body.dark-mode .floating-cart-bar {
|
|||||||
border-radius: 2mm;
|
border-radius: 2mm;
|
||||||
border: 1px solid #cbd5e1;
|
border: 1px solid #cbd5e1;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: linear-gradient(135deg, #0284c7, #0369a1);
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 13pt;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.carnet-details {
|
.carnet-details {
|
||||||
|
|||||||
+4
-4
@@ -641,7 +641,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="adminSelectedStudentBanner" class="selected-student-banner" style="display: flex;">
|
<div id="adminSelectedStudentBanner" class="selected-student-banner" style="display: flex;">
|
||||||
<div style="display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1;">
|
<div style="display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1;">
|
||||||
<img id="adminSelectedAvatar" src="" style="width: 48px; height: 48px; border-radius: 50%; border: 2.5px solid #0284c7; background: white; flex-shrink: 0; object-fit: cover;">
|
<div id="adminSelectedAvatar" class="admin-selected-avatar-badge">ES</div>
|
||||||
<div style="min-width: 0;">
|
<div style="min-width: 0;">
|
||||||
<div style="display: flex; align-items: center; gap: 6px; flex-wrap: wrap;">
|
<div style="display: flex; align-items: center; gap: 6px; flex-wrap: wrap;">
|
||||||
<strong id="adminSelectedName" style="font-size: 1rem; color: var(--text-main); word-break: break-word;">Selecciona un alumno</strong>
|
<strong id="adminSelectedName" style="font-size: 1rem; color: var(--text-main); word-break: break-word;">Selecciona un alumno</strong>
|
||||||
@@ -1272,7 +1272,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="student-info">
|
<div class="student-info">
|
||||||
<img id="walletAvatar" class="student-avatar" src="" alt="Avatar">
|
<div id="walletAvatar" class="student-avatar">ES</div>
|
||||||
<div class="student-meta" style="flex: 1; min-width: 0;">
|
<div class="student-meta" style="flex: 1; min-width: 0;">
|
||||||
<div style="min-width: 0;">
|
<div style="min-width: 0;">
|
||||||
<h2 id="walletName" style="word-break: break-word; margin: 0; font-size: 1.15rem; font-weight: 800;">Cargando...</h2>
|
<h2 id="walletName" style="word-break: break-word; margin: 0; font-size: 1.15rem; font-weight: 800;">Cargando...</h2>
|
||||||
@@ -1845,7 +1845,7 @@
|
|||||||
<div id="transferStepConfirm" style="display: none;">
|
<div id="transferStepConfirm" style="display: none;">
|
||||||
<!-- Tarjeta del receptor -->
|
<!-- Tarjeta del receptor -->
|
||||||
<div style="background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 14px; padding: 12px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px;">
|
<div style="background: #f0fdf4; border: 1.5px solid #86efac; border-radius: 14px; padding: 12px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px;">
|
||||||
<img id="transferTargetAvatar" src="" style="width: 48px; height: 48px; border-radius: 50%; border: 2px solid #10b981; background: white;">
|
<div id="transferTargetAvatar" class="transfer-target-avatar-badge">ES</div>
|
||||||
<div style="flex: 1;">
|
<div style="flex: 1;">
|
||||||
<div style="font-size: 0.7rem; color: #15803d; font-weight: 800; text-transform: uppercase;">Vas a transferir a:</div>
|
<div style="font-size: 0.7rem; color: #15803d; font-weight: 800; text-transform: uppercase;">Vas a transferir a:</div>
|
||||||
<h4 id="transferTargetName" style="font-size: 1rem; font-weight: 900; color: #0f172a; line-height: 1.2;">Nombre</h4>
|
<h4 id="transferTargetName" style="font-size: 1rem; font-weight: 900; color: #0f172a; line-height: 1.2;">Nombre</h4>
|
||||||
@@ -1963,7 +1963,7 @@
|
|||||||
|
|
||||||
<!-- TARJETA DEL ESTUDIANTE -->
|
<!-- TARJETA DEL ESTUDIANTE -->
|
||||||
<div style="background: var(--card-bg); border: 2px solid #0284c7; border-radius: 16px; padding: 14px; margin-bottom: 14px; display: flex; align-items: center; gap: 14px; box-shadow: 0 4px 12px rgba(2, 132, 199, 0.1);">
|
<div style="background: var(--card-bg); border: 2px solid #0284c7; border-radius: 16px; padding: 14px; margin-bottom: 14px; display: flex; align-items: center; gap: 14px; box-shadow: 0 4px 12px rgba(2, 132, 199, 0.1);">
|
||||||
<img id="linkPreviewAvatar" src="" style="width: 58px; height: 58px; border-radius: 50%; border: 2.5px solid #0284c7; object-fit: cover; background: white; flex-shrink: 0;">
|
<div id="linkPreviewAvatar" class="link-preview-avatar-badge">ES</div>
|
||||||
<div style="flex: 1; min-width: 0;">
|
<div style="flex: 1; min-width: 0;">
|
||||||
<div style="font-size: 0.7rem; color: #64748b; font-weight: 800; text-transform: uppercase;">Alumno a vincular:</div>
|
<div style="font-size: 0.7rem; color: #64748b; font-weight: 800; text-transform: uppercase;">Alumno a vincular:</div>
|
||||||
<h3 id="linkPreviewName" style="font-size: 1.05rem; font-weight: 900; color: var(--text-main); margin: 2px 0; word-break: break-word; line-height: 1.2;">Nombre Alumno</h3>
|
<h3 id="linkPreviewName" style="font-size: 1.05rem; font-weight: 900; color: var(--text-main); margin: 2px 0; word-break: break-word; line-height: 1.2;">Nombre Alumno</h3>
|
||||||
|
|||||||
+50
-9
@@ -15,6 +15,17 @@ let adminStaffList = [];
|
|||||||
|
|
||||||
let CLOUDFLARE_TUNNEL_URL = 'https://recreopay.gammapos.app';
|
let CLOUDFLARE_TUNNEL_URL = 'https://recreopay.gammapos.app';
|
||||||
|
|
||||||
|
// Helper universal para iniciales de estudiantes (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();
|
||||||
|
}
|
||||||
|
|
||||||
function checkHttpsEnvironment() {
|
function checkHttpsEnvironment() {
|
||||||
const isHttp = window.location.protocol !== 'https:' &&
|
const isHttp = window.location.protocol !== 'https:' &&
|
||||||
window.location.hostname !== 'localhost' &&
|
window.location.hostname !== 'localhost' &&
|
||||||
@@ -581,7 +592,14 @@ function updateStudentUI() {
|
|||||||
if (!currentStudent) return;
|
if (!currentStudent) return;
|
||||||
|
|
||||||
// Actualizar avatar, nombre y grado
|
// Actualizar avatar, nombre y grado
|
||||||
document.getElementById('walletAvatar').src = currentStudent.foto_url || 'https://api.dicebear.com/7.x/bottts/svg?seed=est';
|
const walletAvatar = document.getElementById('walletAvatar');
|
||||||
|
if (walletAvatar) {
|
||||||
|
if (walletAvatar.tagName === 'IMG') {
|
||||||
|
walletAvatar.src = currentStudent.foto_url || '/img/avatar_default.png';
|
||||||
|
} else {
|
||||||
|
walletAvatar.textContent = getStudentInitials(currentStudent.nombre_completo);
|
||||||
|
}
|
||||||
|
}
|
||||||
document.getElementById('walletName').textContent = currentStudent.nombre_completo;
|
document.getElementById('walletName').textContent = currentStudent.nombre_completo;
|
||||||
document.getElementById('walletGrade').textContent = `${currentStudent.grado} • Sección ${currentStudent.seccion} • Cód: ${currentStudent.codigo_estudiante}`;
|
document.getElementById('walletGrade').textContent = `${currentStudent.grado} • Sección ${currentStudent.seccion} • Cód: ${currentStudent.codigo_estudiante}`;
|
||||||
|
|
||||||
@@ -1207,8 +1225,8 @@ function renderQuickTransferFriends() {
|
|||||||
const others = students.filter(s => s.id !== currentStudent.id);
|
const others = students.filter(s => s.id !== currentStudent.id);
|
||||||
|
|
||||||
container.innerHTML = others.map(s => `
|
container.innerHTML = others.map(s => `
|
||||||
<button type="button" onclick="selectTransferTargetById(${s.id})" style="display: flex; align-items: center; gap: 4px; padding: 4px 8px; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.72rem; font-weight: 700; cursor: pointer; color: #1e293b;">
|
<button type="button" onclick="selectTransferTargetById(${s.id})" style="display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.72rem; font-weight: 700; cursor: pointer; color: #1e293b;">
|
||||||
<img src="${s.foto_url}" style="width: 20px; height: 20px; border-radius: 50%;">
|
<span style="width: 22px; height: 22px; border-radius: 50%; background: #0284c7; color: white; display: inline-flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 900;">${getStudentInitials(s.nombre_completo)}</span>
|
||||||
<span>${s.nombre_completo.split(' ')[0]} (${s.grado.split(' ')[0]})</span>
|
<span>${s.nombre_completo.split(' ')[0]} (${s.grado.split(' ')[0]})</span>
|
||||||
</button>
|
</button>
|
||||||
`).join('');
|
`).join('');
|
||||||
@@ -1226,7 +1244,14 @@ function onTransferTargetIdentified(target) {
|
|||||||
|
|
||||||
if (window.sounds) window.sounds.playScanChirp();
|
if (window.sounds) window.sounds.playScanChirp();
|
||||||
|
|
||||||
document.getElementById('transferTargetAvatar').src = target.foto_url;
|
const targetAvatar = document.getElementById('transferTargetAvatar');
|
||||||
|
if (targetAvatar) {
|
||||||
|
if (targetAvatar.tagName === 'IMG') {
|
||||||
|
targetAvatar.src = target.foto_url || '/img/avatar_default.png';
|
||||||
|
} else {
|
||||||
|
targetAvatar.textContent = getStudentInitials(target.nombre_completo);
|
||||||
|
}
|
||||||
|
}
|
||||||
document.getElementById('transferTargetName').textContent = target.nombre_completo;
|
document.getElementById('transferTargetName').textContent = target.nombre_completo;
|
||||||
document.getElementById('transferTargetGrade').textContent = `${target.grado} • Sección ${target.seccion} • Cód: ${target.codigo_estudiante}`;
|
document.getElementById('transferTargetGrade').textContent = `${target.grado} • Sección ${target.seccion} • Cód: ${target.codigo_estudiante}`;
|
||||||
|
|
||||||
@@ -3018,7 +3043,13 @@ async function showStudentConfirmationForLink(tokenOrCode) {
|
|||||||
const grade = document.getElementById('linkPreviewGrade');
|
const grade = document.getElementById('linkPreviewGrade');
|
||||||
const code = document.getElementById('linkPreviewCode');
|
const code = document.getElementById('linkPreviewCode');
|
||||||
|
|
||||||
if (avatar) avatar.src = student.foto_url || '/img/avatar_default.png';
|
if (avatar) {
|
||||||
|
if (avatar.tagName === 'IMG') {
|
||||||
|
avatar.src = student.foto_url || '/img/avatar_default.png';
|
||||||
|
} else {
|
||||||
|
avatar.textContent = getStudentInitials(student.nombre_completo);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (name) name.textContent = student.nombre_completo;
|
if (name) name.textContent = student.nombre_completo;
|
||||||
if (grade) grade.textContent = `${student.grado} - Sección ${student.seccion}`;
|
if (grade) grade.textContent = `${student.grado} - Sección ${student.seccion}`;
|
||||||
if (code) code.textContent = `Carné: ${student.codigo_estudiante}`;
|
if (code) code.textContent = `Carné: ${student.codigo_estudiante}`;
|
||||||
@@ -3313,7 +3344,9 @@ function renderAdminStudents(list) {
|
|||||||
<div class="admin-student-row ${isBlocked ? 'is-blocked' : ''}">
|
<div class="admin-student-row ${isBlocked ? 'is-blocked' : ''}">
|
||||||
<!-- DATOS PRINCIPALES DEL ESTUDIANTE -->
|
<!-- DATOS PRINCIPALES DEL ESTUDIANTE -->
|
||||||
<div style="display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1;">
|
<div style="display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1;">
|
||||||
<img src="${s.foto_url || 'https://api.dicebear.com/7.x/bottts/svg?seed=est'}" style="width: 42px; height: 42px; border-radius: 50%; border: 2px solid ${isBlocked ? '#fca5a5' : 'var(--border)'}; background: #ffffff; flex-shrink: 0; object-fit: cover;">
|
<div style="width: 42px; height: 42px; border-radius: 50%; border: 2px solid ${isBlocked ? '#fca5a5' : '#0284c7'}; background: ${isBlocked ? '#fee2e2' : 'linear-gradient(135deg, #0284c7, #0369a1)'}; color: ${isBlocked ? '#dc2626' : '#ffffff'}; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.95rem;">
|
||||||
|
${getStudentInitials(s.nombre_completo)}
|
||||||
|
</div>
|
||||||
<div style="min-width: 0; flex: 1;">
|
<div style="min-width: 0; flex: 1;">
|
||||||
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
|
||||||
<strong style="font-size: 0.95rem; font-weight: 800; color: var(--text-main); line-height: 1.2;">${s.nombre_completo}</strong>
|
<strong style="font-size: 0.95rem; font-weight: 800; color: var(--text-main); line-height: 1.2;">${s.nombre_completo}</strong>
|
||||||
@@ -3546,7 +3579,9 @@ function renderAdminSearchDropdown(list, query = '') {
|
|||||||
const isSelected = adminSelectedStudent && adminSelectedStudent.id === s.id;
|
const isSelected = adminSelectedStudent && adminSelectedStudent.id === s.id;
|
||||||
return `
|
return `
|
||||||
<div class="admin-search-item ${isSelected ? 'selected' : ''}" onclick="selectAdminStudent(${s.id}, true)">
|
<div class="admin-search-item ${isSelected ? 'selected' : ''}" onclick="selectAdminStudent(${s.id}, true)">
|
||||||
<img src="${s.foto_url || '/img/avatar_default.png'}" style="width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid ${isSelected ? '#0284c7' : '#cbd5e1'}; flex-shrink: 0;">
|
<div style="width: 38px; height: 38px; border-radius: 50%; background: ${isSelected ? 'linear-gradient(135deg, #0284c7, #0369a1)' : '#e0f2fe'}; color: ${isSelected ? '#ffffff' : '#0369a1'}; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.85rem; border: 2px solid ${isSelected ? '#0284c7' : '#cbd5e1'}; flex-shrink: 0;">
|
||||||
|
${getStudentInitials(s.nombre_completo)}
|
||||||
|
</div>
|
||||||
<div style="min-width: 0; flex: 1;">
|
<div style="min-width: 0; flex: 1;">
|
||||||
<div style="display: flex; align-items: center; gap: 6px;">
|
<div style="display: flex; align-items: center; gap: 6px;">
|
||||||
<strong style="font-size: 0.9rem; color: var(--text-main); display: block; word-break: break-word;">${s.nombre_completo}</strong>
|
<strong style="font-size: 0.9rem; color: var(--text-main); display: block; word-break: break-word;">${s.nombre_completo}</strong>
|
||||||
@@ -3678,7 +3713,13 @@ function selectAdminStudent(studentOrId, updateSearchInput = false) {
|
|||||||
const dropdown = document.getElementById('adminSearchResultsDropdown');
|
const dropdown = document.getElementById('adminSearchResultsDropdown');
|
||||||
const btnClear = document.getElementById('btnClearAdminSearch');
|
const btnClear = document.getElementById('btnClearAdminSearch');
|
||||||
|
|
||||||
if (avatar) avatar.src = student.foto_url || '/img/avatar_default.png';
|
if (avatar) {
|
||||||
|
if (avatar.tagName === 'IMG') {
|
||||||
|
avatar.src = student.foto_url || '/img/avatar_default.png';
|
||||||
|
} else {
|
||||||
|
avatar.textContent = getStudentInitials(student.nombre_completo);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (name) name.textContent = student.nombre_completo;
|
if (name) name.textContent = student.nombre_completo;
|
||||||
if (statusBadge) {
|
if (statusBadge) {
|
||||||
if (student.tarjeta_bloqueada) {
|
if (student.tarjeta_bloqueada) {
|
||||||
@@ -5031,7 +5072,7 @@ function renderCardDesignsCarousel() {
|
|||||||
<div class="card-contactless-wave"><span>)</span><span>)</span><span>)</span></div>
|
<div class="card-contactless-wave"><span>)</span><span>)</span><span>)</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="student-info">
|
<div class="student-info">
|
||||||
<img class="student-avatar" src="${avatarUrl}" alt="Avatar">
|
<div class="student-avatar">${getStudentInitials(studentName)}</div>
|
||||||
<div class="student-meta" style="flex: 1; min-width: 0;">
|
<div class="student-meta" style="flex: 1; min-width: 0;">
|
||||||
<h2 style="margin: 0; font-size: 1.05rem; font-weight: 800; word-break: break-word;">${studentName}</h2>
|
<h2 style="margin: 0; font-size: 1.05rem; font-weight: 800; word-break: break-word;">${studentName}</h2>
|
||||||
<span class="student-grade" style="font-size: 0.72rem;">${studentGrade}</span>
|
<span class="student-grade" style="font-size: 0.72rem;">${studentGrade}</span>
|
||||||
|
|||||||
+19
-1
@@ -11,6 +11,17 @@ let isScanningActive = true;
|
|||||||
let posMobileActiveView = 'catalog';
|
let posMobileActiveView = 'catalog';
|
||||||
let CLOUDFLARE_TUNNEL_URL = 'https://somewhat-ships-looksmart-optical.trycloudflare.com';
|
let CLOUDFLARE_TUNNEL_URL = 'https://somewhat-ships-looksmart-optical.trycloudflare.com';
|
||||||
|
|
||||||
|
// Helper universal para iniciales de estudiantes (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();
|
||||||
|
}
|
||||||
|
|
||||||
function switchPosMobileView(view) {
|
function switchPosMobileView(view) {
|
||||||
posMobileActiveView = view;
|
posMobileActiveView = view;
|
||||||
const body = document.body;
|
const body = document.body;
|
||||||
@@ -830,7 +841,14 @@ function renderScannedStudent() {
|
|||||||
|
|
||||||
if (placeholder) placeholder.style.display = 'none';
|
if (placeholder) placeholder.style.display = 'none';
|
||||||
|
|
||||||
document.getElementById('scannedAvatar').src = scannedStudent.foto_url;
|
const scannedAvatar = document.getElementById('scannedAvatar');
|
||||||
|
if (scannedAvatar) {
|
||||||
|
if (scannedAvatar.tagName === 'IMG') {
|
||||||
|
scannedAvatar.src = scannedStudent.foto_url || '/img/avatar_default.png';
|
||||||
|
} else {
|
||||||
|
scannedAvatar.textContent = getStudentInitials(scannedStudent.nombre_completo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const btnCobrar = document.getElementById('btnCobrarPos');
|
const btnCobrar = document.getElementById('btnCobrarPos');
|
||||||
if (scannedStudent.tarjeta_bloqueada) {
|
if (scannedStudent.tarjeta_bloqueada) {
|
||||||
|
|||||||
+1
-1
@@ -253,7 +253,7 @@
|
|||||||
|
|
||||||
<!-- TARJETA DEL ESTUDIANTE IDENTIFICADO POR QR -->
|
<!-- TARJETA DEL ESTUDIANTE IDENTIFICADO POR QR -->
|
||||||
<div id="studentScannedCard" style="display: none; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 14px; padding: 12px; margin-bottom: 14px; align-items: center; gap: 12px;">
|
<div id="studentScannedCard" style="display: none; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 14px; padding: 12px; margin-bottom: 14px; align-items: center; gap: 12px;">
|
||||||
<img id="scannedAvatar" src="" style="width: 44px; height: 44px; border-radius: 50%; border: 2px solid #16a34a; background: white; flex-shrink: 0; object-fit: cover;">
|
<div id="scannedAvatar" class="scanned-avatar-badge">ES</div>
|
||||||
<div style="flex: 1; min-width: 0; word-break: break-word;">
|
<div style="flex: 1; min-width: 0; word-break: break-word;">
|
||||||
<h4 id="scannedName" style="font-size: 0.92rem; font-weight: 800; color: #0f172a; margin: 0; line-height: 1.2;">Nombre del Alumno</h4>
|
<h4 id="scannedName" style="font-size: 0.92rem; font-weight: 800; color: #0f172a; margin: 0; line-height: 1.2;">Nombre del Alumno</h4>
|
||||||
<div id="scannedGrade" style="font-size: 0.74rem; color: #64748b; margin-top: 2px;">2° Grado • Sección 2-A</div>
|
<div id="scannedGrade" style="font-size: 0.74rem; color: #64748b; margin-top: 2px;">2° Grado • Sección 2-A</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user