no message

This commit is contained in:
kittapath 2024-11-15 16:44:29 +07:00
parent 4dcb2c467d
commit d08b4ca723
2 changed files with 21 additions and 16 deletions

View file

@ -709,8 +709,8 @@ namespace BMA.EHR.Leave.Service.Controllers
var lastSalary = profile.ProfileSalary;
//var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty, AccessToken);
var approver = profile.Commander ?? "";
var userOc = profile.Root ?? "";
//var approver = profile.Commander ?? "";
//var userOc = profile.Root ?? "";
//if (rootOc != null)
//{
// var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
@ -727,10 +727,10 @@ namespace BMA.EHR.Leave.Service.Controllers
FullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}",
Dear = approver,
Dear = profile.Commander ?? "",
PositionName = profile.Position == null ? "" : profile.Position,
PositionLevelName = profile.PosLevel == null ? "" : profile.PosLevel.PosLevelName,
OrganizationName = userOc, //profile.Oc ?? "",
OrganizationName = profile.Root ?? "", //profile.Oc ?? "",
LeaveLimit = leaveType.Limit,
LeaveTotal = sumLeave,
@ -790,12 +790,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var minLeave = (await _context.Set<LeaveRequest>().Where(x => x.Type.Id == req.Type &&
x.LeaveStatus != "DELETE" && x.LeaveStatus != "REJECT")
(x.LeaveStatus == "PENDING" || x.LeaveStatus == "APPROVE") &&
x.KeycloakUserId == userId)
.OrderBy(x => x.LeaveStartDate)
.FirstOrDefaultAsync());
var maxLeave = (await _context.Set<LeaveRequest>().Where(x => x.Type.Id == req.Type &&
x.LeaveStatus != "DELETE" && x.LeaveStatus != "REJECT")
(x.LeaveStatus == "PENDING" || x.LeaveStatus == "APPROVE") &&
x.KeycloakUserId == userId)
.OrderByDescending(x => x.LeaveEndDate)
.FirstOrDefaultAsync());
@ -806,13 +808,16 @@ namespace BMA.EHR.Leave.Service.Controllers
(req.EndLeaveDate.Date >= minLeave.LeaveStartDate.Date && req.EndLeaveDate.Date <= maxLeave.LeaveEndDate.Date);
}
var isLeave = false;
switch (leaveType.Code.ToUpper().Trim())
{
case "LV-001":
isLeave = true;
break;
case "LV-002":
isLeave = true;
break;
case "LV-007":
isLeave = true;
break;
@ -1636,8 +1641,8 @@ namespace BMA.EHR.Leave.Service.Controllers
var rawData = await _leaveRequestRepository.GetByIdAsync(id);
if (rawData == null)
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
if (rawData.ProfileType =="OFFICER")
if (rawData.ProfileType == "OFFICER")
{
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_LEAVE_LIST");
if (getWorkflow == false)
@ -1669,7 +1674,7 @@ namespace BMA.EHR.Leave.Service.Controllers
//if (profile == null)
//{
// return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
// return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
//}
//var userCalendar = await _userCalendarRepository.GetExist(Guid.Parse(rawData.ProfileId));
@ -1686,9 +1691,9 @@ namespace BMA.EHR.Leave.Service.Controllers
//var approver = string.Empty;
//if (rootOc != null)
//{
//var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
//if (list.Count > 0)
//approver = list.First().Name;
//var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
//if (list.Count > 0)
//approver = list.First().Name;
//}
var leaveSummary = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(rawData.KeycloakUserId, rawData.Type.Id, thisYear);