Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
34edc72
sprint 05-12
menjatot Dec 5, 2024
5837092
sprint dec
menjatot Dec 8, 2024
3bc7069
dec09
menjatot Dec 9, 2024
b308294
dec13
menjatot Dec 13, 2024
8206557
home_dic
menjatot Dec 15, 2024
e656606
12-17
menjatot Dec 17, 2024
1e7fc36
18-dic
menjatot Dec 18, 2024
2e1d51c
19-dic
menjatot Dec 19, 2024
ee8153c
dic-24
menjatot Dec 24, 2024
458f81b
26-dic
menjatot Dec 26, 2024
4e9e4d4
dic-27
menjatot Dec 27, 2024
87ec6cb
dic-27b
menjatot Dec 27, 2024
5a0d4e7
jan-01
menjatot Jan 1, 2025
896fe47
jan-01b
menjatot Jan 2, 2025
0f9b825
jan-02
menjatot Jan 2, 2025
6be0707
jan-03
menjatot Jan 3, 2025
c80791c
jan-03
menjatot Jan 3, 2025
e006242
jan-05
menjatot Jan 5, 2025
842fc52
jan-07
menjatot Jan 7, 2025
fef4b7b
Merge branch 'master' of https://github.com/menjatot/admin-one-vue-ta…
menjatot Jan 7, 2025
21c1ef9
jan-07
menjatot Jan 7, 2025
b497c19
jan-07
menjatot Jan 7, 2025
df71648
jan-07
menjatot Jan 7, 2025
9f07bad
jan-07
menjatot Jan 7, 2025
d125a06
jan-07
menjatot Jan 7, 2025
7cf8229
jan-08
menjatot Jan 8, 2025
0746bf2
jan-10
menjatot Jan 10, 2025
7a287eb
jan-10
menjatot Jan 10, 2025
eef8ce5
jan-13
menjatot Jan 13, 2025
80ea1f2
jan-14
menjatot Jan 14, 2025
947bd56
jan-14
menjatot Jan 14, 2025
c9f0cea
jan-14
menjatot Jan 14, 2025
2c8b38b
jan-15
menjatot Jan 15, 2025
3d349bb
jan-27
menjatot Jan 27, 2025
015a426
jan-27
menjatot Jan 27, 2025
3dd0bc0
jan-27
menjatot Jan 27, 2025
820ef14
feb-03
menjatot Feb 3, 2025
b3b6a70
feb_05
menjatot Feb 5, 2025
1803f38
feb-05
menjatot Feb 5, 2025
193b6c2
feb-05
menjatot Feb 5, 2025
b6e5b58
feb-06
menjatot Feb 6, 2025
07cb7f9
feb-06
menjatot Feb 6, 2025
079705b
feb-06
menjatot Feb 6, 2025
3cfb0b3
feb-06
menjatot Feb 6, 2025
32fc358
feb-07
menjatot Feb 7, 2025
6572a1c
feb-07
menjatot Feb 7, 2025
6ffcca8
feb-07
menjatot Feb 7, 2025
5ca4d14
feb-06
menjatot Feb 7, 2025
88e6211
feb-08
menjatot Feb 8, 2025
00abad1
feb-09
menjatot Feb 9, 2025
8bf780e
feb-10
menjatot Feb 11, 2025
1e320f1
feb-11
menjatot Feb 11, 2025
4df0ff6
feb-11
menjatot Feb 11, 2025
0d4c0f8
feb-10
menjatot Feb 11, 2025
ba6bfb2
feb-21
menjatot Feb 21, 2025
b67dc25
feb-21
menjatot Feb 21, 2025
26e5f39
feb-27
menjatot Feb 27, 2025
196bad0
feb-27
menjatot Feb 27, 2025
07e5f9a
mar-14
menjatot Mar 14, 2025
d1ea544
apr-08
menjatot Apr 8, 2025
f5c202a
apr-08
menjatot Apr 8, 2025
35edcf1
informes
menjatot Jun 11, 2025
579ee6b
ago-29
menjatot Aug 30, 2025
28b6dce
sep-04
menjatot Sep 4, 2025
2c27d92
sep-04
menjatot Sep 4, 2025
119602c
sep-30
menjatot Sep 30, 2025
2a9d730
Improve date extraction and validation in data import
menjatot Oct 10, 2025
bf91a76
Update LayoutAuthenticated.vue
menjatot Oct 16, 2025
e18756a
Integrate Doppler for environment management
menjatot Dec 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"permissions": {
"allow": [
"Read(/C:\\Users\\alejandro.minguez\\Documents\\webDev\\GitHub\\admin-one-vue-tailwind\\src\\stores/**)"
]
},
"enabledMcpjsonServers": [
"supabase"
],
"outputStyle": "Explanatory",
"enableAllProjectMcpServers": true
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ coverage
*.njsproj
*.sln
*.sw?

.codegpt
16 changes: 16 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sinaq/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /sinaq/index.html [L]
</IfModule>

# Permitir CORS y Headers necesarios
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,POST,OPTIONS,DELETE,PUT"
Header set Access-Control-Allow-Headers "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization"
Header set Content-Security-Policy "default-src 'self' 'unsafe-inline' 'unsafe-eval' https://login.microsoftonline.com https://*.microsoft.com data: ws:;"
</IfModule>
15 changes: 15 additions & 0 deletions .htaccess_bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sinaq/

# Proxy para manejar CORS
<!-- RewriteRule ^api/lecturas/(.*)$ http://localhost:3000/api/lecturas/$1 [P,L] -->
<!-- RewriteRule ^api/(.*)$ https://app.chj.es/ContadoresWebApiTest/api/$1 [P,L] -->
</IfModule>

# Habilitar CORS
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE,PATCH,OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"
</IfModule>
102 changes: 102 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Development Commands

- **Start development server**: `npm run dev` (Vite development server)
- **Build for production**: `npm run build` (Vite build)
- **Preview production build**: `npm run preview --port 4173`
- **Lint code**: `npm run lint` (ESLint with auto-fix)
- **Format code**: `npm run format` (Prettier)

## Project Architecture

This is a Vue 3 admin dashboard application built with:

- **Vue 3** with Composition API and `<script setup>` syntax
- **Vite** as build tool with custom base path `/sinaq/`
- **Tailwind CSS 3** for styling with custom scrollbar utilities
- **Vue Router 4** with hash-based routing and authentication guards
- **Pinia** for state management
- **PrimeVue 4** UI component library with custom theming
- **FormKit** for form handling
- **Vueform** for advanced form components

### Key Dependencies

- **@azure/msal-browser**: Microsoft authentication (MSAL)
- **@supabase/supabase-js**: Database integration
- **axios**: HTTP client
- **chart.js**: Data visualization
- **leaflet + @vue-leaflet/vue-leaflet**: Interactive maps
- **jspdf + jspdf-autotable**: PDF generation
- **xlsx**: Excel file handling
- **date-fns**: Date manipulation

### Application Structure

#### Authentication & Routing
- **Authentication flow**: Microsoft Azure AD via MSAL (`src/services/msalConfig.js`)
- **Session management**: 30-minute timeout with auto-logout in `src/stores/login.js`
- **Route guards** in `src/router/index.js`:
- Routes with `meta.requiresAuth: true` require authentication
- Routes with `meta.requiredRole: 'admin'` require admin privileges (role '99', 99, or 'admin')
- Session expiry checked on each navigation with `checkSessionExpiry()`
- Session renewed on each authenticated route navigation via `renewSession()`
- **User state persistence**: sessionStorage for user data, avatar, role, and session timestamps
- **Router mode**: Hash-based routing (`createWebHashHistory`)
- **Unauthenticated users** redirected to `/login`
- **Unauthorized users** redirected to `/unauthorized`

#### Main Application Areas
- **Home** (`/`): Excel uploader and analytics (`ExcelUploaderView.vue`)
- **Admin Panel** (`/admin/*`): CRUD operations requiring admin role
- `/admin/operarios`: Operators management
- `/admin/unidades_operativas`: Operational units management
- `/admin/zonas`: Zones management
- `/admin/infraestructuras`: Infrastructure management
- `/admin/puntos_muestreo`: Sampling points management
- **Map Visualization** (`/mapa`): Interactive map of sampling points using Leaflet
- **Analytics Table** (`/tablaAnaliticas`): Table view of analytics data
- **Settings** (`/settings`): Configuration panel (admin only)

