Overview
ICL Cotizaciones manages two types of clients with distinct roles in the quotation workflow. The client management system tracks contact details, assigns sales representatives, and links clients to commercial agreements.Client Types
FFWW
Freight Forwarders who request quotes and manage logistics. These are your direct clients who receive quotations.
Final
End Customers who are the ultimate recipients or shippers of cargo. Referenced in quotations as the final client.
Both
Clients that operate as both FFWW and end customer. Can be selected in either role during quotation creation.
Creating a Client
Access client management
Navigate to Maestros → Clientes (admin only) or click Crear cliente from the quotation form.
Enter client details
Tab: Datos del Cliente
- Razon Social (Legal name): Official business name (required)
- CUIT/RUT (Tax ID): Tax identification number
- Telefono: Contact phone number
- Email: Primary email address
- Tipo de Cliente: Select FFWW, Final, or Both (required)
- Comercial: Assigned sales representative
- Activo: Enable/disable client (default: active)
Configure commercial agreement (optional)
Tab: Acuerdo ComercialSet up pricing terms and fees specific to this client relationship. See Commercial Agreements for details.
Client Type Workflow
FFWW Clients in Quotations
When creating a quotation:- Cliente FFWW field shows only clients with
client_type = "FFWW"or"Both" - Selecting a FFWW client automatically loads their commercial agreement (if configured)
- For admin users, if the client has an assigned
user_id, it auto-fills the Comercial field - Non-admin users only see clients assigned to them (
user_idmatches session user)
Final Clients in Quotations
- Cliente Final field shows only clients with
client_type = "Final"or"Both" - This is an optional reference field
- Also accepts free-text input for ad-hoc end customer names
- Used for tracking ultimate consignee/shipper
Sales Representative Assignment
Admin Assignment
Admin users can assign any sales representative to a client via the Comercial dropdown.This determines:
- Which non-admin user can view/edit the client’s quotations
- Default sales rep when admin creates quotes for this client
Non-Admin Access
Commercial users (non-admin) only see clients where
user_id matches their user account.They cannot reassign clients to other sales reps.Client List View
The client management page displays:- Razon Social: Legal business name
- CUIT/RUT: Tax identification
- Tipo: Client type badge (FFWW, Final, Both)
- Comercial: Assigned sales representative name
- Contacto: Phone and email
- Estado: Active/Inactive status
Actions
- Edit: Click pencil icon to modify client details and agreement
- Delete: Remove client (admin only, requires confirmation)
- Search: Filter clients by name or tax ID
- Filter by Type: Show only FFWW, Final, or Both clients
- Filter by Comercial: Show clients assigned to specific sales rep
Access Control
| Operation | Admin | Commercial User |
|---|---|---|
| View all clients | ✓ | Only assigned clients |
| Create client | ✓ | ✗ (403) |
| Edit any client | ✓ | ✗ (403) |
| Delete client | ✓ | ✗ (403) |
| Assign sales rep | ✓ | ✗ |
| View in quotations | All clients | Only user_id match |
Roles with admin privileges: DIRECTOR, GERENTE, ADMINISTRACIONOther roles: COMERCIAL, CSV, OPERACIONES
Client Creation from Quotation Form
When creating a quotation, if the needed client doesn’t exist:Click 'Crear cliente'
In the Cliente FFWW or Cliente Final combobox, click the Crear cliente button at the bottom of the dropdown.
Form data preserved
Current quotation form data is saved to
sessionStorage as cotizacion_en_curso.User is redirected to /maestros/clientes?nuevo=true&returnTo=cotizacion.Client-Agreement Relationship
Clients can have one commercial agreement that defines:- Fiscal deposit fee structure
- Deconsolidation rates
- Insurance terms
- Payment conditions
- Commission and incentive rates
Data Model Reference
Fromclients table (src/db/schema.ts:15-26):
API Endpoints
GET /api/clientes- List clients (filtered by user_id for non-admin)POST /api/clientes- Create new client (admin only)GET /api/clientes/[id]- Get client detailsPUT /api/clientes/[id]- Update client (admin only)DELETE /api/clientes/[id]- Delete client (admin only)
Best Practices
Client Naming
Use official legal names in Razon Social for consistency with invoicing and documentation.
Type Selection
- Set to FFWW for direct freight forwarder clients
- Set to Final for end customers who are only referenced
- Set to Both for clients who operate in dual capacity
Sales Assignment
Assign clients to sales reps to ensure proper access control and quotation ownership tracking.
Deactivation
Instead of deleting clients with historical quotations, set Activo to false to hide from active lists while preserving data.