Actions
Task #153
openTerritory Master and Employee Territory Assignment
Start date:
03/02/2026
Due date:
03/02/2026 (3 days late)
% Done:
0%
Estimated time:
Description
Territory Master
This module is used to create and manage territories by grouping multiple locations under a single territory name. Territories help organize operational areas and allow assigning employees to specific regions. Locations are selected from the Geography Master and mapped to the territory.
Table
territory_master
- id (PK) INT AUTO_INCREMENT Unique territory ID
- territory_name VARCHAR(100) Name of the territory (example: Cochin, Metros)
- enterprise_id (FK) INT References enterprise_master.id
- is_active BOOLEAN DEFAULT TRUE Territory active / inactive
- created_at DATETIME Record created date
- updated_at DATETIME Record updated date
territory_location_map
- id (PK) INT AUTO_INCREMENT Unique ID
- territory_id (FK) INT References territory_master.id
- geog_id (FK) INT References locations_geography.geog_id
- enterprise_id (FK) INT References enterprise_master.id
- created_at DATETIME Record created date
Validations
- Territory name required
- At least one location must be selected
- enterprise_id required (session based)
Duplicate
- Prevent duplicate territory name within same enterprise
Location
- Location must exist in locations_geography table
- Only active locations allowed
Edit
Allow edit:
- territory_name
- is_active
Do NOT allow edit:
- enterprise_id
Delete
- Soft delete only
- is_active = FALSE
- Do not delete physically
Employee Territory Assignment
This module is used to assign one or more employees to a territory. This ensures employees are responsible for specific operational regions.
Table
territory_employee_map
- id (PK) INT AUTO_INCREMENT Unique ID
- territory_id (FK) INT References territory_master.id
- employee_id (FK) INT References employee_master.id
- enterprise_id (FK) INT References enterprise_master.id
- assigned_at DATETIME Assignment date
- is_active BOOLEAN DEFAULT TRUE Active / inactive
Validations
- territory_id required
- employee_id required
- enterprise_id required
Duplicate
- Prevent assigning same employee twice to same territory
Employee
- employee_id must exist in employee_master
- employee must belong to same enterprise
Territory
- territory_id must exist
- territory must be active
Edit
Allow edit:
- is_active
Do NOT allow edit:
- territory_id
- employee_id
Delete
- Soft delete only
- is_active = FALSE
Actions