Skip to main content

Company Setup

📘

đŸĸ Technical Specification: Company Setup

1. đŸ“‹ Feature Overview

  • This module allows administrators to create, update, and manage company entities within the system. It acts
  • Reference:
    Module:AttributeDetail
    Moduleâš™ī¸ Settings

    Feature Name:Name Company Setup

    Description:Description Acts as athe master data management tool for companies,company supportingentities. internalSupports creating internal/external companies and externalmanages entitysoft definitions.

    deletes.
    User Guide 📄 [Ekajaya Admin User Guide - Setting Module, Page 3]


    2. đŸ•šī¸ Functional Workflow (User Perspective)

    • 📍 Navigation: Go to Settings > Company

    • đŸ‘ī¸ Listing View: Paginated list with search (filters by name, description, remark).

    • Listing➕ View:Add Action: DisplaysOpens athe paginated"Add listCompany" of companies with search functionality.form.

    • 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 soft-delete (requires validation).

    📝 UI Input Fields

    Field Name Type Required?Required Description
    Company Name Text ✅ Yes Must be unique inacross theactive system.records.
    Description Text ❌ No Optional details about the company.
    Remark Text ❌ No Optional internal remarks.
    Is Internal? Checkbox ❌ No MarksFlag to mark the company as an internal entity.

    3. đŸ› ī¸ Technical Implementation

    A. đŸ” Permissions & Access Control

    TheAccess followingis permission codes are required to access specific functionalities. These checks are implementedcontrolled via PermissionGuard and templateUI directives (*ngIf directives.).

    Scope Permission Code Description
    Menu Visibility COMPANY.MENU ShowsSidebar "Company"menu initem the side navigation.visibility.
    Page Access COMPANY.LISTING Grants accessAccess to /listing-company.
    Create Action COMPANY.CREATE ShowsVisibility of the + Add button.
    View/Edit Access COMPANY.VIEW Grants accessAccess to /add-company-manage (Read/Edit).
    Update Action COMPANY.UPDATE AllowsAbility savingto save changes on the Edit screen.
    Delete Action COMPANY.DELETE ShowsVisibility of the Delete (Trash)đŸ—‘ī¸ icon.

    B. đŸ”Œ API Interaction

    Base URL: ${environment.baseApiUrl}

    1. đŸ“Ĩ Retrieve Company List (Pagination & Search)

    • Endpoint: /companies/getQuery

    • Method: POST

    • QueryPurpose: Params:

      Fetches
        paginated
      • data

        page:for (Number)the Page index.grid.

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

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

      • sort: companyName

        • filter: isDeleted||$eq||0 (plus dynamic search filtersfilters).

          for
        • name/description).
        • sort: companyName

      2. 🔍 Get Single Company (ForEdit Edit)Mode)

      • Endpoint: /companies/getOne

      • Method: GET

      • Query Params: id (Number)

      3.ʉϬ Create Company

      • Endpoint: /companies/create

      • Method: POST

      • Payload:

        JSON

        {
          "companyName": "String",
          "description": "String", // Optional
          "remark": "String",      // Optional
          "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 bystatus; settingdoes isDeleted:not true.remove from DB.

      • 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
      • Filter: companyName||$eq||{InputName};isDeleted||$eq||0.

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

      2. đŸ›Ąī¸ Pre-Delete Dependency Checks

      Before allowing a delete,deleting, the system checks ifverifies the company is tied to active recordsisn't in other modules.use. If any checkAPI returns data, the delete is blocked.

      Check Order# đŸ“Ļ Module 🔗 Endpoint 🔍 Filter Logic
      1 Users /companyUsers/getQuery `companyId
      2 Drivers /drivers/getQuery `companyId
      3 Movers /movers/getQuery `companyId
      4 Tankers /tankers/getQuery `companyId