diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopAttendance.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopAttendance.razor index 0315153a..77281261 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopAttendance.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopAttendance.razor @@ -124,10 +124,17 @@ { var staff = await DataService.GetStaffForShopAsync(shopGuid); _staffCount = staff.Count; - // EN: Mock attendance for now — will proxy to real API - // VI: Mock chấm công tạm thời — sẽ proxy đến API thực - _records = new(); - _presentToday = staff.Count; + + // EN: Load real attendance data from merchant-service via BFF. + // VI: Tải dữ liệu chấm công thực từ merchant-service qua BFF. + var attendance = await DataService.GetListFromApiAsync( + $"api/bff/shops/{shopGuid}/attendance?month={_month}&year={_year}"); + _records = attendance; + + var today = DateTime.UtcNow.Date; + _presentToday = attendance.Count(a => a.Date.Date == today); + _lateCount = attendance.Count(a => a.Date.Date == today && a.CheckIn.HasValue && a.CheckIn.Value.Hour >= 9); + _absentCount = _staffCount - _presentToday; } } catch { } diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/StaffController.cs b/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/StaffController.cs index 9ec897f1..bd7c5340 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/StaffController.cs +++ b/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/StaffController.cs @@ -414,6 +414,17 @@ public class StaffController : ControllerBase return await _merchant.PostAsJsonAsync("/api/v1/attendance/check-out", payload).ProxyAsync(); } + /// + /// EN: Get attendance records for a shop (admin) — proxies to merchant-service. + /// VI: Lấy bản ghi chấm công theo shop (admin) — proxy đến merchant-service. + /// + [HttpGet("shops/{shopId:guid}/attendance")] + public Task GetShopAttendance(Guid shopId, [FromQuery] int month = 0, [FromQuery] int year = 0) + { + var qs = $"?month={month}&year={year}"; + return _merchant.GetAsync($"/api/v1/attendance/shop/{shopId}{qs}").ProxyAsync(); + } + /// /// EN: Get all available staff roles. /// VI: Lấy tất cả vai trò nhân viên hiện có.