#### Service Layer Architecture
Services in `src/services/` handle data operations:
- **Authentication**: `msalConfig.js` (Microsoft authentication integration)
- **Database**: `supabase.js` (Supabase client configuration)
- **Domain Services**: Separate files for each entity (operarios, uo, zonas, infraestructuras, puntosMuestreo, analiticas)
- **External APIs**: `factorialConfig.js` (Factorial HR integration)

#### Store Management (Pinia)
- **main.js**: Sample data and general app state
- **login.js**: Authentication state with session timeout management
- Watchers persist state to sessionStorage
- Session timeout clears after 30 minutes of inactivity
- Provides `login()`, `logout()`, `renewSession()`, `checkSessionExpiry()`
- **auth.js**: Additional auth utilities
- **plantas.js**: Plant/facility data
- **darkMode.js**: Theme switching

### Code Style & Standards

- **ESLint**: Vue 3 recommended + eslint:recommended rules
- **Prettier**: 2 spaces, single quotes, no semicolons, 100 char width, no trailing commas
- **Components**: Use Composition API with `<script setup>` syntax
- **Path alias**: `@/` points to `src/` directory
- **ECMAScript**: Target ES2022 (top-level await supported)

### Custom Styling

- **Tailwind extended** with custom scrollbar utilities (`aside-scrollbars` with light/gray variants)
- **PrimeVue theming**: Disabled in favor of Tailwind classes (`theme: 'none'`)
- **Custom animations**: fade-in/fade-out keyframes and transitions
- **Dark mode**: Supported via CSS classes (`darkMode: 'class'` in Tailwind config)
- **Responsive layout**: Mobile-first design with collapsable sidebar

### Build Configuration

- **Vite target**: ES2022 for top-level await support
- **Base path**: `/sinaq/` for deployment
- **Vue options**: Production hydration mismatch details disabled
- **Asset handling**: Static assets served from `/sinaq/` base path
73 changes: 73 additions & 0 deletions GEMINI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Project Overview

This is a Vue.js 3 admin dashboard project built with Tailwind CSS 3 and Vite. It uses Pinia for state management and Vue Router for routing. The project uses MSAL for Microsoft authentication. It is a customizable and responsive admin template with a dark mode feature.

## Building and Running

### Installation
To install the project dependencies, run:
```bash
npm install
```

### Development
To run the project in development mode with hot-reloading, use:
```bash
npm run dev
```

### Production Build
To build the project for production, run:
```bash
npm run build
```

### Preview
To preview the production build, use:
```bash
npm run preview
```

### Linting
To lint the project files, run:
```bash
npm run lint
```

## Development Conventions

- **Framework:** Vue.js 3 with Composition API and `<script setup>` syntax.
- **State Management:** Pinia is used for state management.
- **Routing:** Vue Router is used for routing.
- **Authentication:** MSAL (Microsoft Authentication Library) is used for Microsoft authentication.
- **Styling:** Tailwind CSS is used for styling.
- **Build Tool:** Vite is used as the build tool.
- **Linting:** ESLint is used for linting.
- **Formatting:** Prettier is used for code formatting.

## Project Structure

The `src` directory contains the main source code of the application.

- **`assets`:** Contains static assets like images and CSS files.
- **`components`:** Contains reusable Vue components.
- **`composables`:** Contains composable functions for reusing logic across components.
- **`constants`:** Contains constant values used throughout the application.
- **`css`:** Contains the main CSS file and Tailwind CSS configuration.
- **`helpers`:** Contains helper functions.
- **`layouts`:** Contains layout components for different pages.
- **`router`:** Contains the Vue Router configuration.
- **`services`:** Contains services for interacting with APIs and MSAL configuration.
- **`stores`:** Contains Pinia stores for state management.
- **`views`:** Contains the application's views or pages.
- **`App.vue`:** The root Vue component.
- **`main.js`:** The entry point of the application.

## Features

- **Authentication:** The application has a login system with Microsoft authentication using MSAL.
- **Dashboard:** A dashboard page to display important information.
- **Tables:** Components for displaying data in tables.
- **Forms:** Components for creating and managing forms.
- **Dark Mode:** The application has a dark mode feature.
- **Responsive Layout:** The application is designed to be responsive and work on different screen sizes.
112 changes: 112 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Mejoras de Seguridad Implementadas

## 1. Almacenamiento Seguro de Sesión

### ✅ Cambios Realizados
- **sessionStorage** en lugar de localStorage para datos sensibles
- Los datos se eliminan automáticamente al cerrar la pestaña
- Mayor seguridad contra acceso no autorizado

### 📁 Archivos Modificados
- `src/stores/login.js` - Migración completa a sessionStorage

### 🔒 Beneficios
- Sesiones no persisten después de cerrar el navegador
- Datos aislados entre pestañas diferentes
- Menor superficie de ataque

## 2. Expiración Automática de Sesión

### ✅ Funcionalidades
- **Timeout de sesión**: 30 minutos de inactividad
- **Renovación automática**: Se renueva con cada actividad del usuario
- **Limpieza automática**: Logout automático al expirar

### 📁 Archivos Creados/Modificados
- `src/stores/login.js` - Lógica de timeout y renovación
- `src/composables/useSessionSecurity.js` - Monitor de actividad del usuario
- `src/layouts/LayoutAuthenticated.vue` - Integración automática

### 🔒 Beneficios
- Protección contra sesiones abandonadas
- Logout automático por inactividad
- Monitoreo de actividad del usuario

## 3. Sistema de Autorización Mejorado

### ✅ Funcionalidades
- **Control de roles**: Verificación granular por ruta
- **Rutas protegidas**: Admin panel solo para administradores
- **Validación automática**: En cada navegación

### 📁 Archivos Modificados
- `src/router/index.js` - Guards de navegación mejorados
- Rutas `/admin` y `/settings` requieren rol 'admin'

### 🔒 Beneficios
- Acceso controlado basado en roles
- Prevención de escalada de privilegios
- Redirección automática a página de no autorizado

## 4. Monitoreo de Seguridad de Sesión

### ✅ Funcionalidades
- **Monitor de actividad**: Detecta interacción del usuario
- **Verificación inicial**: Valida sesión al cargar la página
- **Eventos monitoreados**: Click, teclas, scroll, movimiento del mouse

### 📁 Archivos Creados
- `src/composables/useSessionSecurity.js` - Sistema de monitoreo

### 🔒 Beneficios
- Renovación automática de sesión con actividad
- Detección de sesiones abandonadas
- Mejor experiencia de usuario

## Configuración de Seguridad

### Parámetros Configurables (src/stores/login.js)
```javascript
const SESSION_DURATION = 30 * 60 * 1000 // 30 minutos
const WARNING_TIME = 5 * 60 * 1000 // Avisar 5 min antes
```

### Eventos Monitoreados (src/composables/useSessionSecurity.js)
```javascript
const ACTIVITY_EVENTS = [
'mousedown', 'mousemove', 'keypress',
'scroll', 'touchstart', 'click'
]
```

## Flujo de Seguridad

1. **Login** → Inicializa timestamps y timeout de sesión
2. **Actividad del Usuario** → Renueva automáticamente la sesión
3. **Navegación** → Verifica autenticación, expiración y roles
4. **Inactividad (30min)** → Logout automático con alerta
5. **Cierre de pestaña** → Limpieza automática de datos

## Próximas Mejoras Sugeridas

### 🔄 Futuras Implementaciones
- [ ] Sistema de logging de seguridad
- [ ] Protección CSRF para formularios críticos
- [ ] Cifrado de datos sensibles en sessionStorage
- [ ] Rate limiting para intentos de login
- [ ] Autenticación de dos factores (2FA)

## Testing

### Probar las Mejoras
1. **Sesión**: Login → Esperar 30min → Verificar logout automático
2. **Roles**: Login como operario → Intentar acceder a `/admin`
3. **Actividad**: Login → Usar la app → Verificar que no expire
4. **Cierre**: Login → Cerrar pestaña → Reabrir → Verificar logout

### Validación de Seguridad
- ✅ sessionStorage en lugar de localStorage
- ✅ Timeout automático de 30 minutos
- ✅ Renovación con actividad del usuario
- ✅ Control de roles por ruta
- ✅ Limpieza automática de sesión
Loading