Commit Graph

11 Commits

Author SHA1 Message Date
Adrian Flores Cortes
55261598a2 [FIX] fix: Resolve TypeScript errors for successful build
Fixes:
- Add teal, cyan, slate colors to StatusColor type and StatusBadge
- Create StatsCard component with color prop for backward compatibility
- Add label/required props to FormGroup component
- Fix Pagination to accept both currentPage and page props
- Fix unused imports in quality and contracts pages
- Add missing Plus, Trash2, User icon imports in contracts pages
- Remove duplicate formatDate function in ContratoDetailPage

New components:
- StatsCard, StatsCardGrid for statistics display

Build: Success (npm run build passes)
Dev: Success (npm run dev starts on port 3020)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 11:36:21 -06:00
Adrian Flores Cortes
816d591115 [GAPS] feat(components): Implement remaining frontend gaps G-003 to G-013
Components added:
- G-003: ErrorBoundary with withErrorBoundary HOC and PageErrorFallback
- G-010: Pagination with SimplePagination variant
- G-011: Dropdown system (Dropdown, DropdownItem, Menu, etc.)
- G-012: FileUpload with drag & drop and preview
- G-013: DatePicker with DateRangePicker

Hooks added:
- G-006: useDebounce, useDebouncedCallback, useDebounceWithImmediate
- G-007: useLocalStorage, useSessionStorage

Services added:
- G-004: API Client with request/response interceptors, token refresh

Tests: 49 passing (14 new tests for utility hooks)
TypeScript: All types validated

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 01:34:21 -06:00
Adrian Flores Cortes
434990972e test: Add Vitest and tests for Toast system
- Configure Vitest with jsdom environment
- Add test setup with @testing-library/jest-dom
- Add 6 tests for toastStore (addToast, removeToast, clearToasts)
- Add 8 tests for useToast hook (success, error, warning, info, dismiss)

All 14 tests passing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 01:17:52 -06:00
Adrian Flores Cortes
380b96e159 feat(theme): Implement Dark Mode and Toast notifications
- Add dark:* classes to 10 common components
- Create ThemeProvider with Zustand persistence
- Create ThemeToggle component (simple and full modes)
- Implement Toast notification system (toastStore, useToast, ToastContainer)
- Support success, error, warning, info toast types
- Integrate ToastContainer in App.tsx

Components updated:
- Modal, EmptyState, StatusBadge, SearchInput
- ConfirmDialog, PageHeader, FormField, ActionButtons
- DataTable, LoadingSpinner

Closes: G-005, G-008

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 01:14:11 -06:00
Adrian Flores Cortes
b93f4c5797 [CONST-D-001] feat: Integrate API frontend with backend
## New Files
- .env.example: Environment variables template
- .env: Local development config (API URL: localhost:3021)
- src/services/auth/auth.api.ts: Authentication API service
- src/hooks/useAuth.ts: React Query hooks for auth
- src/pages/auth/LoginPage.tsx: Functional login page

## Modified Files
- src/App.tsx: Use LoginPage instead of placeholder
- src/hooks/index.ts: Export useAuth hook

## Features
- Login with email/password
- JWT token management
- Automatic token refresh
- Error handling with toast notifications
- Zustand + React Query integration

Build: PASSED

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 04:25:10 -06:00
Adrian Flores Cortes
0d0d52ac29 [SPRINT-3] feat: Presupuesto detail page with version management
- Add PresupuestoDetailPage with partidas table
- Add version history sidebar
- Add partida CRUD operations
- Add approval/rejection workflow
- Add PDF/Excel export buttons
- Enhance presupuestos.api.ts with version management APIs
- Add 8 new hooks in usePresupuestos.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 01:15:19 -06:00
Adrian Flores Cortes
5083292fbd feat(obras): Add Programa de Obra and Control de Avance pages
Sprint 2 - S2-T01 & S2-T02

New features:
- ProgramaObraPage: Work schedule management with version control
  - Hierarchical activities (WBS)
  - Simple Gantt visualization
  - S-Curve chart (planned vs actual)
- ControlAvancePage: Progress control dashboard
  - KPI cards (SPI, CPI, variance)
  - Progress by concept table
  - Progress by lot grid view
  - Weekly progress chart
  - Pending approvals summary

New API services:
- programa-obra.api.ts with full CRUD
- 18 new React Query hooks for programa operations

Navigation: Added Control and Programa items to sidebar

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 00:21:08 -06:00
Adrian Flores Cortes
e3b33f9caf feat(obras): Add Control de Obra module - Avances and Bitacora
Sprint 1 - S1-T03: Pagina de Catalogo de Obras

New features:
- Avances de Obra page: work progress tracking with workflow
  (pending -> captured -> reviewed -> approved/rejected)
- Bitacora de Obra page: daily work log with timeline view
- Progress API services (avances-obra.api.ts, bitacora-obra.api.ts)
- React Query hooks (useProgress.ts) with 18 hooks total
- Navigation section "Control de Obra" in sidebar

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 23:02:54 -06:00
Adrian Flores Cortes
dac9ae6f19 feat(frontend): Agregar hooks React Query para módulo HSE
Implementación completa de 16 hooks personalizados de React Query para
gestión del módulo HSE (Health, Safety & Environment):

**Incidentes (7 hooks):**
- useIncidentes, useIncidente, useIncidenteStats
- useCreateIncidente, useUpdateIncidente
- useInvestigateIncidente, useCloseIncidente

**Capacitaciones (6 hooks):**
- useCapacitaciones, useCapacitacion
- useCreateCapacitacion, useUpdateCapacitacion
- useToggleCapacitacion, useDeleteCapacitacion

**Inspecciones (7 hooks):**
- useTiposInspeccion (con staleTime 30min)
- useInspecciones, useInspeccion, useInspeccionesStats
- useCreateInspeccion, useUpdateEstadoInspeccion
- useAddHallazgo

**Características:**
- Query Keys jerárquicos type-safe
- Manejo centralizado de errores con toast
- Invalidación inteligente de queries relacionadas
- Patrón consistente con useConstruccion.ts
- TypeScript completamente tipado
- 291 líneas de código

**Validaciones:**
✓ npm run type-check (sin errores)
✓ npm run lint (sin warnings)

Archivos:
- web/src/hooks/useHSE.ts (nuevo, 291 líneas)
- web/src/hooks/index.ts (export agregado)

Relacionado: MAA-017 (Módulo HSE Backend)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:25:18 -06:00
Adrian Flores Cortes
e4cfe62b1b feat(FASE-5A): Frontend modules Dashboard, Presupuestos, Bidding
New modules implemented:
- Dashboard: EVM visualization, Curva S, KPIs, alerts
- Presupuestos: Conceptos tree, presupuestos list, estimaciones workflow
- Bidding: Opportunities, tenders, proposals, vendors pages

Files created:
- services/reports/ - Reports API service (6 types, 8 methods)
- services/presupuestos/ - Budget/estimates API (presupuestos.api, estimaciones.api)
- services/bidding/ - Bidding API (opportunities, tenders, proposals, vendors)
- hooks/useReports.ts - 8 query hooks, 2 mutation hooks
- hooks/usePresupuestos.ts - 27 hooks for conceptos, presupuestos, estimaciones
- hooks/useBidding.ts - 24 hooks for bidding module
- pages/admin/dashboard/ - DashboardPage with EVM metrics
- pages/admin/presupuestos/ - 3 pages (Conceptos, Presupuestos, Estimaciones)
- pages/admin/bidding/ - 4 pages (Opportunities, Tenders, Proposals, Vendors)

Updated:
- App.tsx: Added routes for new modules
- AdminLayout.tsx: Collapsible sidebar with 4 sections
- hooks/index.ts: Export new hooks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 07:21:28 -06:00
Adrian Flores Cortes
f3d91433fe [MAI-002] feat: Implement frontend Proyectos module
- API services: 5 files (fraccionamientos, etapas, manzanas, lotes, prototipos)
- React Query hooks: useConstruccion.ts with 25+ hooks
- Pages: 6 pages for CRUD operations
  - FraccionamientosPage, FraccionamientoDetailPage
  - EtapasPage, ManzanasPage, LotesPage, PrototiposPage
- Components: LoteStatusBadge, HierarchyBreadcrumb
- AdminLayout with sidebar navigation
- Auth store with Zustand + persist
- React Query provider + react-hot-toast setup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 10:04:54 -06:00