Recrea el mark de Collina (dos trazos: loma izquierda baja + loma derecha alta) como SVG vectorial, reemplazando el flourish anterior. En las cuatro páginas, tamaño proporcional al pie. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
367 lines
22 KiB
HTML
367 lines
22 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>Taboada — Mis horas</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com"/>
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
|
|
<link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700&family=Figtree:wght@400;500;600;700&display=swap" rel="stylesheet"/>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/7.23.2/babel.min.js"></script>
|
|
<script src="theme.js"></script>
|
|
<style>
|
|
* { box-sizing: border-box; }
|
|
html, body { margin: 0; padding: 0; }
|
|
body { background: #F3EBDD; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
|
|
input::placeholder { color: #B4A99A; }
|
|
@keyframes tb-spin { to { transform: rotate(360deg); } }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
<script type="text/babel" data-presets="react">
|
|
const { useState, useEffect, useCallback } = React;
|
|
|
|
// Cableado al backend: cliente HTTP compartido en theme.js, el mismo para las
|
|
// tres páginas. Mismo comportamiento de antes (mapeo de error por code/status);
|
|
// ahora vive en un solo sitio en vez de duplicado por página.
|
|
const { apiFetch } = Theme;
|
|
|
|
// Piel visual "cream" del rediseño, servida por theme.js (flavor 'becario' =
|
|
// móvil, mismos componentes y tokens que checada). Nada de colores inline.
|
|
const UI = Theme.makeUI("becario");
|
|
const { Logo, Card, Btn, Input, Aviso, IconBadge, StatusBadge, HorasCard, palette, fonts, icons } = UI;
|
|
|
|
function fmtDT(iso) {
|
|
if (!iso) return "—";
|
|
return new Date(iso).toLocaleString("es-MX", {
|
|
timeZone: "America/Mexico_City", day: "2-digit", month: "short", hour: "2-digit", minute: "2-digit",
|
|
});
|
|
}
|
|
// Día de la semana (capitalizado) en America/Mexico_City, p.ej. "Martes".
|
|
function fmtDia(iso) {
|
|
if (!iso) return "";
|
|
const d = new Date(iso).toLocaleDateString("es-MX", { timeZone: "America/Mexico_City", weekday: "long" });
|
|
return d.charAt(0).toUpperCase() + d.slice(1);
|
|
}
|
|
const fmtHoras = (h) => `${(h ?? 0).toLocaleString("es-MX", { maximumFractionDigits: 1 })} h`;
|
|
function localToIso(v) { return v ? new Date(v).toISOString() : null; }
|
|
|
|
// ─────────────────── Piezas visuales locales ───────────────────
|
|
const Cargando = ({ texto = "Cargando…" }) => (
|
|
<div style={{ minHeight: "100vh", background: palette.bgGradient, display: "grid", placeItems: "center", fontFamily: fonts.body }}>
|
|
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: "12px", color: palette.inkSoft }}>
|
|
<span style={{ display: "inline-flex" }}>{icons.spinner({ size: 24, color: palette.primary, track: palette.line })}</span>
|
|
<span style={{ fontFamily: fonts.body, fontSize: "14px" }}>{texto}</span>
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
// Header de marca para la pantalla de acceso (logo + título según el modo).
|
|
const Marca = ({ titulo }) => (
|
|
<div style={{ textAlign: "center", marginBottom: "18px" }}>
|
|
<div style={{ display: "flex", justifyContent: "center", marginBottom: "10px" }}><Logo /></div>
|
|
<h1 style={{ margin: 0, fontFamily: fonts.title, fontWeight: 600, fontSize: "24px", color: palette.brand, letterSpacing: "-.01em" }}>{titulo}</h1>
|
|
</div>
|
|
);
|
|
|
|
// Barra de error global, descartable (estado P8 del inventario).
|
|
const ErrorBar = ({ error, onClose }) => !error ? null : (
|
|
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: "10px",
|
|
background: palette.errBg, border: `1px solid ${palette.errBorder}`, borderRadius: "14px", padding: "12px 14px", marginBottom: "16px" }}>
|
|
<span style={{ display: "flex", alignItems: "center", gap: "9px" }}>
|
|
<span style={{ display: "inline-flex", flexShrink: 0 }}>{icons.alertTriangle({ size: 18, color: palette.danger })}</span>
|
|
<span style={{ fontFamily: fonts.body, fontSize: "13px", fontWeight: 500, color: palette.errText, lineHeight: 1.35 }}>{error}</span>
|
|
</span>
|
|
<span onClick={onClose} style={{ cursor: "pointer", flexShrink: 0, fontWeight: 700, color: palette.errText, fontSize: "16px", lineHeight: 1, padding: "0 2px" }}>✕</span>
|
|
</div>
|
|
);
|
|
|
|
// Pie de marca, compartido por las vistas de esta página.
|
|
const PoweredBy = () => (
|
|
<div style={{ textAlign: "center", padding: "20px 0 26px", fontFamily: fonts.body, fontSize: "11px", color: palette.inkSoft, letterSpacing: ".02em" }}>
|
|
<div>Powered by <span style={{ fontWeight: 600, color: palette.brand }}>Collina Systems</span></div>
|
|
<svg width="66" height="21" viewBox="0 0 200 64" fill="none" aria-hidden="true" style={{ display: "block", margin: "6px auto 0" }}>
|
|
<path d="M6 45 C 34 45 46 31 64 31 C 82 31 92 41 122 44" stroke={palette.ink} strokeWidth="3.2" strokeLinecap="round" strokeLinejoin="round" opacity="0.82"/>
|
|
<path d="M84 47 C 104 47 118 22 140 21 C 162 20 176 40 196 42" stroke={palette.ink} strokeWidth="3.2" strokeLinecap="round" strokeLinejoin="round" opacity="0.82"/>
|
|
</svg>
|
|
</div>
|
|
);
|
|
|
|
// ═══════════════ Acceso · login / registro ═══════════════
|
|
function Acceso({ onEntra }) {
|
|
const [modo, setModo] = useState(() =>
|
|
new URLSearchParams(window.location.search).get("registro") === "1" ? "registro" : "login"
|
|
);
|
|
const [f, setF] = useState({ telefono: "", password: "", nombre: "" });
|
|
const [error, setError] = useState(null); // { text, ic }
|
|
const [busy, setBusy] = useState(false);
|
|
const set = (k) => (e) => setF({ ...f, [k]: k === "telefono" ? e.target.value.replace(/\D/g, "").slice(0, 10) : e.target.value });
|
|
const submit = async (e) => {
|
|
e.preventDefault(); setBusy(true); setError(null);
|
|
try {
|
|
if (modo === "registro") {
|
|
await apiFetch("/becario/registro", { method: "POST", body: JSON.stringify({ telefono: f.telefono, password: f.password, nombre: f.nombre.trim() }) });
|
|
} else {
|
|
await apiFetch("/becario/login", { method: "POST", body: JSON.stringify({ telefono: f.telefono, password: f.password }) });
|
|
}
|
|
onEntra(await apiFetch("/becario/session"));
|
|
} catch (err) {
|
|
// Mismo mapeo por code/status de siempre; el ícono sólo acompaña.
|
|
let text, ic = "alertCircle";
|
|
if (err.status === 429) { text = "Demasiados intentos, espera un minuto."; ic = "clock"; }
|
|
else if (err.code === "TELEFONO_YA_REGISTRADO") text = "Ese número ya está registrado. Inicia sesión.";
|
|
// Motivo específico del backend para errores de datos (4xx): teléfono,
|
|
// contraseña corta, nombre. No se muestra el detalle de errores 5xx.
|
|
else if (modo === "registro" && err.status >= 400 && err.status < 500 && err.message) text = err.message;
|
|
else if (modo === "registro") text = "No se pudo registrar. Intenta de nuevo.";
|
|
else text = "Número o contraseña incorrectos.";
|
|
setError({ text, ic });
|
|
} finally { setBusy(false); }
|
|
};
|
|
const reg = modo === "registro";
|
|
return (
|
|
<div style={{ minHeight: "100vh", background: palette.bgGradient, display: "flex", flexDirection: "column", justifyContent: "center", padding: "32px 20px", fontFamily: fonts.body }}>
|
|
<div style={{ width: "100%", maxWidth: "420px", margin: "0 auto" }}>
|
|
<Marca titulo={reg ? "Registrarse" : "Iniciar sesión"} />
|
|
<Card>
|
|
<div style={{ display: "flex", gap: "7px", background: palette.softTint, borderRadius: "13px", padding: "4px", marginBottom: "18px" }}>
|
|
{["login", "registro"].map((m) => (
|
|
<button key={m} type="button" onClick={() => { setModo(m); setError(null); }} style={{
|
|
flex: 1, textAlign: "center", padding: "9px", borderRadius: "10px", border: "none", cursor: "pointer",
|
|
fontFamily: fonts.body, fontWeight: 700, fontSize: "14px",
|
|
background: modo === m ? palette.primary : "transparent", color: modo === m ? "#fff" : palette.inkSoft,
|
|
}}>{m === "login" ? "Entrar" : "Registrarme"}</button>
|
|
))}
|
|
</div>
|
|
{error && <Aviso variant="error" icon={error.ic}>{error.text}</Aviso>}
|
|
<form onSubmit={submit}>
|
|
{reg && (
|
|
<div style={{ marginBottom: "12px" }}>
|
|
<Input placeholder="Tu nombre" value={f.nombre} onChange={set("nombre")} required />
|
|
</div>
|
|
)}
|
|
<div style={{ marginBottom: "12px" }}>
|
|
<Input placeholder="Celular (10 dígitos)" inputMode="numeric" value={f.telefono} onChange={set("telefono")} required />
|
|
</div>
|
|
<div style={{ marginBottom: "18px" }}>
|
|
<Input type="password" placeholder="Contraseña" value={f.password} onChange={set("password")} required />
|
|
</div>
|
|
<Btn type="submit" loading={busy} disabled={busy || f.telefono.length !== 10 || f.password.length < (reg ? 6 : 1) || (reg && !f.nombre.trim())}>
|
|
{busy ? (reg ? "Creando…" : "Entrando…") : (reg ? "Crear cuenta" : "Entrar")}
|
|
</Btn>
|
|
</form>
|
|
{reg && (
|
|
<p style={{ margin: "12px 0 0", fontFamily: fonts.body, fontSize: "12px", color: palette.inkSoft, textAlign: "center", lineHeight: 1.5 }}>
|
|
Tu cuenta queda pendiente hasta que la supervisora la apruebe.
|
|
</p>
|
|
)}
|
|
</Card>
|
|
<PoweredBy />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// ═══════════════ Portal ═══════════════
|
|
function Portal({ session, onSalir }) {
|
|
const [resumen, setResumen] = useState(null);
|
|
const [jornadas, setJornadas] = useState([]);
|
|
const [solicitudes, setSolicitudes] = useState([]);
|
|
const [error, setError] = useState(null);
|
|
const [dia, setDia] = useState({ fecha: "", entrada: "", salida: "", concepto: "" });
|
|
const [enviandoDia, setEnviandoDia] = useState(false);
|
|
const [okDia, setOkDia] = useState(null);
|
|
|
|
const load = useCallback(async () => {
|
|
try {
|
|
const [r, j, s] = await Promise.all([
|
|
apiFetch("/becario/resumen"), apiFetch("/becario/jornadas"), apiFetch("/becario/solicitudes"),
|
|
]);
|
|
setResumen(r); setJornadas(j); setSolicitudes(s);
|
|
} catch (e) { setError(e.message); }
|
|
}, []);
|
|
useEffect(() => { load(); }, [load]);
|
|
|
|
const salir = async () => { try { await apiFetch("/becario/logout", { method: "POST" }); } catch {} onSalir(); };
|
|
// Jornada pasada: fecha + entrada + salida (horas en múltiplos de 5 min por el
|
|
// step de los inputs) + actividad realizada. Se combinan en timestamps locales
|
|
// → ISO. El backend valida rango y múltiplos; suma solo tras la autorización.
|
|
const diaValido = dia.fecha && dia.entrada && dia.salida && dia.salida > dia.entrada && dia.concepto.trim();
|
|
const crearJornadaCompleta = async (e) => {
|
|
e.preventDefault(); setEnviandoDia(true); setError(null); setOkDia(null);
|
|
try {
|
|
await apiFetch("/becario/solicitudes", {
|
|
method: "POST",
|
|
body: JSON.stringify({
|
|
entrada_ts: localToIso(`${dia.fecha}T${dia.entrada}`),
|
|
salida_ts: localToIso(`${dia.fecha}T${dia.salida}`),
|
|
concepto: dia.concepto.trim(),
|
|
}),
|
|
});
|
|
setDia({ fecha: "", entrada: "", salida: "", concepto: "" });
|
|
setOkDia("Jornada enviada. Sumará a tus horas cuando la supervisora la autorice.");
|
|
await load();
|
|
} catch (err) {
|
|
setError(err.code === "MINUTOS_INVALIDOS" ? "Las horas deben ir en múltiplos de 5 minutos."
|
|
: err.code === "RANGO_INVALIDO" ? "La salida debe ser posterior a la entrada."
|
|
: err.message);
|
|
} finally { setEnviandoDia(false); }
|
|
};
|
|
|
|
if (!resumen) return <Cargando texto="Cargando tu portal…" />;
|
|
// Horas y avance vienen calculados del backend (resumen.horas); aquí sólo se pintan.
|
|
const h = resumen.horas;
|
|
const pendiente = resumen.estado === "pendiente";
|
|
const meta = h.porcentaje >= 100;
|
|
const secTitle = { margin: "20px 0 9px", fontFamily: fonts.title, fontWeight: 600, fontSize: "15px", color: palette.brand };
|
|
// Campo "sin caja": solo el texto con una línea sutil abajo (más elegante que
|
|
// el recuadro relleno). Se pasa como override de style al Input cream.
|
|
const campoLimpio = { border: "none", borderBottom: `1.5px solid ${palette.line}`, borderRadius: 0, background: "transparent", padding: "10px 2px" };
|
|
|
|
return (
|
|
<div style={{ minHeight: "100vh", background: palette.bgGradient, fontFamily: fonts.body }}>
|
|
<header style={{ maxWidth: "440px", margin: "0 auto", padding: "16px 18px 14px", display: "flex", justifyContent: "space-between", alignItems: "center", borderBottom: `1px solid ${palette.cardBorder}` }}>
|
|
<div>
|
|
<div style={{ fontFamily: fonts.body, fontWeight: 600, fontSize: "15px", color: palette.brand }}>{resumen.nombre}</div>
|
|
<div style={{ display: "flex", alignItems: "center", gap: "6px", marginTop: "2px", fontFamily: fonts.body, fontSize: "12px", color: palette.inkSoft }}>
|
|
{resumen.telefono} <StatusBadge tone={resumen.estado}>{resumen.estado}</StatusBadge>
|
|
</div>
|
|
</div>
|
|
<div style={{ display: "flex", gap: "8px", flexShrink: 0 }}>
|
|
<button onClick={() => { window.location.href = "/checada.html"; }} style={{ padding: "7px 12px", background: palette.primary, border: "none", borderRadius: "11px", fontFamily: fonts.body, fontWeight: 700, fontSize: "12px", color: "#fff", cursor: "pointer" }}>Inicio</button>
|
|
<button onClick={salir} style={{ padding: "7px 12px", background: "transparent", border: `1px solid ${palette.line}`, borderRadius: "11px", fontFamily: fonts.body, fontWeight: 600, fontSize: "12px", color: palette.primary, cursor: "pointer" }}>Salir</button>
|
|
</div>
|
|
</header>
|
|
|
|
<main style={{ maxWidth: "440px", margin: "0 auto", padding: "18px" }}>
|
|
<ErrorBar error={error} onClose={() => setError(null)} />
|
|
|
|
{pendiente && (
|
|
<div style={{ background: palette.warnBg, border: `1px solid ${palette.warnBorder}`, borderRadius: "18px", padding: "16px 18px", marginBottom: "18px" }}>
|
|
<div style={{ display: "flex", alignItems: "center", gap: "8px", marginBottom: "6px" }}>
|
|
<span style={{ display: "inline-flex", flexShrink: 0 }}>{icons.clock({ size: 17, color: palette.amber })}</span>
|
|
<strong style={{ fontFamily: fonts.body, fontWeight: 600, fontSize: "14px", color: palette.warnText }}>Cuenta pendiente de aprobación</strong>
|
|
</div>
|
|
<p style={{ margin: 0, fontFamily: fonts.body, fontSize: "13px", color: palette.warnText, lineHeight: 1.5 }}>
|
|
Ya puedes ver tu portal, pero aún no puedes checar. Avisa a la supervisora para que apruebe tu cuenta.
|
|
</p>
|
|
</div>
|
|
)}
|
|
|
|
<HorasCard
|
|
total={fmtHoras(h.total_horas)} meta={fmtHoras(h.meta_horas)} porcentaje={h.porcentaje}
|
|
sub={`${h.porcentaje}% de tu meta · jornadas ${(h.minutos_jornadas / 60).toFixed(1)} h + ajustes ${(h.minutos_ajustes / 60).toFixed(1)} h`}
|
|
/>
|
|
|
|
{meta && (
|
|
<div style={{ marginTop: "16px" }}>
|
|
<Aviso variant="success">Completaste tus horas de servicio social. La supervisora recibirá la constancia para tu liberación. ¡Gracias por tu compromiso!</Aviso>
|
|
</div>
|
|
)}
|
|
|
|
<h3 style={secTitle}>Mis jornadas</h3>
|
|
{jornadas.length === 0 ? (
|
|
<Card style={{ textAlign: "center", padding: "26px 20px" }}>
|
|
<IconBadge icon="calendar" tone="neutral" size={52} />
|
|
<p style={{ margin: 0, fontFamily: fonts.body, fontSize: "13px", color: palette.inkSoft, lineHeight: 1.5 }}>
|
|
Aún no tienes jornadas.<br/>Empezarán a aparecer cuando puedas checar.
|
|
</p>
|
|
</Card>
|
|
) : (
|
|
<Card style={{ padding: 0, borderRadius: "18px", overflow: "hidden" }}>
|
|
{jornadas.slice(0, 20).map((j, i, arr) => (
|
|
<div key={j.id} style={{ display: "flex", justifyContent: "space-between", alignItems: "center", padding: "12px 15px", borderBottom: i < arr.length - 1 ? `1px solid ${palette.line}` : "none" }}>
|
|
<div style={{ minWidth: 0, marginRight: "10px" }}>
|
|
<div style={{ fontFamily: fonts.body, fontWeight: 700, fontSize: "12px", color: palette.brand }}>{fmtDia(j.entrada_ts)}</div>
|
|
<div style={{ fontFamily: fonts.body, fontWeight: 500, fontSize: "13px", color: palette.ink }}>
|
|
{fmtDT(j.entrada_ts)} → {j.salida_ts ? fmtDT(j.salida_ts) : "sin salida"}
|
|
</div>
|
|
<div style={{ fontFamily: fonts.body, fontWeight: 400, fontSize: "11px", color: palette.inkSoft, marginTop: "2px" }}>
|
|
{j.estado}{j.duracion_minutos != null ? ` · ${(j.duracion_minutos / 60).toFixed(1)} h` : ""}
|
|
</div>
|
|
<div style={{ fontFamily: fonts.body, fontWeight: 500, fontSize: "12px", color: j.concepto ? palette.ink : palette.inkSoft, marginTop: "3px" }}>
|
|
{j.concepto ? `Actividad: ${j.concepto}` : "Sin actividad registrada"}
|
|
</div>
|
|
</div>
|
|
<div style={{ textAlign: "right", flexShrink: 0 }}>
|
|
<StatusBadge tone={j.estado}>{j.estado}</StatusBadge>
|
|
<div style={{ fontFamily: fonts.body, fontSize: "11px", color: palette.inkSoft, marginTop: "4px" }}>
|
|
acumulado {((j.acumulado_minutos || 0) / 60).toFixed(1)} h
|
|
</div>
|
|
</div>
|
|
</div>
|
|
))}
|
|
</Card>
|
|
)}
|
|
|
|
<h3 style={secTitle}>Cargar jornada pasada</h3>
|
|
<Card style={{ borderRadius: "18px", padding: "18px" }}>
|
|
<p style={{ margin: "0 0 12px", fontFamily: fonts.body, fontSize: "13px", color: palette.inkSoft, lineHeight: 1.5 }}>
|
|
Registra una jornada que no checaste: fecha, hora de entrada, de salida y la actividad que realizaste. La supervisora la revisa y, al autorizarla, suma a tus horas.
|
|
</p>
|
|
<form onSubmit={crearJornadaCompleta}>
|
|
<label style={{ display: "block", fontFamily: fonts.body, fontSize: "12px", fontWeight: 600, color: palette.label, marginBottom: "6px" }}>Fecha</label>
|
|
<div style={{ marginBottom: "12px" }}>
|
|
<Input type="date" value={dia.fecha} onChange={(e) => setDia({ ...dia, fecha: e.target.value })} required style={campoLimpio} />
|
|
</div>
|
|
<div style={{ marginBottom: "12px" }}>
|
|
<label style={{ display: "block", fontFamily: fonts.body, fontSize: "12px", fontWeight: 600, color: palette.label, marginBottom: "6px" }}>Entrada</label>
|
|
<Input type="time" step="300" value={dia.entrada} onChange={(e) => setDia({ ...dia, entrada: e.target.value })} required style={campoLimpio} />
|
|
</div>
|
|
<div style={{ marginBottom: "8px" }}>
|
|
<label style={{ display: "block", fontFamily: fonts.body, fontSize: "12px", fontWeight: 600, color: palette.label, marginBottom: "6px" }}>Salida</label>
|
|
<Input type="time" step="300" value={dia.salida} onChange={(e) => setDia({ ...dia, salida: e.target.value })} required style={campoLimpio} />
|
|
</div>
|
|
<p style={{ margin: "0 0 14px", fontFamily: fonts.body, fontSize: "12px", color: palette.inkSoft, lineHeight: 1.4 }}>
|
|
Las horas se registran en intervalos de 5 minutos (por ejemplo 9:00, 9:05, 9:10).
|
|
</p>
|
|
<label style={{ display: "block", fontFamily: fonts.body, fontSize: "12px", fontWeight: 600, color: palette.label, marginBottom: "6px" }}>¿Qué actividad realizaste? (obligatorio)</label>
|
|
<div style={{ marginBottom: "12px" }}>
|
|
<Input value={dia.concepto} onChange={(e) => setDia({ ...dia, concepto: e.target.value })} placeholder="Describe la actividad" required style={campoLimpio} />
|
|
</div>
|
|
{dia.entrada && dia.salida && dia.salida <= dia.entrada && (
|
|
<Aviso variant="warn" icon="alertTriangle">La salida debe ser posterior a la entrada.</Aviso>
|
|
)}
|
|
{okDia && <Aviso variant="success" icon="check">{okDia}</Aviso>}
|
|
<Btn type="submit" loading={enviandoDia} disabled={enviandoDia || !diaValido}>
|
|
{enviandoDia ? "Enviando…" : "Enviar jornada"}
|
|
</Btn>
|
|
</form>
|
|
</Card>
|
|
|
|
{solicitudes.length > 0 && (
|
|
<>
|
|
<h3 style={secTitle}>Mis solicitudes</h3>
|
|
<Card style={{ borderRadius: "18px", padding: "4px 18px" }}>
|
|
{solicitudes.slice(0, 8).map((s, i, arr) => (
|
|
<div key={s.id} style={{ display: "flex", justifyContent: "space-between", alignItems: "center", padding: "11px 0", borderBottom: i < arr.length - 1 ? `1px solid ${palette.line}` : "none" }}>
|
|
<span style={{ fontFamily: fonts.body, fontSize: "12px", color: palette.inkSoft }}>
|
|
{s.tipo === "olvido_entrada" ? "Olvido de entrada" : s.tipo === "jornada_completa" ? "Jornada pasada" : "Auto-cierre"} · {fmtDT(s.propuesta?.entrada_ts || s.created_at)}
|
|
</span>
|
|
<StatusBadge tone={s.estado}>{s.estado}</StatusBadge>
|
|
</div>
|
|
))}
|
|
</Card>
|
|
</>
|
|
)}
|
|
<PoweredBy />
|
|
</main>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function App() {
|
|
const [session, setSession] = useState(undefined);
|
|
useEffect(() => { apiFetch("/becario/session").then(setSession).catch(() => setSession(null)); }, []);
|
|
if (session === undefined) return <Cargando texto="Verificando sesión…" />;
|
|
if (!session) return <Acceso onEntra={setSession} />;
|
|
return <Portal session={session} onSalir={() => setSession(null)} />;
|
|
}
|
|
ReactDOM.createRoot(document.getElementById("root")).render(<App />);
|
|
</script>
|
|
</body>
|
|
</html>
|