@@ -137,7 +147,7 @@
diff --git a/public/js/app.js b/public/js/app.js
index 29fd606..1d53803 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -169,45 +169,51 @@ function switchLoginTab(tab) {
}
}
-let selectedRegisterRole = 'padre';
+let currentLoginRole = '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');
+function selectLoginRole(role) {
+ currentLoginRole = role;
+ const cardPadre = document.getElementById('loginRoleCardPadre');
+ const cardEstudiante = document.getElementById('loginRoleCardEstudiante');
+ const cardPersonal = document.getElementById('loginRoleCardPersonal');
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();
+ const lblUser = document.getElementById('lblLoginUser');
+ const inputUser = document.getElementById('loginUsername');
+ const lblPass = document.getElementById('lblLoginPass');
+ const inputPass = document.getElementById('loginPassword');
+ const btnText = document.getElementById('lblBtnLoginText');
if (role === 'estudiante') {
- if (errorMsg) {
- errorMsg.style.background = '#eff6ff';
- errorMsg.style.borderColor = '#93c5fd';
- errorMsg.style.color = '#1e40af';
- errorMsg.innerHTML = '
🎒 Cuenta de Estudiante: Tu carné y código QR son entregados directamente por el centro educativo. Si ya cuentas con carné o credenciales, toca en
Iniciar Sesión.';
- errorMsg.style.display = 'block';
- }
+ if (lblUser) lblUser.textContent = 'Carné o Código de Estudiante:';
+ if (inputUser) inputUser.placeholder = 'Ej: EST-2026-00001, mateo, sofia';
+ if (lblPass) lblPass.textContent = 'PIN Escolar (4 dígitos) o Contraseña:';
+ if (inputPass) inputPass.placeholder = 'Ej: 1234';
+ if (btnText) btnText.textContent = 'Ingresar como Estudiante';
} else if (role === 'personal') {
- if (errorMsg) {
- errorMsg.style.background = '#fefce8';
- errorMsg.style.borderColor = '#fde047';
- errorMsg.style.color = '#854d0e';
- errorMsg.innerHTML = '
👨🍳 Personal de Soda: Las credenciales de punto de venta y administración son asignadas por la dirección escolar. Por favor ingresa en
Iniciar Sesión.';
- errorMsg.style.display = 'block';
- }
+ if (lblUser) lblUser.textContent = 'Usuario de Soda o Admin:';
+ if (inputUser) inputUser.placeholder = 'Ej: admin, cajero, soda';
+ if (lblPass) lblPass.textContent = 'Contraseña:';
+ if (inputPass) inputPass.placeholder = '••••••••';
+ if (btnText) btnText.textContent = 'Ingresar al Sistema de Soda';
} else {
- if (errorMsg) {
- errorMsg.style.display = 'none';
- errorMsg.style.background = '#fee2e2';
- errorMsg.style.borderColor = '#fca5a5';
- errorMsg.style.color = '#991b1b';
- }
+ // Padre / Encargado
+ if (lblUser) lblUser.textContent = 'Usuario o Teléfono del Padre:';
+ if (inputUser) inputUser.placeholder = 'Ej: padre, carlos_papa o 8888-1122';
+ if (lblPass) lblPass.textContent = 'Contraseña:';
+ if (inputPass) inputPass.placeholder = '••••••••';
+ if (btnText) btnText.textContent = 'Ingresar como Padre / Encargado';
}
+
+ if (window.sounds) window.sounds.playTap();
+}
+
+// Compatibilidad
+function selectRegisterRole(role) {
+ selectLoginRole(role);
}
async function handleRegisterPadreSubmit(event) {
@@ -251,13 +257,23 @@ async function handleRegisterPadreSubmit(event) {
if (window.sounds) window.sounds.playError();
} finally {
btnSubmit.disabled = false;
- btnSubmit.innerHTML = '
Crear Cuenta y Entrar al Panel';
+ btnSubmit.innerHTML = '
Crear Cuenta de Padre y Entrar';
}
}
function quickFillLogin(username, password) {
- document.getElementById('loginUsername').value = username;
- document.getElementById('loginPassword').value = password;
+ if (username === 'mateo' || username === 'sofia') {
+ selectLoginRole('estudiante');
+ } else if (username === 'admin' || username === 'cajero' || username === 'dev') {
+ selectLoginRole('personal');
+ } else if (username === 'padre') {
+ selectLoginRole('padre');
+ }
+
+ const inputUser = document.getElementById('loginUsername');
+ const inputPass = document.getElementById('loginPassword');
+ if (inputUser) inputUser.value = username;
+ if (inputPass) inputPass.value = password;
handleLoginSubmit();
}
@@ -309,7 +325,12 @@ async function handleLoginSubmit(event) {
if (window.sounds) window.sounds.playError();
} finally {
submitBtn.disabled = false;
- submitBtn.innerHTML = '
Iniciar Sesión';
+ const btnLabel = currentLoginRole === 'estudiante'
+ ? 'Ingresar como Estudiante'
+ : currentLoginRole === 'personal'
+ ? 'Ingresar al Sistema de Soda'
+ : 'Ingresar como Padre / Encargado';
+ submitBtn.innerHTML = `
${btnLabel}`;
}
}