[CLAUDE] Domain+App+Infra+FE-Admin+FE-User: S34 Plan 4 G-H2 Mig 35 schema foundation
All checks were successful
Deploy SOLUTION_ERP / build-deploy (push) Successful in 3m30s

Phase 10.2 G-H2 Cấu hình HRM — 4 catalog lookup foundation deploy (BE CRUD +
FE forms DEFER S35 cho clean handoff).

Mig 35 `AddHrmConfigs` — 4 table mới:
- LeaveTypes (Code unique + Name + DaysPerYear decimal(5,2) + IsPaid +
  RequiresAttachment) — 5 sample seed (ANNUAL 12d + SICK 30d + MATERNITY 180d
  + COMPASSIONATE 3d + UNPAID 0d)
- Holidays (Year + Date UNIQUE composite + Name + IsRecurring + IsPaid) —
  10 sample VN 2026 (Tết Dương + 5 Tết Nguyên đán placeholder + Giỗ tổ +
  30/4 + 1/5 + 2/9 + Quốc khánh)
- ShiftPatterns (Code unique + Name + StartTime/EndTime TimeOnly + BreakMinutes +
  WorkDays comma string) — 3 sample (HC 8-17 T2-T6 + CA1 6-14 T2-T7 + CA2 14-22)
- OtPolicies (Code unique + 3 Multiplier decimal(4,2) + 3 MaxHours int) —
  1 sample STANDARD (1.5x/2.0x/3.0x weekday/weekend/holiday + 4h/40h/200h cap
  Luật Lao động VN 2019)

