Skip to main content

Company Setup

đŸĸ  Technical Specification: Company Setup

 

1. 📋 Feature Overview

Attribute Detail
Module âš™ī¸ Settings
Feature Name Company Setup
Description Acts as the master data management tool for company entities. Supports creating internal/external companies and manages soft deletes.
User Guide 📄 [Ekajaya Admin User Guide - Setting Module, Page 3]

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

  • 📍 Navigation: Settings > Company

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

  • ➕ Add Action: Opens the "Add Company" form.

  • âœī¸ Edit Action: Click the Pencil icon to modify details.

  • đŸ—‘ī¸ Delete Action: Click the Trash icon to soft-delete (requires validation).

📝 UI Input Fields

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

3. đŸ› ī¸ Technical Implementation

🔐 A. đŸ” Permissions & Access Control

Access is controlled via PermissionGuard and UI directives (*ngIf).

Scope Permission Code Description
Menu Visibility COMPANY.MENU Sidebar menu item visibility.
Page Access COMPANY.LISTING Access to /listing-company.
Create Action COMPANY.CREATE Visibility of the + Add button.
View/Edit Access COMPANY.VIEW Access to /add-company-manage.
Update Action COMPANY.UPDATE Ability to save changes on Edit screen.
Delete Action COMPANY.DELETE Visibility of the Delete đŸ—‘ī¸ icon.

🔌 B. đŸ”Œ API Interaction

Base URL: ${environment.baseApiUrl}

đŸ“Ĩ 1. đŸ“Ĩ Retrieve Company List

  • Endpoint: /companies/getQuery

  • Method: POST

  • Purpose: Fetches paginated data for the grid.

  • Key Params:

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

    • sort: companyName


🔍 2. đŸ” Get Single Company (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 status; does not 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.

  • Filter: companyName||$eq||{InputName};isDeleted||$eq||0

  • Error: If resultCount > 0, display: "Company name already exists".

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

Before deleting, the system verifies the company isn't in use. If any API returns data, the delete is blocked.

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