fix defect
This commit is contained in:
parent
be10c7ef95
commit
a167f5ec9e
3 changed files with 48 additions and 23 deletions
|
|
@ -38,6 +38,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
private readonly HolidayRepository _holidayRepository;
|
||||
private readonly CommandRepository _commandRepository;
|
||||
|
||||
private const string APPROVE_STEP_CREATE = "st1";
|
||||
private const string APPROVE_STEP_OFFICER_APPROVE = "st2";
|
||||
private const string APPROVE_STEP_COMMANDER_APPROVE = "st3";
|
||||
private const string APPROVE_STEP_APPROVE = "st4";
|
||||
private const string APPROVE_STEP_REJECT = "st5";
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constuctor and Destructor "
|
||||
|
|
@ -133,6 +139,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
LeaveSalaryText = req.LeaveSalaryText ?? "",
|
||||
LeaveStatus = "NEW",
|
||||
KeycloakUserId = userId,
|
||||
ApproveStep = APPROVE_STEP_CREATE
|
||||
};
|
||||
|
||||
// get leave last
|
||||
|
|
@ -909,6 +916,15 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(rawData.KeycloakUserId,
|
||||
rawData.Type.Id);
|
||||
|
||||
var rootOc = _userProfileRepository.GetRootOcId(profile.OcId ?? Guid.Empty);
|
||||
var approver = string.Empty;
|
||||
if (rootOc != null)
|
||||
{
|
||||
var list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
|
||||
if (list.Count > 0)
|
||||
approver = list.First().Name;
|
||||
}
|
||||
|
||||
var result = new GetLeaveRequestForAdminByIdDto
|
||||
{
|
||||
Id = rawData.Id,
|
||||
|
|
@ -928,8 +944,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
LeaveAddress = rawData.LeaveAddress,
|
||||
LeaveNumber = rawData.LeaveNumber,
|
||||
LeaveDetail = rawData.LeaveDetail,
|
||||
LeaveDocument = await _minIOService.ImagesPath(rawData.LeaveDocument.Id),
|
||||
LeaveDraftDocument = await _minIOService.ImagesPath(rawData.LeaveDraftDocument.Id),
|
||||
LeaveDocument = rawData.LeaveDocument == null ? "" : await _minIOService.ImagesPath(rawData.LeaveDocument.Id),
|
||||
LeaveDraftDocument = rawData.LeaveDraftDocument == null ? "" : await _minIOService.ImagesPath(rawData.LeaveDraftDocument.Id),
|
||||
|
||||
LeaveLastStart = lastLeaveRequest == null ? null : lastLeaveRequest.LeaveStartDate,
|
||||
LeaveLastEnd = lastLeaveRequest == null ? null : lastLeaveRequest.LeaveEndDate,
|
||||
|
|
@ -976,6 +992,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
CoupleDayStartDateHistory = rawData.CoupleDayStartDateHistory,
|
||||
CoupleDayEndDateHistory = rawData.CoupleDayEndDateHistory,
|
||||
CoupleDaySumTotalHistory = rawData.CoupleDaySumTotalHistory,
|
||||
|
||||
Dear = approver,
|
||||
ApproveStep = rawData.ApproveStep ?? "-",
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue