Add engagement-level employee workflow board phase 1

This commit is contained in:
A R R R Associates
2026-07-19 23:36:38 +05:30
parent df52845194
commit f25f67389e
4 changed files with 317 additions and 74 deletions
+43
View File
@@ -47,6 +47,7 @@ from app.modules.employees.service import (
list_employee_work_dashboard,
list_employee_work_kanban,
get_employee_engagement_work_board,
start_employee_engagement_workflow,
list_employee_work_assignable_users,
list_visible_work_assignment_dashboard,
list_engagement_progress_dashboard,
@@ -2047,6 +2048,48 @@ def employee_my_work(request: Request, q: str = "", status: str = "open"):
db.close()
@portal_router.post("/work/engagements/{engagement_id}/start")
def employee_my_work_engagement_start(
request: Request,
engagement_id: int,
csrf_token: str = Form(...),
):
db = CommonSessionLocal()
try:
current_user = get_current_user(request, db=db)
if not current_user:
return _redirect_login()
try:
require_permission(db, current_user, "employees.work.view_self")
except Exception:
return _redirect_denied()
try:
validate_csrf(request, csrf_token)
except PermissionError:
return _csrf_rejected(request)
tenant_id = request.session.get("active_tenant_id") or current_user.tenant_id
branch_id = request.session.get("active_branch_id")
scope = build_employee_scope(
db,
current_user,
tenant_id=tenant_id,
branch_id=branch_id,
)
start_employee_engagement_workflow(
db,
scope,
engagement_id,
actor_user_id=current_user.id,
financial_year=_active_financial_year(request),
)
return RedirectResponse(
url=f"/employee/work/engagements/{engagement_id}",
status_code=303,
)
finally:
db.close()
@portal_router.get("/work/engagements/{engagement_id}")
def employee_my_work_engagement_board(request: Request, engagement_id: int):
db = CommonSessionLocal()