Users / Employees
Users / Employees manages employee accounts and branch-warehouse permissions. These settings affect menu access, approval authority, receiving permissions, transfer workflows, and branch-specific warehouse operations.
App Entry Points
| App | Target |
|---|---|
| Mobile | EmployeeList -> EmployeeDetail / profile / transfer receive setting |
| POS Terminal | employee -> EmployeeDetailForm |
Workflow
API And Permission Rules
Detail Settings And Side Effects
| Control | Permission and behavior |
|---|---|
| Profile permission toggles | Only employee managers/admin authority can edit and save; ordinary users see current values. |
| Save | Serializes boolean UI flags as numeric 0/1; server response should be reloaded before relying on new menu access. |
| Reset another employee password | Manager-only destructive credential action with confirmation. |
| Change own password | The current employee may use the self-service verification/new-password flow; managers can also access it. |
| Transfer receive setting | Manager selects a branch, then configures each sub-warehouse independently. |
| Warehouse toggle | Creates a missing grant with canApprove: 1, or updates an existing grant to 0/1; it is scoped by user + branch + warehouse. |
| Runtime impact | Permission changes can affect menus, approvals, receiving and transfers; refresh/re-login may be needed where auth state is cached. |
| Operation | Service |
|---|---|
| List users | getUsers({ page, search }) -> GET /users |
| Detail | getUserById(id) |
| Patch profile | patchUser({ id, payload }) |
| Get warehouse permissions | getUserBranchWarehousePermissions({ userId, branchId }) |
| Create warehouse permission | createUserBranchWarehousePermission({ whsCode, whsName, canApprove: 1 }) |
| Update warehouse permission | updateUserBranchWarehousePermission with canApprove set to 0 or 1 |
Important rules:
- Employee menu is admin-accessible even when normal dept matching is not enough.
- Warehouse permission changes affect inventory/receiving flows and may require refresh or re-login before every menu recalculates.
- Approval flags such as customer approval are stored on the user and consumed by customer-management flows.
- Employee profile self-service is different from admin employee management.
Permissions And Guards
| Topic | Behavior |
|---|---|
| Terminal menu key | employee |
| deptCode menu set | -2, 1, 2, 3, 4, 7, 29, 21, 8, 9, 27 |
| Admin override | Admin can access Employee even if dept rule would otherwise fail. |
| Branch warehouse rule | Permissions are scoped by user and branch. |
Mobile vs POS Terminal
| Topic | Mobile | POS Terminal |
|---|---|---|
| Navigation | Employee stack with profile and transfer receive setting screens | HomeScreen split-pane menu key employee |
| Permission edit | Dedicated transfer receive setting screen | EmployeeDetailForm permission toggles |
| Profile | Mobile employee profile screen | Detail form profile fields |
| Refresh | Screen/list refresh | Split list/detail refresh |
Developer Handoff Map
| Area | Code |
|---|---|
| Mobile stack | apps/mobile/src/screens/employeeStack/* |
| Terminal detail | apps/pos-terminal/src/screens/HomeScreen/EmployeeDetailForm.tsx |
| User service | apps/*/src/services/user.ts, users.ts |
| Menu access | HomeScreen/mobile menu config and @bsr/utils permission helpers |