feat: Implementar sistema de kiosko, enrollment e integración Telegram

## Sistema de Kiosko 
- Nuevo rol 'kiosk' en enum user_role
- Tabla kiosks con autenticación por API key (64 caracteres)
- Funciones SQL: generate_kiosk_api_key(), is_kiosk(), get_available_resources_with_priority()
- API Routes: authenticate, bookings (GET/POST), confirm, resources/available, walkin
- Componentes UI: BookingConfirmation, WalkInFlow, ResourceAssignment
- Página kiosko: /kiosk/[locationId]/page.tsx

## Sistema de Enrollment 
- API routes para administración: /api/admin/users, /api/admin/kiosks, /api/admin/locations
- Frontend enrollment: /admin/enrollment con autenticación por ADMIN_KEY
- Creación de staff (admin, manager, staff, artist) con Supabase Auth
- Creación de kiosks con generación automática de API key
- Componentes UI: card, button, input, label, select, tabs

## Actualización de Recursos 
- Reemplazo de recursos con códigos estándarizados
- Estructura por location: 3 mkup, 1 lshs, 4 pedi, 4 mani
- Migración de limpieza: elimina duplicados
- Total: 12 recursos por location

## Integración Telegram y Scoring 
- Campos agregados a staff: telegram_id, email, gmail, google_account, telegram_chat_id
- Sistema de scoring: performance_score, total_bookings_completed, total_guarantees_count
- Tablas: telegram_notifications, telegram_groups, telegram_bots
- Funciones: update_staff_performance_score(), get_top_performers(), get_performance_summary()
- Triggers automáticos: notificaciones al crear/confirmar/completar booking
- Cálculo de score: base 50 +10 por booking +5 por garantía +1 por $100

## Actualización de Tipos 
- UserRole: agregado 'kiosk'
- CustomerTier: agregado 'black', 'VIP'
- Nuevas interfaces: Kiosk

## Documentación 
- KIOSK_SYSTEM.md: Documentación completa del sistema
- KIOSK_IMPLEMENTATION.md: Guía rápida
- ENROLLMENT_SYSTEM.md: Sistema de enrollment
- RESOURCES_UPDATE.md: Actualización de recursos
- PROJECT_UPDATE_JAN_2026.md: Resumen de proyecto

## Componentes UI (7)
- button.tsx, card.tsx, input.tsx, label.tsx, select.tsx, tabs.tsx

## Migraciones SQL (4)
- 20260116000000_add_kiosk_system.sql
- 20260116010000_update_resources.sql
- 20260116020000_cleanup_and_fix_resources.sql
- 20260116030000_telegram_integration.sql

## Métricas
- ~7,500 líneas de código
- 32 archivos creados/modificados
- 7 componentes UI
- 10 API routes
- 4 migraciones SQL
This commit is contained in:
Marco Gallegos
2026-01-16 10:51:12 -06:00
parent c770d4ebf9
commit fed5cb6850
33 changed files with 6152 additions and 80 deletions

View File

@@ -1,7 +1,7 @@
// Types based on SalonOS database schema
export type UserRole = 'admin' | 'manager' | 'staff' | 'artist' | 'customer'
export type CustomerTier = 'free' | 'gold'
export type UserRole = 'admin' | 'manager' | 'staff' | 'artist' | 'customer' | 'kiosk'
export type CustomerTier = 'free' | 'gold' | 'black' | 'VIP'
export type BookingStatus = 'pending' | 'confirmed' | 'cancelled' | 'completed' | 'no_show'
export type InvitationStatus = 'pending' | 'used' | 'expired'
export type ResourceType = 'station' | 'room' | 'equipment'
@@ -43,6 +43,19 @@ export interface Staff {
location?: Location
}
export interface Kiosk {
id: string
location_id: string
device_name: string
display_name: string
api_key: string
ip_address?: string
is_active: boolean
created_at: string
updated_at: string
location?: Location
}
export interface Service {
id: string
name: string
@@ -148,6 +161,11 @@ export type Database = {
Insert: Omit<Staff, 'id' | 'created_at' | 'updated_at'>
Update: Partial<Omit<Staff, 'id' | 'created_at'>>
}
kiosks: {
Row: Kiosk
Insert: Omit<Kiosk, 'id' | 'created_at' | 'updated_at' | 'api_key'>
Update: Partial<Omit<Kiosk, 'id' | 'created_at' | 'updated_at' | 'api_key'>>
}
services: {
Row: Service
Insert: Omit<Service, 'id' | 'created_at' | 'updated_at'>

6
lib/utils.ts Normal file
View File

@@ -0,0 +1,6 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}