- Ficha de Collina Matrix: recorridos animados de escritorio y móvil (MatrixDemo, isla) portados de referencia/demos/matrix-*.html. Motor en src/scripts/matrix-demo.js, estilos en src/styles/matrix-demo.css y guion como contenido en la colección nueva `recorridos`, con esquema zod. - Sin barra de avance, contador ni botones: el título y el texto de cada paso van encima de su marco, sobre el fondo de la página. DemoPantallas pasa a una retícula con subgrid: títulos en la misma línea y marcos alineados. - Cada demo se detiene al salir de pantalla, cuando la documentación la cubre y mientras tiene el foco (WCAG 2.2.2). Con movimiento reducido avanza sin animaciones. La banda solo se fija con 760 px o más de alto. - Lista de /proyectos: al señalar una fila, tarjeta blanca con el texto y el símbolo en el azul casi negro del fondo y el azul cielo más vivo; también con el foco del teclado. - Bitácora: registro de los cambios. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1889 lines
92 KiB
HTML
1889 lines
92 KiB
HTML
<!doctype html>
|
||
<html lang="es-MX">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Collina Matrix · demostración (móvil)</title>
|
||
<!--
|
||
REFERENCIA PARA PORTAR · Collina Matrix, variante móvil (390 × 844).
|
||
|
||
Qué es componente y qué no:
|
||
- <style data-componente> estilos; todo cuelga de la clase raíz .matrix-demo.
|
||
- <div data-matrix-demo> el único elemento raíz, de tamaño fijo. Lleva el guion
|
||
(datos + pasos) en un <script type="application/json">.
|
||
- <script data-componente> JS sin dependencias. montarMatrixDemo(raiz) devuelve
|
||
{ irA, pausar, reiniciar }.
|
||
- Lo marcado «SOLO VISTA PREVIA» ajusta el lienzo a la ventana y lee #paso=N;
|
||
no se porta.
|
||
|
||
Las dos variantes comparten estilos, JS y el bloque "datos" del guion: solo
|
||
cambian la clase de variante, "variante" y "pasos".
|
||
-->
|
||
<style>
|
||
/* SOLO VISTA PREVIA */
|
||
html, body { height: 100%; margin: 0; background: #dfe3e8; }
|
||
body { overflow: hidden; }
|
||
.vista-previa { position: absolute; left: 50%; top: 50%; width: 390px; height: 844px; margin: calc(844px / -2) 0 0 calc(390px / -2); transform-origin: center; }
|
||
</style>
|
||
<style data-componente>
|
||
/* Collina Matrix · demostración animada. Todo vive bajo .matrix-demo.
|
||
Las medidas van en em: la variante fija el tamaño base (15px móvil, 19px
|
||
escritorio) y las piezas comunes crecen con él. */
|
||
.matrix-demo {
|
||
& {
|
||
--mx-fondo: #f4f5f7;
|
||
--mx-tarjeta: #ffffff;
|
||
--mx-linea: #dfe3e8;
|
||
--mx-linea-2: #eceff3;
|
||
--mx-tinta: #0b1a2b;
|
||
--mx-tinta-2: #4a5565;
|
||
--mx-tinta-3: #5d6877;
|
||
--mx-noche: #07172a;
|
||
--mx-verde: #00c46a;
|
||
--mx-verde-tinta: #006b3a;
|
||
--mx-verde-tinte: #e0f7eb;
|
||
--mx-acento: #1f4fff;
|
||
--mx-acento-tinte: #e9eeff;
|
||
--mx-cielo: #8fd3f7;
|
||
--mx-cielo-tinte: #e4f4fd;
|
||
--mx-cielo-tinta: #14587c;
|
||
--mx-ambar-tinte: #fff3d6;
|
||
--mx-ambar-tinta: #6b4e10;
|
||
--mx-rojo: #b3261e;
|
||
--mx-rojo-tinte: #fdecea;
|
||
--mx-s0: #1f4fff;
|
||
--mx-s1: #00a85a;
|
||
--mx-s2: #07172a;
|
||
--mx-titulos: var(--font-display, 'Fraunces', Georgia, serif);
|
||
--mx-texto: var(--font-body, 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif);
|
||
--mx-datos: var(--font-mono, 'JetBrains Mono', ui-monospace, Menlo, monospace);
|
||
position: relative;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
box-sizing: border-box;
|
||
background: var(--mx-fondo);
|
||
color: var(--mx-tinta);
|
||
font-family: var(--mx-texto);
|
||
line-height: 1.3;
|
||
text-align: left;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
&.matrix-demo--movil { width: 390px; height: 844px; font-size: 15px; }
|
||
&.matrix-demo--escritorio { width: 1280px; height: 800px; font-size: 19px; }
|
||
|
||
*, *::before, *::after { box-sizing: border-box; }
|
||
p { margin: 0; }
|
||
b { font-weight: 700; }
|
||
i { font-style: normal; }
|
||
small { font-size: 0.8em; color: var(--mx-tinta-3); }
|
||
|
||
/* ── Estados del motor ── */
|
||
.mx-fuera { display: none !important; }
|
||
.mx-entra { animation: mx-entra 0.4s ease both; }
|
||
.mx-pant { animation: mx-aparece 0.4s ease both; }
|
||
.mx-quieta, .mx-quieta * { animation: none !important; transition: none !important; }
|
||
.mx-toque {
|
||
position: absolute;
|
||
z-index: 9;
|
||
width: 3.2em;
|
||
height: 3.2em;
|
||
margin: -1.6em 0 0 -1.6em;
|
||
border-radius: 50%;
|
||
background: color-mix(in srgb, var(--mx-acento) 28%, transparent);
|
||
border: 2px solid var(--mx-acento);
|
||
pointer-events: none;
|
||
animation: mx-toque 0.65s ease-out both;
|
||
}
|
||
.mx-pulsado { filter: brightness(0.94); }
|
||
|
||
/* ── Lienzo de la aplicación ── */
|
||
.mx-app { position: relative; flex: 1; min-height: 0; overflow: hidden; }
|
||
.mx-pant { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--mx-fondo); }
|
||
.mx-vista { position: relative; flex: 1; min-height: 0; overflow: hidden; }
|
||
.mx-rollo { display: flex; flex-direction: column; gap: 0.85em; padding: 0.9em 1.1em 1.6em; transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
|
||
.mx-columna { display: flex; flex-direction: column; gap: 0.85em; min-width: 0; }
|
||
|
||
/* ── Piezas ── */
|
||
.mx-ico { flex: none; width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
||
.mx-rotulo { display: block; font-size: 0.68em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mx-tinta-3); }
|
||
.mx-h1 { font-family: var(--mx-titulos); font-size: 1.5em; font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
|
||
.mx-h1-nota { color: var(--mx-tinta-3); font-weight: 400; }
|
||
.mx-h1-fila { display: flex; align-items: center; gap: 0.7em; }
|
||
.mx-h1-fila > :first-child { margin-right: auto; }
|
||
.mx-lema { margin-top: 0.2em; font-size: 0.88em; color: var(--mx-tinta-2); }
|
||
.mx-mono { font-family: var(--mx-datos); font-size: 0.86em; }
|
||
.mx-tarjeta, .mx-bloque { background: var(--mx-tarjeta); border: 1px solid var(--mx-linea); border-radius: 1.1em; padding: 0.85em 1em; }
|
||
.mx-bloque { display: flex; flex-direction: column; gap: 0.55em; }
|
||
.mx-bloque-cab { display: flex; align-items: baseline; gap: 0.5em; }
|
||
.mx-bloque-cab > b { font-size: 1.05em; }
|
||
.mx-bloque-cab > :nth-child(3) { margin-left: auto; align-self: center; }
|
||
.mx-cifra { font-size: 1.9em; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
|
||
.mx-cifra small { font-size: 0.42em; font-weight: 500; letter-spacing: 0; }
|
||
.mx-cifra.mx-grande { font-size: 2.5em; }
|
||
.mx-pie-nota { font-size: 0.8em; color: var(--mx-tinta-3); }
|
||
.mx-pie-nota.mx-rojo { color: var(--mx-rojo); font-weight: 600; }
|
||
.mx-sube { color: var(--mx-verde-tinta); font-weight: 600; }
|
||
.mx-enlace { font-size: 0.88em; font-weight: 700; color: var(--mx-acento); }
|
||
.mx-migas { font-size: 0.82em; font-weight: 600; color: var(--mx-tinta-3); }
|
||
.mx-flecha { margin-left: auto; font-size: 1.4em; color: var(--mx-tinta-3); line-height: 1; }
|
||
.mx-x { display: grid; place-items: center; width: 1.8em; height: 1.8em; border-radius: 50%; color: var(--mx-tinta-3); font-size: 1.1em; }
|
||
.mx-mas { display: grid; place-items: center; flex: none; width: 1.7em; height: 1.7em; border-radius: 0.55em; background: var(--mx-fondo); font-weight: 700; color: var(--mx-tinta-2); }
|
||
.mx-punto { display: inline-block; flex: none; width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--mx-verde); }
|
||
.mx-punto.mx-s0 { background: var(--mx-s0); }
|
||
.mx-punto.mx-s1 { background: var(--mx-s1); }
|
||
.mx-punto.mx-s2 { background: var(--mx-s2); }
|
||
.mx-hueco { color: var(--mx-tinta-3); font-weight: 400; }
|
||
.mx-leyenda { display: flex; gap: 0.9em; font-size: 0.8em; color: var(--mx-tinta-2); }
|
||
.mx-leyenda span { display: flex; align-items: center; gap: 0.35em; }
|
||
i.mx-leyenda { display: inline; font-style: italic; font-size: 0.86em; color: var(--mx-tinta-3); }
|
||
.mx-codigo { display: inline-block; padding: 0.15em 0.6em; border-radius: 99px; background: var(--mx-acento-tinte); color: var(--mx-acento); font-family: var(--mx-datos); font-size: 0.82em; font-weight: 700; }
|
||
|
||
.mx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; min-height: 2.7em; padding: 0 1em; border-radius: 0.8em; font-size: 0.92em; font-weight: 700; white-space: nowrap; }
|
||
.mx-btn.mx-ancho { display: flex; flex: 1; min-height: 3.2em; font-size: 1em; border-radius: 0.95em; }
|
||
.mx-btn.mx-primario { background: var(--mx-verde); color: var(--mx-noche); }
|
||
.mx-btn.mx-primario.mx-apagado { background: var(--mx-linea); color: var(--mx-tinta-2); }
|
||
.mx-btn.mx-oscuro { background: var(--mx-noche); color: #fff; }
|
||
.mx-btn.mx-azul { background: var(--mx-acento); color: #fff; }
|
||
.mx-btn.mx-llano { background: var(--mx-linea-2); color: var(--mx-tinta); }
|
||
.mx-btn.mx-suave { background: var(--mx-verde-tinte); color: var(--mx-verde-tinta); }
|
||
.mx-btn.mx-borde { background: var(--mx-tarjeta); border: 1.5px solid var(--mx-linea); }
|
||
|
||
.mx-avatar { display: inline-grid; place-items: center; flex: none; width: 2.4em; height: 2.4em; border-radius: 50%; background: var(--mx-acento-tinte); color: var(--mx-acento); font-size: 0.82em; font-weight: 700; }
|
||
.mx-avatar.mx-verde { background: var(--mx-verde-tinte); color: var(--mx-verde-tinta); }
|
||
.mx-avatar.mx-cuadro { border-radius: 0.75em; background: var(--mx-noche); color: #fff; }
|
||
.mx-avatar.mx-punteado { background: none; border: 1.5px dashed var(--mx-tinta-3); color: var(--mx-tinta-3); }
|
||
.mx-avatar.mx-grande { width: 3.2em; height: 3.2em; border-radius: 1em; background: var(--mx-noche); color: #fff; font-size: 1em; }
|
||
|
||
.mx-pildora { display: inline-block; padding: 0.2em 0.7em; border-radius: 99px; font-size: 0.78em; font-weight: 700; white-space: nowrap; }
|
||
.mx-pildora.mx-verde { background: var(--mx-verde-tinte); color: var(--mx-verde-tinta); }
|
||
.mx-pildora.mx-ambar { background: var(--mx-ambar-tinte); color: var(--mx-ambar-tinta); }
|
||
.mx-pildora.mx-azul, .mx-pildora.mx-suave { background: var(--mx-acento-tinte); color: var(--mx-acento); }
|
||
.mx-pildora.mx-gris { background: var(--mx-linea-2); color: var(--mx-tinta-2); }
|
||
|
||
.mx-segmento { display: inline-flex; padding: 0.2em; border-radius: 0.8em; background: var(--mx-linea-2); font-size: 0.86em; font-weight: 600; color: var(--mx-tinta-2); }
|
||
.mx-segmento span { padding: 0.35em 0.8em; border-radius: 0.6em; white-space: nowrap; }
|
||
.mx-segmento .mx-seg-on { background: var(--mx-tarjeta); color: var(--mx-tinta); box-shadow: 0 1px 2px rgba(7, 23, 42, 0.12); }
|
||
.mx-chips { display: flex; flex-wrap: wrap; gap: 0.4em; }
|
||
.mx-chip { display: inline-flex; align-items: center; gap: 0.4em; padding: 0.35em 0.8em; border-radius: 99px; border: 1.5px solid var(--mx-linea); background: var(--mx-tarjeta); font-size: 0.86em; font-weight: 600; color: var(--mx-tinta-2); white-space: nowrap; transition: background 0.25s, border-color 0.25s, color 0.25s; }
|
||
.mx-chip.mx-chip-on, .mx-chip.mx-on { border-color: var(--mx-noche); background: var(--mx-noche); color: #fff; }
|
||
.mx-chip.mx-chip-serie { border-color: var(--mx-tinta-2); color: var(--mx-tinta); }
|
||
.mx-conteo { padding: 0 0.45em; border-radius: 99px; background: color-mix(in srgb, currentColor 16%, transparent); font-size: 0.86em; }
|
||
.mx-buscador { display: flex; align-items: center; gap: 0.5em; flex: 1; min-height: 2.7em; padding: 0 0.9em; border-radius: 0.8em; background: var(--mx-tarjeta); border: 1.5px solid var(--mx-linea); color: var(--mx-tinta-3); font-size: 0.92em; white-space: nowrap; overflow: hidden; }
|
||
.mx-filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.7em 1.4em; }
|
||
.mx-filtro { display: flex; flex-direction: column; gap: 0.3em; }
|
||
.mx-campo { display: flex; flex-direction: column; gap: 0.3em; padding-bottom: 0.45em; border-bottom: 1.5px solid var(--mx-linea-2); min-width: 0; }
|
||
.mx-campo:has(.mx-chips) { border-bottom: 0; }
|
||
.mx-dos { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9em; }
|
||
.mx-caja-num { display: inline-block; min-width: 3.4em; padding: 0.25em 0.55em; border-radius: 0.55em; border: 1.5px solid var(--mx-linea); background: var(--mx-tarjeta); font-weight: 700; text-align: right; }
|
||
.mx-vacio { display: flex; flex-direction: column; align-items: center; gap: 0.3em; margin: auto; padding: 1.4em 1em; text-align: center; color: var(--mx-tinta-3); }
|
||
.mx-vacio .mx-ico { width: 2.2em; height: 2.2em; stroke-width: 1.4; }
|
||
.mx-vacio b { color: var(--mx-tinta); }
|
||
.mx-vacio p { max-width: 17em; font-size: 0.88em; }
|
||
.mx-aviso { display: flex; align-items: center; gap: 0.5em; padding: 0.8em 1em; border-radius: 0.9em; background: var(--mx-verde-tinte); color: var(--mx-verde-tinta); font-weight: 700; }
|
||
.mx-sello { display: grid; place-items: center; width: 3em; height: 3em; border-radius: 50%; background: var(--mx-verde-tinte); color: var(--mx-verde-tinta); }
|
||
.mx-sello .mx-ico { width: 1.6em; height: 1.6em; stroke-width: 2.4; }
|
||
.mx-retrato { display: grid; place-items: end center; overflow: hidden; border-radius: 1.2em; background: linear-gradient(160deg, var(--mx-cielo-tinte), var(--mx-cielo)); color: var(--mx-cielo-tinta); }
|
||
.mx-retrato .mx-ico { width: 78%; height: 78%; stroke-width: 1; fill: color-mix(in srgb, var(--mx-cielo-tinta) 22%, transparent); margin-bottom: -6%; }
|
||
.mx-retrato.mx-chico { width: 4.4em; height: 4.4em; border-radius: 1.1em; }
|
||
.mx-retrato.mx-sin-foto { place-items: center; place-content: center; gap: 0.4em; background: var(--mx-fondo); border: 1.5px dashed var(--mx-tinta-3); color: var(--mx-tinta-3); }
|
||
.mx-retrato.mx-sin-foto .mx-ico { width: 2.2em; height: 2.2em; margin: 0; fill: none; stroke-width: 1.5; }
|
||
|
||
/* ── Tablas: una retícula por tabla, compartida por encabezado y filas ── */
|
||
.mx-tabla { display: flex; flex-direction: column; }
|
||
.mx-fila { display: grid; grid-template-columns: var(--cols); align-items: center; gap: 0.7em; padding: 0.6em 0; border-top: 1px solid var(--mx-linea-2); }
|
||
.mx-fila > span { min-width: 0; }
|
||
.mx-fila > span:not(:first-child) { text-align: right; }
|
||
.mx-fila-cab { border-top: 0; padding: 0 0 0.45em; font-size: 0.68em; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--mx-tinta-3); }
|
||
.mx-fila > span:first-child:has(.mx-punto) { display: flex; align-items: center; gap: 0.45em; }
|
||
.mx-fila small { display: block; }
|
||
.mx-fila.mx-nueva { margin: 0 -0.6em; padding-left: 0.6em; padding-right: 0.6em; border-radius: 0.7em; background: var(--mx-verde-tinte); border-top-color: transparent; }
|
||
.mx-t-sucursales { --cols: 1.5fr 1fr 0.8fr 1.1fr 1fr; }
|
||
.mx-t-dos { --cols: 1.3fr 1fr; }
|
||
.mx-t-equipo { --cols: 2fr 0.8fr 1fr 0.7fr; }
|
||
.mx-t-equipo .mx-fila > span:nth-child(2) { text-align: left; }
|
||
.mx-t-gastos { --cols: 3.6em 1fr auto; }
|
||
.mx-t-gastos .mx-fila > span:nth-child(2) { text-align: left; }
|
||
.mx-t-entrada { --cols: 1.9fr 0.6fr 0.9fr 1fr 0.8fr; }
|
||
.mx-t-suc { --cols: 0.6fr 1.4fr 1.2fr 1.2fr; }
|
||
.mx-t-suc .mx-fila > span { text-align: left; }
|
||
.mx-t-hoja { --cols: 1.8fr 0.5fr 1fr 1fr; }
|
||
.mx-persona { display: flex; align-items: center; gap: 0.65em; min-width: 0; }
|
||
|
||
/* ── Barra superior de la aplicación ── */
|
||
.mx-barra { display: flex; align-items: center; gap: 0.9em; flex: none; height: 3.6em; padding: 0 1.1em; background: var(--mx-fondo); }
|
||
.mx-casa { display: grid; place-items: center; }
|
||
.mx-casa .mx-ico { width: 1.7em; height: 1.7em; }
|
||
.mx-tabs { display: flex; align-items: center; gap: 1.2em; flex: 1; min-width: 0; overflow: hidden; font-size: 0.92em; font-weight: 600; color: var(--mx-tinta-2); white-space: nowrap; }
|
||
.mx-tab { padding: 0.5em 0; border-bottom: 3px solid transparent; }
|
||
.mx-tab-on { color: var(--mx-tinta); border-bottom-color: var(--mx-verde); }
|
||
.mx-quien { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
|
||
.mx-quien small { font-size: 0.62em; font-weight: 700; letter-spacing: 0.08em; }
|
||
.mx-orden-chip { padding: 0.25em 0.7em; border-radius: 0.6em; background: var(--mx-verde-tinte); color: var(--mx-verde-tinta); font-family: var(--mx-datos); font-size: 0.86em; }
|
||
|
||
/* ── Tableros ── */
|
||
.mx-encabezado { display: flex; align-items: flex-start; gap: 1em; }
|
||
.mx-encabezado > :first-child { flex: 1; }
|
||
.mx-exportar { display: flex; gap: 0.5em; }
|
||
.mx-metricas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8em; }
|
||
.mx-metrica { display: flex; flex-direction: column; gap: 0.3em; }
|
||
.mx-metrica.mx-atencion { background: var(--mx-ambar-tinte); border-color: color-mix(in srgb, var(--mx-ambar-tinta) 35%, transparent); }
|
||
.mx-metrica.mx-atencion small, .mx-metrica.mx-atencion .mx-rotulo { color: var(--mx-ambar-tinta); }
|
||
.mx-grafica { display: grid; grid-template-columns: auto 1fr; gap: 0.3em 0.6em; font-size: 0.72em; color: var(--mx-tinta-3); }
|
||
.mx-eje-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; }
|
||
.mx-eje-x { display: flex; justify-content: space-between; }
|
||
.mx-grafica-lienzo { height: 11.5em; }
|
||
.mx-curvas { display: block; width: 100%; height: 100%; animation: mx-trazo 1.4s ease-out both; }
|
||
.mx-reticula { stroke: var(--mx-linea-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
|
||
.mx-curva { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
|
||
.mx-curva.mx-s0 { stroke: var(--mx-s0); }
|
||
.mx-curva.mx-s1 { stroke: var(--mx-s1); }
|
||
.mx-curva.mx-s2 { stroke: var(--mx-s2); }
|
||
.mx-inferior { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85em; }
|
||
.mx-vendido { display: flex; flex-direction: column; gap: 0.55em; }
|
||
.mx-vendido-fila { display: grid; grid-template-columns: 9.5em 1fr 4.6em; align-items: center; gap: 0.7em; font-size: 0.92em; }
|
||
.mx-vendido-fila b { text-align: right; }
|
||
.mx-riel { height: 0.7em; border-radius: 99px; background: var(--mx-linea-2); overflow: hidden; }
|
||
.mx-riel i { display: block; width: var(--v); height: 100%; border-radius: 99px; background: var(--mx-verde); }
|
||
.mx-alerta { display: grid; grid-template-columns: 1fr auto 2.4em; gap: 0.7em; padding: 0.4em 0; border-top: 1px solid var(--mx-linea-2); font-size: 0.92em; }
|
||
.mx-alerta span { color: var(--mx-tinta-3); }
|
||
.mx-cantidad { text-align: right; }
|
||
.mx-cantidad.mx-negativa { color: var(--mx-rojo); }
|
||
|
||
/* ── Personal y fichas ── */
|
||
.mx-resumenes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8em; }
|
||
.mx-resumen { display: flex; flex-direction: column; gap: 0.25em; }
|
||
.mx-resumen.mx-sel { border-color: var(--mx-noche); box-shadow: inset 0 0 0 1px var(--mx-noche); }
|
||
.mx-ficha { display: grid; grid-template-columns: 11em 1fr; gap: 1.4em; padding: 1.2em 1.4em; }
|
||
.mx-ficha .mx-retrato { aspect-ratio: 4 / 5; }
|
||
.mx-campos { display: flex; flex-direction: column; gap: 0.8em; min-width: 0; }
|
||
.mx-ficha-pie { display: flex; align-items: center; gap: 0.6em; }
|
||
.mx-cifras { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6em; }
|
||
.mx-cifrita { display: flex; flex-direction: column; gap: 0.2em; padding: 0.55em 0.8em; border-radius: 0.9em; }
|
||
.mx-mosaico { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8em; }
|
||
.mx-cliente { display: flex; align-items: center; gap: 0.8em; transition: border-color 0.2s; }
|
||
.mx-cliente > div:nth-child(2) { flex: 1; min-width: 0; }
|
||
.mx-cliente small { display: block; }
|
||
.mx-plegable { display: flex; align-items: baseline; gap: 0.6em; padding: 0.7em 1em; border-radius: 0.9em; background: var(--mx-tarjeta); border: 1px solid var(--mx-linea); }
|
||
.mx-visitas { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8em; align-items: start; }
|
||
.mx-visita { overflow: hidden; border: 1px solid var(--mx-linea); border-radius: 0.9em; background: var(--mx-tarjeta); }
|
||
.mx-visita-cab { display: flex; gap: 0.6em; padding: 0.5em 0.9em; background: var(--mx-linea-2); }
|
||
.mx-visita-cab span { color: var(--mx-tinta-3); }
|
||
.mx-formula { margin: 0.6em 0.9em 0.2em; padding: 0.45em 0.7em; border-radius: 0.6em; border: 1px solid var(--mx-linea); font-family: var(--mx-datos); font-size: 0.84em; }
|
||
.mx-formula small { display: block; font-family: var(--mx-texto); }
|
||
.mx-visita-fila { display: grid; grid-template-columns: 1fr auto 5.2em; gap: 0.6em; padding: 0.35em 0.9em; font-size: 0.92em; }
|
||
.mx-visita-fila:last-child { padding-bottom: 0.7em; }
|
||
.mx-visita-fila span { color: var(--mx-tinta-3); text-align: right; }
|
||
.mx-visita-fila span:last-child { color: var(--mx-tinta); font-weight: 600; }
|
||
|
||
/* ── Gastos: captura a pantalla completa ── */
|
||
.mx-captura { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; gap: 1em; padding: 1.2em 1.2em 1.1em; background: var(--mx-tarjeta); }
|
||
.mx-captura-cab { display: flex; align-items: flex-start; justify-content: space-between; }
|
||
.mx-captura-pie { display: flex; gap: 0.6em; margin-top: auto; }
|
||
.mx-captura-pie .mx-llano { min-height: 3.2em; }
|
||
.mx-interruptor { display: flex; align-items: center; gap: 0.8em; }
|
||
.mx-interruptor > i { flex: none; width: 2.6em; height: 1.5em; border-radius: 99px; background: var(--mx-linea); position: relative; }
|
||
.mx-interruptor > i::after { content: ''; position: absolute; top: 0.2em; left: 0.2em; width: 1.1em; height: 1.1em; border-radius: 50%; background: #fff; }
|
||
.mx-interruptor small { display: block; }
|
||
|
||
/* ── Inventario ── */
|
||
.mx-recibir { display: grid; grid-template-columns: 1fr 1.25fr; gap: 1em; align-items: start; }
|
||
.mx-escaneo { display: flex; align-items: center; gap: 0.7em; padding: 0.6em 0.6em 0.6em 1em; border-radius: 1em; border: 2px solid var(--mx-acento); background: var(--mx-tarjeta); color: var(--mx-tinta-3); font-size: 0.92em; }
|
||
.mx-escaneo > .mx-ico { color: var(--mx-acento); width: 1.7em; height: 1.7em; }
|
||
.mx-escaneo > span:not(.mx-btn-cam) { flex: 1; }
|
||
.mx-btn-cam { display: grid; place-items: center; flex: none; width: 2.9em; height: 2.9em; border-radius: 0.8em; background: var(--mx-acento-tinte); color: var(--mx-acento); }
|
||
.mx-ayuda { font-size: 0.84em; color: var(--mx-tinta-3); }
|
||
.mx-existencia { display: grid; grid-template-columns: 1fr auto 4.2em auto; align-items: center; gap: 0.6em; padding: 0.35em 0; border-top: 1px solid var(--mx-linea-2); font-size: 0.9em; }
|
||
.mx-existencia > span:nth-child(3) { color: var(--mx-tinta-3); text-align: right; }
|
||
.mx-queda { color: var(--mx-acento); font-size: 1.1em; }
|
||
.mx-visor { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: #0d1117; color: #fff; }
|
||
.mx-visor-guia { position: relative; display: grid; place-items: center; width: 78%; height: 9em; border-radius: 1em; background: #f4f5f7; box-shadow: 0 0 0 100em rgba(13, 17, 23, 0.72); }
|
||
.mx-visor-guia.mx-cuadrada { width: 15em; height: 15em; }
|
||
.mx-barcode { width: 82%; height: 62%; fill: #0d1117; }
|
||
.mx-visor .mx-qr { width: 84%; height: 84%; fill: #0d1117; }
|
||
.mx-visor-linea { position: absolute; left: 4%; right: 4%; height: 2px; background: var(--mx-verde); box-shadow: 0 0 10px var(--mx-verde); animation: mx-barrido 1.3s ease-in-out infinite alternate; }
|
||
.mx-visor-luz { position: absolute; left: 1.2em; bottom: 1.4em; display: inline-flex; align-items: center; gap: 0.4em; height: 3.2em; padding: 0 1.1em; border-radius: 99px; background: #fff; color: #0d1117; font-weight: 700; }
|
||
.mx-visor-texto { position: absolute; left: 0; right: 0; bottom: 5em; text-align: center; font-weight: 600; }
|
||
|
||
/* ── Checador ── */
|
||
.mx-chk-pant { justify-content: center; padding: 1.2em; background: radial-gradient(circle at 50% 30%, #ffffff, var(--mx-fondo) 55%, #e3e7ee); }
|
||
.mx-chk { display: flex; flex-direction: column; gap: 0.6em; }
|
||
.mx-chk-tarjeta { display: flex; flex-direction: column; gap: 0.9em; padding: 1.2em; border-radius: 1.6em; box-shadow: 0 12px 30px rgba(7, 23, 42, 0.08); }
|
||
.mx-chk-cab { display: flex; align-items: center; gap: 0.5em; padding-bottom: 0.8em; border-bottom: 1px solid var(--mx-linea-2); }
|
||
.mx-chk-cab small { margin-left: auto; }
|
||
.mx-chk-hola { font-family: var(--mx-titulos); font-size: 1.5em; font-weight: 600; }
|
||
.mx-chk-mov { display: flex; align-items: flex-end; justify-content: space-between; }
|
||
.mx-chk-grande { font-size: 2em; font-weight: 700; line-height: 1.1; }
|
||
.mx-chk-reloj { display: flex; flex-direction: column; align-items: flex-end; }
|
||
.mx-chk-reloj b { font-family: var(--mx-datos); font-size: 1.7em; color: var(--mx-verde-tinta); }
|
||
.mx-chk-tira { display: flex; align-items: center; justify-content: space-between; gap: 0.6em; padding: 0.8em 1em; border-radius: 1em; background: var(--mx-fondo); font-size: 0.88em; color: var(--mx-tinta-2); }
|
||
.mx-chk-tira b { font-size: 1.15em; color: var(--mx-tinta); }
|
||
.mx-chk-ok { border-top: 4px solid var(--mx-verde); }
|
||
.mx-chk-titulo { font-size: 1.35em; font-weight: 700; line-height: 1.2; }
|
||
.mx-chk-ok p { color: var(--mx-tinta-2); }
|
||
.mx-mi { display: flex; flex-direction: column; gap: 0.9em; }
|
||
.mx-mi-cab { display: flex; align-items: center; gap: 0.8em; }
|
||
.mx-mi-cab small { display: block; }
|
||
.mx-mi .mx-tarjeta { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6em; padding: 1.1em; border-radius: 1.4em; }
|
||
.mx-mis-ventas .mx-dos { align-self: stretch; }
|
||
.mx-casilla { display: flex; flex-direction: column; padding: 0.7em 0.9em; border-radius: 0.9em; background: var(--mx-fondo); }
|
||
.mx-casilla b { font-size: 1.2em; }
|
||
|
||
/* ── Kiosco ── */
|
||
.mx-kiosco { align-items: center; justify-content: center; background: var(--mx-acento); color: #fff; }
|
||
.mx-kiosco-centro { display: flex; flex-direction: column; align-items: center; gap: 1em; max-width: 24em; margin-right: 15em; text-align: center; }
|
||
.mx-kiosco-suc { font-family: var(--mx-titulos); font-size: 1.7em; font-weight: 600; }
|
||
.mx-kiosco-qr { padding: 1.3em; border-radius: 1.6em; background: #fff; }
|
||
.mx-kiosco .mx-qr { display: block; width: 15em; height: 15em; fill: var(--mx-noche); }
|
||
.mx-kiosco-centro small { color: rgba(255, 255, 255, 0.86); }
|
||
.mx-kiosco-centro b { color: var(--mx-cielo); }
|
||
.mx-telefono { position: absolute; right: 4.6em; top: 50%; width: 372px; margin-top: -260px; height: 520px; display: flex; flex-direction: column; justify-content: center; padding: 14px; border-radius: 34px; border: 6px solid var(--mx-noche); background: var(--mx-fondo); color: var(--mx-tinta); font-size: 14.5px; box-shadow: 0 30px 60px rgba(7, 23, 42, 0.45); }
|
||
.mx-telefono .mx-chk-tarjeta { padding: 1.1em; }
|
||
.mx-chk-cab b, .mx-chk-tira b, .mx-chk-mov .mx-rotulo { white-space: nowrap; }
|
||
|
||
/* ── Menú principal ── */
|
||
.mx-menu { gap: 1em; padding: 1.4em 3.4em 1.1em; background: radial-gradient(circle at 50% 20%, #ffffff, var(--mx-fondo) 60%, #e6eaf0); }
|
||
.mx-menu-cab { display: flex; flex-direction: column; align-items: center; gap: 0.5em; }
|
||
.mx-menu-cab .mx-ico { width: 2em; height: 2em; }
|
||
.mx-menu-cab i { width: 3.4em; height: 4px; border-radius: 2px; background: var(--mx-linea); }
|
||
.mx-menu-fila { display: flex; gap: 1em; flex: 1; min-height: 0; }
|
||
.mx-menu-fila2 { padding: 0 16.6%; }
|
||
.mx-acceso { display: flex; flex-direction: column; justify-content: space-between; flex: 1; padding: 1.1em 1.3em; border-radius: 1.5em; border: 1.5px solid rgba(255, 255, 255, 0.85); background: linear-gradient(150deg, rgba(255, 255, 255, 0.75), transparent 55%), color-mix(in srgb, var(--tono) 14%, #fff); color: var(--tono); box-shadow: 0 8px 24px rgba(7, 23, 42, 0.06); transition: flex-grow 0.3s; }
|
||
.mx-acceso b { font-family: var(--mx-titulos); font-size: 1.5em; font-weight: 600; }
|
||
.mx-acceso .mx-ico { align-self: flex-end; width: 5.6em; height: 5.6em; stroke-width: 1.1; }
|
||
.mx-acceso.mx-pulsado { flex-grow: 1.18; filter: none; }
|
||
.mx-acceso.mx-verde { --tono: var(--mx-verde-tinta); }
|
||
.mx-acceso.mx-azul { --tono: var(--mx-acento); }
|
||
.mx-acceso.mx-tinta { --tono: var(--mx-noche); }
|
||
.mx-acceso.mx-cielo { --tono: var(--mx-cielo-tinta); }
|
||
.mx-acceso.mx-ambar { --tono: #8a5a00; }
|
||
.mx-menu-pie { display: flex; justify-content: space-between; font-size: 0.8em; color: var(--mx-tinta-3); }
|
||
|
||
/* ── Caja: venta, cobro y comprobante ── */
|
||
.mx-caja-cuerpo { display: flex; flex: 1; min-height: 0; }
|
||
.mx-ticket, .mx-cobro-panel { display: flex; flex-direction: column; flex: none; width: 22em; background: var(--mx-tarjeta); border-radius: 0 1.2em 0 0; box-shadow: 14px 0 34px rgba(7, 23, 42, 0.06); }
|
||
.mx-lineas { display: flex; flex-direction: column; flex: 1; padding: 0.4em 1em; }
|
||
.mx-ticket > .mx-vacio { flex: 100; justify-content: center; }
|
||
.mx-linea { display: flex; align-items: center; gap: 0.7em; padding: 0.65em 0; border-bottom: 1px solid var(--mx-linea-2); }
|
||
.mx-linea-txt { flex: 1; min-width: 0; }
|
||
.mx-linea-txt small { display: block; }
|
||
.mx-cant { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.2em 0.5em; border-radius: 99px; background: var(--mx-linea-2); font-size: 0.86em; }
|
||
.mx-cant .mx-suma { color: var(--mx-verde-tinta); font-weight: 700; }
|
||
.mx-totales { display: flex; flex-direction: column; gap: 0.25em; padding: 0.7em 1.1em; font-size: 0.86em; color: var(--mx-tinta-2); }
|
||
.mx-totales > div { display: flex; justify-content: space-between; }
|
||
.mx-totales .mx-total { align-items: baseline; margin-top: 0.3em; padding-top: 0.4em; border-top: 1px solid var(--mx-linea); color: var(--mx-tinta); font-weight: 700; }
|
||
.mx-totales .mx-total b { font-size: 1.9em; letter-spacing: -0.02em; }
|
||
.mx-ticket-pie { display: flex; flex-direction: column; gap: 0.6em; padding: 0 1em 1em; }
|
||
.mx-llanos { display: flex; gap: 0.5em; }
|
||
.mx-llanos .mx-btn { flex: 1; }
|
||
.mx-catalogo { display: flex; flex-direction: column; gap: 0.8em; flex: 1; min-width: 0; padding: 0.4em 1.4em 1em; }
|
||
.mx-cat-ctrl { display: flex; align-items: center; gap: 0.6em; }
|
||
.mx-productos { display: flex; flex-direction: column; gap: 0.5em; }
|
||
.mx-producto { display: flex; align-items: center; gap: 0.8em; min-height: 3.5em; padding: 0.4em 0.7em 0.4em 1em; border-radius: 0.9em; border: 1.5px solid var(--mx-linea); background: var(--mx-tarjeta); transition: border-color 0.25s, background 0.25s; }
|
||
.mx-producto.mx-on { border-color: var(--mx-verde); background: #f6fdf9; }
|
||
.mx-producto-txt { flex: 1; min-width: 0; }
|
||
.mx-producto-txt small { display: flex; align-items: center; gap: 0.5em; }
|
||
.mx-tipo { padding: 0.1em 0.55em; border-radius: 99px; font-size: 0.82em; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
|
||
.mx-tipo.mx-tipo-s { background: var(--mx-acento-tinte); color: var(--mx-acento); }
|
||
.mx-tipo.mx-tipo-p { background: var(--mx-cielo-tinte); color: var(--mx-cielo-tinta); }
|
||
.mx-badge { display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--mx-verde); color: var(--mx-noche); font-size: 0.82em; font-weight: 700; }
|
||
.mx-precio { min-width: 5.4em; text-align: right; font-size: 1.1em; }
|
||
|
||
.mx-cobro-cab { display: flex; align-items: flex-start; justify-content: space-between; padding: 0.7em 1.1em 0.3em; }
|
||
.mx-cobro-panel .mx-rollo { gap: 0.5em; padding: 0.3em 1.1em 1em; }
|
||
.mx-paso { display: flex; align-items: center; gap: 0.5em; margin-top: 0.35em; font-size: 0.92em; }
|
||
.mx-paso i { display: grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--mx-noche); color: #fff; font-size: 0.78em; font-weight: 700; }
|
||
.mx-quien-tarjeta { display: flex; align-items: center; gap: 0.7em; min-height: 3em; padding: 0.35em 0.8em; border-radius: 0.85em; background: var(--mx-fondo); }
|
||
.mx-propinas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5em; }
|
||
.mx-propina { display: flex; flex-direction: column; align-items: center; padding: 0.35em; border-radius: 0.8em; border: 1.5px solid var(--mx-linea); transition: background 0.25s, border-color 0.25s; }
|
||
.mx-propina.mx-on { border-color: var(--mx-verde); background: var(--mx-verde-tinte); }
|
||
.mx-propina-fila { display: flex; align-items: center; gap: 0.6em; }
|
||
.mx-propina-fila .mx-caja-num { margin-left: auto; border-color: var(--mx-verde); }
|
||
.mx-propina-total { display: flex; justify-content: space-between; padding: 0.5em 0.8em; border-radius: 0.7em; background: var(--mx-verde-tinte); color: var(--mx-verde-tinta); font-size: 0.92em; }
|
||
.mx-metodos { display: flex; flex-direction: column; gap: 0.45em; }
|
||
.mx-metodo { display: flex; align-items: center; gap: 0.7em; padding: 0.45em 0.7em; border-radius: 0.85em; border: 1.5px solid var(--mx-linea); font-size: 0.92em; transition: background 0.25s, border-color 0.25s; }
|
||
.mx-metodo > div { flex: 1; }
|
||
.mx-metodo small { display: block; }
|
||
.mx-metodo small.mx-ok { color: var(--mx-verde-tinta); font-weight: 700; }
|
||
.mx-metodo.mx-on { border-color: var(--mx-verde); background: #f6fdf9; }
|
||
.mx-cobro-pie { display: flex; gap: 0.6em; padding: 0.7em 1.1em 0.9em; border-top: 1px solid var(--mx-linea-2); }
|
||
.mx-cobro-pie .mx-btn { min-width: 0; min-height: 3.4em; padding: 0 0.8em; font-size: 0.88em; }
|
||
.mx-cobro-lienzo { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5em; flex: 1; padding: 1em 2em; }
|
||
.mx-cobro-folio { position: absolute; top: 0.6em; left: 1.6em; font-size: 0.84em; color: var(--mx-tinta-3); }
|
||
.mx-gran-total { display: flex; align-items: baseline; line-height: 1; }
|
||
.mx-gran-total b { font-size: 4.6em; font-weight: 700; letter-spacing: -0.03em; }
|
||
.mx-gran-total i { font-size: 1.9em; color: var(--mx-tinta-3); }
|
||
.mx-incluye { color: var(--mx-verde-tinta); font-weight: 600; }
|
||
.mx-sin-pagos { width: 28em; margin-top: 1em; padding: 1.1em 1.3em; border-radius: 1em; border: 1.5px dashed var(--mx-tinta-3); text-align: center; }
|
||
.mx-sin-pagos p { margin-top: 0.3em; font-size: 0.88em; color: var(--mx-tinta-3); }
|
||
.mx-pago, .mx-estado-pago { display: flex; align-items: center; gap: 0.8em; width: 28em; padding: 0.7em 1em; border-radius: 1em; background: var(--mx-tarjeta); border: 1.5px solid var(--mx-linea); }
|
||
.mx-pago { margin-top: 1em; }
|
||
.mx-pago > i { display: grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 0.5em; background: var(--mx-linea-2); font-weight: 700; }
|
||
.mx-pago > div { flex: 1; }
|
||
.mx-pago small { display: block; }
|
||
.mx-monto { font-size: 1.2em; }
|
||
.mx-estado-pago { justify-content: space-between; background: var(--mx-verde-tinte); border-color: transparent; }
|
||
.mx-estado-pago .mx-rotulo, .mx-estado-pago b { color: var(--mx-verde-tinta); }
|
||
.mx-estado-pago b { font-size: 1.3em; }
|
||
.mx-velo { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(7, 23, 42, 0.42); }
|
||
.mx-modal { display: flex; flex-direction: column; gap: 0.6em; width: 30em; padding: 1.3em 1.4em; border-radius: 1.5em; background: var(--mx-tarjeta); box-shadow: 0 28px 70px rgba(7, 23, 42, 0.38); }
|
||
.mx-modal-busca { display: flex; gap: 0.6em; }
|
||
.mx-cli-fila { display: flex; align-items: center; gap: 0.8em; padding: 0.55em 0.8em; border-radius: 0.9em; border: 1.5px solid var(--mx-linea); transition: background 0.25s, border-color 0.25s; }
|
||
.mx-cli-fila > div { flex: 1; }
|
||
.mx-cli-fila small { display: block; }
|
||
.mx-check { display: grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; border: 1.5px solid var(--mx-linea); color: transparent; }
|
||
.mx-check .mx-ico { width: 1em; height: 1em; stroke-width: 2.6; }
|
||
.mx-cli-fila.mx-on { border-color: var(--mx-verde); background: #f6fdf9; }
|
||
.mx-cli-fila.mx-on .mx-check { border-color: var(--mx-verde); background: var(--mx-verde); color: var(--mx-noche); }
|
||
.mx-modal-pie { display: flex; align-items: center; justify-content: space-between; margin-top: 0.3em; color: var(--mx-tinta-2); }
|
||
|
||
.mx-hecho { display: grid; grid-template-columns: 1fr 1fr; flex: 1; min-height: 0; }
|
||
.mx-hecho-izq { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.55em; padding: 1em 3em; }
|
||
.mx-hecho-izq .mx-btn { align-self: stretch; }
|
||
.mx-hecho-izq .mx-ancho { flex: none; margin-top: 0.4em; }
|
||
.mx-hecho-izq .mx-borde { margin-top: 0.6em; }
|
||
.mx-hecho-total { font-size: 3.2em; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
|
||
.mx-hecho-der { display: grid; place-items: start center; overflow: hidden; padding: 1.4em 1.4em 0; background: #e8ebf0; }
|
||
.mx-preparando { place-self: center; text-align: center; color: var(--mx-tinta-3); }
|
||
.mx-preparando b { color: var(--mx-tinta); }
|
||
.mx-hoja { display: flex; flex-direction: column; gap: 0.9em; width: 100%; min-height: 110%; padding: 1.6em 1.7em; background: #fff; box-shadow: 0 10px 34px rgba(7, 23, 42, 0.16); font-size: 0.84em; }
|
||
.mx-hoja-cab { display: flex; justify-content: space-between; gap: 1em; padding-bottom: 0.9em; border-bottom: 1.5px solid var(--mx-linea); }
|
||
.mx-hoja-cab > div { display: flex; flex-direction: column; gap: 0.15em; }
|
||
.mx-hoja-datos { align-items: flex-end; text-align: right; }
|
||
.mx-hoja-suc { font-family: var(--mx-titulos); font-size: 1.5em; font-weight: 600; }
|
||
.mx-hoja-folio { padding: 0.15em 0.5em; border-radius: 0.4em; background: var(--mx-verde-tinte); color: var(--mx-verde-tinta); font-weight: 700; }
|
||
.mx-hoja-totales { display: flex; flex-direction: column; gap: 0.25em; width: 62%; margin-left: auto; }
|
||
.mx-hoja-totales > div { display: flex; justify-content: space-between; }
|
||
.mx-hoja-totales .mx-total { margin-top: 0.2em; padding-top: 0.35em; border-top: 2px solid var(--mx-tinta); font-size: 1.15em; font-weight: 700; }
|
||
.mx-hoja-pago { color: var(--mx-tinta-2); }
|
||
|
||
/* ── Sucursales ── */
|
||
.mx-recursos { display: flex; flex-direction: column; gap: 0.5em; }
|
||
.mx-recursos > .mx-rotulo { color: var(--mx-verde-tinta); }
|
||
.mx-recursos > p { font-size: 0.88em; color: var(--mx-tinta-2); }
|
||
.mx-pares { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6em 1em; }
|
||
.mx-pares > div { display: grid; grid-template-columns: auto 1fr; column-gap: 0.45em; align-items: center; }
|
||
.mx-pares .mx-ico { grid-row: span 2; color: var(--mx-verde-tinta); stroke-width: 2.4; }
|
||
.mx-pares b { font-size: 0.9em; }
|
||
|
||
/* ── Pie de la demostración: leyenda del paso y controles ── */
|
||
.mx-pie { position: relative; z-index: 10; flex: none; display: grid; gap: 0.3em 1.2em; padding: 0.85em 1.4em 0.9em; background: var(--mx-noche); color: #fff; }
|
||
.mx-progreso { display: flex; gap: 4px; }
|
||
.mx-seg { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.24); overflow: hidden; }
|
||
.mx-seg i { display: block; width: 0; height: 100%; background: var(--mx-verde); }
|
||
.mx-seg.mx-hecho i { width: 100%; }
|
||
.mx-seg.mx-activo i { animation: mx-llenar linear both; }
|
||
.mx-leyenda-paso { min-width: 0; }
|
||
.mx-paso-titulo { display: flex; align-items: baseline; gap: 0.6em; font-family: var(--mx-titulos); font-size: 1.25em; font-weight: 600; line-height: 1.2; }
|
||
.mx-paso-titulo span { font-family: var(--mx-datos); font-size: 0.62em; font-weight: 500; color: var(--mx-verde); }
|
||
.mx-paso-texto { font-size: 0.95em; color: rgba(255, 255, 255, 0.84); }
|
||
.mx-controles { display: flex; align-items: center; gap: 0.45em; }
|
||
.mx-ctrl { min-width: 2.75em; min-height: 2.75em; padding: 0 0.9em; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 0.5em; background: transparent; color: #fff; font: inherit; font-size: 0.86em; font-weight: 600; cursor: pointer; }
|
||
.mx-ctrl:hover { border-color: var(--mx-verde); color: var(--mx-verde); }
|
||
.mx-ctrl:focus-visible { outline: 2px solid var(--mx-cielo); outline-offset: 2px; }
|
||
.mx-nota { font-family: var(--mx-datos); font-size: 0.66em; color: rgba(255, 255, 255, 0.72); }
|
||
&.mx-pausado .mx-seg.mx-activo i, &.mx-pausado .mx-visor-linea { animation-play-state: paused; }
|
||
|
||
/* ── Variante de escritorio ── */
|
||
&.matrix-demo--escritorio {
|
||
.mx-rollo { padding: 0.7em 1.6em 1.6em; }
|
||
.mx-barra { padding: 0 1.6em; }
|
||
.mx-t-equipo .mx-fila:not(.mx-fila-cab) { padding: 0.2em 0; }
|
||
.mx-resumen { padding: 0.65em 1em; }
|
||
.mx-pie { grid-template-columns: 1fr auto; align-items: center; }
|
||
.mx-progreso { grid-column: 1 / -1; margin-bottom: 0.25em; }
|
||
.mx-controles { flex-wrap: wrap; justify-content: flex-end; max-width: 19em; }
|
||
.mx-nota { flex-basis: 100%; text-align: right; }
|
||
.mx-paso-texto { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||
}
|
||
|
||
/* ── Variante móvil ── */
|
||
&.matrix-demo--movil {
|
||
.mx-barra { gap: 0.8em; height: 3.7em; }
|
||
.mx-tabs { gap: 1em; }
|
||
.mx-metricas, .mx-inferior, .mx-resumenes, .mx-recibir, .mx-visitas { grid-template-columns: 1fr; }
|
||
.mx-metricas { gap: 0.6em; }
|
||
.mx-metrica { padding: 0.7em 1em; gap: 0.15em; }
|
||
.mx-grafica-lienzo { height: 10em; }
|
||
.mx-t-sucursales { --cols: 1.2fr 1fr 0.6fr; }
|
||
.mx-t-equipo { --cols: 1fr 6.4em 3.6em; }
|
||
.mx-t-equipo .mx-fila > span:nth-child(2) { text-align: right; }
|
||
.mx-t-entrada { --cols: 1.5fr auto auto; }
|
||
.mx-vendido-fila { grid-template-columns: 9.6em 1fr 4.4em; }
|
||
.mx-bloque-cab { flex-wrap: wrap; }
|
||
.mx-bloque-cab > .mx-leyenda { flex-basis: 100%; margin-left: 0; }
|
||
.mx-ctrl { padding: 0 0.7em; }
|
||
.mx-cifras { display: flex; overflow: hidden; margin-right: -1.1em; }
|
||
.mx-cifrita { flex: none; }
|
||
.mx-ficha { grid-template-columns: 1fr; gap: 1em; padding: 1em; }
|
||
.mx-ficha .mx-retrato { aspect-ratio: auto; height: 11em; }
|
||
.mx-ficha .mx-retrato .mx-ico { width: auto; height: 92%; }
|
||
.mx-chk-pant { padding: 1.1em; }
|
||
.mx-pie { padding: 0.75em 1em 0.85em; gap: 0.45em; }
|
||
.mx-paso-texto { min-height: 2.6em; }
|
||
.mx-nota { margin-left: auto; max-width: 10.5em; text-align: right; line-height: 1.25; }
|
||
}
|
||
}
|
||
|
||
@keyframes mx-entra { from { opacity: 0; transform: translateY(8px); } }
|
||
@keyframes mx-aparece { from { opacity: 0; } }
|
||
@keyframes mx-toque { from { opacity: 0.9; transform: scale(0.35); } to { opacity: 0; transform: scale(1.25); } }
|
||
@keyframes mx-llenar { from { width: 0; } to { width: 100%; } }
|
||
@keyframes mx-trazo { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
|
||
@keyframes mx-barrido { from { top: 12%; } to { top: 86%; } }
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.matrix-demo *, .matrix-demo *::before, .matrix-demo *::after { animation: none !important; transition: none !important; }
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="vista-previa">
|
||
<div class="matrix-demo matrix-demo--movil" data-matrix-demo role="group" aria-label="Demostración de Collina Matrix en teléfono, con datos ficticios">
|
||
<script type="application/json" data-guion>
|
||
{
|
||
"variante": "movil",
|
||
"datos": {
|
||
"producto": "Collina Matrix",
|
||
"fecha": "jueves 12 de marzo",
|
||
"fechaCorta": "12 mar",
|
||
"dias": [
|
||
"Lun",
|
||
"Mar",
|
||
"Mié",
|
||
"Jue",
|
||
"Vie",
|
||
"Sáb",
|
||
"Dom"
|
||
],
|
||
"sucursales": [
|
||
{
|
||
"codigo": "S01",
|
||
"nombre": "Norte",
|
||
"ventas": 48200,
|
||
"tickets": 96,
|
||
"ticketsHoy": 14,
|
||
"personal": 6,
|
||
"horas": 149,
|
||
"dias": [
|
||
5200,
|
||
6100,
|
||
5800,
|
||
6900,
|
||
7400,
|
||
9600,
|
||
7200
|
||
]
|
||
},
|
||
{
|
||
"codigo": "S02",
|
||
"nombre": "Sur",
|
||
"ventas": 39650,
|
||
"tickets": 81,
|
||
"ticketsHoy": 10,
|
||
"personal": 5,
|
||
"horas": 131.5,
|
||
"dias": [
|
||
4300,
|
||
4900,
|
||
5100,
|
||
5600,
|
||
6200,
|
||
7800,
|
||
5750
|
||
]
|
||
},
|
||
{
|
||
"codigo": "S03",
|
||
"nombre": "Oriente",
|
||
"ventas": 27900,
|
||
"tickets": 58,
|
||
"ticketsHoy": 7,
|
||
"personal": 4,
|
||
"horas": 98,
|
||
"dias": [
|
||
3100,
|
||
3400,
|
||
3600,
|
||
3900,
|
||
4300,
|
||
5600,
|
||
4000
|
||
]
|
||
}
|
||
],
|
||
"sucursalNueva": {
|
||
"codigo": "S04",
|
||
"nombre": "Sucursal Poniente",
|
||
"almacen": "Almacén S04",
|
||
"caja": "Caja Poniente"
|
||
},
|
||
"tablero": {
|
||
"variacion": 8,
|
||
"variacionGerente": 6,
|
||
"sinChecar": 1,
|
||
"gasto": {
|
||
"operacion": 18900,
|
||
"mercancia": 22400
|
||
},
|
||
"vendido": [
|
||
{
|
||
"nombre": "Tinte completo",
|
||
"monto": 31020
|
||
},
|
||
{
|
||
"nombre": "Corte de dama",
|
||
"monto": 26600
|
||
},
|
||
{
|
||
"nombre": "Tratamiento capilar",
|
||
"monto": 18000
|
||
},
|
||
{
|
||
"nombre": "Manicure spa",
|
||
"monto": 9800
|
||
}
|
||
],
|
||
"alertas": [
|
||
{
|
||
"producto": "Tinte profesional 60 ml",
|
||
"sucursal": "Sur",
|
||
"cantidad": -2
|
||
},
|
||
{
|
||
"producto": "Shampoo reparador 500 ml",
|
||
"sucursal": "Norte",
|
||
"cantidad": 1
|
||
},
|
||
{
|
||
"producto": "Mascarilla nutritiva 250 ml",
|
||
"sucursal": "Oriente",
|
||
"cantidad": 2
|
||
}
|
||
]
|
||
},
|
||
"personal": [
|
||
{
|
||
"nombre": "Renata Solís",
|
||
"puesto": "Estilista senior",
|
||
"celular": "55 5550 0101",
|
||
"hoy": "Trabajando",
|
||
"tono": "verde",
|
||
"horas": 32.5,
|
||
"ventas": 16400
|
||
},
|
||
{
|
||
"nombre": "Emilio Paz",
|
||
"puesto": "Barbero",
|
||
"celular": "55 5550 0102",
|
||
"hoy": "Trabajando",
|
||
"tono": "verde",
|
||
"horas": 30,
|
||
"ventas": 13900
|
||
},
|
||
{
|
||
"nombre": "Irene Lara",
|
||
"puesto": "Manicurista",
|
||
"celular": "55 5550 0103",
|
||
"hoy": "Trabajando",
|
||
"tono": "verde",
|
||
"horas": 28.5,
|
||
"ventas": 9700
|
||
},
|
||
{
|
||
"nombre": "Tomás Vera",
|
||
"puesto": "Estilista",
|
||
"celular": "55 5550 0104",
|
||
"hoy": "Sin entrada",
|
||
"tono": "ambar",
|
||
"horas": 24,
|
||
"ventas": 8200
|
||
},
|
||
{
|
||
"nombre": "Óscar Meza",
|
||
"puesto": "Gerente",
|
||
"celular": "55 5550 0105",
|
||
"hoy": "Trabajando",
|
||
"tono": "verde",
|
||
"horas": 34,
|
||
"ventas": 0,
|
||
"rol": "Administrador de sucursal"
|
||
},
|
||
{
|
||
"nombre": "Noemí Cruz",
|
||
"puesto": "Recepcionista",
|
||
"celular": "55 5550 0106",
|
||
"hoy": "Vacaciones",
|
||
"tono": "ambar",
|
||
"horas": 0,
|
||
"ventas": 0
|
||
}
|
||
],
|
||
"alta": {
|
||
"nombre": "Lucía Ferrer",
|
||
"celular": "55 5550 0142",
|
||
"puesto": "Estilista",
|
||
"ingreso": "12 mar 2026"
|
||
},
|
||
"catalogo": [
|
||
{
|
||
"nombre": "Corte de dama",
|
||
"tipo": "Servicio",
|
||
"precio": 380
|
||
},
|
||
{
|
||
"nombre": "Tinte completo",
|
||
"tipo": "Servicio",
|
||
"precio": 940
|
||
},
|
||
{
|
||
"nombre": "Manicure spa",
|
||
"tipo": "Servicio",
|
||
"precio": 280
|
||
},
|
||
{
|
||
"nombre": "Tratamiento capilar",
|
||
"tipo": "Servicio",
|
||
"precio": 1200
|
||
},
|
||
{
|
||
"nombre": "Shampoo reparador 500 ml",
|
||
"tipo": "Producto",
|
||
"precio": 280
|
||
},
|
||
{
|
||
"nombre": "Tinte profesional 60 ml",
|
||
"tipo": "Producto",
|
||
"precio": 190
|
||
}
|
||
],
|
||
"venta": {
|
||
"orden": "0012",
|
||
"folio": "NT1-268-000412",
|
||
"hora": "11:27",
|
||
"renglones": [
|
||
0,
|
||
1,
|
||
4
|
||
],
|
||
"propinaPct": 10,
|
||
"metodo": "Tarjeta",
|
||
"atendio": "Renata Solís"
|
||
},
|
||
"clientes": [
|
||
{
|
||
"nombre": "Valeria Montes",
|
||
"telefono": "55 5550 0118",
|
||
"visitas": 12
|
||
},
|
||
{
|
||
"nombre": "Julián Arce",
|
||
"telefono": "55 5550 0121",
|
||
"visitas": 5
|
||
},
|
||
{
|
||
"nombre": "Camila Duarte",
|
||
"telefono": "55 5550 0127",
|
||
"visitas": 9
|
||
},
|
||
{
|
||
"nombre": "Bruno Salas",
|
||
"telefono": "55 5550 0130",
|
||
"visitas": 3
|
||
},
|
||
{
|
||
"nombre": "Elena Prado",
|
||
"telefono": "55 5550 0133",
|
||
"visitas": 7
|
||
},
|
||
{
|
||
"nombre": "Mateo Rivas",
|
||
"telefono": "55 5550 0139",
|
||
"visitas": 2
|
||
}
|
||
],
|
||
"cliente": {
|
||
"gasto": 14860,
|
||
"ultima": "12 mar",
|
||
"habitual": "Norte",
|
||
"historico": [
|
||
{
|
||
"fecha": "12 mar",
|
||
"sucursal": "Norte",
|
||
"formula": "7.1 + 20 vol, 30 min",
|
||
"por": "Renata",
|
||
"renglones": [
|
||
[
|
||
"Corte de dama",
|
||
380
|
||
],
|
||
[
|
||
"Tinte completo",
|
||
940
|
||
],
|
||
[
|
||
"Shampoo reparador 500 ml",
|
||
280
|
||
]
|
||
]
|
||
},
|
||
{
|
||
"fecha": "14 feb",
|
||
"sucursal": "Norte",
|
||
"formula": "",
|
||
"por": "Irene",
|
||
"renglones": [
|
||
[
|
||
"Tratamiento capilar",
|
||
1200
|
||
],
|
||
[
|
||
"Manicure spa",
|
||
280
|
||
]
|
||
]
|
||
}
|
||
]
|
||
},
|
||
"gastos": {
|
||
"lista": [
|
||
{
|
||
"fecha": "11 mar",
|
||
"concepto": "Renta del local",
|
||
"categoria": "Renta",
|
||
"monto": 12000
|
||
},
|
||
{
|
||
"fecha": "9 mar",
|
||
"concepto": "Recibo de luz",
|
||
"categoria": "Servicios",
|
||
"monto": 2300
|
||
},
|
||
{
|
||
"fecha": "6 mar",
|
||
"concepto": "Volantes",
|
||
"categoria": "Publicidad",
|
||
"monto": 900
|
||
},
|
||
{
|
||
"fecha": "3 mar",
|
||
"concepto": "Artículos de limpieza",
|
||
"categoria": "Insumos",
|
||
"monto": 700
|
||
}
|
||
],
|
||
"nuevo": {
|
||
"fecha": "12 mar",
|
||
"concepto": "Reparación del clima",
|
||
"categoria": "Mantenimiento",
|
||
"monto": 1850
|
||
}
|
||
},
|
||
"entrada": [
|
||
{
|
||
"nombre": "Shampoo reparador 500 ml",
|
||
"codigo": "0000 0001 2345",
|
||
"tenia": 1,
|
||
"llegaron": 12,
|
||
"costo": 95
|
||
},
|
||
{
|
||
"nombre": "Tinte profesional 60 ml",
|
||
"codigo": "0000 0006 7890",
|
||
"tenia": -2,
|
||
"llegaron": 24,
|
||
"costo": 48
|
||
}
|
||
],
|
||
"checada": {
|
||
"hora": "09:02",
|
||
"empleado": "Renata Solís",
|
||
"propinas": 1480,
|
||
"servicios": 41
|
||
},
|
||
"existencias": [
|
||
{
|
||
"nombre": "Shampoo reparador 500 ml",
|
||
"uso": "De venta",
|
||
"tiene": 1
|
||
},
|
||
{
|
||
"nombre": "Tinte profesional 60 ml",
|
||
"uso": "De insumo",
|
||
"tiene": -2
|
||
},
|
||
{
|
||
"nombre": "Mascarilla nutritiva 250 ml",
|
||
"uso": "De venta",
|
||
"tiene": 2
|
||
},
|
||
{
|
||
"nombre": "Acondicionador 500 ml",
|
||
"uso": "De venta",
|
||
"tiene": 6
|
||
}
|
||
]
|
||
},
|
||
"pasos": [
|
||
{
|
||
"pantalla": "tableroDirector",
|
||
"titulo": "Tablero del director",
|
||
"texto": "Ventas, gasto e inventario de todas las sucursales en una sola vista.",
|
||
"dura": 11000,
|
||
"eventos": [
|
||
[
|
||
3400,
|
||
"baja",
|
||
"grafica"
|
||
],
|
||
[
|
||
7200,
|
||
"baja",
|
||
"sucursales"
|
||
]
|
||
]
|
||
},
|
||
{
|
||
"pantalla": "tableroGerente",
|
||
"titulo": "Tablero del gerente",
|
||
"texto": "Cada gerente ve solo su sucursal: ventas, equipo y quién falta por checar.",
|
||
"dura": 9500,
|
||
"eventos": [
|
||
[
|
||
3600,
|
||
"baja",
|
||
"grafica"
|
||
],
|
||
[
|
||
6400,
|
||
"baja",
|
||
"equipo"
|
||
]
|
||
]
|
||
},
|
||
{
|
||
"pantalla": "personal",
|
||
"titulo": "Personal",
|
||
"texto": "Quién está trabajando ahora y cuántas horas lleva en la semana.",
|
||
"dura": 7500,
|
||
"eventos": [
|
||
[
|
||
3400,
|
||
"baja",
|
||
"equipo"
|
||
]
|
||
]
|
||
},
|
||
{
|
||
"pantalla": "gastos",
|
||
"titulo": "Gastos",
|
||
"texto": "Un gasto se captura desde el teléfono y queda en la lista de la sucursal.",
|
||
"dura": 10500,
|
||
"eventos": [
|
||
[
|
||
1500,
|
||
"toque",
|
||
"nuevo"
|
||
],
|
||
[
|
||
1900,
|
||
"fase",
|
||
1
|
||
],
|
||
[
|
||
3600,
|
||
"fase",
|
||
2
|
||
],
|
||
[
|
||
6000,
|
||
"toque",
|
||
"guardar"
|
||
],
|
||
[
|
||
6400,
|
||
"fase",
|
||
3
|
||
]
|
||
]
|
||
},
|
||
{
|
||
"pantalla": "inventario",
|
||
"titulo": "Inventario",
|
||
"texto": "La mercancía se recibe leyendo el código de barras con la cámara.",
|
||
"dura": 11000,
|
||
"eventos": [
|
||
[
|
||
1600,
|
||
"toque",
|
||
"camara"
|
||
],
|
||
[
|
||
2000,
|
||
"fase",
|
||
1
|
||
],
|
||
[
|
||
4600,
|
||
"fase",
|
||
2
|
||
],
|
||
[
|
||
7400,
|
||
"toque",
|
||
"confirmar"
|
||
],
|
||
[
|
||
7800,
|
||
"fase",
|
||
3
|
||
]
|
||
]
|
||
},
|
||
{
|
||
"pantalla": "cliente",
|
||
"titulo": "Clientes",
|
||
"texto": "Cada cliente tiene su ficha con foto, visitas e histórico de consumo.",
|
||
"dura": 10500,
|
||
"eventos": [
|
||
[
|
||
3200,
|
||
"baja",
|
||
"hist"
|
||
],
|
||
[
|
||
4600,
|
||
"toque",
|
||
"hist"
|
||
],
|
||
[
|
||
5000,
|
||
"fase",
|
||
1
|
||
],
|
||
[
|
||
5600,
|
||
"baja",
|
||
"hist"
|
||
]
|
||
]
|
||
},
|
||
{
|
||
"pantalla": "checada",
|
||
"titulo": "Checador",
|
||
"texto": "El empleado escanea el código del kiosco y registra su entrada.",
|
||
"dura": 9500,
|
||
"eventos": [
|
||
[
|
||
2600,
|
||
"fase",
|
||
1
|
||
],
|
||
[
|
||
5200,
|
||
"toque",
|
||
"registrar"
|
||
],
|
||
[
|
||
5600,
|
||
"fase",
|
||
2
|
||
]
|
||
]
|
||
},
|
||
{
|
||
"pantalla": "miPanel",
|
||
"titulo": "Mi panel",
|
||
"texto": "Cada empleado consulta sus ventas atribuidas y sus propinas.",
|
||
"dura": 7000,
|
||
"eventos": []
|
||
}
|
||
]
|
||
}
|
||
</script>
|
||
<!-- La interfaz simulada es decorativa: lo que se lee es la leyenda del paso. -->
|
||
<div class="mx-app" data-app aria-hidden="true"></div>
|
||
<div class="mx-pie">
|
||
<div class="mx-progreso" data-progreso aria-hidden="true"></div>
|
||
<div class="mx-leyenda-paso" data-leyenda aria-live="off">
|
||
<p class="mx-paso-titulo"><span data-num></span><strong data-titulo></strong></p>
|
||
<p class="mx-paso-texto" data-texto></p>
|
||
</div>
|
||
<div class="mx-controles">
|
||
<button type="button" class="mx-ctrl" data-anterior aria-label="Paso anterior">‹</button>
|
||
<button type="button" class="mx-ctrl" data-pausar aria-pressed="false">Pausar</button>
|
||
<button type="button" class="mx-ctrl" data-siguiente aria-label="Paso siguiente">›</button>
|
||
<button type="button" class="mx-ctrl" data-reiniciar>Reiniciar</button>
|
||
<span class="mx-nota">Demostración con datos ficticios</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script data-componente>
|
||
/* Collina Matrix · demostración animada.
|
||
Un solo módulo para las dos variantes (móvil y escritorio): utilidades,
|
||
pantallas y motor. JS sin dependencias; todos los nodos se crean con
|
||
createElement/textContent y los eventos con addEventListener.
|
||
|
||
Cómo se anima una pantalla sin código propio por pantalla:
|
||
- data-d="n" el elemento existe desde la fase n
|
||
- data-h="n" el elemento existe hasta antes de la fase n
|
||
- data-on="n" el elemento recibe la clase mx-on desde la fase n (data-off la retira)
|
||
- data-k="x" nombre para que el guion lo toque o desplace hasta él
|
||
El guion (JSON) dice cuándo cambia la fase: [ms, "fase"|"toque"|"baja", valor]. */
|
||
|
||
const SVGNS = 'http://www.w3.org/2000/svg';
|
||
|
||
const ICONOS = {
|
||
casa: 'M4 11.5 12 4l8 7.5M6.5 10v9.5h11V10',
|
||
bolsa: 'M6 8h12l1 12H5L6 8Zm3 0V6.5a3 3 0 0 1 6 0V8',
|
||
panel: 'M4 5h7v6H4zM13 5h7v10h-7zM4 13h7v6H4zM13 17h7v2h-7z',
|
||
qr: 'M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h3v3h-3zM18.5 18.5h1.5v1.5h-1.5z',
|
||
cubo: 'M12 3l8 4.5v9L12 21l-8-4.5v-9L12 3Zm0 9l8-4.5M12 12L4 7.5M12 12v9',
|
||
barras: 'M6 20v-9M12 20V5M18 20v-6',
|
||
camara: 'M4 8h3l1.5-2h7L17 8h3v11H4V8Zm8 8.5a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z',
|
||
palomita: 'M5 12.5l5 5 9-10',
|
||
lupa: 'M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm5-2l4.5 4.5',
|
||
codigo: 'M4 6v12M7 6v12M10.5 6v12M14 6v12M17 6v12M20 6v12',
|
||
etiqueta: 'M4 4h8l8 8-8 8-8-8V4Zm4.5 4.5h.01',
|
||
tarjeta: 'M3 6h18v12H3zM3 10h18',
|
||
billete: 'M3 7h18v10H3zM12 14.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z',
|
||
transfer: 'M4 9h15l-3-3M20 15H5l3 3',
|
||
doc: 'M14 3.5H7.5A1.5 1.5 0 0 0 6 5v14a1.5 1.5 0 0 0 1.5 1.5h9A1.5 1.5 0 0 0 18 19V7.5l-4-4Zm0 0v4h4',
|
||
tabla: 'M4.5 4.5h15v15h-15zM4.5 9.5h15M9.5 4.5v15',
|
||
persona: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm-7.5 8.5a7.5 7.5 0 0 1 15 0',
|
||
luz: 'M13 3 6 13.5h5L10 21l8-11h-5.5L13 3Z',
|
||
};
|
||
|
||
/* ── Utilidades de construcción ─────────────────────────────────────────── */
|
||
|
||
/* h('div.a.b', {k:'x', d:1}, hijos…) → <div class="mx-a mx-b" data-k="x" data-d="1"> */
|
||
function h(sel, ...resto) {
|
||
const partes = sel.split('.');
|
||
const el = document.createElement(partes[0] || 'div');
|
||
if (partes.length > 1) el.className = partes.slice(1).map((c) => 'mx-' + c).join(' ');
|
||
for (const r of resto.flat(4)) {
|
||
if (r == null || r === false) continue;
|
||
if (r instanceof Node) el.append(r);
|
||
else if (typeof r === 'object') {
|
||
for (const c in r) {
|
||
if (c === 'v') el.style.setProperty('--v', r[c]);
|
||
else el.dataset[c] = r[c];
|
||
}
|
||
} else el.append(String(r));
|
||
}
|
||
return el;
|
||
}
|
||
|
||
function sv(etiqueta, atributos, ...hijos) {
|
||
const el = document.createElementNS(SVGNS, etiqueta);
|
||
for (const a in atributos) el.setAttribute(a, atributos[a]);
|
||
el.append(...hijos);
|
||
return el;
|
||
}
|
||
|
||
const ico = (nombre, cls) =>
|
||
sv('svg', { viewBox: '0 0 24 24', class: 'mx-ico' + (cls ? ' mx-' + cls : ''), 'aria-hidden': 'true' }, sv('path', { d: ICONOS[nombre] }));
|
||
|
||
/* $1,760.00 (con centavos) o $1,760 (sin ellos). Sin Intl: el resultado no
|
||
depende del idioma del navegador. */
|
||
function $(n, centavos) {
|
||
const signo = n < 0 ? '-' : '';
|
||
return signo + '$' + Math.abs(n).toFixed(centavos ? 2 : 0).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||
}
|
||
const horas = (n) => n.toFixed(1) + ' h';
|
||
const suma = (lista, f) => lista.reduce((t, x) => t + f(x), 0);
|
||
const iniciales = (nombre) => nombre.split(' ').map((p) => p[0]).join('').slice(0, 2);
|
||
|
||
/* Un trozo de texto por fase: el último se queda. */
|
||
const porFase = (n, f) =>
|
||
Array.from({ length: n }, (_, i) => h('span', i < n - 1 ? { d: i, h: i + 1 } : { d: i }, f(i)));
|
||
|
||
/* Código de muestra: módulos al azar con tres esquinas. No codifica nada. */
|
||
function qr(semilla) {
|
||
const N = 25;
|
||
let x = semilla;
|
||
const azar = () => (x = (x * 1103515245 + 12345) % 2147483648) / 2147483648;
|
||
const esquina = (f, c) => (f < 8 && c < 8) || (f < 8 && c >= N - 8) || (f >= N - 8 && c < 8);
|
||
let d = '';
|
||
for (let f = 0; f < N; f++) for (let c = 0; c < N; c++) if (!esquina(f, c) && azar() > 0.52) d += `M${c} ${f}h1v1h-1z`;
|
||
for (const [cx, cy] of [[0, 0], [N - 7, 0], [0, N - 7]])
|
||
d += `M${cx} ${cy}h7v7h-7zM${cx + 1} ${cy + 1}v5h5v-5zM${cx + 2} ${cy + 2}h3v3h-3z`;
|
||
return sv('svg', { viewBox: `0 0 ${N} ${N}`, class: 'mx-qr', 'aria-hidden': 'true' }, sv('path', { d, 'fill-rule': 'evenodd' }));
|
||
}
|
||
|
||
function barrasCodigo() {
|
||
const anchos = [3, 1, 2, 1, 1, 3, 2, 1, 3, 1, 1, 2, 3, 1, 2, 2, 1, 3, 1, 1, 2, 1, 3, 2, 1, 1, 3, 1, 2, 1];
|
||
let x = 0;
|
||
let d = '';
|
||
anchos.forEach((a, i) => {
|
||
if (i % 2 === 0) d += `M${x} 0h${a}v40h-${a}z`;
|
||
x += a;
|
||
});
|
||
return sv('svg', { viewBox: `0 0 ${x} 40`, class: 'mx-barcode', preserveAspectRatio: 'none', 'aria-hidden': 'true' }, sv('path', { d }));
|
||
}
|
||
|
||
/* ── Pantallas ──────────────────────────────────────────────────────────── */
|
||
|
||
function pantallas(D, m) {
|
||
const S = D.sucursales;
|
||
const P = D.personal;
|
||
const V = D.venta;
|
||
const R = V.renglones.map((i) => D.catalogo[i]);
|
||
const subtotal = suma(R, (r) => r.precio);
|
||
const propina = (subtotal * V.propinaPct) / 100;
|
||
const total = subtotal + propina;
|
||
const TABS_PANEL = m ? ['Clientes', 'Catálogo', 'Gastos', 'Personal'] : ['Clientes', 'Sucursales', 'Catálogo', 'Gastos', 'Personal'];
|
||
|
||
/* Piezas comunes */
|
||
const rotulo = (t) => h('span.rotulo', t);
|
||
const pildora = (t, tono, p) => h('span.pildora.' + tono, p, t);
|
||
const avatar = (nombre, cls) => h('span.avatar' + (cls ? '.' + cls : ''), iniciales(nombre));
|
||
const segmento = (ops, activa) => h('div.segmento', ops.map((o) => h('span' + (o === activa ? '.seg-on' : ''), o)));
|
||
const campo = (l, v) => h('div.campo', rotulo(l), h('b', v));
|
||
const campoQueSeLlena = (l, hueco, v, fase) => h('div.campo', rotulo(l), h('span.hueco', { h: fase }, hueco), h('b', { d: fase }, v));
|
||
const retrato = (cls) => h('div.retrato' + (cls ? '.' + cls : ''), ico('persona'));
|
||
const cabBloque = (t, sub, extra) => h('div.bloque-cab', h('b', t), sub && h('small', sub), extra);
|
||
|
||
const barra = (tabs, activa, titulo, ambito, inicial) =>
|
||
h('div.barra',
|
||
h('span.casa', ico('casa')),
|
||
h('div.tabs', tabs.map((t) => h('span.tab' + (t === activa ? '.tab-on' : ''), t))),
|
||
!m && h('div.quien', h('b', titulo), h('small', ambito)),
|
||
h('span.avatar.cuadro', inicial || 'D'));
|
||
|
||
const barraCaja = () =>
|
||
h('div.barra.barra-caja',
|
||
h('span.casa', ico('casa')),
|
||
h('div.tabs', h('span.tab.tab-on', 'Registrar'), h('span.tab', 'Órdenes'), h('span.orden-chip', V.orden)),
|
||
h('div.quien', h('b', 'Caja'), h('small', 'SUCURSAL NORTE')),
|
||
h('span.avatar.cuadro', iniciales(V.atendio)[0]));
|
||
|
||
/* filas: arreglos de celdas, o { p: props, cls, c: celdas } */
|
||
const tabla = (cls, cab, filas, p) =>
|
||
h('div.tabla.' + cls, p,
|
||
h('div.fila.fila-cab', cab.map((c) => h('span', c))),
|
||
filas.map((f) => {
|
||
const celdas = Array.isArray(f) ? f : f.c;
|
||
return h('div.fila' + (f.cls ? '.' + f.cls : ''), f.p, celdas.map((c) => h('span', c)));
|
||
}));
|
||
|
||
function grafica(series) {
|
||
const max = 10000;
|
||
const L = 8, R2 = 992, T = 14, B = 286;
|
||
const svg = sv('svg', { viewBox: '0 0 1000 300', preserveAspectRatio: 'none', class: 'mx-curvas', 'aria-hidden': 'true' });
|
||
for (let i = 0; i <= 4; i++) {
|
||
const y = B - ((B - T) * i) / 4;
|
||
svg.append(sv('line', { x1: 0, x2: 1000, y1: y, y2: y, class: 'mx-reticula' }));
|
||
}
|
||
series.forEach((s) => {
|
||
const puntos = s.dias.map((v, i) => `${(L + ((R2 - L) * i) / (s.dias.length - 1)).toFixed(1)},${(B - ((B - T) * v) / max).toFixed(1)}`);
|
||
svg.append(sv('polyline', { points: puntos.join(' '), class: 'mx-curva mx-s' + S.indexOf(s) }));
|
||
});
|
||
return h('div.grafica',
|
||
h('div.eje-y', [4, 3, 2, 1, 0].map((i) => h('span', $((max * i) / 4)))),
|
||
h('div.grafica-lienzo', svg),
|
||
h('span'),
|
||
h('div.eje-x', D.dias.map((d) => h('span', d))));
|
||
}
|
||
|
||
/* ── Tableros ── */
|
||
function tablero(gerente) {
|
||
const yo = S[0];
|
||
const T = D.tablero;
|
||
const ventas = gerente ? yo.ventas : suma(S, (s) => s.ventas);
|
||
const tickets = gerente ? yo.tickets : suma(S, (s) => s.tickets);
|
||
const hoy = gerente ? yo.ticketsHoy : suma(S, (s) => s.ticketsHoy);
|
||
const gasto = T.gasto.operacion + T.gasto.mercancia;
|
||
const metricas = [
|
||
['Ventas del periodo', $(ventas), `▲ ${gerente ? T.variacionGerente : T.variacion}% vs periodo anterior`, 'sube'],
|
||
['Tickets', tickets, hoy + ' hoy'],
|
||
['Ticket promedio', $(ventas / tickets, 1), 'IVA incluido'],
|
||
gerente
|
||
? ['Sin checar hoy', T.sinChecar, `de ${yo.personal} activos`, '', 'atencion']
|
||
: ['Gasto del periodo', $(gasto), `${$(T.gasto.operacion)} operación + ${$(T.gasto.mercancia)} mercancía`],
|
||
];
|
||
const topMax = T.vendido[0].monto;
|
||
const conVentas = P.filter((p) => p.ventas);
|
||
return h('div.pant',
|
||
barra(['Tableros'], 'Tableros', 'Tableros', gerente ? 'SUCURSAL NORTE' : 'DIRECCIÓN GENERAL', gerente ? 'G' : 'D'),
|
||
h('div.vista', h('div.rollo',
|
||
h('div.encabezado',
|
||
h('div',
|
||
h('div.h1', gerente ? [yo.nombre, h('span.h1-nota', ' · tu sucursal')] : 'Tablero del director'),
|
||
h('p.lema', gerente ? 'Ventas, equipo y pendientes de tu sucursal, en un vistazo.' : 'Ventas, productividad e inventario de todas las sucursales, en un vistazo.')),
|
||
!m && h('div.exportar', h('span.btn.llano', ico('doc'), 'PDF'), h('span.btn.llano', ico('tabla'), 'Excel'))),
|
||
h('div.filtros',
|
||
h('div.filtro', rotulo('Periodo'), segmento(['Hoy', 'Semana', 'Mes', 'Año'], 'Semana')),
|
||
!m && h('div.filtro', rotulo('Catálogo'), segmento(['Todo', 'Solo servicios', 'Solo productos'], 'Todo')),
|
||
!gerente && h('div.filtro', rotulo('Sucursales'), h('div.chips', S.map((s, n) => h('span.chip.chip-serie', h('i.punto.s' + n), s.nombre))))),
|
||
h('div.metricas', metricas.map(([t, cifra, pie, cls, atencion]) =>
|
||
h('div.tarjeta.metrica' + (atencion ? '.atencion' : ''), rotulo(t), h('div.cifra', cifra), h('small' + (cls ? '.' + cls : ''), pie)))),
|
||
h('div.bloque', { k: 'grafica' },
|
||
cabBloque(gerente ? 'Evolución de ventas' : 'Comparativo entre sucursales', 'por día',
|
||
!gerente && h('div.leyenda', S.map((s, n) => h('span', h('i.punto.s' + n), s.nombre)))),
|
||
grafica(gerente ? [yo] : S)),
|
||
!gerente && h('div.bloque', { k: 'sucursales' },
|
||
cabBloque('Por sucursal'),
|
||
tabla('t-sucursales', m ? ['Sucursal', 'Ventas', 'Tickets'] : ['Sucursal', 'Ventas', 'Tickets', 'Ticket promedio', 'Personal activo'],
|
||
S.map((s, n) => [[h('i.punto.s' + n), h('b', s.nombre)], h('b', $(s.ventas)), s.tickets].concat(m ? [] : [$(s.ventas / s.tickets, 1), s.personal])))),
|
||
gerente && h('div.bloque', { k: 'equipo' },
|
||
cabBloque('Tu equipo'),
|
||
tabla('t-dos', ['Persona', 'Ventas atribuidas'], conVentas.map((p) => [h('b', p.nombre), h('b', $(p.ventas))]))),
|
||
h('div.inferior', { k: 'inferior' },
|
||
h('div.bloque',
|
||
cabBloque('Lo más vendido', null, !m && segmento(['Por monto', 'Por cantidad'], 'Por monto')),
|
||
h('div.vendido', T.vendido.map((v) =>
|
||
h('div.vendido-fila', h('span', v.nombre), h('div.riel', h('i', { v: Math.round((v.monto / topMax) * 100) + '%' })), h('b', $(v.monto)))))),
|
||
!gerente && h('div.bloque',
|
||
cabBloque('Alertas de inventario'),
|
||
T.alertas.map((a) => h('div.alerta', h('b', a.producto), h('span', a.sucursal), h('b.cantidad' + (a.cantidad < 0 ? '.negativa' : ''), a.cantidad))),
|
||
h('p.pie-nota', 'En rojo, existencia negativa: se vendió algo que nunca se registró como recibido.'))))));
|
||
}
|
||
|
||
/* ── Personal: equipo y ficha de colaborador ── */
|
||
function personal() {
|
||
const tarjetas = m
|
||
? [['Sucursal Norte', S[0]]]
|
||
: [['Toda la red', { horas: suma(S, (s) => s.horas), personal: suma(S, (s) => s.personal) }]].concat(S.map((s) => ['Sucursal ' + s.nombre, s]));
|
||
const cuenta = (hoy) => P.filter((p) => p.hoy === hoy).length;
|
||
const A = D.alta;
|
||
const niveles = ['Colaborador (sin acceso al sistema)', 'Administrador de sucursal', 'Administrador general'];
|
||
const lista = h('div.columna', !m && { h: 1 },
|
||
h('div.h1-fila', h('div.h1', 'Equipo'), h('span.btn.oscuro', { k: 'nuevo' }, '+ Nuevo')),
|
||
h('div.resumenes', tarjetas.map(([t, s], i) =>
|
||
h('div.tarjeta.resumen' + (i === 0 ? '.sel' : ''), rotulo(t), h('div.cifra', horas(s.horas), h('small', ' trabajadas')), h('small', s.personal + ' personas')))),
|
||
h('div.filtros',
|
||
h('div.filtro', segmento(['Hoy', 'Semana', 'Mes', 'Año'], 'Semana')),
|
||
h('div.chips', [['Todos', P.length], ['Trabajando ahora', cuenta('Trabajando')], ['Sin entrada hoy', cuenta('Sin entrada')], ['De vacaciones', cuenta('Vacaciones')]]
|
||
.slice(0, m ? 3 : 4).map(([t, n], i) => h('span.chip' + (i === 0 ? '.chip-on' : ''), t, h('i.conteo', n))))),
|
||
tabla('t-equipo', m ? ['Persona', 'Hoy', 'Semana'] : ['Persona', 'Sucursal', 'Hoy', 'Semana'],
|
||
P.map((p) => [
|
||
h('div.persona', avatar(p.nombre), h('div', h('b', p.nombre), h('small', m ? p.puesto : p.puesto + ' · ' + p.celular))),
|
||
].concat(m ? [] : ['Norte'], [pildora(p.hoy, p.tono), h('b', horas(p.horas))])), { k: 'equipo' }));
|
||
const ficha = !m && h('div.columna', { d: 1 },
|
||
h('div.h1-fila', h('div', rotulo('Ficha de colaborador'), h('div.h1', A.nombre)), pildora('Activo', 'verde')),
|
||
h('div.tarjeta.ficha',
|
||
h('div.retrato.sin-foto', ico('camara'), h('small', 'Tomar fotografía')),
|
||
h('div.campos',
|
||
h('div.dos', campo('Nombre', A.nombre), campo('Celular · es su usuario', A.celular)),
|
||
h('div.dos', campo('Puesto', A.puesto), campo('Fecha de ingreso', A.ingreso)),
|
||
h('div.campo', rotulo('Sucursal'), h('div.chips', S.map((s, i) => h('span.chip' + (i === 0 ? '.chip-on' : ''), s.nombre)))),
|
||
h('div.campo', rotulo('Nivel de acceso'), h('div.chips', niveles.map((n, i) =>
|
||
h('span.chip', i === 0 ? { on: 1, off: 2 } : i === 1 ? { k: 'nivel', on: 2 } : null, n)))),
|
||
campo('Contraseña inicial', '••••••••'))),
|
||
h('div.ficha-pie', h('span.btn.oscuro', 'Guardar'), h('span.btn.llano', 'Descartar'), h('small', 'Los cambios se aplican al guardar.')));
|
||
return h('div.pant',
|
||
barra(TABS_PANEL, 'Personal', 'Panel General', m ? 'SUCURSAL NORTE' : 'DIRECCIÓN GENERAL', m ? 'G' : 'D'),
|
||
h('div.vista', h('div.rollo', lista, ficha)));
|
||
}
|
||
|
||
/* ── Gastos (captura desde el teléfono) ── */
|
||
function gastos() {
|
||
const G = D.gastos;
|
||
const N = G.nuevo;
|
||
const base = suma(G.lista, (g) => g.monto);
|
||
const renglon = (g) => [g.fecha, [h('b', g.concepto), h('small', g.categoria)], h('b', $(g.monto))];
|
||
return h('div.pant',
|
||
barra(TABS_PANEL, 'Gastos', 'Panel General', 'SUCURSAL NORTE', 'G'),
|
||
h('div.vista', h('div.rollo',
|
||
h('div.h1-fila', h('div.h1', 'Gastos'), h('span.btn.oscuro', { k: 'nuevo' }, '+ Nuevo')),
|
||
h('div.filtros', h('div.filtro', rotulo('Periodo'), segmento(['Hoy', 'Este mes', 'Este año'], 'Este mes'))),
|
||
h('div.tarjeta.resumen', rotulo('Mis gastos capturados'),
|
||
h('div.cifra', h('span', { h: 3 }, $(base)), h('span', { d: 3 }, $(base + N.monto))),
|
||
h('small', 'Sucursal Norte')),
|
||
tabla('t-gastos', ['Fecha', 'Concepto', 'Monto'], [{ p: { d: 3 }, cls: 'nueva', c: renglon(N) }].concat(G.lista.map(renglon))))),
|
||
h('div.captura', { d: 1, h: 3 },
|
||
h('div.captura-cab', h('div', rotulo('Nuevo gasto'), h('div.h1', 'Captura un gasto')), h('span.x', '×')),
|
||
campoQueSeLlena('Concepto', 'Recibo de luz…', N.concepto, 2),
|
||
h('div.dos', campoQueSeLlena('Monto', '$ 0.00', $(N.monto, 1), 2), campo('Fecha', N.fecha)),
|
||
h('div.dos', campo('Sucursal', 'Norte'), campoQueSeLlena('Categoría', 'Elige una', N.categoria, 2)),
|
||
h('div.interruptor', h('i'), h('div', h('b', 'Gasto recurrente'), h('small', 'Se vuelve a capturar cada mes'))),
|
||
h('div.campo', rotulo('Archivos'), h('span.hueco', 'Factura, comprobante o ticket')),
|
||
h('div.captura-pie', h('span.btn.oscuro.ancho', { k: 'guardar' }, 'Guardar'), h('span.btn.llano', 'Guardar y otro'))));
|
||
}
|
||
|
||
/* ── Inventario: recibir mercancía escaneando ──
|
||
Fases en escritorio: 0 vacío · 1 y 2 un artículo cada una · 3 confirmada.
|
||
Fases en móvil: 0 vacío · 1 cámara · 2 artículo · 3 confirmada. */
|
||
function inventario() {
|
||
const E = D.entrada.slice(0, m ? 1 : 2);
|
||
const entra = (i) => (m ? 2 : i + 1);
|
||
const cab = m ? ['Entrada de hoy', 'Llegaron', 'Costo c/u'] : ['Entrada de hoy', 'Tenía', 'Llegaron', 'Costo c/u', 'Quedará'];
|
||
return h('div.pant',
|
||
barra(['Inventario'], 'Inventario', 'Inventario', 'DIRECCIÓN GENERAL'),
|
||
h('div.vista', h('div.rollo',
|
||
h('div.migas', '← Inventario · Sucursal Norte'),
|
||
h('div.h1', 'Recibir mercancía'),
|
||
h('div.recibir',
|
||
h('div.columna',
|
||
h('div.escaneo', { k: 'escaneo' }, ico('codigo'), h('span', 'Escanea el código, o escribe el nombre y pulsa Enter'), h('span.btn-cam', { k: 'camara' }, ico('camara'))),
|
||
!m && h('p.ayuda', 'Con la caja enfrente, escanea. Si capturas contra la factura del proveedor, escribe el nombre o elígelo del catálogo.'),
|
||
!m && h('div.bloque',
|
||
cabBloque('Catálogo de Norte', D.existencias.length + ' artículos'),
|
||
D.existencias.map((x) => h('div.existencia', h('b', x.nombre), pildora(x.uso, x.uso === 'De venta' ? 'azul' : 'gris'), h('span', 'tiene ' + x.tiene), h('span.mas', '+'))))),
|
||
h('div.columna',
|
||
h('div.bloque',
|
||
tabla('t-entrada', cab, E.map((e, i) => ({
|
||
p: { d: entra(i) },
|
||
c: [[h('b', e.nombre), h('small.mono', e.codigo)]].concat(
|
||
m ? [] : [e.tenia],
|
||
[h('span.caja-num', e.llegaron), h('span.caja-num', $(e.costo, 1))],
|
||
m ? [] : [h('b.queda', e.tenia + e.llegaron)]),
|
||
}))),
|
||
h('div.vacio', { h: 1 + (m ? 1 : 0) }, ico('cubo'), h('b', 'Aún no agregas nada'), h('p', 'Escanea la caja o toca + en el catálogo.')),
|
||
!m && h('p.pie-nota.rojo', { d: 2 }, 'Estaba en negativo: esta entrada lo resuelve.')),
|
||
h('span.btn.azul.ancho', { k: 'confirmar', h: 3 }, 'Confirmar entrada'),
|
||
h('div.aviso', { d: 3 }, ico('palomita'), `Entrada registrada: ${E.length} artículo(s).`))))),
|
||
m && h('div.visor', { d: 1, h: 2 },
|
||
h('div.visor-guia', barrasCodigo(), h('i.visor-linea')),
|
||
h('span.visor-luz', ico('luz'), 'Luz')));
|
||
}
|
||
|
||
/* ── Clientes: mosaico (escritorio) y ficha ── */
|
||
function cliente() {
|
||
const c = D.clientes[0];
|
||
const X = D.cliente;
|
||
const fFicha = m ? 0 : 1;
|
||
const cifras = [['Visitas', c.visitas], ['Gasto acumulado', $(X.gasto)], ['Última visita', X.ultima], ['Sucursal habitual', X.habitual], ['Ticket promedio', $(X.gasto / c.visitas, 1)]];
|
||
const mosaico = !m && h('div.columna', { h: 1 },
|
||
h('div.h1-fila', h('div.h1', 'Clientes'), h('div.buscador', ico('lupa'), 'Buscar por nombre o teléfono'), h('span.btn.oscuro', '+ Nuevo')),
|
||
h('div.mosaico', D.clientes.map((x, i) =>
|
||
h('div.tarjeta.cliente', i === 0 && { k: 'cli' }, retrato('chico'), h('div', h('b', x.nombre), h('small', x.telefono)), pildora(x.visitas + ' visitas', 'suave')))));
|
||
const ficha = h('div.columna', fFicha ? { d: fFicha } : null,
|
||
h('div.h1-fila', h('div.h1', c.nombre), !m && h('span.btn.oscuro', 'Guardar')),
|
||
h('div.cifras', cifras.map(([t, v]) => h('div.tarjeta.cifrita', rotulo(t), h('b', v)))),
|
||
h('div.tarjeta.ficha',
|
||
retrato(),
|
||
h('div.campos',
|
||
h('div.dos', campo('Nombre', c.nombre), campo('Teléfono', c.telefono)),
|
||
h('div.campo', rotulo('Sucursal de alta'), h('div.chips', S.map((s, i) => h('span.chip' + (i === 0 ? '.chip-on' : ''), s.nombre))),
|
||
h('small', 'Habitual, donde más compra: ' + X.habitual)),
|
||
!m && h('div.campo', rotulo('Notas'), h('span.hueco', 'Escribe una nota sobre este cliente…')))),
|
||
h('div.plegable', { k: 'hist' }, h('b', 'Histórico de consumo'), h('small', c.visitas + ' visitas'), h('span.flecha', '›')),
|
||
h('div.visitas', { d: fFicha + 1, k: 'visitas' }, X.historico.map((v) =>
|
||
h('div.visita',
|
||
h('div.visita-cab', h('b', v.fecha), h('span', v.sucursal)),
|
||
v.formula && h('div.formula', v.formula, h('small', `por ${v.por} · ${v.fecha}`)),
|
||
v.renglones.map(([n, p]) => h('div.visita-fila', h('b', n), h('span', '× 1'), h('span', $(p, 1))))))));
|
||
return h('div.pant',
|
||
barra(TABS_PANEL, 'Clientes', 'Panel General', m ? 'SUCURSAL NORTE' : 'DIRECCIÓN GENERAL', m ? 'G' : 'D'),
|
||
h('div.vista', h('div.rollo', mosaico, ficha)));
|
||
}
|
||
|
||
/* ── Checador: lo que ve el empleado en su teléfono ── */
|
||
function checadaCuerpo(base) {
|
||
const K = D.checada;
|
||
const nombre = K.empleado.split(' ')[0];
|
||
return [
|
||
h('div.chk', { h: base + 1 },
|
||
rotulo('Checador'),
|
||
h('div.tarjeta.chk-tarjeta',
|
||
h('div.chk-cab', h('i.punto'), h('b', 'Kiosco de Norte'), h('small', D.fecha)),
|
||
h('p.chk-hola', 'Hola, ' + nombre),
|
||
h('div.chk-mov',
|
||
h('div', rotulo('Tu siguiente movimiento'), h('div.chk-grande', 'Entrada')),
|
||
h('div.chk-reloj', h('b', K.hora), h('small', 'hora del kiosco'))),
|
||
h('span.btn.primario.ancho', { k: 'registrar' }, 'Registrar entrada'),
|
||
h('div.chk-tira', h('span', 'Sin jornada abierta · acumuladas hoy'), h('b', '0.0 h')))),
|
||
h('div.chk', { d: base + 1 },
|
||
rotulo('Checador'),
|
||
h('div.tarjeta.chk-tarjeta.chk-ok',
|
||
h('span.sello', ico('palomita')),
|
||
h('div.chk-titulo', 'Entrada registrada a las ' + K.hora),
|
||
h('small', 'Kiosco de Norte · ' + D.fecha),
|
||
h('p', 'Cuando termines, vuelve a escanear el QR del kiosco para registrar tu salida.'),
|
||
h('div.chk-tira', h('span', 'Acumuladas hoy'), h('b', '0.0 h')),
|
||
h('span.btn.suave.ancho', 'Ver mis horas →'))),
|
||
];
|
||
}
|
||
|
||
function checada() {
|
||
return h('div.pant.chk-pant',
|
||
h('div.visor', { h: 1 }, h('div.visor-guia.cuadrada', qr(7), h('i.visor-linea')), h('span.visor-texto', 'Apunta al código del kiosco')),
|
||
checadaCuerpo(1));
|
||
}
|
||
|
||
function miPanel() {
|
||
const p = P[0];
|
||
const K = D.checada;
|
||
return h('div.pant.chk-pant',
|
||
h('div.mi',
|
||
h('div.mi-cab', avatar(p.nombre, 'grande'), h('div', h('div.h1', p.nombre), h('small', 'Norte · Colaborador'))),
|
||
h('div.tarjeta', rotulo('Periodo'),
|
||
h('div.chips', h('span.chip.chip-on', 'Este mes'), h('span.chip', 'Mes pasado'))),
|
||
h('div.tarjeta.mis-ventas', rotulo('Mis ventas'),
|
||
h('small', 'ATRIBUIDO'),
|
||
h('div.cifra.grande', $(p.ventas)),
|
||
pildora($(K.propinas) + ' en propinas', 'verde'),
|
||
h('div.dos', h('div.casilla', h('b', K.servicios), h('small', 'servicios')), h('div.casilla', h('b', $(p.ventas / K.servicios, 1)), h('small', 'ticket promedio'))),
|
||
h('span.enlace', 'Ver detalle'))));
|
||
}
|
||
|
||
/* ── Kiosco con código que se renueva (y el teléfono del empleado) ── */
|
||
function kiosco() {
|
||
return h('div.pant.kiosco',
|
||
h('div.kiosco-centro',
|
||
h('div.kiosco-suc', 'Sucursal Norte'),
|
||
h('div.kiosco-qr', h('div', { h: 2 }, qr(7)), h('div', { d: 2 }, qr(23))),
|
||
h('p', 'Escanea con la cámara de tu celular para checar tu ', h('b', 'entrada'), ' o ', h('b', 'salida'), '.'),
|
||
h('small', 'El código se renueva solo.')),
|
||
h('div.telefono', checadaCuerpo(0)));
|
||
}
|
||
|
||
/* ── Menú principal ── */
|
||
function menu() {
|
||
const b = (clave, nombre, icono, tono) => h('div.acceso.' + tono, { k: clave }, h('b', nombre), ico(icono));
|
||
return h('div.pant.menu',
|
||
h('div.menu-cab', ico('casa'), h('i')),
|
||
h('div.menu-fila', b('m-venta', 'Venta', 'bolsa', 'verde'), b('m-panel', 'Panel General', 'panel', 'azul'), b('m-qr', 'QR', 'qr', 'tinta')),
|
||
h('div.menu-fila.menu-fila2', b('m-inv', 'Inventario', 'cubo', 'cielo'), b('m-tab', 'Tableros', 'barras', 'ambar')),
|
||
h('div.menu-pie', h('span', 'Cerrar sesión'), h('span', 'Powered by Collina Systems')));
|
||
}
|
||
|
||
/* ── Venta: catálogo y ticket ── */
|
||
function venta() {
|
||
const sub = (n) => suma(R.slice(0, n), (r) => r.precio);
|
||
const n = R.length + 1;
|
||
return h('div.pant.caja',
|
||
barraCaja(),
|
||
h('div.caja-cuerpo',
|
||
h('div.ticket',
|
||
h('div.vacio', { h: 1 }, ico('bolsa'), h('b', 'Ticket vacío'), h('p', 'Toca un producto o escanea un código para empezar la venta.')),
|
||
h('div.lineas', R.map((r, i) =>
|
||
h('div.linea', { d: i + 1 },
|
||
h('span.cant', h('i', '−'), h('b', '1'), h('i.suma', '+')),
|
||
h('div.linea-txt', h('b', r.nombre), h('small', $(r.precio, 1) + ' c/u')),
|
||
h('b', $(r.precio, 1)),
|
||
h('span.x', '×')))),
|
||
h('div.totales',
|
||
h('div', h('span', 'Subtotal · ', porFase(n, (i) => i + (i === 1 ? ' pieza' : ' piezas'))), h('span', porFase(n, (i) => $(sub(i), 1)))),
|
||
h('div', h('span', 'Impuestos incluidos'), h('span', porFase(n, (i) => $(sub(i) - sub(i) / 1.16, 1)))),
|
||
h('div.total', h('span', 'Total'), h('b', porFase(n, (i) => $(sub(i), 1))))),
|
||
h('div.ticket-pie',
|
||
h('div.llanos', h('span.btn.llano', ico('etiqueta'), 'Descuento'), h('span.btn.llano', 'Nota')),
|
||
h('span.btn.primario.ancho', { k: 'cobrar' }, 'Cobrar ', porFase(n, (i) => $(sub(i), 1))))),
|
||
h('div.catalogo',
|
||
h('div.cat-ctrl',
|
||
segmento(['Todo', 'Servicios', 'Productos'], 'Todo'),
|
||
h('div.buscador', ico('lupa'), 'Buscar producto o servicio'),
|
||
h('span.btn.llano', ico('codigo'), 'Escanear')),
|
||
h('div.productos', D.catalogo.map((p, i) => {
|
||
const pos = V.renglones.indexOf(i);
|
||
return h('div.producto', { k: 'prod-' + i }, pos >= 0 && { on: pos + 1 },
|
||
h('div.producto-txt', h('b', p.nombre),
|
||
h('small', h('span.tipo.' + (p.tipo === 'Servicio' ? 'tipo-s' : 'tipo-p'), p.tipo), p.tipo === 'Servicio' ? 'por servicio' : 'por pieza')),
|
||
pos >= 0 && h('span.badge', { d: pos + 1 }, '1'),
|
||
h('b.precio', $(p.precio, 1)),
|
||
h('span.mas', '+'));
|
||
})))));
|
||
}
|
||
|
||
/* ── Cobro: cliente, quién atendió, propina y forma de pago ──
|
||
Fases: 1 se abre «Elige el cliente» · 2 clienta elegida · 3 clienta puesta
|
||
4 quién atendió · 5 propina · 6 pago registrado */
|
||
function cobro() {
|
||
const cli = D.clientes[0];
|
||
const paso = (num, t, p) => h('div.paso', p, h('i', num), h('b', t));
|
||
const metodos = [['Efectivo', 'billete'], ['Tarjeta', 'tarjeta'], ['Transferencia', 'transfer']];
|
||
return h('div.pant.caja',
|
||
barraCaja(),
|
||
h('div.caja-cuerpo',
|
||
h('div.cobro-panel',
|
||
h('div.cobro-cab', h('div', rotulo('Orden ' + V.orden), h('div.h1', 'Cobrar')), h('span.x', '×')),
|
||
h('div.vista', h('div.rollo',
|
||
paso(1, 'Cliente y colaborador'),
|
||
h('div.quien-tarjeta', { k: 'cliente' },
|
||
h('span.avatar.punteado', { h: 3 }, '+'), h('span', { d: 3 }, avatar(cli.nombre)),
|
||
h('div', rotulo('Cliente'), h('b', { h: 3 }, 'Agregar cliente'), h('b', { d: 3 }, cli.nombre)),
|
||
h('span.flecha', '›')),
|
||
h('div.quien-tarjeta', { k: 'atendio' },
|
||
h('span.avatar.punteado', { h: 4 }, '+'), h('span', { d: 4 }, avatar(V.atendio, 'verde')),
|
||
h('div', rotulo('Atendió'), h('b', { h: 4 }, 'Agregar colaborador'), h('b', { d: 4 }, V.atendio)),
|
||
h('span.flecha', '›')),
|
||
paso(2, 'Propina · opcional', { k: 'paso2' }),
|
||
h('div.propinas', [10, 15, 20].map((pct) =>
|
||
h('div.propina', pct === V.propinaPct && { k: 'propina', on: 5 }, h('b', pct + '%'), h('small', $((subtotal * pct) / 100, 1))))),
|
||
h('div.propina-fila', { d: 5 }, avatar(V.atendio, 'verde'), h('b', V.atendio), h('span.caja-num', $(propina, 1))),
|
||
h('div.propina-total', { d: 5 }, h('span', 'Propina total'), h('b', $(propina, 1))),
|
||
paso(3, '¿Cómo paga el cliente?'),
|
||
h('div.metodos', metodos.map(([nombre, icono]) => {
|
||
const elegido = nombre === V.metodo;
|
||
return h('div.metodo', elegido && { k: 'metodo', on: 6 }, ico(icono),
|
||
h('div', h('b', nombre + ' Sucursal Norte'),
|
||
h('small', { h: 6 }, 'Agrega ', h('span', { h: 5 }, $(subtotal, 1)), h('span', { d: 5 }, $(total, 1))),
|
||
elegido ? h('small.ok', { d: 6 }, $(total, 1) + ' registrado') : h('small', { d: 6 }, 'Agregar otro pago')),
|
||
h('span.mas', '+'));
|
||
})))),
|
||
h('div.cobro-pie',
|
||
h('span.btn.llano', 'Regresar'),
|
||
h('span.btn.primario.ancho.apagado', { h: 4 }, 'Falta quién atendió · paso 1'),
|
||
h('span.btn.primario.ancho.apagado', { d: 4, h: 6 }, 'Falta ', h('span', { h: 5 }, $(subtotal, 1)), h('span', { d: 5 }, $(total, 1))),
|
||
h('span.btn.primario.ancho', { d: 6, k: 'validar' }, 'Validar cobro'))),
|
||
h('div.cobro-lienzo',
|
||
h('div.cobro-folio', `Orden ${V.orden} · ${R.length} piezas`),
|
||
rotulo('Total a cobrar'),
|
||
h('div.gran-total', h('i', '$'), h('b', { h: 5 }, $(subtotal).slice(1)), h('b', { d: 5 }, $(total).slice(1)), h('i', '.00')),
|
||
h('p.incluye', { d: 5 }, `Incluye ${$(propina, 1)} de propina`),
|
||
h('div.sin-pagos', { h: 6 }, h('b', 'Aún no registras ningún pago'), h('p', 'Toca el método con el que paga y aquí aparecerá el pago por el total.')),
|
||
h('div.pago', { d: 6 }, h('i', '1'), h('div', h('b', V.metodo + ' Sucursal Norte'), h('small', 'Toca para editar')), h('b.monto', $(total, 1)), h('span.x', '×')),
|
||
h('div.estado-pago', { d: 6 }, rotulo('Pago completo'), h('b', $(total, 1))))),
|
||
h('div.velo', { d: 1, h: 3 },
|
||
h('div.modal',
|
||
h('div.h1', 'Elige el cliente'),
|
||
h('div.modal-busca', h('div.buscador', ico('lupa'), 'Busca por nombre, teléfono o correo'), h('span.btn.suave', '+ Nuevo')),
|
||
D.clientes.slice(0, 3).map((c, i) =>
|
||
h('div.cli-fila', i === 0 && { k: 'cli', on: 2 }, avatar(c.nombre), h('div', h('b', c.nombre), h('small', c.telefono)), h('span.check', ico('palomita')))),
|
||
h('div.modal-pie', h('span', { h: 2 }, 'Ninguno seleccionado'), h('span', { d: 2 }, cli.nombre), h('span.btn.primario', { k: 'usar' }, 'Usar cliente')))));
|
||
}
|
||
|
||
/* ── Cobro realizado y comprobante en carta ── */
|
||
function comprobante() {
|
||
const base = subtotal / 1.16;
|
||
return h('div.pant.caja',
|
||
barraCaja(),
|
||
h('div.hecho',
|
||
h('div.hecho-izq',
|
||
h('span.sello', ico('palomita')),
|
||
rotulo('Cobro realizado'),
|
||
h('p.mono', 'Folio ' + V.folio),
|
||
h('div.hecho-total', $(total, 1)),
|
||
h('p', V.metodo),
|
||
h('span.btn.borde', ico('doc'), 'Descargar comprobante'),
|
||
h('span.btn.primario.ancho', 'Nueva orden →')),
|
||
h('div.hecho-der',
|
||
h('div.preparando', { h: 1 }, h('b', 'Preparando el comprobante'), h('p', 'Aparece aquí en cuanto la venta llega al servidor.')),
|
||
h('div.hoja', { d: 1 },
|
||
h('div.hoja-cab',
|
||
h('div', h('b.hoja-suc', 'Sucursal Norte'), h('small', 'Av. Ejemplo 100'), h('small', 'Tel. 55 5550 0100')),
|
||
h('div.hoja-datos', h('b', 'Comprobante de venta'), h('span.mono.hoja-folio', { k: 'folio' }, 'Folio ' + V.folio), h('small', `12 de marzo de 2026, ${V.hora}`), h('small', 'Caja · Atendió: ' + V.atendio))),
|
||
h('div.hoja-cli', rotulo('Cliente'), h('b', D.clientes[0].nombre)),
|
||
tabla('t-hoja', ['Concepto', 'Cant.', 'P. unitario', 'Importe'], R.map((r) => [r.nombre, 1, $(r.precio, 1), $(r.precio, 1)])),
|
||
h('div.hoja-totales',
|
||
[['Artículos', subtotal], ['Subtotal', base], ['IVA 16%', subtotal - base], ['Propina', propina]].map(([t, v]) => h('div', h('span', t), h('span', $(v, 1)))),
|
||
h('div.total', h('span', 'Total'), h('b', $(total, 1)))),
|
||
h('p.hoja-pago', `Forma de pago: ${V.metodo} ${$(total, 1)}`)))));
|
||
}
|
||
|
||
/* ── Sucursales: el alta crea los recursos ──
|
||
Fases: 1 renglón nuevo · 2 nombre escrito · 3 guardada */
|
||
function sucursales() {
|
||
const N = D.sucursalNueva;
|
||
const corto = N.nombre.replace('Sucursal ', '');
|
||
const alGuardar = (leyenda, valor) => [h('i.leyenda', { h: 3 }, leyenda), h('span', { d: 3 }, valor)];
|
||
const recursos = [['Almacén', N.almacen], ['Punto de venta', N.caja], ['Lista de precios', 'Precios ' + corto], ['Caja (efectivo)', 'Efectivo ' + N.nombre],
|
||
['Tarjeta', 'Tarjeta ' + N.nombre], ['Transferencia', 'Transferencia ' + N.nombre], ['Equipo', 'Equipo ' + corto], ['Checador', 'Kiosco de ' + corto]];
|
||
return h('div.pant',
|
||
barra(TABS_PANEL, 'Sucursales', 'Panel General', 'DIRECCIÓN GENERAL'),
|
||
h('div.vista', h('div.rollo',
|
||
h('div.h1-fila', h('div.h1', 'Sucursales'),
|
||
h('span.btn.oscuro', { k: 'nueva', h: 1 }, '+ Nuevo'), h('span.btn.oscuro', { k: 'guardar', d: 1, h: 3 }, 'Guardar')),
|
||
tabla('t-suc', ['Código', 'Nombre', 'Almacén', 'Punto de venta'],
|
||
S.map((s) => [h('span.codigo', s.codigo), h('b', 'Sucursal ' + s.nombre), 'Almacén ' + s.codigo, 'Caja ' + s.nombre]).concat([{
|
||
p: { d: 1 }, cls: 'nueva',
|
||
c: [[h('i.leyenda', { h: 3 }, 'se asigna al guardar'), h('span.codigo', { d: 3 }, N.codigo)],
|
||
[h('span.hueco', { h: 2 }, 'p. ej. Sucursal 5'), h('b', { d: 2 }, N.nombre)],
|
||
alGuardar('se crea al guardar', N.almacen), alGuardar('se crea al guardar', N.caja)],
|
||
}])),
|
||
h('div.tarjeta.recursos', { d: 3, k: 'recursos' },
|
||
rotulo('Recursos de operación'),
|
||
h('p', 'Los crea el sistema al dar de alta la sucursal. Solo lectura.'),
|
||
h('div.pares', recursos.map(([t, v]) => h('div', ico('palomita'), h('small', t), h('b', v))))))));
|
||
}
|
||
|
||
return {
|
||
tableroDirector: () => tablero(false),
|
||
tableroGerente: () => tablero(true),
|
||
personal, gastos, inventario, cliente, checada, miPanel, kiosco, menu, venta, cobro, comprobante, sucursales,
|
||
};
|
||
}
|
||
|
||
/* ── Motor ──────────────────────────────────────────────────────────────── */
|
||
|
||
function montarMatrixDemo(raiz) {
|
||
const guion = JSON.parse(raiz.querySelector('[data-guion]').textContent);
|
||
const q = (sel) => raiz.querySelector(sel);
|
||
const app = q('[data-app]');
|
||
const progreso = q('[data-progreso]');
|
||
const elNum = q('[data-num]');
|
||
const elTitulo = q('[data-titulo]');
|
||
const elTexto = q('[data-texto]');
|
||
const btnPausar = q('[data-pausar]');
|
||
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||
const pasos = guion.pasos;
|
||
const P = pantallas(guion.datos, guion.variante === 'movil');
|
||
|
||
let i = 0; // paso actual
|
||
let ev = 0; // siguiente evento del paso
|
||
let transcurrido = 0; // ms corridos dentro del paso
|
||
let marca = 0;
|
||
let reloj = 0;
|
||
let visible = false;
|
||
let pausado = reduce; // con movimiento reducido no arranca sola
|
||
const andando = () => visible && !pausado;
|
||
|
||
const segmentos = pasos.map(() => {
|
||
const s = h('span.seg', h('i'));
|
||
progreso.append(s);
|
||
return s;
|
||
});
|
||
|
||
/* El sitio escala el lienzo con transform: las medidas de pantalla se
|
||
devuelven a medidas del lienzo. */
|
||
const escala = () => app.getBoundingClientRect().width / app.offsetWidth || 1;
|
||
|
||
function aplicarFase(n, animar) {
|
||
app.querySelectorAll('[data-d],[data-h]').forEach((el) => {
|
||
const desde = Number(el.dataset.d || 0);
|
||
const hasta = el.dataset.h === undefined ? Infinity : Number(el.dataset.h);
|
||
const fuera = n < desde || n >= hasta;
|
||
if (!fuera && animar && !reduce && el.classList.contains('mx-fuera')) el.classList.add('mx-entra');
|
||
el.classList.toggle('mx-fuera', fuera);
|
||
});
|
||
app.querySelectorAll('[data-on]').forEach((el) => {
|
||
const off = el.dataset.off === undefined ? Infinity : Number(el.dataset.off);
|
||
el.classList.toggle('mx-on', n >= Number(el.dataset.on) && n < off);
|
||
});
|
||
}
|
||
|
||
function toque(clave) {
|
||
const el = app.querySelector(`[data-k="${clave}"]`);
|
||
if (!el || reduce) return;
|
||
const a = app.getBoundingClientRect();
|
||
const r = el.getBoundingClientRect();
|
||
const s = escala();
|
||
const t = h('span.toque');
|
||
t.style.left = (r.left + r.width / 2 - a.left) / s + 'px';
|
||
t.style.top = (r.top + r.height / 2 - a.top) / s + 'px';
|
||
app.append(t);
|
||
el.classList.add('mx-pulsado');
|
||
setTimeout(() => {
|
||
t.remove();
|
||
el.classList.remove('mx-pulsado');
|
||
}, 650);
|
||
}
|
||
|
||
/* Desplaza el contenido hasta dejar arriba el elemento nombrado. */
|
||
function baja(clave) {
|
||
const el = app.querySelector(`[data-k="${clave}"]`);
|
||
const rollo = el && el.closest('.mx-rollo');
|
||
if (!rollo) return;
|
||
const s = escala();
|
||
const y = (el.getBoundingClientRect().top - rollo.getBoundingClientRect().top) / s - 14;
|
||
const tope = rollo.offsetHeight - rollo.parentElement.clientHeight;
|
||
rollo.style.transform = `translateY(${-Math.max(0, Math.min(y, tope))}px)`;
|
||
}
|
||
|
||
function ejecutar([, tipo, valor], animar) {
|
||
if (tipo === 'fase') aplicarFase(valor, animar);
|
||
else if (tipo === 'toque') animar && toque(valor);
|
||
else if (tipo === 'baja') baja(valor);
|
||
}
|
||
|
||
function programar() {
|
||
clearTimeout(reloj);
|
||
if (!andando()) return;
|
||
const p = pasos[i];
|
||
const proximo = ev < p.eventos.length ? p.eventos[ev][0] : p.dura;
|
||
marca = performance.now();
|
||
reloj = setTimeout(() => {
|
||
transcurrido = proximo;
|
||
if (ev < p.eventos.length) {
|
||
ejecutar(p.eventos[ev++], true);
|
||
programar();
|
||
} else irA((i + 1) % pasos.length);
|
||
}, Math.max(0, proximo - transcurrido));
|
||
}
|
||
|
||
/* completo: pinta el paso en su estado final (navegación manual en pausa). */
|
||
function irA(n, completo) {
|
||
i = n;
|
||
ev = 0;
|
||
transcurrido = 0;
|
||
const p = pasos[i];
|
||
const pantalla = P[p.pantalla]();
|
||
if (reduce) pantalla.classList.add('mx-quieta');
|
||
app.replaceChildren(pantalla);
|
||
aplicarFase(0, false);
|
||
if (completo) {
|
||
pantalla.classList.add('mx-quieta');
|
||
p.eventos.forEach((e) => ejecutar(e, false));
|
||
ev = p.eventos.length;
|
||
transcurrido = p.dura;
|
||
}
|
||
elNum.textContent = `${i + 1}/${pasos.length}`;
|
||
elTitulo.textContent = p.titulo;
|
||
elTexto.textContent = p.texto;
|
||
segmentos.forEach((s, k) => {
|
||
s.className = 'mx-seg' + (k < i || (k === i && completo) ? ' mx-hecho' : k === i ? ' mx-activo' : '');
|
||
s.firstChild.style.animationDuration = p.dura + 'ms';
|
||
});
|
||
programar();
|
||
}
|
||
|
||
function pausar(valor) {
|
||
if (valor === pausado) return;
|
||
if (valor && andando()) transcurrido += performance.now() - marca;
|
||
pausado = valor;
|
||
pintarPausa();
|
||
/* Tras navegar en pausa el paso está completo: al reanudar sigue el siguiente. */
|
||
if (!pausado && ev >= pasos[i].eventos.length && transcurrido >= pasos[i].dura) irA((i + 1) % pasos.length);
|
||
else programar();
|
||
}
|
||
|
||
function pintarPausa() {
|
||
raiz.classList.toggle('mx-pausado', !andando());
|
||
btnPausar.textContent = pausado ? 'Reproducir' : 'Pausar';
|
||
btnPausar.setAttribute('aria-pressed', String(pausado));
|
||
q('[data-leyenda]').setAttribute('aria-live', pausado ? 'polite' : 'off');
|
||
}
|
||
|
||
const reiniciar = () => irA(0, pausado);
|
||
|
||
btnPausar.addEventListener('click', () => pausar(!pausado));
|
||
q('[data-reiniciar]').addEventListener('click', reiniciar);
|
||
q('[data-anterior]').addEventListener('click', () => irA((i - 1 + pasos.length) % pasos.length, pausado));
|
||
q('[data-siguiente]').addEventListener('click', () => irA((i + 1) % pasos.length, pausado));
|
||
|
||
/* Arranca al entrar en pantalla y se detiene al salir. */
|
||
new IntersectionObserver(([e]) => {
|
||
const antes = andando();
|
||
if (antes && !e.isIntersecting) transcurrido += performance.now() - marca;
|
||
visible = e.isIntersecting;
|
||
pintarPausa();
|
||
if (andando() !== antes) programar();
|
||
}, { threshold: 0.25 }).observe(raiz);
|
||
|
||
irA(0, pausado);
|
||
pintarPausa();
|
||
return { irA, pausar, reiniciar, aplicarFase };
|
||
}
|
||
|
||
document.querySelectorAll('[data-matrix-demo]').forEach((raiz) => {
|
||
raiz.matrixDemo = montarMatrixDemo(raiz);
|
||
});
|
||
</script>
|
||
<script>
|
||
/* SOLO VISTA PREVIA: ajusta el lienzo a la ventana; #paso=N abre ese paso en
|
||
pausa y completo, y #paso=N&fase=K lo deja en la fase K. */
|
||
(function () {
|
||
const marco = document.querySelector('.vista-previa');
|
||
const ajustar = () => {
|
||
const s = Math.min(innerWidth / 390, innerHeight / 844, 1);
|
||
marco.style.transform = 'scale(' + s + ')';
|
||
};
|
||
addEventListener('resize', ajustar);
|
||
ajustar();
|
||
const h = new URLSearchParams(location.hash.slice(1));
|
||
if (h.has('paso')) {
|
||
const demo = document.querySelector('[data-matrix-demo]').matrixDemo;
|
||
demo.pausar(true);
|
||
demo.irA(Number(h.get('paso')) - 1, !h.has('fase'));
|
||
if (h.has('fase')) demo.aplicarFase(Number(h.get('fase')), false);
|
||
document.querySelector('.mx-pant').classList.add('mx-quieta');
|
||
}
|
||
})();
|
||
</script>
|
||
</body>
|
||
</html>
|