Client Master
This page documents the Client Master module in Worksphere: the Client List, Add, Edit and Delete flows.
1. Client List Page
Page title: Client Lists
Displays a table of clients with the following columns:
- S No
- Code
- Client Name
- Client Type
- Client Category
- Industry Type
- Status
- Actions
Features:
- Search bar at the top to filter clients
- Column-level filters (inputs/selects) below each column header
- Checkbox selection for rows (bulk actions)
- Table view toggle (compact / comfortable)
- Add Client button at the top-right
- Actions column contains icons for Edit and Delete
Behaviour:
- The search bar performs a global filter across table columns.
- Column-level filters narrow results by that specific column.
- Selecting rows enables bulk actions (if implemented).
- Clicking Add Client opens the Add New Client form.
- Clicking Edit opens the Edit Client page for that record.
- Clicking Delete opens a confirmation modal (see section 4).
2. Add New Client Page
Page title: Add New Client
Used to create a new client master record.
Form fields (Client Details):
- Code — Auto-generated (read-only)
- Client Name — Text input; required
- Client Type — Dropdown; required
- Client Category — Dropdown; required
- Industry Type — Dropdown; optional
- Gross PF / ESI Applicable — Toggle or dropdown (Yes / No)
Email Management:
- Email 1 — Email input (required if provided)
- Ability to add multiple email rows (Add / Delete controls per row)
- Each email row validates format before save
Actions:
- Submit — Saves the client record (validates required fields and email formats)
- Reset — Clears form inputs
Validation:
- Required fields must be filled prior to submission.
- Email fields must match a valid email regex; show inline error for invalid entries.
- If the selected Code already exists (unlikely for auto-generated), surface a validation error.
Success:
- On success, close the form (or navigate back) and show a success toast: "Client created successfully." The new record appears in the Client Lists.
3. Edit Client Page
Page title: Edit Client
Same layout and fields as Add New Client. Fields are pre-filled with the selected client's data.
Capabilities:
- Update client information
- Add new email addresses
- Edit existing emails
- Delete email addresses
Actions:
- Update — Saves changes (validations apply)
- Cancel — Discards changes and returns to the list
Success:
- On successful update show: "Client updated successfully."
4. Delete Client Confirmation
Triggered from the Actions column delete icon on the Client Lists table.
Modal content:
- Warning icon
- Title: Are you sure?
- Message: You are about to permanently delete this client.
- Buttons:
- Yes, delete it! — Confirms deletion
- Cancel — Closes the popup without changes
Behaviour:
- Deletion is destructive; confirm action with the modal.
- On confirm, remove the client and show success toast: "Client deleted successfully." Optionally refresh the list.
Field Definitions, Usage, and Calculation Logic
This section provides a technical deep dive into the properties, automated generation logic, and cross-module integration of the Client Master.
1. Field Definitions
| Field Name | Data Type | Description | Example Value |
|---|---|---|---|
companyCode | String | Auto-generated sequential identifier. | CL0001 |
companyName | String | Legal name of the client (Unique per company). | Luvid Solutions Pvt Ltd |
clientType | String | Classification (e.g., Corporate, Government). | Corporate |
clientCategory | String | Internal categorization for reporting. | A+ Category |
industryType | ObjectId | Reference to Industry Master. | 60d8a... |
emailIds | Array[String] | List of valid email addresses (Max 4). | ["hr@client.com"] |
grossPFESIApplicable | Boolean | Flag to trigger PF/ESI calculations at billing level. | true |
validityFrom | Date | Start of the service/contract validity. | 2024-01-01 |
validityTo | Date | End of the service/contract validity. | 2024-12-31 |
isActive | Boolean | Operational status flag. | true |
2. Field Usage & Validation
| Category | Validation Rules | System Impact |
|---|---|---|
| Identification | companyName must be unique across non-deleted records. | Prevents redundant billing entities. |
| Email Limits | Maximum of 4 email addresses allowed per client. | Standardizes communication channels. |
| Soft Delete | Uniqueness is checked only against isDeleted: false. | Allows re-creation of clients with same name after deletion. |
| Multi-Tenancy | All clients are sandboxed by companyId. | Ensures data isolation between different Worksphere tenants. |
3. Business Logic: The "CL" Code Generation
The Client Master implements an automated sequential coding system during the pre-save process:
- Prefix: Every client code starts with the constant
CL. - Sequence: The system counts existing non-deleted clients for the company.
- Padded Format: A 4-digit sequential number is appended (e.g.,
CL0001,CL0002). - Collision Handling: If a race condition occurs, the system automatically finds the maximum existing
CL\d{4}pattern and increments it to ensure zero overlap.
4. Cross-Module Integration
The Client Master serves as the Parent Entity for several key operational modules:
A. Unit Management (Branch/Site Level)
Every Unit created in the system must be linked to a Client. The Unit's clientType acts as a categorization filter synced from this master.
B. Attendance & Payroll Transactions
Daily attendance records (SalaryAttendanceDetails) and automated salary processes (SalarySalaryAutoProccess) explicitly track the clientId. This allows the system to:
- Generate Client-wise Manpower Cost Reports.
- Batch process payroll for specific clients.
- Apply client-specific billing slabs (via
locationHeadSlabMaster).
5. Data Flow & System Hierarchy
The Client Master module interacts with the following API endpoints:
Base URL
export const CLIENTMASTER_URL = '/api/commonClientDetails'
Endpoints
| Endpoint | Method | Description | Parameters/Body |
|---|---|---|---|
${CLIENTMASTER_URL} | POST | Create a new client master | Body: data |
${CLIENTMASTER_URL} | GET | Get all client masters | Query: page, limit |
${CLIENTMASTER_URL}/:clientId | GET | Get client master by ID | Path: clientId |
${CLIENTMASTER_URL}/:clientId | PATCH | Update an existing client master | Path: clientId, Body: body |
${CLIENTMASTER_URL}/delete/:clientId | PATCH | Delete a client master | Path: clientId |
${CLIENTMASTER_URL}/search | GET | Search common clients | Query: query |
${CLIENTMASTER_URL}/search/by-branch | GET | Search common clients by branch | Query: query |
RTK Query Hooks
The following hooks are available for frontend integration:
useCreateClientMasterMutationuseGetAllClientMastersQueryuseGetClientMasterByIdQueryuseUpdateClientMasterMutationuseDeleteClientMasterMutationuseSearchCommonClientsQueryuseSearchCommonClientsByBranchQuery
End of Client Master documentation.