diff --git a/BMA.EHR.Application/Repositories/UserProfileRepository.cs b/BMA.EHR.Application/Repositories/UserProfileRepository.cs index d45660a3..82205706 100644 --- a/BMA.EHR.Application/Repositories/UserProfileRepository.cs +++ b/BMA.EHR.Application/Repositories/UserProfileRepository.cs @@ -585,6 +585,41 @@ namespace BMA.EHR.Application.Repositories } } + public async Task> GetProfileWithKeycloakAllOfficerRetireFilterAndRevisionAndDate(string? accessToken, int? node, string? nodeId, bool isAll, bool? isRetirement, string? revisionId, DateTime? startDate, DateTime? endDate) + { + try + { + var apiPath = $"{_configuration["API"]}/org/dotnet/keycloak-all-officer/date"; + var apiKey = _configuration["API_KEY"]; + var body = new + { + node = node, + nodeId = nodeId, + isAll = isAll, + isRetirement = isRetirement, + revisionId = revisionId, + dateStart = startDate, + dateEnd = endDate, + }; + + var profiles = new List(); + + var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey); + if (apiResult != null) + { + var raw = JsonConvert.DeserializeObject(apiResult); + if (raw != null) + return raw.Result; + } + + return null; + } + catch + { + throw; + } + } + public async Task> GetProfileWithKeycloakAllEmployeeAndRevision(string? accessToken, int? node, string? nodeId, bool isAll, string? revisionId) { try diff --git a/BMA.EHR.Leave/Controllers/LeaveReportController.cs b/BMA.EHR.Leave/Controllers/LeaveReportController.cs index f7c9ff6e..5f62b403 100644 --- a/BMA.EHR.Leave/Controllers/LeaveReportController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveReportController.cs @@ -1185,7 +1185,7 @@ namespace BMA.EHR.Leave.Service.Controllers return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden); } var profile = new List(); - profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficerRetireFilterAndRevision(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD", req.isRetirement ?? true, req.revisionId); + profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficerRetireFilterAndRevisionAndDate(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD", req.isRetirement ?? true, req.revisionId, req.StartDate, req.EndDate); // get leave day var leaveDays = await _leaveRequestRepository.GetSumApproveLeaveByTypeAndRange(req.StartDate, req.EndDate);