Files:
- Domain/Hrm/{LeaveType,Holiday,ShiftPattern,OtPolicy}.cs (4 entity AuditableEntity)
- Infrastructure/Persistence/Configurations/{LeaveType,Holiday,ShiftPattern,OtPolicy}Configuration.cs (4 EF Config UNIQUE indexes)
- IApplicationDbContext + ApplicationDbContext +4 DbSet
- Migrations/20260527075940_AddHrmConfigs.{cs,Designer.cs} + Snapshot updated (3-file rule)
- DbInitializer.SeedHrmConfigsAsync ~120 LOC seed sample (NOT gated DemoSeed per gotcha #51)
- MenuKeys.cs +HrmConfig sub-group + 4 leaf (LeaveTypes/Holidays/Shifts/OtPolicies) Order=2 dưới Hrm
- DbInitializer.SeedMenuTreeAsync +5 entry (sub-group + 4 leaf)
- fe-admin + fe-user menuKeys.ts +5 const mirror BE (Pattern 16-bis sync)

Verify:
- dotnet build PASS (2 warn DocxRenderer baseline, 0 error)
- dotnet test 130/130 PASS baseline preserve
- Mig 35 applied LocalDB SolutionErp_Dev — verified via dotnet ef database update
- 4 catalog table created + 5+10+3+1 = 19 sample row seed

Defer S35:
- Task 2 BE CQRS 4 catalog CRUD (16 endpoint) — Implementer Case 2 cookie-cutter
- Task 4 FE 2 app 4 catalog page (list/create/edit dialog) — Implementer Case 2

Cumulative S34 mig: 34 → 35 (+1). Tables 67 → 71 (+4). Menu keys 64 → 69 (+5).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-05-27 15:04:10 +07:00
parent e506cd8135
commit 07b3f3b284
17 changed files with 5739 additions and 0 deletions

View File

@ -0,0 +1,24 @@
using SolutionErp.Domain.Common;
namespace SolutionErp.Domain.Hrm;
// Phase 10.2 G-H2 (Mig 35 — S34 2026-05-27) — Ngày lễ Việt Nam.
// Catalog admin maintain per year. IsRecurring=true (vd 1/1) → auto roll-over
// năm sau (admin bulk clone). Non-recurring (vd Tết Nguyên đán date thay đổi
// theo Âm lịch) → admin tạo mới mỗi năm.
//
// Sample seed 10 ngày lễ VN 2026: Tết Dương lịch (1/1) + Tết Nguyên đán
// (5 ngày 28/1-1/2 đầu năm tới) + Giỗ tổ Hùng Vương (14/3 ÂL ~2026-04-20) +
// 30/4 + 1/5 + 2/9 + Quốc khánh 3/9.
public class Holiday : AuditableEntity
{
public int Year { get; set; } // 2026
public DateOnly Date { get; set; } // UNIQUE composite (Year, Date)
public string Name { get; set; } = string.Empty; // "Tết Dương lịch"
public bool IsRecurring { get; set; } // 1/1 lặp mỗi năm, Tết Âm lịch không
public bool IsPaid { get; set; } = true; // Có lương / Không lương (mặc định có)
public bool IsActive { get; set; } = true;
public string? Description { get; set; }
}

View File

@ -0,0 +1,25 @@
using SolutionErp.Domain.Common;
namespace SolutionErp.Domain.Hrm;
// Phase 10.2 G-H2 (Mig 35 — S34 2026-05-27) — Loại phép.
// Catalog lookup table cho HRM Workflow Apps (G-O4 LeaveRequest).
// Sample seed 5 loại: ANNUAL (12d) + SICK (30d) + MATERNITY (180d) +
// COMPASSIONATE (3d) + UNPAID (0d, không giới hạn).
public class LeaveType : AuditableEntity
{
public string Code { get; set; } = string.Empty; // UNIQUE — "ANNUAL", "SICK", ...
public string Name { get; set; } = string.Empty; // "Phép năm", "Phép ốm"
// Số ngày max được nghỉ trong năm. 0 = không giới hạn (UNPAID).
// decimal(5,2) cho phép half-day (vd 0.5d).
public decimal DaysPerYear { get; set; }
public bool IsPaid { get; set; } = true; // Có lương / Không lương
// Yêu cầu đính kèm giấy tờ (vd Sick → giấy bác sĩ, Maternity → giấy KS).
public bool RequiresAttachment { get; set; }
public bool IsActive { get; set; } = true;
public string? Description { get; set; }
}

View File

@ -0,0 +1,32 @@
using SolutionErp.Domain.Common;
namespace SolutionErp.Domain.Hrm;
// Phase 10.2 G-H2 (Mig 35 — S34 2026-05-27) — Chính sách tăng ca (OT).
// Catalog admin define hệ số OT theo loại ngày + giới hạn max hour.
// 1 OtPolicy hoạt động "default" cho toàn công ty (IsActive=true unique).
//
// Sample seed 1 default:
// STANDARD: Weekday 1.5x / Weekend 2.0x / Holiday 3.0x
// MaxHoursPerDay=4h, MaxHoursPerMonth=40h (Luật Lao động VN cap)
//
// Future G-P1 Chấm công attendance + G-O4 OtRequest workflow sẽ reference
// OtPolicy.IsActive=true để calc lương + validate approval.
public class OtPolicy : AuditableEntity
{
public string Code { get; set; } = string.Empty; // UNIQUE — "STANDARD"
public string Name { get; set; } = string.Empty; // "Chính sách OT chuẩn"
// Hệ số nhân lương OT decimal(4,2) — vd 1.5 / 2.0 / 3.0.
public decimal MultiplierWeekday { get; set; }
public decimal MultiplierWeekend { get; set; }
public decimal MultiplierHoliday { get; set; }
// Giới hạn OT — vd Luật Lao động VN max 4h/day, 40h/month, 200h/year.
public int MaxHoursPerDay { get; set; }
public int MaxHoursPerMonth { get; set; }
public int MaxHoursPerYear { get; set; }
public bool IsActive { get; set; } = true;
public string? Description { get; set; }
}

View File

@ -0,0 +1,30 @@
using SolutionErp.Domain.Common;
namespace SolutionErp.Domain.Hrm;
// Phase 10.2 G-H2 (Mig 35 — S34 2026-05-27) — Ca làm việc.
// Catalog admin define ca làm — assign cho NV qua EmployeeProfile (defer Phase 1.5
// nếu user cần per-NV shift assignment) hoặc default "HC" cho toàn công ty.
//
// Sample seed 3 ca:
// HC (Hành chính) — 8:00-17:00 Mon-Fri, nghỉ trưa 60 phút
// CA1 (Ca sáng) — 6:00-14:00 Mon-Sat, nghỉ trưa 30 phút
// CA2 (Ca chiều) — 14:00-22:00 Mon-Sat, nghỉ giữa ca 30 phút
public class ShiftPattern : AuditableEntity
{
public string Code { get; set; } = string.Empty; // UNIQUE — "HC", "CA1", "CA2"
public string Name { get; set; } = string.Empty; // "Hành chính", "Ca sáng"
public TimeOnly StartTime { get; set; } // 08:00
public TimeOnly EndTime { get; set; } // 17:00
public int BreakMinutes { get; set; } // Phút nghỉ trưa / giữa ca
// Comma-separated weekday codes: "Mon,Tue,Wed,Thu,Fri" cho HC,
// "Mon,Tue,Wed,Thu,Fri,Sat" cho CA1/CA2 (working Sat).
// FE Designer multi-select chuyển → comma string. Flexibility cao hơn bitmask int.
public string WorkDays { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
public string? Description { get; set; }
}

View File

@ -84,6 +84,12 @@ public static class MenuKeys
// ============================================================
public const string Hrm = "Hrm"; // root group
public const string HrmHoSo = "Hrm_HoSo"; // Hồ sơ Nhân sự (list + detail + edit)
// Phase 10.2 G-H2 (Mig 35 — S34) — Cấu hình HRM 4 catalog lookup.
public const string HrmConfig = "Hrm_Config"; // sub-group cấu hình
public const string HrmConfigLeaveTypes = "Hrm_Config_LeaveTypes"; // Loại phép
public const string HrmConfigHolidays = "Hrm_Config_Holidays"; // Ngày lễ
public const string HrmConfigShifts = "Hrm_Config_Shifts"; // Ca làm việc
public const string HrmConfigOtPolicies = "Hrm_Config_OtPolicies"; // Chính sách OT
// ============================================================
// Module Văn phòng số (Phase 10.2 G-O1+ S34 2026-05-27).
@ -119,6 +125,7 @@ public static class MenuKeys
PurchaseEvaluations,
Budgets, BudgetList, BudgetCreate, BudgetPending,
Hrm, HrmHoSo, // Mig 34 — Phase 10.1
HrmConfig, HrmConfigLeaveTypes, HrmConfigHolidays, HrmConfigShifts, HrmConfigOtPolicies, // Mig 35 — Phase 10.2 G-H2
Off, OffDanhBa, // Phase 10.2 G-O1 — Văn phòng số
System, Users, Roles, Permissions, MenuVisibility, Workflows, PeWorkflows,
ApprovalWorkflowsV2, ApprovalWorkflowDuyetNccV2, ApprovalWorkflowDuyetNccPhuongAnV2, // Mig 22