Commit Graph

24 Commits

Author SHA1 Message Date
Adrian Flores Cortes
a03bed842f [REMEDIATION] feat: Frontend remediation - auth, finance, contracts, session management
Add auth components, finance pages/hooks/services, contract components.
Enhance LoginPage, AdminLayout, hooks. Remove legacy apiClient.
Add mock data services for development. Addresses frontend gaps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 23:18:22 -06:00
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
b3dd4b859e [G-009] feat(components): Add Skeleton loading component system
- Add Skeleton base component with variants: text, rectangular, circular
- Add SkeletonText for multi-line text placeholders
- Add SkeletonCard for card-shaped loading states
- Add SkeletonTable for table loading with configurable rows/columns
- Add SkeletonAvatar for avatar placeholders (sm/md/lg/xl)
- Add SkeletonButton for button placeholders
- Add shimmer animation to Tailwind config
- Add comprehensive tests (21 tests passing)
- Export all components from common/index.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 01:27:06 -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
a746b0b4df feat(design-system): Implement CSS custom properties for theming
- Add src/styles/variables.css with 100+ design tokens
- Define ISEM brand colors (primary #0061A8, secondary #00A868)
- Add semantic colors (success, warning, danger, info)
- Add light/dark theme support via CSS variables
- Add construction-specific colors (EVM, HSE, project states)
- Add typography tokens (Inter font family)
- Add spacing system (4px base)
- Add border radius, shadows, z-index scales
- Add animation duration and easing tokens
- Add component-specific tokens (button, input, card, modal)
- Update tailwind.config.js to use CSS variables
- Enable dark mode support with 'class' strategy
- Update index.css to import variables and use semantic tokens

Closes G-001 from FASE3-VALIDACION-FRONTEND-UXUI.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:51:57 -06:00
Adrian Flores Cortes
d5a703b926 refactor(frontend): Refactor LotesPage and DashboardPage using common components
LotesPage (548 -> 307 lines, -44%):
- Use SearchInput, SelectField, Modal, ConfirmDialog from common
- Use DataTable instead of inline table
- Use LOTE_STATUS_OPTIONS from utils/constants
- Keep StatCard specific to lotes (with color indicator)

DashboardPage (710 -> 382 lines, -46%):
- Use formatCurrency, formatPercent, formatNumber from utils
- Use SearchInput, SelectField from common
- Remove inline utility functions (duplicated)
- Keep specialized components (StatCard, KPIGauge, EVMValueCard)

Total reduction: 569 lines removed across both files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 09:30:06 -06:00
Adrian Flores Cortes
765a639004 refactor(frontend): Extract common components and types
- Create src/types/ with organized type files:
  - api.types.ts, auth.types.ts, construction.types.ts
  - estimates.types.ts, hse.types.ts, common.types.ts

- Create src/utils/ with utilities:
  - formatters.ts (formatCurrency, formatDate, etc.)
  - validators.ts (isValidEmail, isValidRFC, etc.)
  - constants.ts (status options, color maps)

- Create src/components/common/ with reusable components:
  - DataTable, Modal, ConfirmDialog
  - FormField (TextInput, SelectField, TextareaField)
  - StatusBadge, SearchInput, PageHeader
  - ActionButtons, LoadingSpinner, EmptyState

- Refactor pages to use common components:
  - FraccionamientosPage: 385 -> 285 lines
  - PresupuestosPage: 412 -> 297 lines
  - IncidentesPage: 741 -> 253 lines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 09:02:57 -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
5db3ef247d fix(hse): Remove unused imports and variables from HSE pages
- Remove unused 'Link' import from InspeccionDetailPage.tsx
- Remove unused 'XCircle' import from InspeccionesPage.tsx
- Remove unused 'gravedadColors' and 'tipoHallazgoLabels' constants

Fixes TypeScript compilation errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 22:30:00 -06:00
Adrian Flores Cortes
8127abca70 feat(hse): Add routing and exports for HSE inspection pages
- Update App.tsx with routes for InspeccionesPage and InspeccionDetailPage
- Update AdminLayout.tsx with HSE navigation menu
- Update hse/index.ts exports

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 22:29:04 -06:00
Adrian Flores Cortes
3b5587e1f3 feat(hse): Add route for InspeccionDetailPage
- Add InspeccionDetailPage import to App.tsx
- Add route /admin/hse/inspecciones/:id for inspection detail view
- Enables navigation to inspection detail from inspections list

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 22:25:17 -06:00
Adrian Flores Cortes
3b76b455dc feat(hse): Add InspeccionesPage and InspeccionDetailPage components
- InspeccionesPage: List and filter HSE inspections
- InspeccionDetailPage: View inspection details

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 22:22:24 -06:00
Adrian Flores Cortes
744545defb feat(hse): Add IncidentesPage component for HSE incidents management
- Complete CRUD for HSE incidents (accidente, incidente, casi_accidente)
- Filters by tipo, gravedad, estado, fraccionamiento, date range
- Investigation workflow (abierto -> en_investigacion -> cerrado)
- Modal forms for create/edit, investigate, and close
- Color-coded badges for tipo, gravedad, and estado

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 22:20:21 -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
cbb4f265c5 feat(frontend): Add HSE module navigation and routes
- Add HSE section to AdminLayout sidebar with Incidentes and Capacitaciones
- Add HSE routes in App.tsx (/admin/hse/incidentes and /admin/hse/capacitaciones)
- Create IncidentesPage and CapacitacionesPage components
- Create barrel export index.ts for HSE pages
- Import AlertTriangle and GraduationCap icons for HSE navigation

Routes added:
- /admin/hse -> redirects to /admin/hse/incidentes
- /admin/hse/incidentes -> IncidentesPage
- /admin/hse/capacitaciones -> CapacitacionesPage

Navigation structure:
- HSE section in sidebar (collapsed by default)
- Links to Incidentes and Capacitaciones pages
- Active state highlighting for current route

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:23:13 -06:00
Adrian Flores Cortes
676978146b feat(frontend): Add HSE API services module
Create API service layer for HSE (Health, Safety, Environment) module:
- incidentes.api.ts: Incidents management with stats and investigation workflow
- capacitaciones.api.ts: Training courses management
- inspecciones.api.ts: Inspections with findings tracking
- index.ts: Barrel exports

All services follow the established pattern from fraccionamientos.api.ts:
- TypeScript interfaces for entities, filters, and DTOs
- Paginated responses support
- Axios integration with automatic auth headers
- Complete CRUD operations aligned with backend endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 21:21:14 -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
0ff0ca8070 Migración desde erp-construccion/frontend - Estándar multi-repo v2
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:11:18 -06:00