db0c3a4a02
CI/CD / CI · API (dotnet build + test) (push) Successful in 1m10s
CI/CD / CI · Admin API (dotnet build) (push) Successful in 1m40s
CI/CD / CI · Dashboard (tsc) (push) Successful in 1m5s
CI/CD / CI · Admin Web (tsc) (push) Successful in 1m32s
CI/CD / CI · Website (tsc) (push) Successful in 45s
CI/CD / CI · Koja (tsc) (push) Successful in 49s
CI/CD / Deploy · all services (push) Successful in 9m24s
Previously the only Employee records were the Owner (created at café signup) and
one Manager per branch — there was no way to add a waiter/cashier/chef. Adds it.
Backend:
- POST /api/cafes/{cafeId}/employees (HrController). Owner/Manager only; creating a
Manager requires Owner; Owner cannot be created here. Validates name/phone/role,
enforces one-employee-per-phone, validates branch belongs to the café, and can
optionally set username/password login in the same step (same hashing + uniqueness
as the credentials endpoint). Returns EmployeeSummaryDto.
Dashboard:
- New "Team" tab on the HR screen (now the default): employee roster (name, role,
phone, base salary) + an "Add employee" button (owner/manager) opening an inline
form — name, phone, role, optional branch, optional base salary, optional login.
- Role labels + all form strings in fa/en/ar.
86 API tests pass; dashboard tsc + build clean.
77 lines
1.9 KiB
C#
77 lines
1.9 KiB
C#
using Meezi.Core.Enums;
|
|
|
|
namespace Meezi.API.Models.Hr;
|
|
|
|
public record EmployeeSummaryDto(
|
|
string Id,
|
|
string Name,
|
|
string Phone,
|
|
EmployeeRole Role,
|
|
decimal BaseSalary);
|
|
|
|
public record AttendanceDto(
|
|
string Id,
|
|
string EmployeeId,
|
|
string EmployeeName,
|
|
DateOnly Date,
|
|
DateTime? ClockIn,
|
|
DateTime? ClockOut,
|
|
string? Notes);
|
|
|
|
public record ShiftDto(int DayOfWeek, ShiftType ShiftType);
|
|
|
|
public record UpsertShiftsRequest(IReadOnlyList<ShiftDto> Shifts);
|
|
|
|
public record LeaveRequestDto(
|
|
string Id,
|
|
string EmployeeId,
|
|
string EmployeeName,
|
|
DateOnly StartDate,
|
|
DateOnly EndDate,
|
|
string? Reason,
|
|
LeaveStatus Status,
|
|
string? ReviewedBy,
|
|
DateTime CreatedAt);
|
|
|
|
public record CreateLeaveRequest(
|
|
DateOnly StartDate,
|
|
DateOnly EndDate,
|
|
string? Reason);
|
|
|
|
public record ReviewLeaveRequest(LeaveStatus Status);
|
|
|
|
public record EmployeeSalaryDto(
|
|
string Id,
|
|
string EmployeeId,
|
|
string EmployeeName,
|
|
string MonthYear,
|
|
decimal BaseSalary,
|
|
decimal OvertimePay,
|
|
decimal Deductions,
|
|
decimal NetSalary,
|
|
bool IsPaid);
|
|
|
|
public record CreateSalaryRequest(
|
|
string EmployeeId,
|
|
string MonthYear,
|
|
decimal BaseSalary,
|
|
decimal OvertimePay,
|
|
decimal Deductions);
|
|
|
|
public record TodayShiftDto(ShiftType ShiftType, string Label);
|
|
|
|
/// <summary>Set or update username/password credentials for an employee.</summary>
|
|
public record SetEmployeeCredentialsRequest(string Username, string Password);
|
|
|
|
/// <summary>Create a new employee. Owner/Manager only; Manager role requires Owner.
|
|
/// Username+Password are optional and, when supplied, enable dashboard/POS login.</summary>
|
|
public record CreateEmployeeRequest(
|
|
string Name,
|
|
string Phone,
|
|
EmployeeRole Role,
|
|
string? BranchId = null,
|
|
decimal? BaseSalary = null,
|
|
string? NationalId = null,
|
|
string? Username = null,
|
|
string? Password = null);
|