Frontend
Masters
Role Master

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 NameTypeDescription
Role NameText InputFilters 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 NameDescription
S NoSerial number.
Role NameThe official name of the organizational role.
ActionsEdit and Delete options.

Row Actions

ActionDescription
EditOpens the Edit Role drawer/form with pre-filled names.
DeleteOpens 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 NameTypeMandatoryDescription
Role NameText InputYesEnter the designation or organizational role name.

Actions

ActionBehavior
SaveValidates naming constraints and saves the record.
ResetClears the text entry.
CancelReturns 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 NameEditable
Role NameYes

Actions

ActionBehavior
UpdateSaves the modified name and refreshes the master table.
CancelDiscards 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.status to true.
  • Cancel → Dismisses the alert.

Field Definitions, Usage, and Calculation Logic

1. Technical Field Definitions

Field NameData TypeDescriptionExample Value
roleNameStringOfficial name of the role (Required).Line Supervisor
companyIdObjectIdReference to the parent Company.60d8a...

2. Field Usage & System Impact

CategoryValidation / RuleSystem Behavior
MappingEmployeeProfileDirect link in the employee master for classification.
Data PartitioningcompanyIdMulti-tenant isolation; roles are company-specific.
Search EngineRegex SearchSupports 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

EndpointMethodDescriptionParameters/Body
${PAYROLE_ROLEMASTER_URL}POSTCreate a new roleBody: data
${PAYROLE_ROLEMASTER_URL}GETGet all active rolesQuery: page, limit
${PAYROLE_ROLEMASTER_URL}/:idGETGet role details by IDPath: id
${PAYROLE_ROLEMASTER_URL}/:idPATCHUpdate an existing rolePath: id, Body: body
${PAYROLE_ROLEMASTER_URL}/delete/:idPATCHSoft delete a rolePath: id
${PAYROLE_ROLEMASTER_URL}/searchGETSpecialized search endpointQuery: search, page

RTK Query Hooks

Available in payrollRoleMasterSlice.js:

  • useCreateRoleMutation
  • useGetAllRolesQuery
  • useGetRoleByIdQuery
  • useUpdateRoleMutation
  • useDeleteRoleMutation
  • useSearchRolesQuery

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