Role Master
The Role Master allows administrators to manage organizational roles (e.g., Manager, Supervisor, Operator). These roles are used to classify employees for administrative purposes and can be linked to system-level permissions to control access to specific modules.
Navigation Path
Company → Masters → Role Master
1. Role List Page
URL
/masters/role-master
Page Description
- Displays all roles configured for the organization.
- Provides a centralized interface to manage job-level classifications.
- Integrated with a search mechanism to quickly locate specific roles in large organizations.
Filter & Search Section
| Field Name | Type | Description |
|---|---|---|
| Role Name | Text Input | Filters the list by the primary name of the role. |
Actions:
- Search → Filters the role table using a case-insensitive regex.
- Reset → Clears search input and reloads all active roles.
List Table Columns
| Column Name | Description |
|---|---|
| S No | Serial number. |
| Role Name | The official name of the organizational role. |
| Actions | Edit and Delete options. |
Row Actions
| Action | Description |
|---|---|
| Edit | Opens the Edit Role drawer/form with pre-filled names. |
| Delete | Opens a delete confirmation alert for soft-deletion. |
2. Add Role Page
Triggered From
Role List Page → Add Role button
Page Description
- Allows administrators to create a new role definition.
- Ensures consistent role labeling across the company.
Add Role – Fields
| Field Name | Type | Mandatory | Description |
|---|---|---|---|
| Role Name | Text Input | Yes | Enter the designation or organizational role name. |
Actions
| Action | Behavior |
|---|---|
| Save | Validates naming constraints and saves the record. |
| Reset | Clears the text entry. |
| Cancel | Returns to the Role List page. |
Validation Rules
- Role Name cannot be empty.
- Duplicate names within the same company context are not allowed.
- Input is sanitized to remove accidental whitespace.
3. Edit Role Page
Triggered From
Role List Page → Edit icon
Page Description
- Allows administrators to rename existing roles.
- Modified role names are automatically updated across all linked employee master records.
Editable Fields
| Field Name | Editable |
|---|---|
| Role Name | Yes |
Actions
| Action | Behavior |
|---|---|
| Update | Saves the modified name and refreshes the master table. |
| Cancel | Discards changes and returns to the list view. |
4. Delete Role Confirmation Alert
Triggered From
Role List Page → Delete icon
Alert Content
- "Are you sure you want to delete this Role?"
Actions:
- Confirm / Yes → Sets the
isDeleted.statustotrue. - Cancel → Dismisses the alert.
Field Definitions, Usage, and Calculation Logic
1. Technical Field Definitions
| Field Name | Data Type | Description | Example Value |
|---|---|---|---|
roleName | String | Official name of the role (Required). | Line Supervisor |
companyId | ObjectId | Reference to the parent Company. | 60d8a... |
2. Field Usage & System Impact
| Category | Validation / Rule | System Behavior |
|---|---|---|
| Mapping | EmployeeProfile | Direct link in the employee master for classification. |
| Data Partitioning | companyId | Multi-tenant isolation; roles are company-specific. |
| Search Engine | Regex Search | Supports partial name matching in the UI lookup. |
3. Business Logic
A. Soft Delete Protection
Roles are never permanently purged if they have been historically linked to employee records. The isDeleted flag prevents the role from appearing in active selection menus while maintaining database integrity for historical reporting.
B. Multi-Tenant Integrity
All role lookups and searches are strictly filtered by the current user's companyId, ensuring that administrators cannot view or modify roles from other companies in the instance.
API Endpoints
Base URL
export const PAYROLE_ROLEMASTER_URL = '/api/payrollRoleMaster'
Endpoints
| Endpoint | Method | Description | Parameters/Body |
|---|---|---|---|
${PAYROLE_ROLEMASTER_URL} | POST | Create a new role | Body: data |
${PAYROLE_ROLEMASTER_URL} | GET | Get all active roles | Query: page, limit |
${PAYROLE_ROLEMASTER_URL}/:id | GET | Get role details by ID | Path: id |
${PAYROLE_ROLEMASTER_URL}/:id | PATCH | Update an existing role | Path: id, Body: body |
${PAYROLE_ROLEMASTER_URL}/delete/:id | PATCH | Soft delete a role | Path: id |
${PAYROLE_ROLEMASTER_URL}/search | GET | Specialized search endpoint | Query: search, page |
RTK Query Hooks
Available in payrollRoleMasterSlice.js:
useCreateRoleMutationuseGetAllRolesQueryuseGetRoleByIdQueryuseUpdateRoleMutationuseDeleteRoleMutationuseSearchRolesQuery
Summary
The Role Master provides a structured way to categorize the workforce, facilitating role-based reporting and serving as a foundation for permission-based access control.
End of Documentation