แก้ยกเลิกลาออก
This commit is contained in:
parent
4c80c26508
commit
4cb5ff7102
6 changed files with 621 additions and 288 deletions
36
.github/workflows/release_Retirement.yaml
vendored
36
.github/workflows/release_Retirement.yaml
vendored
|
|
@ -69,21 +69,21 @@ jobs:
|
|||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
# - uses: snow-actions/line-notify@v1.1.0
|
||||
# if: success()
|
||||
# with:
|
||||
# access_token: ${{ env.TOKEN_LINE }}
|
||||
# message: |
|
||||
# -Success✅✅✅
|
||||
# Image: ${{env.IMAGE_NAME}}
|
||||
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
# By: ${{secrets.DOCKER_USER}}
|
||||
# - uses: snow-actions/line-notify@v1.1.0
|
||||
# if: failure()
|
||||
# with:
|
||||
# access_token: ${{ env.TOKEN_LINE }}
|
||||
# message: |
|
||||
# -Failure❌❌❌
|
||||
# Image: ${{env.IMAGE_NAME}}
|
||||
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
# By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
|
|
|
|||
36
.github/workflows/release_discipline.yaml
vendored
36
.github/workflows/release_discipline.yaml
vendored
|
|
@ -69,21 +69,21 @@ jobs:
|
|||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
# - uses: snow-actions/line-notify@v1.1.0
|
||||
# if: success()
|
||||
# with:
|
||||
# access_token: ${{ env.TOKEN_LINE }}
|
||||
# message: |
|
||||
# -Success✅✅✅
|
||||
# Image: ${{env.IMAGE_NAME}}
|
||||
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
# By: ${{secrets.DOCKER_USER}}
|
||||
# - uses: snow-actions/line-notify@v1.1.0
|
||||
# if: failure()
|
||||
# with:
|
||||
# access_token: ${{ env.TOKEN_LINE }}
|
||||
# message: |
|
||||
# -Failure❌❌❌
|
||||
# Image: ${{env.IMAGE_NAME}}
|
||||
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
# By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
|
|
|
|||
36
.github/workflows/release_placement.yaml
vendored
36
.github/workflows/release_placement.yaml
vendored
|
|
@ -69,21 +69,21 @@ jobs:
|
|||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
# - uses: snow-actions/line-notify@v1.1.0
|
||||
# if: success()
|
||||
# with:
|
||||
# access_token: ${{ env.TOKEN_LINE }}
|
||||
# message: |
|
||||
# -Success✅✅✅
|
||||
# Image: ${{env.IMAGE_NAME}}
|
||||
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
# By: ${{secrets.DOCKER_USER}}
|
||||
# - uses: snow-actions/line-notify@v1.1.0
|
||||
# if: failure()
|
||||
# with:
|
||||
# access_token: ${{ env.TOKEN_LINE }}
|
||||
# message: |
|
||||
# -Failure❌❌❌
|
||||
# Image: ${{env.IMAGE_NAME}}
|
||||
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
# By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
CitizenId = x.CitizenId,
|
||||
ExamNumber = x.ExamNumber,
|
||||
posmasterId = x.posmasterId,
|
||||
rootIdOld = x.rootIdOld,
|
||||
root = x.root,
|
||||
rootId = x.rootId,
|
||||
rootShortName = x.rootShortName,
|
||||
|
|
@ -239,6 +240,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.profileId,
|
||||
p.ExamNumber,
|
||||
p.posmasterId,
|
||||
p.rootIdOld,
|
||||
p.root,
|
||||
p.rootId,
|
||||
p.rootShortName,
|
||||
|
|
@ -298,6 +300,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
CitizenId = x.CitizenId,
|
||||
ExamNumber = x.ExamNumber,
|
||||
posmasterId = x.posmasterId,
|
||||
rootIdOld = x.rootIdOld,
|
||||
root = x.root,
|
||||
rootId = x.rootId,
|
||||
rootShortName = x.rootShortName,
|
||||
|
|
@ -351,6 +354,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
p.profileId,
|
||||
p.ExamNumber,
|
||||
p.posmasterId,
|
||||
p.rootIdOld,
|
||||
p.root,
|
||||
p.rootId,
|
||||
p.rootShortName,
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.RejectReason,
|
||||
p.CancelReason,
|
||||
p.Status,
|
||||
p.RetirementResignCancels,//xxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
statusCancel = p.RetirementResignCancels.FirstOrDefault() == null ? null : p.RetirementResignCancels.FirstOrDefault().Status,
|
||||
p.IsActive,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
|
@ -218,7 +218,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet()]
|
||||
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
||||
public async Task<ActionResult<ResponseObject>> GetListByAdmin(string type)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_RESIGN");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
|
|
@ -227,6 +227,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var retirementResigns = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.Status == type.Trim().ToUpper())
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
|
|
@ -247,6 +248,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.PositionNumberOld,
|
||||
p.OrganizationPositionOld,
|
||||
p.RemarkHorizontal,
|
||||
statusCancel = p.RetirementResignCancels.FirstOrDefault().Status ?? null,
|
||||
p.ApproveReason,
|
||||
p.RejectReason,
|
||||
p.CancelReason,
|
||||
|
|
@ -267,7 +269,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("cancel")]
|
||||
public async Task<ActionResult<ResponseObject>> GetListByAdminCancel()
|
||||
public async Task<ActionResult<ResponseObject>> GetListByAdminCancel(string type)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_RESIGN");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
|
|
@ -276,6 +278,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var retirementResigns = await _context.RetirementResignCancels.AsQueryable()
|
||||
.Where(x => x.Status == type.Trim().ToUpper())
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
|
|
@ -296,6 +299,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.PositionNumberOld,
|
||||
p.OrganizationPositionOld,
|
||||
p.RemarkHorizontal,
|
||||
statusMain = p.RetirementResign.Status,
|
||||
p.ApproveReason,
|
||||
p.RejectReason,
|
||||
p.CancelReason,
|
||||
|
|
@ -319,10 +323,374 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
[HttpGet("{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetDetailByUser(Guid id)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_RESIGN");
|
||||
var createdUserId = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.CreatedUserId == UserId)
|
||||
var dataMain = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Status,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (dataMain == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
if(dataMain.Status != "CANCEL"){
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_RESIGN");
|
||||
var createdUserId = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Where(x => x.CreatedUserId == UserId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (getWorkflow == false && createdUserId == null)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_RESIGN");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
}
|
||||
var data = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
p.prefix,
|
||||
p.firstName,
|
||||
p.lastName,
|
||||
p.profileId,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
p.Reason,
|
||||
p.Status,
|
||||
salary = p.AmountOld,
|
||||
p.ApproveReason,
|
||||
p.RejectReason,
|
||||
p.IsActive,
|
||||
p.CreatedAt,
|
||||
p.PositionTypeOld,
|
||||
p.PositionLevelOld,
|
||||
p.PositionNumberOld,
|
||||
p.OrganizationPositionOld,
|
||||
p.OligarchReject,
|
||||
p.OligarchApproveReason,
|
||||
p.OligarchRejectReason,
|
||||
p.OligarchRejectDate,
|
||||
p.CommanderReject,
|
||||
p.CommanderApproveReason,
|
||||
p.CommanderRejectReason,
|
||||
p.CommanderRejectDate,
|
||||
p.OfficerReject,
|
||||
p.OfficerApproveReason,
|
||||
p.OfficerRejectReason,
|
||||
p.OfficerRejectDate,
|
||||
p.RemarkHorizontal,
|
||||
p.rootOld,
|
||||
p.rootOldId,
|
||||
p.rootShortNameOld,
|
||||
p.child1Old,
|
||||
p.child1OldId,
|
||||
p.child1ShortNameOld,
|
||||
p.child2Old,
|
||||
p.child2OldId,
|
||||
p.child2ShortNameOld,
|
||||
p.child3Old,
|
||||
p.child3OldId,
|
||||
p.child3ShortNameOld,
|
||||
p.child4Old,
|
||||
p.child4OldId,
|
||||
p.child4ShortNameOld,
|
||||
p.PositionOld,
|
||||
p.posMasterNoOld,
|
||||
p.posTypeOldId,
|
||||
p.posTypeNameOld,
|
||||
p.posLevelOldId,
|
||||
p.posLevelNameOld,
|
||||
p.IsNoDebt,
|
||||
p.IsNoBurden,
|
||||
p.IsDiscipline,
|
||||
p.CancelReason,
|
||||
RetirementResignCancels = p.RetirementResignCancels.FirstOrDefault(),
|
||||
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// RetirementResignDebtDocs = p.RetirementResignDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
var retirementResignDocs = new List<dynamic>();
|
||||
foreach (var doc in data.RetirementResignDocs)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
FileName = doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id),
|
||||
doc.Id,
|
||||
};
|
||||
retirementResignDocs.Add(_doc);
|
||||
}
|
||||
// var retirementResignDebtDocs = new List<dynamic>();
|
||||
// foreach (var doc in data.RetirementResignDebtDocs)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// FileName = doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id),
|
||||
// doc.Id,
|
||||
// };
|
||||
// retirementResignDebtDocs.Add(_doc);
|
||||
// }
|
||||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.profileId,
|
||||
data.prefix,
|
||||
// data.PrefixId,
|
||||
data.firstName,
|
||||
data.lastName,
|
||||
data.Location,
|
||||
data.SendDate,
|
||||
data.ActiveDate,
|
||||
data.Reason,
|
||||
data.Status,
|
||||
data.salary,
|
||||
data.PositionTypeOld,
|
||||
data.PositionLevelOld,
|
||||
data.PositionNumberOld,
|
||||
data.OrganizationPositionOld,
|
||||
data.ApproveReason,
|
||||
data.RejectReason,
|
||||
data.IsActive,
|
||||
data.CreatedAt,
|
||||
data.OligarchReject,
|
||||
data.OligarchApproveReason,
|
||||
data.OligarchRejectReason,
|
||||
data.OligarchRejectDate,
|
||||
data.CommanderReject,
|
||||
data.CommanderApproveReason,
|
||||
data.CommanderRejectReason,
|
||||
data.CommanderRejectDate,
|
||||
data.OfficerReject,
|
||||
data.OfficerApproveReason,
|
||||
data.OfficerRejectReason,
|
||||
data.OfficerRejectDate,
|
||||
data.RemarkHorizontal,
|
||||
data.rootOld,
|
||||
data.rootOldId,
|
||||
data.rootShortNameOld,
|
||||
data.child1Old,
|
||||
data.child1OldId,
|
||||
data.child1ShortNameOld,
|
||||
data.child2Old,
|
||||
data.child2OldId,
|
||||
data.child2ShortNameOld,
|
||||
data.child3Old,
|
||||
data.child3OldId,
|
||||
data.child3ShortNameOld,
|
||||
data.child4Old,
|
||||
data.child4OldId,
|
||||
data.child4ShortNameOld,
|
||||
data.PositionOld,
|
||||
data.posMasterNoOld,
|
||||
data.posTypeOldId,
|
||||
data.posTypeNameOld,
|
||||
data.posLevelOldId,
|
||||
data.posLevelNameOld,
|
||||
data.IsNoDebt,
|
||||
data.IsNoBurden,
|
||||
data.IsDiscipline,
|
||||
data.CancelReason,
|
||||
idCancel = data.RetirementResignCancels?.Id ?? Guid.Empty,
|
||||
statusCancel = data.RetirementResignCancels?.Status ?? null,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
// DocDebts = retirementResignDebtDocs,
|
||||
};
|
||||
|
||||
return Success(_data);
|
||||
}
|
||||
else{
|
||||
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "RETIREMENT_CANCEL");
|
||||
var createdUserId = await _context.RetirementResignCancels.AsQueryable()
|
||||
.Where(x => x.CreatedUserId == UserId)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (getWorkflow == false && createdUserId == null)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_RESIGN");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
}
|
||||
var data = await _context.RetirementResignCancels.AsQueryable()
|
||||
.Where(x => x.RetirementResign.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
p.prefix,
|
||||
p.firstName,
|
||||
p.lastName,
|
||||
p.profileId,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
p.Reason,
|
||||
p.Status,
|
||||
salary = p.AmountOld,
|
||||
p.ApproveReason,
|
||||
p.RejectReason,
|
||||
p.IsActive,
|
||||
p.CreatedAt,
|
||||
p.PositionTypeOld,
|
||||
p.PositionLevelOld,
|
||||
p.PositionNumberOld,
|
||||
p.OrganizationPositionOld,
|
||||
p.OligarchReject,
|
||||
p.OligarchApproveReason,
|
||||
p.OligarchRejectReason,
|
||||
p.OligarchRejectDate,
|
||||
p.CommanderReject,
|
||||
p.CommanderApproveReason,
|
||||
p.CommanderRejectReason,
|
||||
p.CommanderRejectDate,
|
||||
p.OfficerReject,
|
||||
p.OfficerApproveReason,
|
||||
p.OfficerRejectReason,
|
||||
p.OfficerRejectDate,
|
||||
p.RemarkHorizontal,
|
||||
p.rootOld,
|
||||
p.rootOldId,
|
||||
p.rootShortNameOld,
|
||||
p.child1Old,
|
||||
p.child1OldId,
|
||||
p.child1ShortNameOld,
|
||||
p.child2Old,
|
||||
p.child2OldId,
|
||||
p.child2ShortNameOld,
|
||||
p.child3Old,
|
||||
p.child3OldId,
|
||||
p.child3ShortNameOld,
|
||||
p.child4Old,
|
||||
p.child4OldId,
|
||||
p.child4ShortNameOld,
|
||||
p.PositionOld,
|
||||
p.posMasterNoOld,
|
||||
p.posTypeOldId,
|
||||
p.posTypeNameOld,
|
||||
p.posLevelOldId,
|
||||
p.posLevelNameOld,
|
||||
p.IsNoDebt,
|
||||
p.IsNoBurden,
|
||||
p.IsDiscipline,
|
||||
p.CancelReason,
|
||||
idMain = p.RetirementResign.Id,
|
||||
statusMain = p.RetirementResign.Status,
|
||||
RetirementResignDocs = p.RetirementResign.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
var retirementResignDocs = new List<dynamic>();
|
||||
foreach (var doc in data.RetirementResignDocs)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
FileName = doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id),
|
||||
doc.Id,
|
||||
};
|
||||
retirementResignDocs.Add(_doc);
|
||||
}
|
||||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.profileId,
|
||||
data.prefix,
|
||||
// data.PrefixId,
|
||||
data.firstName,
|
||||
data.lastName,
|
||||
data.Location,
|
||||
data.SendDate,
|
||||
data.ActiveDate,
|
||||
data.Reason,
|
||||
data.Status,
|
||||
data.salary,
|
||||
data.PositionTypeOld,
|
||||
data.PositionLevelOld,
|
||||
data.PositionNumberOld,
|
||||
data.OrganizationPositionOld,
|
||||
data.ApproveReason,
|
||||
data.RejectReason,
|
||||
data.IsActive,
|
||||
data.CreatedAt,
|
||||
data.OligarchReject,
|
||||
data.OligarchApproveReason,
|
||||
data.OligarchRejectReason,
|
||||
data.OligarchRejectDate,
|
||||
data.CommanderReject,
|
||||
data.CommanderApproveReason,
|
||||
data.CommanderRejectReason,
|
||||
data.CommanderRejectDate,
|
||||
data.OfficerReject,
|
||||
data.OfficerApproveReason,
|
||||
data.OfficerRejectReason,
|
||||
data.OfficerRejectDate,
|
||||
data.RemarkHorizontal,
|
||||
data.rootOld,
|
||||
data.rootOldId,
|
||||
data.rootShortNameOld,
|
||||
data.child1Old,
|
||||
data.child1OldId,
|
||||
data.child1ShortNameOld,
|
||||
data.child2Old,
|
||||
data.child2OldId,
|
||||
data.child2ShortNameOld,
|
||||
data.child3Old,
|
||||
data.child3OldId,
|
||||
data.child3ShortNameOld,
|
||||
data.child4Old,
|
||||
data.child4OldId,
|
||||
data.child4ShortNameOld,
|
||||
data.PositionOld,
|
||||
data.posMasterNoOld,
|
||||
data.posTypeOldId,
|
||||
data.posTypeNameOld,
|
||||
data.posLevelOldId,
|
||||
data.posLevelNameOld,
|
||||
data.IsNoDebt,
|
||||
data.IsNoBurden,
|
||||
data.IsDiscipline,
|
||||
data.CancelReason,
|
||||
data.idMain,
|
||||
data.statusMain,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
// DocDebts = retirementResignDebtDocs,
|
||||
};
|
||||
return Success(_data);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายละเอียดลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id ลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("cancel/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetDetailByUserCancel(Guid id)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "RETIREMENT_CANCEL");
|
||||
var createdUserId = await _context.RetirementResignCancels.AsQueryable()
|
||||
.Where(x => x.CreatedUserId == UserId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (getWorkflow == false && createdUserId == null)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_RESIGN");
|
||||
|
|
@ -332,7 +700,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
}
|
||||
var data = await _context.RetirementResigns.AsQueryable()
|
||||
var data = await _context.RetirementResignCancels.AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
|
|
@ -393,9 +761,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.IsNoBurden,
|
||||
p.IsDiscipline,
|
||||
p.CancelReason,
|
||||
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// RetirementResignDebtDocs = p.RetirementResignDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
idMain = p.RetirementResign.Id,
|
||||
statusMain = p.RetirementResign.Status,
|
||||
RetirementResignDocs = p.RetirementResign.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -412,17 +780,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
};
|
||||
retirementResignDocs.Add(_doc);
|
||||
}
|
||||
// var retirementResignDebtDocs = new List<dynamic>();
|
||||
// foreach (var doc in data.RetirementResignDebtDocs)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// FileName = doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id),
|
||||
// doc.Id,
|
||||
// };
|
||||
// retirementResignDebtDocs.Add(_doc);
|
||||
// }
|
||||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
|
|
@ -483,109 +840,15 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.IsNoBurden,
|
||||
data.IsDiscipline,
|
||||
data.CancelReason,
|
||||
data.idMain,
|
||||
data.statusMain,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
// DocDebts = retirementResignDebtDocs,
|
||||
};
|
||||
|
||||
return Success(_data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายละเอียดลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id ลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("cancel/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetDetailByUserCancel(Guid id)
|
||||
{
|
||||
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "RETIREMENT_CANCEL");
|
||||
var createdUserId = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.CreatedUserId == UserId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (getWorkflow == false && createdUserId == null)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "RETIREMENT_CANCEL");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
}
|
||||
var data = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
p.prefix,
|
||||
p.firstName,
|
||||
p.lastName,
|
||||
p.profileId,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
p.Reason,
|
||||
p.Status,
|
||||
salary = p.AmountOld,
|
||||
p.ApproveReason,
|
||||
p.RejectReason,
|
||||
p.IsActive,
|
||||
p.CreatedAt,
|
||||
p.PositionTypeOld,
|
||||
p.PositionLevelOld,
|
||||
p.PositionNumberOld,
|
||||
p.OrganizationPositionOld,
|
||||
p.OligarchReject,
|
||||
p.OligarchApproveReason,
|
||||
p.OligarchRejectReason,
|
||||
p.OligarchRejectDate,
|
||||
p.CommanderReject,
|
||||
p.CommanderApproveReason,
|
||||
p.CommanderRejectReason,
|
||||
p.CommanderRejectDate,
|
||||
p.OfficerReject,
|
||||
p.OfficerApproveReason,
|
||||
p.OfficerRejectReason,
|
||||
p.OfficerRejectDate,
|
||||
p.RemarkHorizontal,
|
||||
p.rootOld,
|
||||
p.rootOldId,
|
||||
p.rootShortNameOld,
|
||||
p.child1Old,
|
||||
p.child1OldId,
|
||||
p.child1ShortNameOld,
|
||||
p.child2Old,
|
||||
p.child2OldId,
|
||||
p.child2ShortNameOld,
|
||||
p.child3Old,
|
||||
p.child3OldId,
|
||||
p.child3ShortNameOld,
|
||||
p.child4Old,
|
||||
p.child4OldId,
|
||||
p.child4ShortNameOld,
|
||||
p.PositionOld,
|
||||
p.posMasterNoOld,
|
||||
p.posTypeOldId,
|
||||
p.posTypeNameOld,
|
||||
p.posLevelOldId,
|
||||
p.posLevelNameOld,
|
||||
p.IsNoDebt,
|
||||
p.IsNoBurden,
|
||||
p.IsDiscipline,
|
||||
p.CancelReason,
|
||||
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สร้างการลาออก
|
||||
/// </summary>
|
||||
|
|
@ -773,7 +1036,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("cancel/{id:length(36)}")]
|
||||
[HttpPut("update-cancel/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> PutCancel([FromForm] RetirementResignRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResignCancels
|
||||
|
|
@ -956,7 +1219,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
posLevelOldId = updated.posLevelOldId,
|
||||
posLevelNameOld = updated.posLevelNameOld,
|
||||
RetirementResign = updated,
|
||||
Status = "PENDING",
|
||||
Status = "WAITTING",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -964,6 +1227,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.RetirementResignCancels.AddAsync(retirementResignCancel);
|
||||
await _context.SaveChangesAsync();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -1123,25 +1387,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
if (updated.profileId != null)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse(updated.profileId),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1172,25 +1436,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
if (updated.profileId != null)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse(updated.profileId),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1219,25 +1483,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
if (updated.profileId != null)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse(updated.profileId),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1268,25 +1532,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
if (updated.profileId != null)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse(updated.profileId),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1314,25 +1578,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
if (updated.profileId != null)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse(updated.profileId),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1363,25 +1627,79 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
if (updated.profileId != null)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse(updated.profileId),
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
$"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
"",
|
||||
"",
|
||||
true
|
||||
);
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ผู้บังคับบัญชา อนุมัติคำลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id คำลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("commander-cancel/reject/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> CommanderConfirmCancel([FromBody] RetirementReasonCancelRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResignCancels
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
updated.CommanderReject = req.Reject;
|
||||
updated.CommanderApproveReason = req.Reason;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
/// <summary>
|
||||
/// ผู้มีอำนาจ อนุมัติคำลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id คำลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("oligarch-cancel/reject/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> OligarchConfirmCancel([FromBody] RetirementReasonCancelRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResignCancels
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
||||
updated.Status = "APPROVE";
|
||||
updated.OligarchReject = req.Reject;
|
||||
updated.OligarchApproveReason = req.Reason;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -2273,7 +2591,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Where(x => req.refIds.Contains(x.Id.ToString()))
|
||||
.Where(x => x.Status.ToUpper() == "REPORT")
|
||||
.ToListAsync();
|
||||
placementProfiles.ForEach(profile => profile.Status = "PENDING");
|
||||
placementProfiles.ForEach(profile => profile.Status = "APPROVE");
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Retirement.Service.Requests
|
||||
{
|
||||
public class RetirementReasonCancelRequest
|
||||
{
|
||||
public string Reason { get; set; }
|
||||
public bool Reject { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue