Skip to main content

Technical Specification: Company Setup

1. Feature Overview

  • Module: Settings

  • Feature Name: Company Setup

  • Description: This module allows administrators to create, update, and manage company entities within the system. It acts as a master data management tool for companies, supporting internal and external entity definitions.

  • User Guide Reference: [Ekajaya Admin User Guide - Setting Module, Page 3]

2. Functional Workflow (User Perspective)

  • Navigation: Go to Settings > Company.

  • Listing View: Displays a paginated list of companies with search functionality.

  • Add Action: Click the + (Add) button to create a new company.

  • Edit Action: Click the Pencil icon on a row to modify details.

  • Delete Action: Click the Trash icon to perform a soft delete (requires validation).

UI Input Fields

Field NameTypeRequired?Description
Company NameTextYesMust be unique in the system.
DescriptionTextNoOptional details about the company.
RemarkTextNoOptional internal remarks.
Is Internal?CheckboxNoMarks the company as an internal entity.

3. Technical Implementation

A. Permissions & Access Control

The following permission codes are required to access specific functionalities. These checks are implemented via PermissionGuard and template *ngIf directives.

ScopePermission CodeDescription
Menu VisibilityCOMPANY.MENUShows "Company" in the side navigation.
Page AccessCOMPANY.LISTINGGrants access to /listing-company.
Create ActionCOMPANY.CREATEShows the + Add button.
View/Edit AccessCOMPANY.VIEWGrants access to /add-company-manage (Read/Edit).
Update ActionCOMPANY.UPDATEAllows saving changes on the Edit screen.
Delete ActionCOMPANY.DELETEShows the Delete (Trash) icon.

B. API Interaction

Base URL: ${environment.baseApiUrl}

1. Retrieve Company List (Pagination & Search)

  • Endpoint: /companies/getQuery

  • Method: POST

  • Query Params:

    • page: (Number) Page index.

    • limit: (Number) Records per page (default 25).

    • select: id,companyName,description,remark,isDeleted

    • sort: companyName

    • filter: isDeleted||$eq||0 (plus dynamic search filters for name/description).

2. Get Single Company (For Edit)

  • Endpoint: /companies/getOne

  • Method: GET

  • Query Params: id (Number)

3. Create Company

  • Endpoint: /companies/create

  • Method: POST

  • Payload:

    JSON
    {
      "companyName": "String",
      "description": "String",
      "remark": "String",
      "isInternal": Boolean
    }
    

4. Update Company

  • Endpoint: /companies/update

  • Method: POST

  • Payload: Same as Create, but includes "id": Number.

5. Delete Company (Soft Delete)

  • Endpoint: /companies/update

  • Method: POST

  • Logic: Updates the record by setting isDeleted: true.

  • Payload:

    JSON
    {
      "id": Number,
      "isDeleted": true
    }
    

C. Validation & Business Logic

1. Unique Name Validation

  • Trigger: On Save (Create Mode only).

  • Logic: Frontend calls /companies/getQuery with filter companyName||$eq||{InputName};isDeleted||$eq||0.

  • Condition: If resultCount > 0, blocking error: "Company name already exists".

2. Pre-Delete Dependency Checks

Before allowing a delete, the system checks if the company is tied to active records in other modules. If any check returns data, the delete is blocked.

Check OrderModuleEndpointFilter Logic
1Users/companyUsers/getQuery`companyId
2Drivers/drivers/getQuery`companyId
3Movers/movers/getQuery`companyId
4Tankers/tankers/getQuery`companyId