mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
Merge branch 'Feat/BE/Expense_adjust_approval_flow' into 'development'
[Feat][BE}: expense adjust approval flow get rid approval manager change to head area and add business unit vice president approval See merge request mbugroup/lti-api!159
This commit is contained in:
@@ -1049,21 +1049,30 @@ func (s *expenseService) Approval(c *fiber.Ctx, req *validation.ApprovalRequest,
|
||||
}
|
||||
|
||||
var stepNumber approvalutils.ApprovalStep
|
||||
if approvalType == "manager" {
|
||||
if approvalType == "head-area" {
|
||||
|
||||
stepNumber = utils.ExpenseStepManager
|
||||
stepNumber = utils.ExpenseStepHeadArea
|
||||
if latestApproval.StepNumber != uint16(utils.ExpenseStepPengajuan) {
|
||||
currentStepName := utils.ExpenseApprovalSteps[approvalutils.ApprovalStep(latestApproval.StepNumber)]
|
||||
return fiber.NewError(fiber.StatusBadRequest,
|
||||
fmt.Sprintf("Cannot process at Manager step. Latest approval is at %s step. Expected previous step: Pengajuan", currentStepName))
|
||||
fmt.Sprintf("Cannot process at Head Area step. Latest approval is at %s step. Expected previous step: Pengajuan", currentStepName))
|
||||
}
|
||||
} else if approvalType == "unit-vice-president" {
|
||||
|
||||
stepNumber = utils.ExpenseStepUnitVicePresident
|
||||
if latestApproval.StepNumber != uint16(utils.ExpenseStepHeadArea) {
|
||||
currentStepName := utils.ExpenseApprovalSteps[approvalutils.ApprovalStep(latestApproval.StepNumber)]
|
||||
return fiber.NewError(fiber.StatusBadRequest,
|
||||
fmt.Sprintf("Cannot process at Unit Vice President step. Latest approval is at %s step. Expected previous step: Head Area", currentStepName))
|
||||
}
|
||||
|
||||
} else if approvalType == "finance" {
|
||||
|
||||
stepNumber = utils.ExpenseStepFinance
|
||||
if latestApproval.StepNumber != uint16(utils.ExpenseStepManager) {
|
||||
if latestApproval.StepNumber != uint16(utils.ExpenseStepUnitVicePresident) {
|
||||
currentStepName := utils.ExpenseApprovalSteps[approvalutils.ApprovalStep(latestApproval.StepNumber)]
|
||||
return fiber.NewError(fiber.StatusBadRequest,
|
||||
fmt.Sprintf("Cannot process at Finance step. Latest approval is at %s step. Expected previous step: Manager", currentStepName))
|
||||
fmt.Sprintf("Cannot process at Finance step. Latest approval is at %s step. Expected previous step: Unit Vice President", currentStepName))
|
||||
}
|
||||
} else {
|
||||
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("Invalid approval type: %v", approvalType))
|
||||
|
||||
Reference in New Issue
Block a user