Merge branch 'develop' into working
This commit is contained in:
commit
2ec737d601
13 changed files with 218 additions and 70 deletions
2
.github/workflows/release_leave.yaml
vendored
2
.github/workflows/release_leave.yaml
vendored
|
|
@ -47,7 +47,7 @@ jobs:
|
|||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
|
|
|
|||
35
.vscode/launch.json
vendored
Normal file
35
.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/BMA.EHR.Leave.Service/bin/Debug/net7.0/BMA.EHR.Leave.Service.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/BMA.EHR.Leave.Service",
|
||||
"stopAtEntry": false,
|
||||
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
41
.vscode/tasks.json
vendored
Normal file
41
.vscode/tasks.json
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/BMA.EHR.Solution.sln",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/BMA.EHR.Solution.sln",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/BMA.EHR.Solution.sln"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -39,6 +39,8 @@ namespace BMA.EHR.Application
|
|||
|
||||
services.AddTransient<HolidayRepository>();
|
||||
|
||||
//services.AddTransient<UserDutyTimeRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,6 +138,23 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public Guid? GetRootOcId(Guid ocId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = _dbContext.Set<OrganizationEntity>()
|
||||
.FirstOrDefault(o => o.Id == ocId);
|
||||
|
||||
return data == null ? Guid.Empty : data.OrganizationAgencyId;
|
||||
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
EndTimeMorning = data.EndTimeMorning,
|
||||
StartTimeAfternoon = data.StartTimeAfternoon,
|
||||
EndTimeAfternoon = data.EndTimeAfternoon,
|
||||
IsActive = true,
|
||||
IsActive = data.IsActive,
|
||||
IsDefault = true,
|
||||
};
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
oldData.Description = data.Description;
|
||||
oldData.Description = data.Description ?? "";
|
||||
oldData.IsDefault = data.IsDefault;
|
||||
oldData.IsActive = data.IsActive;
|
||||
|
||||
|
|
@ -553,7 +553,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
"LATE" :
|
||||
"NORMAL",
|
||||
|
||||
IsEdit = (d.EditStatus != null || d.EditStatus != "")
|
||||
IsEdit = (d.EditStatus != null && d.EditStatus != "")
|
||||
|
||||
//EditReason = d.EditReason ?? "",
|
||||
//EditStatus = d.EditStatus ?? ""
|
||||
|
|
@ -610,12 +610,20 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
CheckInLon = d.CheckInLon,
|
||||
CheckInImage = $"{imgUrl}/{d.CheckInImageUrl}",
|
||||
|
||||
// add from new specification
|
||||
IsLocationCheckIn = 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.CheckOut == null ? "" : d.CheckOutPOI,
|
||||
CheckOutLat = d.CheckOut == null ? null : d.CheckOutLat,
|
||||
CheckOutLon = d.CheckOut == null ? null : d.CheckOutLon,
|
||||
CheckOutImage = d.CheckOut == null ? "" : $"{imgUrl}/{d.CheckOutImageUrl}",
|
||||
|
||||
// add from new specification
|
||||
IsLocationCheckOut = d.IsLocationCheckOut,
|
||||
CheckOutLocationName = d.CheckOutLocationName ?? ""
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
|
@ -1309,8 +1317,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
{
|
||||
Id = data.Id,
|
||||
|
||||
CheckInTime = checkInData == null ? "00:00" : checkInData.CheckIn.ToString("HH:mm"),
|
||||
CheckOutTime = checkInData == null ? "00:00" : checkInData.CheckOut == null ? "00:00" : checkInData.CheckOut.Value.ToString("HH:mm"),
|
||||
CheckInTime = checkInData == null ? duty.StartTimeMorning : checkInData.CheckIn.ToString("HH:mm"),
|
||||
CheckOutTime = checkInData == null ? duty.EndTimeAfternoon : checkInData.CheckOut == null ? "00:00" : checkInData.CheckOut.Value.ToString("HH:mm"),
|
||||
|
||||
CheckInStatus = checkInData == null ? null :
|
||||
DateTime.Parse(checkInData.CheckIn.ToString("yyyy-MM-dd HH:mm")) >
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Mvc.Routing;
|
|||
using Sentry;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Security.Claims;
|
||||
using BMA.EHR.Application.Repositories.Commands;
|
||||
|
||||
namespace BMA.EHR.Leave.Service.Controllers
|
||||
{
|
||||
|
|
@ -35,20 +36,22 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
private readonly LeaveRequestRepository _leaveRequestRepository;
|
||||
private readonly MinIOLeaveService _minIOService;
|
||||
private readonly HolidayRepository _holidayRepository;
|
||||
private readonly CommandRepository _commandRepository;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constuctor and Destructor "
|
||||
|
||||
public LeaveRequestController(LeaveDbContext context,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IWebHostEnvironment hostingEnvironment,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
LeaveTypeRepository leaveTypeRepository,
|
||||
LeaveRequestRepository leaveRequestRepository,
|
||||
MinIOLeaveService minIOService,
|
||||
HolidayRepository holidayRepository)
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IWebHostEnvironment hostingEnvironment,
|
||||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
LeaveTypeRepository leaveTypeRepository,
|
||||
LeaveRequestRepository leaveRequestRepository,
|
||||
MinIOLeaveService minIOService,
|
||||
HolidayRepository holidayRepository,
|
||||
CommandRepository commandRepository)
|
||||
{
|
||||
_context = context;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
|
|
@ -59,6 +62,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
_leaveRequestRepository = leaveRequestRepository;
|
||||
_minIOService = minIOService;
|
||||
_holidayRepository = holidayRepository;
|
||||
_commandRepository = commandRepository;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -165,8 +169,10 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
break;
|
||||
case "LV-005":
|
||||
{
|
||||
leaveRequest.RestDayOldTotal = await _leaveRequestRepository.GetRestDayTotalByYearForUserAsync(userId, thisYear - 1);
|
||||
leaveRequest.RestDayCurrentTotal = await _leaveRequestRepository.GetRestDayTotalByYearForUserAsync(userId, thisYear);
|
||||
leaveRequest.RestDayOldTotal =
|
||||
await _leaveRequestRepository.GetRestDayTotalByYearForUserAsync(userId, thisYear - 1);
|
||||
leaveRequest.RestDayCurrentTotal =
|
||||
await _leaveRequestRepository.GetRestDayTotalByYearForUserAsync(userId, thisYear);
|
||||
}
|
||||
break;
|
||||
case "LV-006":
|
||||
|
|
@ -186,7 +192,6 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
leaveRequest.LeaveGovernmentDate = profile.DateStart;
|
||||
|
||||
leaveRequest.HajjDayStatus = req.HajjDayStatus ?? false;
|
||||
|
||||
}
|
||||
break;
|
||||
case "LV-007":
|
||||
|
|
@ -206,7 +211,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var lastSalary = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
|
||||
leaveRequest.LeaveSalary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value;
|
||||
leaveRequest.LeaveSalaryText = lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false);
|
||||
leaveRequest.LeaveSalaryText =
|
||||
lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false);
|
||||
leaveRequest.LeaveBirthDate = profile.BirthDate;
|
||||
leaveRequest.LeaveGovernmentDate = profile.DateStart;
|
||||
|
||||
|
|
@ -218,7 +224,6 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
leaveRequest.StudyDayTrainingSubject = req.StudyDayTrainingSubject ?? "";
|
||||
leaveRequest.StudyDayTrainingName = req.StudyDayTrainingName ?? "";
|
||||
|
||||
}
|
||||
break;
|
||||
case "LV-010":
|
||||
|
|
@ -226,7 +231,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var lastSalary = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
|
||||
leaveRequest.LeaveSalary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value;
|
||||
leaveRequest.LeaveSalaryText = lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false);
|
||||
leaveRequest.LeaveSalaryText =
|
||||
lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false);
|
||||
|
||||
leaveRequest.CoupleDayName = req.CoupleDayName ?? "";
|
||||
leaveRequest.CoupleDayPosition = req.CoupleDayPosition ?? "";
|
||||
|
|
@ -242,8 +248,6 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
leaveRequest.CoupleDayEndDateHistory = req.CoupleDayEndDateHistory.Value;
|
||||
|
||||
leaveRequest.CoupleDaySumTotalHistory = req.CoupleDaySumTotalHistory ?? "";
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -288,24 +292,35 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
var lastSalary = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
|
||||
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 leaveLast = await _leaveRequestRepository.GetLeaveLastByTypeForUserAsync(userId, req.Type);
|
||||
|
||||
var result = new GetUserLeaveProfileResultDto
|
||||
{
|
||||
DateSendLeave = DateTime.Now.Date,
|
||||
LeaveTypeName = leaveType.Name,
|
||||
Dear = "นายณัฐพงษ์ ดิษยบุตร",
|
||||
Dear = approver,
|
||||
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
|
||||
PositionName = profile.Position.Name,
|
||||
PositionLevelName = profile.PositionEmployeeLevel.Name,
|
||||
OrganizationName = profile.Oc,
|
||||
PositionName = profile.Position == null ? "" : profile.Position.Name,
|
||||
PositionLevelName = profile.PositionLevel == null ? "" : profile.PositionLevel.Name,
|
||||
OrganizationName = profile.Oc ?? "",
|
||||
LeaveLimit = leaveType.Limit,
|
||||
LeaveTotal = sumLeave,
|
||||
LeaveRemain = leaveType.Limit - sumLeave,
|
||||
RestDayTotalOld = restOldDay,
|
||||
BirthDate = profile.BirthDate.Date,
|
||||
DateAppoint = profile.DateAppoint.Value.Date,
|
||||
DateAppoint = profile.DateAppoint == null ? null : profile.DateAppoint.Value.Date,
|
||||
Salary = lastSalary == null ? 0 : (int)lastSalary.Amount.Value,
|
||||
SalaryText = lastSalary == null ? "" : ((int)lastSalary.Amount.Value).ToThaiBahtText(false),
|
||||
|
||||
LeaveLast = leaveLast == null ? null : leaveLast
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
|
|
@ -332,9 +347,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var sumLeave = await _leaveRequestRepository.GetSumLeaveByTypeForUserAsync(userId, req.Type, req.StartLeaveDate.Year);
|
||||
var sumLeave =
|
||||
await _leaveRequestRepository.GetSumLeaveByTypeForUserAsync(userId, req.Type, req.StartLeaveDate.Year);
|
||||
var sumWorkDay = await _holidayRepository.GetHolidayCountAsync(req.StartLeaveDate, req.EndLeaveDate);
|
||||
var totalDay = req.StartLeaveDate.DiffDay(req.EndLeaveDate);
|
||||
var sumWeekend = _holidayRepository.GetWeekEndCount(req.StartLeaveDate, req.EndLeaveDate);
|
||||
|
||||
var isLeave = sumLeave + (totalDay - sumWorkDay) <= leaveType.Limit;
|
||||
|
||||
var result = new GetLeaveCheckResultDto
|
||||
|
|
@ -342,6 +360,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
IsLeave = isLeave,
|
||||
SumDateWork = sumWorkDay,
|
||||
TotalDate = totalDay,
|
||||
SumDateHoliday = sumWeekend
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
|
|
@ -360,7 +379,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetLeaveRequestCalendarAsync([FromBody] GetLeaveRequestCalendarDto req)
|
||||
public async Task<ActionResult<ResponseObject>> GetLeaveRequestCalendarAsync(
|
||||
[FromBody] GetLeaveRequestCalendarDto req)
|
||||
{
|
||||
//var thisYear = DateTime.Now.Year;
|
||||
var data = await _leaveRequestRepository.GetLeaveRequestByYearAsync(req.Year);
|
||||
|
|
@ -402,7 +422,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetLeaveRequestTableAsync([FromBody] GetLeaveRequestTableDto req)
|
||||
public async Task<ActionResult<ResponseObject>> GetLeaveRequestTableAsync(
|
||||
[FromBody] GetLeaveRequestTableDto req)
|
||||
{
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
|
|
@ -412,7 +433,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var rawData = await _leaveRequestRepository.GetLeaveRequestByUserIdAsync(userId, req.Year, req.Type, req.Status);
|
||||
var rawData =
|
||||
await _leaveRequestRepository.GetLeaveRequestByUserIdAsync(userId, req.Year, req.Type, req.Status);
|
||||
|
||||
var result = new List<GetLeaveRequestTableResultDto>();
|
||||
|
||||
|
|
@ -437,7 +459,6 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var pageResult = result.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
|
||||
|
||||
return Success(new { data = pageResult, total = result.Count });
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -473,7 +494,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var lastSalary = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var lastSalaryAmount = lastSalary == null ? 0 : lastSalary.Amount ?? 0;
|
||||
|
||||
var lastLeaveRequest = await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(rawData.KeycloakUserId, rawData.Type.Id);
|
||||
var lastLeaveRequest =
|
||||
await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(rawData.KeycloakUserId,
|
||||
rawData.Type.Id);
|
||||
|
||||
var result = new GetLeaveRequestByIdDto
|
||||
{
|
||||
|
|
@ -537,7 +560,6 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
CoupleDayStartDateHistory = rawData.CoupleDayStartDateHistory,
|
||||
CoupleDayEndDateHistory = rawData.CoupleDayEndDateHistory,
|
||||
CoupleDaySumTotalHistory = rawData.CoupleDaySumTotalHistory,
|
||||
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
|
|
@ -555,7 +577,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetLeaveRequestForAdminAsync([FromBody] GetLeaveRequestForAdminDto req)
|
||||
public async Task<ActionResult<ResponseObject>> GetLeaveRequestForAdminAsync(
|
||||
[FromBody] GetLeaveRequestForAdminDto req)
|
||||
{
|
||||
var rawData = await _leaveRequestRepository.GetLeaveRequestForAdminAsync(req.Year, req.Type, req.Status);
|
||||
|
||||
|
|
@ -597,7 +620,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> CancelLeaveRequestAsync([FromForm] CancelLeaveRequestDto req, Guid id)
|
||||
public async Task<ActionResult<ResponseObject>> CancelLeaveRequestAsync([FromForm] CancelLeaveRequestDto req,
|
||||
Guid id)
|
||||
{
|
||||
var data = await _leaveRequestRepository.GetByIdAsync(id);
|
||||
if (data == null)
|
||||
|
|
@ -627,10 +651,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
// save to database
|
||||
await _leaveRequestRepository.UpdateAsync(data);
|
||||
|
||||
// await _leaveRequestRepository.AddAsync(data);
|
||||
// await _leaveRequestRepository.AddAsync(data);
|
||||
|
||||
return Success();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -645,9 +668,11 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCancelLeaveRequestForAdminAsync([FromBody] GetLeaveRequestForAdminDto req)
|
||||
public async Task<ActionResult<ResponseObject>> GetCancelLeaveRequestForAdminAsync(
|
||||
[FromBody] GetLeaveRequestForAdminDto req)
|
||||
{
|
||||
var rawData = await _leaveRequestRepository.GetCancelLeaveRequestForAdminAsync(req.Year, req.Type, req.Status);
|
||||
var rawData =
|
||||
await _leaveRequestRepository.GetCancelLeaveRequestForAdminAsync(req.Year, req.Type, req.Status);
|
||||
|
||||
var result = new List<GetLeaveCancelRequestResultDto>();
|
||||
|
||||
|
|
@ -717,7 +742,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
LeaveAddress = rawData.LeaveAddress,
|
||||
LeaveNumber = rawData.LeaveNumber,
|
||||
LeaveDetail = rawData.LeaveDetail,
|
||||
LeaveDocDelete = rawData.LeaveCancelDocument == null ? "" : await _minIOService.ImagesPath(rawData.LeaveCancelDocument.Id),
|
||||
LeaveDocDelete = rawData.LeaveCancelDocument == null
|
||||
? ""
|
||||
: await _minIOService.ImagesPath(rawData.LeaveCancelDocument.Id),
|
||||
LeaveReasonDelete = rawData.LeaveCancelComment ?? "",
|
||||
LeaveTotal = rawData.LeaveTotal,
|
||||
};
|
||||
|
|
@ -737,9 +764,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveCancelLeaveRequestAsync(Guid id, [FromBody] CancelLeaveRequestApproveDto req)
|
||||
public async Task<ActionResult<ResponseObject>> ApproveCancelLeaveRequestAsync(Guid id,
|
||||
[FromBody] CancelLeaveRequestApproveDto req)
|
||||
{
|
||||
|
||||
await _leaveRequestRepository.ApproveCancelLeaveRequestAsync(id, req.Reason ?? "");
|
||||
|
||||
return Success();
|
||||
|
|
@ -758,9 +785,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> RejectCancelLeaveRequestAsync(Guid id, [FromBody] CancelLeaveRequestApproveDto req)
|
||||
public async Task<ActionResult<ResponseObject>> RejectCancelLeaveRequestAsync(Guid id,
|
||||
[FromBody] CancelLeaveRequestApproveDto req)
|
||||
{
|
||||
|
||||
await _leaveRequestRepository.RejectCancelLeaveRequestAsync(id, req.Reason ?? "");
|
||||
|
||||
return Success();
|
||||
|
|
@ -780,7 +807,6 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> OfficerApproveLeaveRequestAsync(Guid id)
|
||||
{
|
||||
|
||||
await _leaveRequestRepository.OfficerApproveLeaveRequest(id);
|
||||
|
||||
return Success();
|
||||
|
|
@ -794,13 +820,13 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("admin/approve/commander/{id:guid}")]
|
||||
[HttpPut("admin/approve/comander/{id:guid}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> CommanderApproveLeaveRequestAsync(Guid id, [FromBody] LeaveRequestApproveDto req)
|
||||
public async Task<ActionResult<ResponseObject>> CommanderApproveLeaveRequestAsync(Guid id,
|
||||
[FromBody] LeaveRequestApproveDto req)
|
||||
{
|
||||
|
||||
await _leaveRequestRepository.CommanderApproveLeaveRequest(id, req.Reason ?? "");
|
||||
|
||||
return Success();
|
||||
|
|
@ -818,9 +844,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> ApproveLeaveRequestAsync(Guid id, [FromBody] LeaveRequestApproveDto req)
|
||||
public async Task<ActionResult<ResponseObject>> ApproveLeaveRequestAsync(Guid id,
|
||||
[FromBody] LeaveRequestApproveDto req)
|
||||
{
|
||||
|
||||
await _leaveRequestRepository.ApproveLeaveRequest(id, req.Reason ?? "");
|
||||
|
||||
return Success();
|
||||
|
|
@ -838,9 +864,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> RejectLeaveRequestAsync(Guid id, [FromBody] LeaveRequestApproveDto req)
|
||||
public async Task<ActionResult<ResponseObject>> RejectLeaveRequestAsync(Guid id,
|
||||
[FromBody] LeaveRequestApproveDto req)
|
||||
{
|
||||
|
||||
await _leaveRequestRepository.RejectLeaveRequest(id, req.Reason ?? "");
|
||||
|
||||
return Success();
|
||||
|
|
@ -879,7 +905,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var lastSalary = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var lastSalaryAmount = lastSalary == null ? 0 : lastSalary.Amount ?? 0;
|
||||
|
||||
var lastLeaveRequest = await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(rawData.KeycloakUserId, rawData.Type.Id);
|
||||
var lastLeaveRequest =
|
||||
await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(rawData.KeycloakUserId,
|
||||
rawData.Type.Id);
|
||||
|
||||
var result = new GetLeaveRequestForAdminByIdDto
|
||||
{
|
||||
|
|
@ -948,7 +976,6 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
CoupleDayStartDateHistory = rawData.CoupleDayStartDateHistory,
|
||||
CoupleDayEndDateHistory = rawData.CoupleDayEndDateHistory,
|
||||
CoupleDaySumTotalHistory = rawData.CoupleDaySumTotalHistory,
|
||||
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
|
|
@ -976,13 +1003,17 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var result = new List<dynamic>();
|
||||
foreach (var leaveType in leaveTypes)
|
||||
{
|
||||
var send = await _leaveRequestRepository.GetSumSendLeaveByTypeForUserAsync(userId, leaveType.Id, thisYear);
|
||||
var send = await _leaveRequestRepository.GetSumSendLeaveByTypeForUserAsync(userId, leaveType.Id,
|
||||
thisYear);
|
||||
|
||||
var approve = await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(userId, leaveType.Id, thisYear);
|
||||
var approve =
|
||||
await _leaveRequestRepository.GetSumApproveLeaveByTypeForUserAsync(userId, leaveType.Id, thisYear);
|
||||
|
||||
var reject = await _leaveRequestRepository.GetSumRejectLeaveByTypeForUserAsync(userId, leaveType.Id, thisYear);
|
||||
var reject =
|
||||
await _leaveRequestRepository.GetSumRejectLeaveByTypeForUserAsync(userId, leaveType.Id, thisYear);
|
||||
|
||||
var delete = await _leaveRequestRepository.GetSumDeleteLeaveByTypeForUserAsync(userId, leaveType.Id, thisYear);
|
||||
var delete =
|
||||
await _leaveRequestRepository.GetSumDeleteLeaveByTypeForUserAsync(userId, leaveType.Id, thisYear);
|
||||
|
||||
var data = new
|
||||
{
|
||||
|
|
@ -997,7 +1028,6 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
LeaveCountDelete = delete,
|
||||
};
|
||||
result.Add(data);
|
||||
|
||||
}
|
||||
|
||||
return Success(result);
|
||||
|
|
@ -1005,4 +1035,4 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
namespace BMA.EHR.Leave.Service.DTOs.CheckIn
|
||||
{
|
||||
{
|
||||
public class CheckInHistoryForAdminDto
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
public string? CheckInImage { get; set; } = string.Empty;
|
||||
|
||||
public bool IsLocationCheckIn { get; set; } = true;
|
||||
|
||||
public string? CheckInLocationName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? CheckOutDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
public string? CheckOutTime { get; set; } = "00:00";
|
||||
|
|
@ -29,5 +33,9 @@
|
|||
public double? CheckOutLon { get; set; } = 0;
|
||||
|
||||
public string? CheckOutImage { get; set; } = string.Empty;
|
||||
|
||||
public bool IsLocationCheckOut { get; set; } = true;
|
||||
|
||||
public string? CheckOutLocationName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,5 +23,8 @@ namespace BMA.EHR.Leave.Service.DTOs.DutyTime
|
|||
|
||||
[Required, Comment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)")]
|
||||
public bool IsDefault { get; set; } = false;
|
||||
|
||||
[Required, Comment("Is Active")]
|
||||
public bool IsActive { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ namespace BMA.EHR.Leave.Service.DTOs.DutyTime
|
|||
{
|
||||
public class UpdateDutyTimeDto
|
||||
{
|
||||
[Required, Comment("คำอธิบาย")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
[Comment("คำอธิบาย")]
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)")]
|
||||
public bool IsDefault { get; set; } = false;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@
|
|||
{
|
||||
public class GetLeaveCheckResultDto
|
||||
{
|
||||
public bool IsLeave { get;set; } = false;
|
||||
public bool IsLeave { get; set; } = false;
|
||||
|
||||
public double SumDateWork { get; set; } = 0;
|
||||
|
||||
public double TotalDate { get; set; } = 0;
|
||||
|
||||
public double SumDateHoliday { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,10 +26,12 @@
|
|||
|
||||
public DateTime BirthDate { get; set; }
|
||||
|
||||
public DateTime DateAppoint { get; set; }
|
||||
public DateTime? DateAppoint { get; set; }
|
||||
|
||||
public int Salary { get; set; }
|
||||
|
||||
public string SalaryText { get; set; }
|
||||
|
||||
public DateTime? LeaveLast { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
|
|||
COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
|
||||
COPY ["BMA.EHR.Leave.Service/BMA.EHR.Leave.Service.csproj", "BMA.EHR.Leave.Service/"]
|
||||
|
||||
RUN dotnet restore "BMA.EHR.Leave.Service/BMA.EHR.Leave.Service.csproj"
|
||||
RUN dotnet restore "BMA.EHR.Leave.Service/BMA.EHR.Leave.Service.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/BMA.EHR.Leave.Service"
|
||||
RUN dotnet build "BMA.EHR.Leave.Service.csproj" -c Release -o /app/build
|
||||
RUN dotnet build "BMA.EHR.Leave.Service.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "BMA.EHR.Leave.Service.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue