Initial private backup - working local version

This commit is contained in:
Isaac Aracena
2026-05-05 14:18:59 -04:00
commit c9a3723058
16 changed files with 4279 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
VITE_FIREBASE_API_KEY=tu_api_key
VITE_FIREBASE_AUTH_DOMAIN=tu_auth_domain
VITE_FIREBASE_PROJECT_ID=tu_project_id
VITE_FIREBASE_STORAGE_BUCKET=tu_storage_bucket
VITE_FIREBASE_MESSAGING_SENDER_ID=tu_messaging_sender_id
VITE_FIREBASE_APP_ID=tu_app_id
VITE_WEBHOOK_URL=http://localhost:5678/webhook-test/cruce-cuentas-fase5
+47
View File
@@ -0,0 +1,47 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# Dependencies
node_modules/
# Build outputs
dist/
build/
dist-ssr/
# Local env files
.env
.env.local
.env.production
.env.development
.env.*.local
.env.*
!.env.example
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Temporales de procesamiento y backups
samples-local/
tmp/
*.xlsx
*.xls
*.csv
backups/
docs/workflows-local-backup/
+46
View File
@@ -0,0 +1,46 @@
# Cruce de Cuentas GLM
Sistema de conciliación de cuentas entre registros bancarios, nómina y BambooHR.
## Descripción
Este proyecto es una interfaz frontend profesional diseñada para gestionar el proceso de cruce de cuentas (reconciliación) de GLM. Permite cargar archivos, ejecutar el motor de conciliación a través de n8n y visualizar los resultados e irregularidades detectadas.
## Requisitos
- Node.js (v18 o superior recomendado)
- npm o yarn
- Acceso a la instancia de n8n configurada
## Cómo instalar
1. Clonar el repositorio.
2. Ejecutar la instalación de dependencias:
```bash
npm install
```
## Cómo correr en local
1. Asegúrate de tener el archivo `.env` configurado (puedes basarte en `.env.example`).
2. Inicia el servidor de desarrollo:
```bash
npm run dev
```
3. Abre [http://localhost:5173](http://localhost:5173) en tu navegador.
## Cómo generar build
Para generar la versión de producción:
```bash
npm run build
```
Los archivos optimizados se generarán en la carpeta `dist/`.
## Variables de Entorno Requeridas
El proyecto requiere las siguientes variables en un archivo `.env`:
- `VITE_FIREBASE_API_KEY`: API Key de Firebase.
- `VITE_FIREBASE_AUTH_DOMAIN`: Dominio de autenticación.
- `VITE_FIREBASE_PROJECT_ID`: ID del proyecto Firebase.
- `VITE_FIREBASE_STORAGE_BUCKET`: Bucket de almacenamiento.
- `VITE_FIREBASE_MESSAGING_SENDER_ID`: ID del remitente de mensajería.
- `VITE_FIREBASE_APP_ID`: ID de la aplicación Firebase.
- `VITE_WEBHOOK_URL`: URL del webhook de n8n para procesar el cruce.
## Nota de Seguridad
**IMPORTANTE:** Nunca subas el archivo `.env` o cualquier archivo con credenciales reales al repositorio. El archivo `.gitignore` está configurado para excluir archivos sensibles. Solo comparte `.env.example` con los nombres de las variables necesarias.
+21
View File
@@ -0,0 +1,21 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import { defineConfig, globalIgnores } from 'eslint/config'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{js,jsx}'],
extends: [
js.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
globals: globals.browser,
parserOptions: { ecmaFeatures: { jsx: true } },
},
},
])
+13
View File
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cruce de Cuentas GLM</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
+3460
View File
File diff suppressed because it is too large Load Diff
+28
View File
@@ -0,0 +1,28 @@
{
"name": "cruce-cuentas-glm",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"firebase": "^12.12.1",
"react": "^19.2.5",
"react-dom": "^19.2.5"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
"eslint": "^10.2.1",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.2",
"globals": "^17.5.0",
"vite": "^8.0.10"
}
}
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.3 KiB

+24
View File
@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="bluesky-icon" viewBox="0 0 16 17">
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
</symbol>
<symbol id="discord-icon" viewBox="0 0 20 19">
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
</symbol>
<symbol id="documentation-icon" viewBox="0 0 21 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
</symbol>
<symbol id="github-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
</symbol>
<symbol id="social-icon" viewBox="0 0 20 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
</symbol>
<symbol id="x-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

