Frontend
Masters
State

State Master

Navigation Path

Company → Masters → State Master


1. State List Page

URL

/masters/state-master

Page Description

  • Displays a list of all states configured in the system
  • Allows filtering based on state name
  • Provides actions to add, edit, and delete state records

Filter & Search Section

Field NameTypeDescription
State NameText InputFilters the list by state name

Actions:

  • Search → Filters states based on entered state name
  • Reset → Clears filter and reloads the full list

List Table Columns

Column NameDescription
S NoSerial number
CountryCountry associated with the state
State NameName of the state
Company PF NoCompany PF number mapped to the state
ActionsEdit and Delete options

Row Actions

ActionDescription
EditOpens Edit State page with pre-filled data
DeleteOpens delete confirmation alert

2. Add State Page

Triggered From

State List Page → Add State button

Page Description

  • Allows admins to add a new state and associate it with a country
  • Company PF number can be configured per state

Add State – Fields

Field NameTypeMandatoryDescription
CountryDropdownYesSelect country from the list
State NameText InputYesEnter the state name
Company PF NoText InputNoEnter Company PF number for the state

Actions

ActionBehavior
SaveValidates and saves the state
ResetClears all entered values
CancelReturns to State List page

Validation Rules

  • Country must be selected
  • State Name cannot be empty
  • Duplicate state names are not allowed within the same country

3. Edit State Page

/masters/state-master/edit/:id

Triggered From

State List Page → Edit icon

Page Description

  • Allows updating existing state details
  • All fields are pre-filled with saved data

Editable Fields

Field NameEditable
CountryYes
State NameYes
Company PF NoYes

Actions

ActionBehavior
UpdateSaves changes
CancelDiscards changes and navigates back

4. Delete State Confirmation Alert

Triggered From

State List Page → Delete icon

Alert Content

  • Confirmation message before deletion

Actions:

  • Confirm / Yes → Deletes the state
  • Cancel → Closes the alert without action

Delete Behavior

  • State is removed permanently after confirmation
  • If the state is mapped to other records, deletion may be restricted

5. Filter by State Name

Search Flow

  1. Enter State Name in the search field
  2. Click Search

Result

  • Displays only states matching the entered state name


Field Definitions, Usage, and Calculation Logic

This section provides a technical analysis of the State Master's data structure and its role in geographical and statutory reporting.

1. Field Definitions

Field NameData TypeDescriptionExample Value
stateNameStringOfficial name of the state (Required).Maharashtra
CountryStringParent country (Required).INDIA
CompanyPFNoStringPF Registration Number specific to the state.MH/BAN/12345
codeStringInternal alphanumeric code for the state.ST001
companyIdObjectIdReference to the parent Company.60d8a...

2. Field Usage & System Impact

CategoryValidation / RuleSystem Behavior
UniquenessstateName + companyIdEnforced unique index to prevent duplicate states within the same company.
PF ComplianceCompanyPFNoUsed to populate statutory forms and PF return files for employees in this state.
Data PartitioningcompanyIdEnsures multi-tenant isolation; states are company-specific.

3. Business & Calculation Logic

The State Master serves as a foundational geographical entity with the following technical logic:

A. Bulk Import Engine

The system supports a consolidated import process via the /all-in-one-state-import endpoint:

  • Mapping: The Excel column description is automatically mapped to the stateName field.
  • Deduplication: Before insertion, the system checks for existing records by stateName. If found, it updates the CompanyPFNo and Country; otherwise, it creates a new record.
  • Normalization: All inputs are processed using .trim() to eliminate accidental duplicates caused by trailing spaces.
  • Defaulting: If the country is not specified in the import file, the system defaults it to INDIA.

B. Relational Integrity

State records are primary parents for Districts and Cities. Deleting a state (via soft-delete isDeleted.status: true) hide it from selection dropdowns, but historical data in employee records remains intact for audit purposes.


The State Master module interacts with the following API endpoints:

Base URL

export const STATE_URL = '/api/stateMaster'

Endpoints

EndpointMethodDescriptionParameters/Body
${STATE_URL}POSTCreate a new state masterBody: data
${STATE_URL}GETGet all state mastersQuery: page, limit
${STATE_URL}/:stateIdGETGet state master by IDPath: stateId
${STATE_URL}/:stateIdPATCHUpdate an existing state masterPath: stateId, Body: body
${STATE_URL}/delete/:stateIdPATCHDelete a state masterPath: stateId

RTK Query Hooks

The following hooks are available for frontend integration:

  • useCreateStateMasterMutation
  • useGetAllStateMastersQuery
  • useGetStateMasterByIdQuery
  • useUpdateStateMasterMutation
  • useDeleteStateMasterMutation

End of Documentation