Frontend Features
The SGIVU frontend is organized into feature modules, each handling a specific domain of the application. This document provides detailed information about each feature module.Authentication (auth)
Overview
Handles user authentication, session management, and authorization throughout the application. Location:src/app/features/auth/
Components
LoginComponent
Path:/login
Initiates the OAuth2 login flow by redirecting to the gateway’s authorization endpoint.
CallbackComponent
Path:/callback
Handles OAuth2 callback after successful authentication. Verifies session and redirects to dashboard.
Services
AuthService
Key Responsibilities:- Initialize authentication on app startup
- Check session status via
/auth/session - Manage authentication state with signals
- Handle login and logout flows
- Store current user information
PermissionService
Key Responsibilities:- Check user permissions
- Evaluate role-based access
- Support permission guards
Guards
authGuard
Protects routes requiring authentication:permissionGuard
Protects routes requiring specific permissions:Interceptors
defaultOAuthInterceptor
- Adds
withCredentials: trueto API requests - Enables cookie-based session management
- Handles 401 errors for expired sessions
Directives
hasPermissionDirective
Conditionally shows/hides elements based on permissions:Dashboard
Overview
Provides analytics, KPIs, and visualizations for business metrics. Location:src/app/features/dashboard/
Components
DashboardComponent
Path:/dashboard
Main dashboard with:
- KPI cards (total users, vehicles, active contracts, revenue)
- Vehicle status distribution chart
- Sales trend chart
- Demand prediction insights
- Recent activity feed
- Real-time data updates
- Chart.js visualizations
- Responsive grid layout
- Permission-based content visibility
Services
DashboardService
Fetches dashboard metrics:Utilities
- Chart configuration helpers
- Date range utilities
- KPI formatters
User Management (users)
Overview
Manages application users, roles, and permissions. Location:src/app/features/users/
Routes: /users/*
Components
UserListComponent
Path:/users
Displays paginated list of users with:
- Search and filtering
- Sorting by column
- Role badges
- Quick actions (edit, delete, view profile)
- Permission-based action visibility
UserFormComponent
Paths:/users/create, /users/:id/edit
Form for creating/editing users:
- Personal information (name, email, phone)
- Role assignment
- Address information
- Form validation
- Success/error handling
UserProfileComponent
Path:/users/:id
Detailed user profile view:
- Personal information
- Assigned roles and permissions
- Activity history
- Edit profile button
RolesPermissionsComponent
Path:/roles-permissions
Manage system roles and permissions:
- List all roles
- Assign permissions to roles
- Create/edit roles
- View permission matrix
role:update
Services
UserService
CRUD operations for users:Models
Resolvers
userProfileResolver
Preloads user data before route activation:Client Management (clients)
Overview
Manages clients (persons and companies) who buy or sell vehicles. Location:src/app/features/clients/
Routes: /clients/*
Components
ClientListComponent
Path:/clients
Unified view of all clients (persons + companies):
- Tabbed interface (All, Persons, Companies)
- Search and filtering
- Client type badges
- Contact information display
PersonListComponent
Path:/clients/persons
List of individual clients:
- Personal information
- Document number
- Contact details
- Transaction history
CompanyListComponent
Path:/clients/companies
List of company clients:
- Company name
- Tax ID (NIT)
- Legal representative
- Contact information
Services
PersonService
CRUD for person clients:CompanyService
CRUD for company clients:Models
Vehicle Inventory (vehicles)
Overview
Manages vehicle inventory including cars and motorcycles. Location:src/app/features/vehicles/
Routes: /vehicles/*
Components
VehicleListComponent
Path:/vehicles
Combined list of all vehicles:
- Tabbed view (All, Cars, Motorcycles)
- Status filters (Available, Reserved, Sold)
- Search by brand/model/VIN
- Image thumbnails
- Price display
- Quick actions
CarListComponent
Path:/vehicles/cars
Car-specific listing:
- Car-specific attributes (doors, seats)
- Price range filtering
- Year filtering
- Transmission type
MotorcycleListComponent
Path:/vehicles/motorcycles
Motorcycle-specific listing:
- Engine displacement
- Motorcycle type (sport, cruiser, etc.)
- Price range filtering
VehicleFormComponent
Paths:/vehicles/create, /vehicles/:id/edit
Form for creating/editing vehicles:
- Vehicle type selection
- Basic information (brand, model, year, VIN)
- Specifications (engine, transmission, mileage)
- Pricing
- Status management
- Image upload
- Validation
VehicleDetailComponent
Path:/vehicles/:id
Detailed vehicle view:
- Full specifications
- Image gallery
- Status history
- Transaction history
- Edit/delete actions
Services
CarService
CRUD for cars:MotorcycleService
CRUD for motorcycles:VehicleImageService
Manages vehicle images:VehicleImageUploadService
Handles S3 uploads:Models
Image Upload Flow
-
Request Presigned URL:
-
Upload to S3:
-
Confirm Upload:
Purchase & Sales (purchase-sales)
Overview
Manages vehicle purchase and sales transactions. Location:src/app/features/purchase-sales/
Routes: /purchase-sales/*
Components
PurchaseSaleListComponent
Path:/purchase-sales
List of all transactions:
- Transaction type tabs (All, Purchases, Sales)
- Date range filtering
- Client search
- Vehicle search
- Status filters
- Amount display
- Quick suggestions for common queries
PurchaseSaleCreateComponent
Path:/purchase-sales/create
Create new transaction:
- Transaction type selection (Purchase/Sale)
- Client selection with search
- Vehicle selection with search
- Price and payment terms
- Contract details
- Document upload
- Multi-step workflow
PurchaseVehicleFormComponent
Path:/purchase-sales/purchase-vehicle
Quick purchase flow:
- Add new vehicle during purchase
- Client selection
- Vehicle information
- Purchase price
- Streamlined workflow
Services
PurchaseSaleService
CRUD for transactions:PurchaseSaleLookupService
Search and lookup utilities:PurchaseSaleReportService
Generate reports:Models
Utilities
quick-search.utils
Quick search suggestions:- Recent searches
- Popular queries
- Auto-complete
purchase-sale-filter.utils
Filter helpers:- Build filter query parameters
- Date range validation
- Amount range filters
Shared Components
DataTableComponent
Generic data table with:- Column configuration
- Sorting
- Row selection
- Row navigation
- Custom cell templates
- Loading state
PagerComponent
Pagination controls:- Page size selection
- Page navigation
- Total count display
- Jump to page
KpiCardComponent
Dashboard KPI display:- Icon
- Title
- Value
- Change percentage
- Trend indicator
FormShellComponent
Form wrapper with:- Page header
- Form container
- Action buttons
- Loading state
- Error display
Permission Matrix
User Permissions
user:read- View usersuser:create- Create usersuser:update- Edit usersuser:delete- Delete users
Client Permissions
client:read- View clientsclient:create- Create clientsclient:update- Edit clientsclient:delete- Delete clients
Vehicle Permissions
vehicle:read- View vehiclesvehicle:create- Create vehiclesvehicle:update- Edit vehiclesvehicle:delete- Delete vehiclesvehicle:manage_images- Upload/delete images
Transaction Permissions
transaction:read- View transactionstransaction:create- Create transactionstransaction:update- Edit transactionstransaction:cancel- Cancel transactionstransaction:report- Generate reports
Role Permissions
role:read- View rolesrole:update- Manage roles and permissions
Next Steps
Setup
Setup development environment
Architecture
Learn about architectural patterns