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
- 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.
- Profile — Status, full name, gender, email, and phone number are filled in.
- 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.
- Review — All inputs are reviewed before saving.
- 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.
- Employee Saved — The employee code is generated automatically, and the employee can immediately be selected on transactions of the assigned stores.
- 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
| Status | Description | Next |
|---|---|---|
Activeis_active: true | The employee still works and can be selected on transactions | Inactive, or deleted |
Inactiveis_active: false | The employee no longer works and cannot be selected for new transactions | Active, or deleted |
6. Document Structure
6.1 General
| Field | Type | Required | Default | Rules |
|---|---|---|---|---|
| Code | Text | — | Generated on save | Set by the system, cannot be changed (BR-01) |
| Status | Enum | Yes | Not selected | Active or Inactive |
| Full Name | Text | Yes | Follows the entity, if created from an entity | Stored on the entity, not on the employee record |
| Gender | Enum | Yes | — | Male or Female |
| Text | Yes | Follows the entity, if created from an entity | Valid email format | |
| Phone Number | Text | Yes | — | — |
| Stores | Ref. Store, multiple | Yes, 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
| Column | Sortable | Sample Value | Component |
|---|---|---|---|
| Code | Yes | EMP-0042 | Text |
| Full Name | Yes | Budi Santoso | Text |
| Gender | — | Male | Badge |
| Stores | — | Cianjur Store, Bandung Store | Accordion if more than one |
| As User | — | budi@toko.com | Link to the User detail, or empty |
| As Supplier | — | SUP-0012 | Link to the Supplier detail, or empty |
| Status | — | Active | Badge |
| Actions | — | View · Edit · Delete | Action Menu |
7.2 Advance Filter
| Field | Control | Options Source | Default |
|---|---|---|---|
| Status | Single Select | Active or Inactive | Empty |
| Gender | Single Select | Male or Female | Empty |
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
| Field | Control | Options Source | Behavior |
|---|---|---|---|
| Status | Single Select | Active or Inactive | — |
| Full Name | Text Input | — | Filled from the entity if created from an entity |
| Gender | Single Select | Male or Female | — |
| Text Input | — | Filled from the entity if created from an entity | |
| Phone Number | Text Input | — | — |
Stores
| Field | Control | Options Source | Behavior |
|---|---|---|---|
| Stores | Multi Select (cards) | Store master | Clicked 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.
| ID | Acceptance criteria |
|---|---|
| AC-01.1 | Opening Add Employee shows the source choice dialog; choosing “Create from Scratch” opens the Profile → Stores → Review wizard. |
| AC-01.2 | Status, full name, gender, email (valid format), and phone are required. |
| AC-01.3 | At least one store must be selected. |
| AC-01.4 | On success, a success toast appears and the user is redirected to the employee list. |
| AC-01.5 | Error 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.
| ID | Acceptance criteria |
|---|---|
| AC-02.1 | The entity table only shows entities that do not have employee data yet. |
| AC-02.2 | After an entity is selected and Next is clicked, the full name and email are filled from the entity. |
| AC-02.3 | Data is sent with the selected entity’s party_id; no new entity is created. |
| AC-02.4 | Employee 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.5 | The 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.6 | No 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.
| ID | Acceptance criteria |
|---|---|
| AC-03.1 | The Edit Data button only appears for users with the update permission. |
| AC-03.2 | The employee code is shown but cannot be changed. |
| AC-03.3 | Validation is the same as on creation (AC-01.2); the save button is only enabled when there are changes. |
| AC-03.4 | Employee 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.
| ID | Acceptance criteria |
|---|---|
| AC-04.1 | The Stores tab in view mode only shows the assigned stores; in edit mode it shows all stores with checkboxes. |
| AC-04.2 | At least one store must remain selected. |
| AC-04.3 | The list of assigned stores is fully replaced with the new selection on save. |
| AC-04.4 | The 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.5 | Stores 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.
| ID | Acceptance criteria |
|---|---|
| AC-05.1 | Columns: 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.2 | Keyword search; advanced filters for gender and status; pagination; default sort by name A–Z. |
| AC-05.3 | Row 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.
| ID | Acceptance criteria |
|---|---|
| AC-06.1 | Single and bulk delete require confirmation and the delete permission. |
| AC-06.2 | If the deletion is rejected, the error message appears as a toast. |
| AC-06.3 | Deleting 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.
| ID | Acceptance criteria |
|---|---|
| AC-07.1 | The 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
| Role | Scenario |
|---|---|
| Owner | Registers a new cashier and assigns them to two branches |
| Admin | Turns an existing user into an employee without retyping their name and email |
| Store Manager | Moves an employee from branch A to branch B |
| Owner | Deactivates an employee who has left |
10. Permissions & Actions
10.1 Permission by Action
| Action | Permission | Condition |
|---|---|---|
| View Employee List | settings:employee:list:any | — |
| View Activity Logs | settings:employee:list:any | — |
| View Employee Detail | settings:employee:view:any | — |
| Create Employee | settings:employee:create:any | — |
| Edit Employee (Profile) | settings:employee:update:any | — |
| Edit Employee (Store Assignment) | settings:employee:update:any | — |
| Delete Employee | settings: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).