diff --git a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs
index 0eb15ee1..c635ba21 100644
--- a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs
+++ b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs
@@ -1,4 +1,5 @@
-using BMA.EHR.Application.Repositories;
+using Amazon.S3.Model;
+using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.Leaves.TimeAttendants;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
@@ -614,7 +615,7 @@ namespace BMA.EHR.Leave.Service.Controllers
}
///
- /// LV1_011 - รายละเอียดการลงเวลาปฎิบัติงานรายบุคคล
+ /// LV1_011 - รายละเอียดการลงเวลาปฎิบัติงานรายบุคคล Tabรายากรลงเวลาที่ประมวลผลแล้ว (ADMIN)
///
///
///
@@ -630,7 +631,7 @@ namespace BMA.EHR.Leave.Service.Controllers
var imgUrl = $"{_configuration["MinIO:Endpoint"]}{_configuration["MinIO:BucketName"]}";
- var d = (await _userTimeStampRepository.GetTimeStampById(id));
+ var d = (await _processUserTimeStampRepository.GetTimeStampById(id));
if (d == null)
{
throw new Exception(GlobalMessages.DataNotFound);
@@ -1048,6 +1049,9 @@ namespace BMA.EHR.Leave.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPut("admin/edit/approve/{id:guid}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task> ApproveRequestAsync(Guid id, [FromBody] ApproveRequestDto req)
{
if (req.Reason == null || req.Reason == string.Empty)
@@ -1131,6 +1135,9 @@ namespace BMA.EHR.Leave.Service.Controllers
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPut("admin/edit/reject/{id:guid}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task> RejectRequestAsync(Guid id, [FromBody] RejectRequestDto req)
{
if (req.Reason == null || req.Reason == string.Empty)
@@ -1163,6 +1170,82 @@ namespace BMA.EHR.Leave.Service.Controllers
}
+ ///
+ /// LV1_021 - รายละเอียดการลงเวลาปฎิบัติงานรายบุคคล Tabรายการลงเวลา (ADMIN)
+ ///
+ ///
+ ///
+ /// เมื่อทำรายการสำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpGet("log-record/{id:guid}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> GetLogRecordAsync([Required] Guid id)
+ {
+ var imgUrl = $"{_configuration["MinIO:Endpoint"]}{_configuration["MinIO:BucketName"]}";
+
+
+ var d = (await _userTimeStampRepository.GetTimeStampById(id));
+ if (d == null)
+ {
+ throw new Exception(GlobalMessages.DataNotFound);
+ }
+ else
+ {
+ var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(d.KeycloakUserId);
+ if (profile == null)
+ {
+ return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
+ }
+
+ var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
+ if (defaultRound == null)
+ {
+ return Error("ไม่พบรอบการลงเวลา Default", StatusCodes.Status404NotFound);
+ }
+
+ var userRound = await _dutyTimeRepository.GetByIdAsync(profile.DutyTimeId ?? Guid.Empty);
+
+ var duty = userRound ?? defaultRound;
+
+ var result = new CheckInDetailForAdminDto
+ {
+ Id = d.Id,
+ FullName = _userProfileRepository.GetUserFullName(d.KeycloakUserId),
+
+ CheckInDate = d.CheckIn.Date,
+ CheckInTime = d.CheckIn.ToString("HH:mm"),
+ CheckInPOI = d.CheckInPOI,
+ CheckInLat = d.CheckInLat,
+ CheckInLon = d.CheckInLon,
+ CheckInImg = $"{imgUrl}/{d.CheckInImageUrl}",
+ CheckInStatus = DateTime.Parse(d.CheckIn.ToString("yyyy-MM-dd HH:mm")) >
+ DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}") ?
+ "LATE" :
+ "NORMAL",
+ CheckInDescription = d.CheckInRemark ?? "",
+
+ CheckOutDate = d.CheckOut == null ? null : d.CheckOut.Value.Date,
+ CheckOutTime = d.CheckOut == null ? "" : d.CheckOut.Value.ToString("HH:mm"),
+ CheckOutPOI = d.CheckOut == null ? "" : d.CheckOutPOI,
+ CheckOutLat = d.CheckOut == null ? null : d.CheckOutLat,
+ CheckOutLon = d.CheckOut == null ? null : d.CheckOutLon,
+ CheckOutImg = d.CheckOut == null ? "" : $"{imgUrl}/{d.CheckOutImageUrl}",
+
+ CheckOutStatus = d.CheckOut == null ? null :
+ DateTime.Parse(d.CheckOut.Value.ToString("yyyy-MM-dd HH:mm")) <
+ DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
+ "LATE" :
+ "NORMAL",
+ CheckOutDescription = d.CheckOutRemark ?? "",
+ };
+
+ return Success(result);
+ }
+ }
+
#endregion
#endregion