diff --git a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs index 2cbd1d34..e51ec08f 100644 --- a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs +++ b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/AdditionalCheckRequestRepository.cs @@ -64,6 +64,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants var data = await _dbContext.Set().AsQueryable() .Where(x => x.KeycloakUserId == keycloakId) .Where(x => (x.CheckDate.Year == year && x.CheckDate.Month == month)) + .OrderByDescending(x => x.CheckDate.Date) // add sort for fix defect .ToListAsync(); return data; @@ -80,6 +81,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants { var data = await _dbContext.Set().AsQueryable() .Where(x => (x.CheckDate.Year == year && x.CheckDate.Month == month)) + .OrderByDescending(x => x.CreatedAt.Date) .ToListAsync(); return data; diff --git a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/ProcessUserTimeStampRepository.cs b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/ProcessUserTimeStampRepository.cs index 9d0119c5..eb8dda94 100644 --- a/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/ProcessUserTimeStampRepository.cs +++ b/BMA.EHR.Application/Repositories/Leaves/TimeAttendants/ProcessUserTimeStampRepository.cs @@ -137,7 +137,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants var data = await _dbContext.Set() .Where(u => u.KeycloakUserId == keycloakId) .Where(u => u.CheckIn.Year == year) - .OrderBy(u => u.CheckIn) + .OrderByDescending(u => u.CheckIn.Date) .Skip((page - 1) * pageSize) .Take(pageSize) .ToListAsync(); diff --git a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs index 7e55fd9f..36024048 100644 --- a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs +++ b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs @@ -556,6 +556,8 @@ namespace BMA.EHR.Leave.Service.Controllers DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}") ? "LATE" : "NORMAL", + CheckInIsLocation = d.IsLocationCheckIn, + CheckInLocationName = d.CheckInLocationName, CheckOutDate = d.CheckOut == null ? null : d.CheckOut.Value.Date, CheckOutTime = d.CheckOut == null ? "" : d.CheckOut.Value.ToString("HH:mm:ss"), CheckOutLocation = d.CheckOutPOI ?? "", @@ -568,6 +570,9 @@ namespace BMA.EHR.Leave.Service.Controllers "ABSENT" : "NORMAL", + CheckOutIsLocation = d.IsLocationCheckOut, + CheckOutLocationName = d.CheckOutLocationName, + IsEdit = _processUserTimeStampRepository.IsEditRequest(userId, d.CheckIn.Date) //IsEdit = (d.EditStatus != null && d.EditStatus != "") diff --git a/BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs b/BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs index aeef002f..c5fe905c 100644 --- a/BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs +++ b/BMA.EHR.Leave.Service/DTOs/CheckIn/CheckInHistoryDto.cs @@ -12,6 +12,10 @@ public string? CheckInStatus { get; set; } = string.Empty; + public bool CheckInIsLocation { get; set; } = false; + + public string? CheckInLocationName { get; set; } = string.Empty; + public DateTime? CheckOutDate { get; set; } = DateTime.MinValue; public string? CheckOutTime { get; set; } = "00:00"; @@ -20,6 +24,10 @@ public string? CheckOutStatus { get; set; } = string.Empty; + public bool CheckOutIsLocation { get; set; } = false; + + public string? CheckOutLocationName { get; set; } = string.Empty; + //public string EditStatus { get; set; } = string.Empty; //public string EditReason { get; set; } = string.Empty;