Frontend
Client
Client

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 NameData TypeDescriptionExample Value
companyCodeStringAuto-generated sequential identifier.CL0001
companyNameStringLegal name of the client (Unique per company).Luvid Solutions Pvt Ltd
clientTypeStringClassification (e.g., Corporate, Government).Corporate
clientCategoryStringInternal categorization for reporting.A+ Category
industryTypeObjectIdReference to Industry Master.60d8a...
emailIdsArray[String]List of valid email addresses (Max 4).["hr@client.com"]
grossPFESIApplicableBooleanFlag to trigger PF/ESI calculations at billing level.true
validityFromDateStart of the service/contract validity.2024-01-01
validityToDateEnd of the service/contract validity.2024-12-31
isActiveBooleanOperational status flag.true

2. Field Usage & Validation

CategoryValidation RulesSystem Impact
IdentificationcompanyName must be unique across non-deleted records.Prevents redundant billing entities.
Email LimitsMaximum of 4 email addresses allowed per client.Standardizes communication channels.
Soft DeleteUniqueness is checked only against isDeleted: false.Allows re-creation of clients with same name after deletion.
Multi-TenancyAll 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:

  1. Prefix: Every client code starts with the constant CL.
  2. Sequence: The system counts existing non-deleted clients for the company.
  3. Padded Format: A 4-digit sequential number is appended (e.g., CL0001, CL0002).
  4. 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

EndpointMethodDescriptionParameters/Body
${CLIENTMASTER_URL}POSTCreate a new client masterBody: data
${CLIENTMASTER_URL}GETGet all client mastersQuery: page, limit
${CLIENTMASTER_URL}/:clientIdGETGet client master by IDPath: clientId
${CLIENTMASTER_URL}/:clientIdPATCHUpdate an existing client masterPath: clientId, Body: body
${CLIENTMASTER_URL}/delete/:clientIdPATCHDelete a client masterPath: clientId
${CLIENTMASTER_URL}/searchGETSearch common clientsQuery: query
${CLIENTMASTER_URL}/search/by-branchGETSearch common clients by branchQuery: query

RTK Query Hooks

The following hooks are available for frontend integration:

  • useCreateClientMasterMutation
  • useGetAllClientMastersQuery
  • useGetClientMasterByIdQuery
  • useUpdateClientMasterMutation
  • useDeleteClientMasterMutation
  • useSearchCommonClientsQuery
  • useSearchCommonClientsByBranchQuery

End of Client Master documentation.