Skip to Content

Employees

  • Code: SET-EMP
  • Module: Settings
  • Type: Master Data

1. Overview

Employees are the records of people who work at the tenant and are assigned to one or more stores. An employee is linked to an entity; if the same entity also has a user account, that employee can log in and act as themselves, for example as the PIC of a Purchase Order. Employees can be created from scratch, with a new entity created automatically, or from an existing entity, for example from a user who is not yet recorded as an employee.

Expected outcome: the tenant knows who works at which store, and employee data can be used as the person in charge on transactions.

2. Problem

Without structured employee data, assigning the person in charge of a transaction and managing store assignments is done ad hoc. As a result:

  • Transactions such as POs need a clear person in charge, limited to employees of the related store.
  • Employees often move between or work across several branches.
  • Employees who have left must no longer be selectable, but their history must remain.

3. Goals & Non-goals

3.1 Goals

  • Store transactions can only be assigned to employees who are actually assigned to that store.
  • Employees working across several branches only need to be recorded once, not re-registered per store.
  • One person remains one identity, even if they also have a user account or are recorded as a supplier.
  • Employees who have left can be stopped from new assignments without erasing their traces on past transactions.

3.2 Non-goals

  • Job titles, salaries, work schedules, and attendance.
  • Employee access rights settings; access rights are managed through Users and Roles.
  • Store transfer history beyond the activity log records.

4. Business Rules

Business rules are the set of provisions and constraints that apply to Employees throughout the application, on every screen and action that involves it, whoever performs it. These rules are the single source of truth: if another part of this PRD appears to differ, the rules here prevail.

  • BR-01 The employee code is generated automatically and cannot be changed.
  • BR-02 Status, full name, gender, email, and phone number are required.
  • BR-03 Every employee must be assigned to at least one store.
  • BR-04 One entity may only have one employee record. Creating from an entity can only use an entity not yet recorded as an employee.
  • BR-05 An employee can only be selected as the person in charge of a transaction in the stores they are assigned to.
  • BR-06 Every change to employee data is recorded along with its actor and time.

5. Flow

5.1 Main Flowchart

  1. Choose Source — An employee can be created from scratch, or from an existing entity so that one person is not recorded twice.
    • 0a. Choose Entity — An entity not yet recorded as an employee is selected first, then its name and email are filled in automatically.
  2. Profile — Status, full name, gender, email, and phone number are filled in.
  3. Assigned Stores — The employee is assigned to one or more stores, which determines where they can be selected as the person in charge of transactions.
  4. Review — All inputs are reviewed before saving.
  5. Validation — Inputs are checked before the employee is saved. Data that violates the rules cannot be saved, and the errors are shown in the relevant section.
  6. Employee Saved — The employee code is generated automatically, and the employee can immediately be selected on transactions of the assigned stores.
  7. Edit Employee Data — The profile and assigned stores can be updated at any time, except the employee code, which stays fixed.

5.2 Status Lifecycle

StatusDescriptionNext
Active
is_active: true
The employee still works and can be selected on transactionsInactive, or deleted
Inactive
is_active: false
The employee no longer works and cannot be selected for new transactionsActive, or deleted

6. Document Structure

6.1 General

FieldTypeRequiredDefaultRules
CodeText—Generated on saveSet by the system, cannot be changed (BR-01)
StatusEnumYesNot selectedActive or Inactive
Full NameTextYesFollows the entity, if created from an entityStored on the entity, not on the employee record
GenderEnumYes—Male or Female
EmailTextYesFollows the entity, if created from an entityValid email format
Phone NumberTextYes——
StoresRef. Store, multipleYes, at least 1—Selected from the Store master (BR-03)

7. UI Structure

This section defines how Employees are displayed and operated: the list columns, filters, and form controls along with their option sources. This section only governs display and interaction; content and value rules still follow Document Structure.

7.1 Datatable

ColumnSortableSample ValueComponent
CodeYesEMP-0042Text
Full NameYesBudi SantosoText
Gender—MaleBadge
Stores—Cianjur Store, Bandung StoreAccordion if more than one
As User—budi@toko.comLink to the User detail, or empty
As Supplier—SUP-0012Link to the Supplier detail, or empty
Status—ActiveBadge
Actions—View · Edit · DeleteAction Menu

7.2 Advance Filter

FieldControlOptions SourceDefault
StatusSingle SelectActive or InactiveEmpty
GenderSingle SelectMale or FemaleEmpty

7.3 Form & Details

Create — The Choose Source dialog (From Scratch or From Entity) appears first. Choosing From Entity adds a Choose Entity step, which fills in Full Name and Email automatically. A three-step wizard: Profile, Stores, then Review. Actions: Next, Save.

Edit — Two tabs, Profile and Stores, each saved separately.

Detail — Full name, code, and status badge at the top, followed by read-only Profile and Stores tabs. Actions: Edit Data, Delete, and Activity Logs.

Profile

FieldControlOptions SourceBehavior
StatusSingle SelectActive or Inactive—
Full NameText Input—Filled from the entity if created from an entity
GenderSingle SelectMale or Female—
EmailText Input—Filled from the entity if created from an entity
Phone NumberText Input——

Stores

FieldControlOptions SourceBehavior
StoresMulti Select (cards)Store masterClicked to select; at least one store selected

8. User Stories

US-01 - Create an employee from scratch

As an owner, I want to register a new employee, so that they can be assigned to stores.

IDAcceptance criteria
AC-01.1Opening Add Employee shows the source choice dialog; choosing “Create from Scratch” opens the Profile → Stores → Review wizard.
AC-01.2Status, full name, gender, email (valid format), and phone are required.
AC-01.3At least one store must be selected.
AC-01.4On success, a success toast appears and the user is redirected to the employee list.
AC-01.5Error messages appear in the Review step and on the related fields.

US-02 - Create an employee from an entity

As an admin, I want to create an employee from an existing entity, so that identities are not duplicated.

IDAcceptance criteria
AC-02.1The entity table only shows entities that do not have employee data yet.
AC-02.2After an entity is selected and Next is clicked, the full name and email are filled from the entity.
AC-02.3Data is sent with the selected entity’s party_id; no new entity is created.
AC-02.4Employee created from an entity, then the name or email is changed in the wizard — Needs confirmation: whether the entity data is updated as well.
AC-02.5The employee’s email is the same as another entity’s email — Needs confirmation: whether it is rejected as a duplicate; the error appears on the email field.
AC-02.6No entities without an employee record when choosing “From Entity” — the table is empty; the user can go back and choose “From Scratch”.

US-03 - Edit an employee profile

As an admin, I want to update an employee’s profile and status, so that the data stays accurate.

IDAcceptance criteria
AC-03.1The Edit Data button only appears for users with the update permission.
AC-03.2The employee code is shown but cannot be changed.
AC-03.3Validation is the same as on creation (AC-01.2); the save button is only enabled when there are changes.
AC-03.4Employee deactivated — still appears in the options with a status marker; Needs confirmation: the behavior toward ongoing transactions.

US-04 - Change store assignments

As a store manager, I want to change an employee’s assigned stores, so that they match where the employee works.

IDAcceptance criteria
AC-04.1The Stores tab in view mode only shows the assigned stores; in edit mode it shows all stores with checkboxes.
AC-04.2At least one store must remain selected.
AC-04.3The list of assigned stores is fully replaced with the new selection on save.
AC-04.4The employee is removed from a store where they are the PO PIC — existing POs keep that PIC; they no longer appear in that store’s PIC options.
AC-04.5Stores are shown without an address in the store options — store addresses are not yet available in the option data; a ”-” placeholder is shown.

US-05 - Employee list and filters

As an owner, I want to view and filter employees, so that specific employees are easy to find.

IDAcceptance criteria
AC-05.1Columns: code, full name, gender, stores, as user (email, link to the user detail), as supplier (code, link to the supplier detail), and status.
AC-05.2Keyword search; advanced filters for gender and status; pagination; default sort by name A–Z.
AC-05.3Row actions: View, Edit, Delete according to permissions; bulk delete from selected rows.

US-06 - Delete an employee

As an owner, I want to delete an employee created by mistake.

IDAcceptance criteria
AC-06.1Single and bulk delete require confirmation and the delete permission.
AC-06.2If the deletion is rejected, the error message appears as a toast.
AC-06.3Deleting an employee who is the PIC of a transaction — Needs confirmation: whether it is allowed; if rejected, the error message appears as a toast.

US-07 - Activity history

As an auditor, I want to see the employee activity log.

IDAcceptance criteria
AC-07.1The log is available for all employees (in the list) and per employee (in the detail), with event, actor, and date range filters.

9. User Scenarios

RoleScenario
OwnerRegisters a new cashier and assigns them to two branches
AdminTurns an existing user into an employee without retyping their name and email
Store ManagerMoves an employee from branch A to branch B
OwnerDeactivates an employee who has left

10. Permissions & Actions

10.1 Permission by Action

ActionPermissionCondition
View Employee Listsettings:employee:list:any—
View Activity Logssettings:employee:list:any—
View Employee Detailsettings:employee:view:any—
Create Employeesettings:employee:create:any—
Edit Employee
(Profile)
settings:employee:update:any—
Edit Employee
(Store Assignment)
settings:employee:update:any—
Delete Employeesettings:employee:delete:any—

11. Notifications

This feature does not trigger any notifications.

12. Dependencies

Related PRDs

  • Entities — employee identity and synchronization with users/suppliers.
  • Stores — assigned stores.
  • Users — employees who are also users can log in and act as PIC.
  • Purchase Order — the person in charge is selected from the store’s employees.
  • Activity Logs — the source of the activity log.

Effects on other modules

  • The person in charge options on transactions are taken from the store’s employees (/api/stores/:id/employees/cursor).
Last updated on