+132
View File
@@ -0,0 +1,132 @@
:root {
--bg: #f4f7fb;
--surface: #ffffff;
--soft: #f7faff;
--text: #172033;
--muted: #63728a;
--faint: #8391a7;
--line: #dbe6f2;
--blue: #1c63d8;
--blue2: #0d47a7;
--green: #11845b;
--amber: #b46c00;
--red: #c43b3b;
--shadow: 0 18px 50px rgba(25, 45, 76, .11);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 12% 4%, rgba(28,99,216,.16), transparent 34%), radial-gradient(circle at 92% 10%, rgba(17,132,91,.12), transparent 30%), var(--bg); min-width: 320px; }
button, input, select { font: inherit; }
button { border: 0; }
a { color: inherit; }
.kicker { margin: 0 0 10px; color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.loginPage { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.loginCard { width: min(520px, 100%); padding: 50px; text-align: center; background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow); }
.symbol { width: 58px; height: 44px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.symbol span { width: 30px; height: 19px; border: 6px solid var(--blue); border-radius: 9px; transform: rotate(-42deg); }
.symbol span + span { margin-left: -8px; border-color: #20a886; transform: rotate(42deg); }
.loginCard h1 { margin: 0; font-size: clamp(34px,5vw,52px); letter-spacing: -.045em; line-height: 1; }
.lead { margin: 18px auto 28px; max-width: 360px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.inlineError { margin-bottom: 16px; padding: 12px 14px; color: #8b2020; background: #fff0f0; border: 1px solid #ffd3d3; border-radius: 14px; font-weight: 800; }
.googleBtn { width: 100%; min-height: 58px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; color: var(--text); background: #fff; border: 1px solid #c6d3e5; border-radius: 17px; box-shadow: 0 14px 30px rgba(28,99,216,.12); font-weight: 900; cursor: pointer; }
.googleBtn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 20px 38px rgba(28,99,216,.16); }
.googleBtn:disabled { opacity: .65; cursor: not-allowed; }
.googleIcon { width: 30px; height: 30px; display: grid; place-items: center; color: white; background: linear-gradient(135deg,#4285f4,#34a853 45%,#fbbc05 72%,#ea4335); border-radius: 50%; }
.accessNote { margin: 24px 0 0; color: var(--muted); line-height: 1.6; }
.topHeader, .container { width: min(1220px, calc(100% - 40px)); margin: 0 auto; }
.topHeader { padding: 28px 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topHeader h1 { margin: 0; font-size: clamp(30px,4vw,44px); letter-spacing: -.045em; }
.sessionBox { display: flex; align-items: center; gap: 10px; padding: 8px; background: rgba(255,255,255,.82); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 10px 24px rgba(25,45,76,.07); }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; color: white; background: var(--blue); border-radius: 50%; font-weight: 900; }
.sessionEmail { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.logoutBtn { min-height: 38px; padding: 0 16px; color: #9d2424; background: #fff0f0; border-radius: 999px; font-weight: 900; cursor: pointer; }
.container { padding: 16px 0 60px; }
.heroPanel, .card, .submitPanel, .resultSection, .errorSection { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 12px 34px rgba(25,45,76,.08); }
.heroPanel { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: center; padding: 34px; }
.heroPanel h2 { margin: 0; max-width: 760px; font-size: clamp(32px,5vw,58px); line-height: 1.02; letter-spacing: -.055em; }
.heroPanel p:not(.kicker) { max-width: 650px; margin: 18px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.progressBox { padding: 22px; background: linear-gradient(180deg,#fff,#f8fbff); border: 1px solid var(--line); border-radius: 22px; }
.progressBox div:first-child { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-weight: 800; }
.progressBox strong { color: var(--text); font-size: 34px; letter-spacing: -.05em; }
.progressTrack { height: 10px; margin-top: 16px; overflow: hidden; background: #e8eef7; border-radius: 999px; }
.progressTrack span { display: block; height: 100%; background: linear-gradient(90deg,var(--blue),#20a886); border-radius: inherit; transition: width .2s ease; }
.stepLine { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 18px 0; }
.step { min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: var(--muted); background: rgba(255,255,255,.78); border: 1px solid var(--line); border-radius: 18px; font-weight: 900; }
.step span { width: 30px; height: 30px; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: 50%; font-size: 13px; }
.step.done { color: var(--green); background: #ebf8f2; border-color: #bfe7d7; }
.step.done span { color: white; background: var(--green); border-color: var(--green); }
.step.active { color: var(--blue); background: #edf4ff; }
.formGrid { display: grid; grid-template-columns: minmax(320px,.9fr) minmax(380px,1.1fr); gap: 18px; }
.card, .submitPanel, .resultSection, .errorSection { padding: 28px; }
.sectionHead { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.sectionHead > span { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--blue); background: #edf4ff; border: 1px solid #bfd5ff; border-radius: 14px; font-weight: 900; }
.sectionHead h2, .submitPanel h2, .resultSection h2, .errorSection h2 { margin: 0; font-size: clamp(24px,3vw,34px); line-height: 1.08; letter-spacing: -.04em; }
.sectionHead p, .submitPanel p, .resultSection p, .errorSection p, .softPanel p { margin: 8px 0 0; color: var(--muted); line-height: 1.6; }
.fieldsGrid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.field { display: grid; gap: 8px; }
.field span { font-weight: 900; }
.field input, .field select { width: 100%; min-height: 48px; padding: 0 14px; color: var(--text); background: white; border: 1px solid #c7d5e7; border-radius: 14px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(28,99,216,.12); }
.fileGrid { display: grid; gap: 14px; }
.fileBox { padding: 18px; background: var(--soft); border: 1px solid var(--line); border-radius: 20px; }
.fileBox.ready { background: #f8fffc; border-color: #bfe7d7; }
.fileBoxTop { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fileBox h3 { margin: 0; font-size: 16px; }
.fileBox p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.fileBoxTop > span { height: 28px; padding: 6px 10px; color: var(--muted); background: #eef2f7; border-radius: 999px; font-size: 12px; font-weight: 900; }
.fileBox.ready .fileBoxTop > span { color: var(--green); background: #e7f6f0; }
.fileButton { min-height: 52px; display: flex; align-items: center; justify-content: center; padding: 12px 14px; color: var(--blue); background: #fff; border: 1px dashed #9fb3cf; border-radius: 16px; font-weight: 900; cursor: pointer; }
.fileButton input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.fileList { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.fileList li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; color: var(--muted); background: rgba(255,255,255,.8); border-radius: 12px; font-size: 13px; }
.fileList span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.submitPanel { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(135deg,#112a50,#143a73); }
.submitPanel h2, .submitPanel p { color: white; }
.submitPanel p { opacity: .76; }
.submitBtn { min-width: 260px; min-height: 54px; padding: 0 24px; color: white; background: linear-gradient(135deg,var(--blue),var(--blue2)); border-radius: 16px; box-shadow: 0 16px 34px rgba(0,0,0,.18); font-weight: 900; cursor: pointer; }
.submitBtn:disabled { opacity: .48; cursor: not-allowed; }
.resultSection, .errorSection { margin-top: 18px; }
.resultHeader { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.mainLink, .sheetPanel a { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 0 18px; color: white; background: linear-gradient(135deg,var(--blue),var(--blue2)); border-radius: 14px; text-decoration: none; font-weight: 900; white-space: nowrap; }
.metricsGrid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 22px 0; }
.metric { min-height: 108px; padding: 18px; background: var(--soft); border: 1px solid var(--line); border-radius: 18px; }
.metric span { color: var(--muted); font-size: 13px; font-weight: 900; }
.metric strong { display: block; margin-top: 10px; font-size: clamp(24px,3vw,36px); letter-spacing: -.05em; }
.metric.danger strong { color: var(--red); } .metric.warning strong { color: var(--amber); } .metric.success strong { color: var(--green); font-size: clamp(21px,2.4vw,30px); }
.resultGrid { display: grid; grid-template-columns: 1fr 340px; gap: 14px; margin-bottom: 14px; }
.softPanel { padding: 20px; background: var(--soft); border: 1px solid var(--line); border-radius: 20px; }
.softPanel h3 { margin: 0 0 14px; font-size: 18px; }
.categoryStack { display: grid; gap: 14px; }
.categoryItem > div { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 8px; color: var(--muted); }
.categoryItem strong { color: var(--text); }
.categoryItem em { display: block; height: 8px; overflow: hidden; background: #e8eef7; border-radius: 999px; }
.categoryItem i { display: block; height: 100%; background: linear-gradient(90deg,var(--blue),#20a886); border-radius: inherit; }
.sheetPanel { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.tablePanel { padding: 0; overflow: hidden; }
.tablePanel h3 { padding: 20px 20px 0; }
.tableWrap { overflow-x: auto; }
table { width: 100%; min-width: 900px; border-collapse: collapse; }
th, td { padding: 14px 16px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); background: #f1f6fc; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: 14px; line-height: 1.45; }
.priority { display: inline-flex; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.priority.alto { color: var(--red); background: #fff0f0; } .priority.medio { color: var(--amber); background: #fff7e8; } .priority.bajo, .priority.ok { color: var(--green); background: #e7f6f0; }
.notes { display: grid; gap: 8px; margin-top: 14px; }
.notes p { margin: 0; padding: 12px 14px; color: #684806; background: #fff7e8; border: 1px solid #ffe0a8; border-radius: 14px; font-size: 14px; }
.errorSection { border-color: #ffd2d2; background: #fffafa; }
.debugBox { margin-top: 16px; overflow: hidden; background: #111827; border-radius: 16px; }
.debugBox summary { padding: 14px 16px; color: white; cursor: pointer; font-weight: 900; }
.debugBox pre { max-height: 420px; overflow: auto; margin: 0; padding: 0 16px 16px; color: #cbd5e1; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
@media (max-width: 980px) { .topHeader, .sessionBox, .submitPanel, .resultHeader { flex-direction: column; align-items: stretch; } .topHeader, .sessionBox, .submitPanel, .resultHeader { display: flex; } .heroPanel, .formGrid, .resultGrid { grid-template-columns: 1fr; } .metricsGrid, .stepLine { grid-template-columns: repeat(2,1fr); } .mainLink, .submitBtn { width: 100%; } }
@media (max-width: 640px) { .topHeader, .container { width: min(100% - 24px, 1220px); } .heroPanel, .card, .submitPanel, .resultSection, .errorSection, .loginCard { padding: 22px; border-radius: 22px; } .fieldsGrid, .metricsGrid, .stepLine { grid-template-columns: 1fr; } .sessionEmail { max-width: 100%; } }
.technicalWarning {
margin: 18px 0 0;
padding: 14px 16px;
color: #6b4b05;
background: #fff7e8;
border: 1px solid #ffd58b;
border-radius: 16px;
line-height: 1.55;
}
.technicalWarning strong { color: #493103; }
+445
View File
@@ -0,0 +1,445 @@
import { useEffect, useMemo, useState } from 'react';
import { onAuthStateChanged } from 'firebase/auth';
import { auth, loginWithGoogle, logout } from './firebase';
import './App.css';
const DOMAIN = '@gomezleemarketing.com';
const MONTHS = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
const FILE_INPUTS = [
{ key: 'bambooActivo', title: 'Bamboo activo', note: 'Empleados activos del período', accept: '.xlsx,.xls' },
{ key: 'bambooAdditionsTerminations', title: 'Bamboo additions / terminations', note: 'Altas, bajas y cambios', accept: '.xlsx,.xls' },
{ key: 'nominaExcel', title: 'Nómina', note: 'Nómina consolidada', accept: '.xlsx,.xls' },
{ key: 'bancoFiles', title: 'Banco', note: 'Movimientos bancarios exportados del banco en CSV', accept: '.csv', multiple: true },
];
function cx(...classes) {
return classes.filter(Boolean).join(' ');
}
function money(value, currency = 'QTZ') {
const amount = Number(value || 0);
return `${currency} ${amount.toLocaleString('es-GT', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
}
function fileSize(size) {
if (!size && size !== 0) return '';
if (size < 1024) return `${size} B`;
if (size < 1024 * 1024) return `${Math.round(size / 1024)} KB`;
return `${(size / 1024 / 1024).toFixed(1)} MB`;
}
function responseSheetUrl(data) {
return data?.reporteGoogleSheetsUrl || data?.googleSheet?.url || data?.folderUrl || '';
}
function responseSheetTitle(data) {
return data?.googleSheet?.title || 'Reporte de Google Sheets';
}
function normalizeIssues(data) {
const direct = Array.isArray(data?.irregularidades) ? data.irregularidades : [];
const topGeneral = Array.isArray(data?.topGeneral) ? data.topGeneral : [];
const topAltas = Array.isArray(data?.topAltas) ? data.topAltas : [];
const samples = Array.isArray(data?.samples?.irregularidades) ? data.samples.irregularidades : [];
const rows = direct.length ? direct : topGeneral.length ? topGeneral : topAltas.length ? topAltas : samples;
return rows.filter((row) => row && typeof row === 'object');
}
function buildResultSummary(data) {
const base = data?.resumenEjecutivo || data?.summary || {};
const issues = normalizeIssues(data);
const realIssues = issues.filter((row) => String(row.Prioridad || '').toUpperCase() !== 'OK');
const high = realIssues.filter((row) => String(row.Prioridad || '').toUpperCase() === 'ALTO');
const medium = realIssues.filter((row) => String(row.Prioridad || '').toUpperCase() === 'MEDIO');
const low = realIssues.filter((row) => String(row.Prioridad || '').toUpperCase() === 'BAJO');
const risk = realIssues.reduce((sum, row) => sum + Number(row.MontoRiesgo || 0), 0);
const merged = {
...base,
totalIrregularidades: base.totalIrregularidades ?? realIssues.length,
totalAltas: base.totalAltas ?? high.length,
totalMedias: base.totalMedias ?? medium.length,
totalBajas: base.totalBajas ?? low.length,
montoRiesgoTotal: base.montoRiesgoTotal ?? risk,
montoRiesgoTotalFormateado: base.montoRiesgoTotalFormateado || money(base.montoRiesgoTotal ?? risk),
};
const hasOnlyOkRow = issues.length === 1 && String(issues[0]?.Prioridad || '').toUpperCase() === 'OK';
const hasNoParsedRows = [
merged.totalNominaRowsEntrada,
merged.totalNominaRowsValidas,
merged.totalBancoRowsEntrada,
merged.totalBancoRowsValidas,
].some((value) => value === 0);
return { resumen: merged, issues: realIssues.length ? realIssues : issues, isSuspiciousEmpty: hasOnlyOkRow || hasNoParsedRows };
}
function categoriesFromData(data, issues) {
if (Array.isArray(data?.categorias) && data.categorias.length) return data.categorias;
const source = data?.summary?.categorias || data?.resumenEjecutivo?.categorias;
if (source && typeof source === 'object') return Object.entries(source).map(([categoria, cantidad]) => ({ categoria, cantidad }));
const counts = {};
for (const row of issues || []) counts[row.Categoria || 'Sin categoría'] = (counts[row.Categoria || 'Sin categoría'] || 0) + 1;
return Object.entries(counts).map(([categoria, cantidad]) => ({ categoria, cantidad }));
}
function LoginView({ loading, error, onLogin }) {
return (
<main className="loginPage">
<section className="loginCard">
<div className="symbol" aria-hidden="true"><span /><span /></div>
<p className="kicker">Auditoría interna</p>
<h1>Cruce de Cuentas</h1>
<p className="lead">Panel seguro para detectar irregularidades entre Bamboo, nómina y banco.</p>
{error && <div className="inlineError">{error}</div>}
<button className="googleBtn" onClick={onLogin} disabled={loading} type="button">
<span className="googleIcon">G</span>
{loading ? 'Validando acceso…' : 'Continuar con Google corporativo'}
</button>
<p className="accessNote">Acceso restringido a cuentas corporativas <strong>{DOMAIN}</strong></p>
</section>
</main>
);
}
function Header({ user }) {
return (
<header className="topHeader">
<div>
<p className="kicker">Uso interno · Datos confidenciales</p>
<h1>Cruce de Cuentas</h1>
</div>
<div className="sessionBox">
<span className="avatar">{user?.email?.[0]?.toUpperCase() || 'U'}</span>
<span className="sessionEmail">{user?.email}</span>
<button className="logoutBtn" onClick={logout} type="button">Cerrar sesión</button>
</div>
</header>
);
}
function Progress({ percent }) {
return (
<aside className="progressBox">
<div><span>Preparación</span><strong>{percent}%</strong></div>
<div className="progressTrack"><span style={{ width: `${percent}%` }} /></div>
</aside>
);
}
function StepLine({ contextReady, filesReady, submitting, hasResult }) {
const steps = [
['Contexto', contextReady],
['Archivos', filesReady],
['Proceso', submitting || hasResult],
['Reporte', hasResult],
];
return (
<div className="stepLine">
{steps.map(([label, done], index) => (
<div className={cx('step', done && 'done', submitting && label === 'Proceso' && 'active')} key={label}>
<span>{done ? '✓' : index + 1}</span>
<strong>{label}</strong>
</div>
))}
</div>
);
}
function Field({ label, children }) {
return <label className="field"><span>{label}</span>{children}</label>;
}
function FileBox({ config, value, onChange }) {
const files = config.multiple ? value : value ? [value] : [];
const ready = files.length > 0;
return (
<article className={cx('fileBox', ready && 'ready')}>
<div className="fileBoxTop">
<div>
<h3>{config.title}</h3>
<p>{config.note}</p>
</div>
<span>{ready ? 'Listo' : 'Pendiente'}</span>
</div>
<label className="fileButton">
<input
type="file"
accept={config.accept}
multiple={config.multiple}
required
onChange={(event) => onChange(config.key, config.multiple ? Array.from(event.target.files || []) : event.target.files?.[0] || null)}
/>
{ready ? 'Cambiar archivo' : 'Seleccionar archivo'}
</label>
{ready && (
<ul className="fileList">
{files.slice(0, 4).map((file, idx) => (
<li key={`${file.name}-${idx}`}><span>{file.name}</span><small>{fileSize(file.size)}</small></li>
))}
{files.length > 4 && <li><span>+{files.length - 4} archivo(s) adicional(es)</span></li>}
</ul>
)}
</article>
);
}
function Metric({ label, value, tone }) {
return <div className={cx('metric', tone)}><span>{label}</span><strong>{value}</strong></div>;
}
function ResultView({ data }) {
const { resumen, issues, isSuspiciousEmpty } = buildResultSummary(data);
const categorias = categoriesFromData(data, issues);
const rows = issues;
const sheetUrl = responseSheetUrl(data);
return (
<section className="resultSection">
<div className="resultHeader">
<div>
<p className="kicker">Reporte generado</p>
<h2>{resumen.tituloResultado || data.message || 'Cruce completado'}</h2>
<p>{resumen.recomendacionPrincipal || 'Revisa primero los casos de prioridad alta y confirma los hallazgos con RRHH/Finanzas.'}</p>
</div>
{sheetUrl && <a className="mainLink" href={sheetUrl} target="_blank" rel="noreferrer">Abrir Google Sheet</a>}
</div>
{isSuspiciousEmpty && (
<div className="technicalWarning">
<strong>Revisión técnica recomendada:</strong> n8n devolvió un resultado vacío/OK aunque se enviaron archivos. Esto suele pasar cuando el flujo no convirtió filas desde los binarios, cuando el banco no está en CSV o cuando el frontend apunta a un webhook distinto al flujo actualizado. Revisa en la respuesta completa los totales de filas de nómina y banco.
</div>
)}
<div className="metricsGrid">
<Metric label="Irregularidades" value={resumen.totalIrregularidades ?? 0} />
<Metric label="Prioridad alta" value={resumen.totalAltas ?? 0} tone="danger" />
<Metric label="Prioridad media" value={resumen.totalMedias ?? 0} tone="warning" />
<Metric label="Riesgo estimado" value={resumen.montoRiesgoTotalFormateado || money(resumen.montoRiesgoTotal)} tone="success" />
</div>
<div className="resultGrid">
<div className="softPanel">
<h3>Categorías principales</h3>
<div className="categoryStack">
{categorias.slice(0, 6).map((item) => {
const count = Number(item.cantidad || 0);
const total = Number(resumen.totalIrregularidades || count || 1);
return (
<div className="categoryItem" key={item.categoria}>
<div><span>{item.categoria}</span><strong>{count}</strong></div>
<em><i style={{ width: `${Math.min(100, Math.round((count / total) * 100))}%` }} /></em>
</div>
);
})}
</div>
</div>
<div className="softPanel sheetPanel">
<h3>Salida oficial</h3>
<p>{responseSheetTitle(data)}</p>
{sheetUrl ? <a href={sheetUrl} target="_blank" rel="noreferrer">Ver reporte</a> : <span>No se recibió enlace.</span>}
</div>
</div>
<div className="softPanel tablePanel">
<h3>Casos prioritarios</h3>
<div className="tableWrap">
<table>
<thead><tr><th>Prioridad</th><th>Categoría</th><th>Empleado</th><th>Monto</th><th>Acción sugerida</th></tr></thead>
<tbody>
{rows.slice(0, 8).map((row, index) => (
<tr key={`${row.EmpleadoNomina || row.Categoria}-${index}`}>
<td><span className={cx('priority', String(row.Prioridad || '').toLowerCase())}>{row.Prioridad || 'N/A'}</span></td>
<td>{row.Categoria || '-'}</td>
<td>{row.EmpleadoNomina || row.BeneficiarioBanco || '-'}</td>
<td>{row.MontoRiesgoFormateado || money(row.MontoRiesgo || 0, row.Moneda || 'QTZ')}</td>
<td>{row.AccionSugerida || 'Revisar manualmente.'}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
{data.alertas?.length > 0 && <div className="notes">{data.alertas.map((a, i) => <p key={`${a}-${i}`}>{a}</p>)}</div>}
<details className="debugBox"><summary>Respuesta completa para soporte</summary><pre>{JSON.stringify(data, null, 2)}</pre></details>
</section>
);
}
function ErrorView({ error }) {
const message = error?.error || error?.message || 'No se pudo completar el proceso.';
return (
<section className="errorSection">
<p className="kicker">Error</p>
<h2>No se pudo procesar la corrida</h2>
<p>{message}</p>
<details className="debugBox" open><summary>Detalle técnico</summary><pre>{JSON.stringify(error, null, 2)}</pre></details>
</section>
);
}
export default function App() {
const [user, setUser] = useState(null);
const [loadingAuth, setLoadingAuth] = useState(true);
const [authError, setAuthError] = useState('');
const [pais, setPais] = useState('Guatemala');
const [mes, setMes] = useState('');
const [anio, setAnio] = useState(String(new Date().getFullYear()));
const [tipoCruce, setTipoCruce] = useState('Mensual');
const [quincena, setQuincena] = useState('');
const [files, setFiles] = useState({ bambooActivo: null, bambooAdditionsTerminations: null, nominaExcel: null, bancoFiles: [] });
const [submitting, setSubmitting] = useState(false);
const [result, setResult] = useState(null);
const [error, setError] = useState(null);
useEffect(() => {
const unsubscribe = onAuthStateChanged(auth, async (currentUser) => {
if (!currentUser) {
setUser(null);
setLoadingAuth(false);
return;
}
if (!currentUser.email?.endsWith(DOMAIN)) {
await logout();
setAuthError(`Solo se permiten correos ${DOMAIN}`);
setUser(null);
} else {
setUser(currentUser);
setAuthError('');
}
setLoadingAuth(false);
});
return () => unsubscribe();
}, []);
const contextReady = Boolean(pais && mes && anio && tipoCruce && (tipoCruce !== 'Quincenal' || quincena));
const filesReady = Boolean(files.bambooActivo && files.bambooAdditionsTerminations && files.nominaExcel && files.bancoFiles.length > 0);
const percent = useMemo(() => {
const checks = [pais, mes, anio, files.bambooActivo, files.bambooAdditionsTerminations, files.nominaExcel, files.bancoFiles.length > 0];
const extra = tipoCruce === 'Quincenal' ? [quincena] : [];
const all = [...checks, ...extra];
return Math.round((all.filter(Boolean).length / all.length) * 100);
}, [pais, mes, anio, tipoCruce, quincena, files]);
const doLogin = async () => {
setLoadingAuth(true);
setAuthError('');
try {
await loginWithGoogle();
} catch (err) {
setAuthError(err.message || 'No se pudo iniciar sesión.');
setLoadingAuth(false);
}
};
const updateFile = (key, value) => setFiles((current) => ({ ...current, [key]: value }));
const submit = async (event) => {
event.preventDefault();
setSubmitting(true);
setResult(null);
setError(null);
try {
if (!contextReady || !filesReady) throw new Error('Completa el contexto y adjunta todos los archivos requeridos.');
const webhookUrl = import.meta.env.VITE_WEBHOOK_URL;
if (!webhookUrl) throw new Error('VITE_WEBHOOK_URL no está configurado en .env');
const token = await user.getIdToken();
const formData = new FormData();
formData.append('pais', pais.trim());
formData.append('mes', mes.trim());
formData.append('anio', anio.trim());
formData.append('tipoCruce', tipoCruce);
if (tipoCruce === 'Quincenal') formData.append('quincena', quincena);
formData.append('userEmail', user.email);
formData.append('authIdToken', token);
formData.append('frontendVersion', 'fase6-profesional-compat-2026-05-05');
formData.append('frontendPayloadMeta', JSON.stringify({
pais: pais.trim(),
mes: mes.trim(),
anio: anio.trim(),
tipoCruce,
quincena: tipoCruce === 'Quincenal' ? quincena : '',
files: {
bambooActivo: files.bambooActivo?.name || '',
bambooAdditionsTerminations: files.bambooAdditionsTerminations?.name || '',
nominaExcel: files.nominaExcel?.name || '',
bancoFiles: files.bancoFiles.map((file) => file.name),
},
}));
formData.append('bambooActivo', files.bambooActivo, files.bambooActivo.name);
formData.append('bambooAdditionsTerminations', files.bambooAdditionsTerminations, files.bambooAdditionsTerminations.name);
formData.append('nominaExcel', files.nominaExcel, files.nominaExcel.name);
files.bancoFiles.forEach((file) => formData.append('bancoFiles', file, file.name));
const response = await fetch(webhookUrl, { method: 'POST', body: formData });
const text = await response.text();
let data = {};
try {
data = text ? JSON.parse(text) : {};
} catch {
throw new Error(`El webhook respondió sin JSON válido: ${text.slice(0, 300)}`);
}
if (!response.ok || data.success === false) {
setError(data);
} else {
setResult(data);
}
} catch (err) {
setError({ success: false, error: err.message });
} finally {
setSubmitting(false);
}
};
if (!user) return <LoginView loading={loadingAuth} error={authError} onLogin={doLogin} />;
return (
<div className="appPage">
<Header user={user} />
<main className="container">
<section className="heroPanel">
<div>
<p className="kicker">Flujo conectado a n8n</p>
<h2>Convierte archivos sensibles en un reporte claro y accionable</h2>
<p>Carga Bamboo, nómina y banco. El backend genera un Google Sheet por corrida y devuelve un resumen ejecutivo.</p>
</div>
<Progress percent={percent} />
</section>
<StepLine contextReady={contextReady} filesReady={filesReady} submitting={submitting} hasResult={Boolean(result)} />
<form className="formGrid" onSubmit={submit}>
<section className="card contextCard">
<div className="sectionHead"><span>01</span><div><h2>Contexto de la corrida</h2><p>Información que identifica el período auditado.</p></div></div>
<div className="fieldsGrid">
<Field label="País"><input value={pais} onChange={(e) => setPais(e.target.value)} required placeholder="Guatemala" /></Field>
<Field label="Mes"><select value={mes} onChange={(e) => setMes(e.target.value)} required><option value="">Seleccionar</option>{MONTHS.map((m) => <option key={m}>{m}</option>)}</select></Field>
<Field label="Año"><input type="number" min="2020" max="2100" value={anio} onChange={(e) => setAnio(e.target.value)} required /></Field>
<Field label="Tipo de cruce"><select value={tipoCruce} onChange={(e) => setTipoCruce(e.target.value)}><option>Mensual</option><option>Quincenal</option></select></Field>
{tipoCruce === 'Quincenal' && <Field label="Quincena"><select value={quincena} onChange={(e) => setQuincena(e.target.value)} required><option value="">Seleccionar</option><option value="15">15</option><option value="30">30</option></select></Field>}
</div>
</section>
<section className="card filesCard">
<div className="sectionHead"><span>02</span><div><h2>Archivos requeridos</h2><p>Todos deben corresponder al mismo período.</p></div></div>
<div className="fileGrid">{FILE_INPUTS.map((item) => <FileBox key={item.key} config={item} value={files[item.key]} onChange={updateFile} />)}</div>
</section>
<section className="submitPanel">
<div><h2>Enviar a validación</h2><p>n8n cruzará los registros y devolverá el enlace al Google Sheet generado.</p></div>
<button className="submitBtn" disabled={submitting || !contextReady || !filesReady}>{submitting ? 'Procesando…' : 'Ejecutar cruce de cuentas'}</button>
</section>
</form>
{result && <ResultView data={result} />}
{error && <ErrorView error={error} />}
</main>
</div>
);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

+35
View File
@@ -0,0 +1,35 @@
import { initializeApp } from 'firebase/app';
import { getAuth, GoogleAuthProvider, signInWithPopup, signOut } from 'firebase/auth';
const firebaseConfig = {
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
appId: import.meta.env.VITE_FIREBASE_APP_ID
};
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
const provider = new GoogleAuthProvider();
export const loginWithGoogle = async () => {
try {
const result = await signInWithPopup(auth, provider);
const user = result.user;
// Solo permitir @gomezleemarketing.com
if (!user.email.endsWith('@gomezleemarketing.com')) {
await signOut(auth);
throw new Error('Solo se permiten correos @gomezleemarketing.com');
}
return user;
} catch (error) {
console.error("Error signing in", error);
throw error;
}
};
export const logout = () => signOut(auth);
+3
View File
@@ -0,0 +1,3 @@
html, body, #root { min-height: 100%; }
body { min-height: 100vh; }
#root { min-height: 100vh; }
+10
View File
@@ -0,0 +1,10 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)
+7
View File
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})