ปรับการขอยกเลิกการลา ให้สถานะเป็น DELETING จนมีการอนุมัติ แล้วเปลี่ยนเป็น DELETE
This commit is contained in:
parent
0367e33768
commit
41bcc2a1ef
2 changed files with 28 additions and 17 deletions
|
|
@ -524,6 +524,9 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ปรับสถานะ จาก DELETING มาเป็น DELETE
|
||||||
|
data.LeaveStatus = "DELETE";
|
||||||
|
|
||||||
data.LeaveCancelStatus = "APPROVE";
|
data.LeaveCancelStatus = "APPROVE";
|
||||||
data.LeaveDirectorComment = Reason;
|
data.LeaveDirectorComment = Reason;
|
||||||
data.LeaveCancelComment = LeaveReason;
|
data.LeaveCancelComment = LeaveReason;
|
||||||
|
|
@ -586,6 +589,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
throw new Exception(GlobalMessages.DataNotFound);
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rawData.LeaveStatus = "DELETE";
|
||||||
|
|
||||||
rawData.LeaveCancelStatus = "APPROVE";
|
rawData.LeaveCancelStatus = "APPROVE";
|
||||||
rawData.LeaveDirectorComment = Reason;
|
rawData.LeaveDirectorComment = Reason;
|
||||||
|
|
||||||
|
|
@ -593,20 +598,8 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
|
|
||||||
// TODO : Update ไปตาราง beginning
|
// TODO : Update ไปตาราง beginning
|
||||||
if (rawData.ApproveStep == "st4") // ถ้ามีการอนุมัติจากผู้มีอำนาจแล้ว
|
if (rawData.ApproveStep == "st4") // ถ้ามีการอนุมัติจากผู้มีอำนาจแล้ว
|
||||||
await _leaveBeginningRepository.UpdateLeaveUsageAsync(rawData.LeaveStartDate.Year, rawData.Type.Id, rawData.KeycloakUserId, -1 * rawData.LeaveTotal);
|
|
||||||
|
|
||||||
// TODO: remove วันลา
|
|
||||||
|
|
||||||
// Send Noti
|
|
||||||
var noti = new Notification
|
|
||||||
{
|
{
|
||||||
Body = $"การขอยกเลิกใบลาของคุณได้รับการอนุมัติ",
|
await _leaveBeginningRepository.UpdateLeaveUsageAsync(rawData.LeaveStartDate.Year, rawData.Type.Id, rawData.KeycloakUserId, -1 * rawData.LeaveTotal);
|
||||||
ReceiverUserId = profile.Id,
|
|
||||||
Type = "",
|
|
||||||
Payload = "",
|
|
||||||
};
|
|
||||||
_appDbContext.Set<Notification>().Add(noti);
|
|
||||||
await _appDbContext.SaveChangesAsync();
|
|
||||||
|
|
||||||
var _baseAPI = _configuration["API"];
|
var _baseAPI = _configuration["API"];
|
||||||
var apiUrlSalary = $"{_baseAPI}/org/profile/leave/cancel/{rawData.Id}";
|
var apiUrlSalary = $"{_baseAPI}/org/profile/leave/cancel/{rawData.Id}";
|
||||||
|
|
@ -623,6 +616,21 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
throw new Exception("ไม่สามารถอัพเดตการยกเลิกรายการลาไปยังระบบทะเบียนประวัติ");
|
throw new Exception("ไม่สามารถอัพเดตการยกเลิกรายการลาไปยังระบบทะเบียนประวัติ");
|
||||||
//var _result = await _res.Content.ReadAsStringAsync();
|
//var _result = await _res.Content.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove วันลา
|
||||||
|
|
||||||
|
// Send Noti
|
||||||
|
var noti = new Notification
|
||||||
|
{
|
||||||
|
Body = $"การขอยกเลิกใบลาของคุณได้รับการอนุมัติ",
|
||||||
|
ReceiverUserId = profile.Id,
|
||||||
|
Type = "",
|
||||||
|
Payload = "",
|
||||||
|
};
|
||||||
|
_appDbContext.Set<Notification>().Add(noti);
|
||||||
|
await _appDbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1693,7 +1693,10 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
// change status to delete
|
// change status to delete
|
||||||
data.LeaveStatus = "DELETE";
|
// แก้จาก DELETE เป็น DELETING ไว้ก่อน รอ approve ค่อยเปลี่ยนเป็น DELETE
|
||||||
|
// data.LeaveStatus = "DELETE";
|
||||||
|
|
||||||
|
data.LeaveStatus = "DELETING";
|
||||||
data.CancelLeaveWrote = req.LeaveWrote ?? "";
|
data.CancelLeaveWrote = req.LeaveWrote ?? "";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue