How lawlielowen/front_atc works
Purpose and Runtime
Front_ATC is an Angular/Ionic TypeScript frontend for ATC’s sales, inventory, and operational workflows. It runs primarily as a branch-hosted web application, consumes the separate Back_ATC API, and has Capacitor configuration for hybrid packaging. Bootstrap and global composition begin at src/main.ts, src/app/app.module.ts, and src/app/app.component.ts.
Application Shell and Navigation
The root router defines application navigation; HomePage provides the authenticated application shell, likely hosting shared header/sidebar layout and child views. Feature areas are organized as Angular page modules with their own route modules, supporting separation and likely lazy loading.
• src/app/app-routing.module.ts
• src/app/home/home-routing.module.ts
• src/app/shared/components/layout/header/header.component.ts
• src/app/shared/components/layout/siderbar/siderbar.component.ts
Identity, Authorization, and HTTP Boundary
Authentication is centralized in auth/login services, route guards, and HTTP interceptors. Requests cross the frontend/backend boundary through domain services; the token interceptor attaches credentials, while the auth-error interceptor handles authentication failures. Guards distinguish authenticated, unauthenticated, role-based, and admin-only access, redirecting blocked users to the unauthorized flow.
• src/app/core/services/auth.service.ts
• src/app/core/guard/Authtoken.interceptor.ts
• src/app/core/guard/Auth error.interceptor.ts
• src/app/core/guard/auth.guard.ts
• src/app/core/guard/Role.guard.ts
API and Domain Model Layer
core/services is the client-side API adapter layer, with a service per backend business resource. Shared models define the frontend’s domain contracts and are consumed by pages, services, and reusable UI. The backend base URL is environment-specific.
• src/app/core/services/Productos.service.ts
• src/app/core/services/Cotizaciones.service.ts
• src/app/core/services/Pedidos.service.ts
• src/app/shared/model/productos.model.ts
• src/app/shared/model/cotizacion.model.ts
• src/environments/environment.ts
Core Business Workflows
The main control flow is: routed feature page → domain service/API → model-backed response → list/detail/modal UI and optional transition to related workflow. Commercial workflows connect customers, quotes/POS, orders, and receipt uploads; inventory workflows cover products, stock, movements/history, vouchers, and receptions.
• src/app/pages/cotizaciones/cotizaciones.page.ts
• src/app/pages/cotizaciones/pos/pos.page.ts
• src/app/pages/pedidos/detalle-pedido/detalle-pedido.page.ts
• src/app/pages/productos/existencias/existencias.page.ts
• src/app/pages/recepciones/confirmar-recepcion/confirmar-recepcion.page.ts
• src/app/pages/historial-es/historial-es.page.ts
CRM, Service, and Field Operations
Customer and advisor records support sales activity. Separate feature modules manage demos, visits, tickets/incidents, and projects, each structured as list plus create/edit modal and/or detail/completion route. This makes each workflow independently navigable while sharing API, auth, layout, and UI layers.
• src/app/pages/clientes/clientes.page.ts
• src/app/pages/asesores/detalles/detalles.page.ts
• src/app/pages/demos/detalles-demo/detalles-demo.page.ts
• src/app/pages/visitas/completar-visita/completar-visita.page.ts
• src/app/pages/tickets/detalle-ticket/detalle-ticket.page.ts
• src/app/pages/proyectos/detalles-proyecto/detalles-proyecto.page.ts
Shared Presentation and Cross-Cutting UX
Reusable layout and UI components standardize headers, notifications, forms, tables, filters, pagination, cards, and modals across feature modules. Dashboard metrics are supplied by the metrics service; notification functionality has a service, header component, and local audio asset. SweetAlert-oriented domain utilities centralize operation feedback.
• src/app/core/services/Metricas.service.ts
• src/app/core/services/Notificaciones.service.ts
• src/app/pages/dashboard/dashboard.page.ts
• src/app/shared/components/UI/table/table.component.ts
• src/app/shared/components/UI/modal/upload-modal/upload-modal.component.ts
• src/assets/Sound/notificacion.mp3
Main entry points: home-routing.module.ts Authenticated shell · Productos.service.ts Domain API services · app-routing.module.ts Root router · Authtoken.interceptor.ts HTTP interceptors
Components 20
Runtime & Shell
- Angular bootstrap
src/main.ts - App module
src/app/app.module.ts - Root router
src/app/app-routing.module.ts - Authenticated shell · Hosts shared navigation and child feature views.
src/app/home/home-routing.module.ts - Header & sidebar
src/app/shared/components/layout/header/header.component.ts
Security & API
- Authentication
src/app/core/services/auth.service.ts - Guards · Authentication and role checks protect routes.
src/app/core/guard/auth.guard.ts - HTTP interceptors · Attaches tokens and handles authentication failures.
src/app/core/guard/Authtoken.interceptor.ts - Domain API services · Resource services for products, quotes, orders, and other backend domains.
src/app/core/services/Productos.service.ts - API environment · Provides environment-specific backend base URL.
src/environments/environment.ts - Back_ATC API
Business Workflows
- Quotes & POS · Creates commercial quotes and point-of-sale activity.
src/app/pages/cotizaciones/cotizaciones.page.ts - Order detail
src/app/pages/pedidos/detalle-pedido/detalle-pedido.page.ts - Stock & history · Shows stock, movements, and inventory history.
src/app/pages/productos/existencias/existencias.page.ts - Reception confirmation
src/app/pages/recepciones/confirmar-recepcion/confirmar-recepcion.page.ts - CRM & field operations · Customers, advisors, demos, visits, tickets, and projects.
src/app/pages/clientes/clientes.page.ts
Shared UX
- Shared domain models
src/app/shared/model/productos.model.ts - Reusable UI · Tables, forms, filters, pagination, cards, and modals.
src/app/shared/components/UI/table/table.component.ts - Dashboard metrics
src/app/core/services/Metricas.service.ts - Notifications · Supports header notifications and alert audio.
src/app/core/services/Notificaciones.service.ts
Connections 26
- Angular bootstrap → App module: boots
- App module → Root router: configures
- Root router → Guards: protects routes with
- Root router → Authenticated shell: loads authenticated area
- Authenticated shell → Header & sidebar: renders
- Authenticated shell → Quotes & POS: navigates to
- Authenticated shell → Order detail: navigates to
- Authenticated shell → Stock & history: navigates to
- Authenticated shell → Reception confirmation: navigates to
- Authenticated shell → CRM & field operations: navigates to
- Guards → Authentication: checks session and roles
- Quotes & POS → Domain API services: uses
- Order detail → Domain API services: uses
- Stock & history → Domain API services: uses
- Reception confirmation → Domain API services: uses
- CRM & field operations → Domain API services: uses
- Domain API services → Shared domain models: maps contracts
- Domain API services → HTTP interceptors: sends requests through
- HTTP interceptors → Authentication: attaches and refreshes auth state
- HTTP interceptors → Back_ATC API: requests
- API environment → Domain API services: supplies API base URL
- Quotes & POS → Reusable UI: renders with
- Stock & history → Reusable UI: renders with
- CRM & field operations → Reusable UI: renders with
- Authenticated shell → Dashboard metrics: shows dashboard data
- Header & sidebar → Notifications: presents