Show engagement progress instead of internal task status to consultants
This commit is contained in:
@@ -62,6 +62,7 @@ from app.modules.consultants.service import (
|
||||
)
|
||||
from app.modules.consultants.portal_service import (
|
||||
get_consultant_assignment_detail,
|
||||
get_consultant_engagement_progress,
|
||||
update_consultant_assignment,
|
||||
get_consultant_document_centre,
|
||||
get_consultant_work_board,
|
||||
@@ -1743,6 +1744,34 @@ def consultant_work_board(request: Request, q: str = "", status: str = ""):
|
||||
db.close()
|
||||
|
||||
|
||||
@portal_router.get("/engagements/{subscription_id}", response_class=HTMLResponse)
|
||||
def consultant_engagement_progress(request: Request, subscription_id: int):
|
||||
db = CommonSessionLocal()
|
||||
try:
|
||||
user = get_current_user(request, db=db)
|
||||
if not user:
|
||||
return RedirectResponse(url="/login", status_code=303)
|
||||
if not (_has_perm(db, user, "consultants.portal.view") or _is_consultant(db, user)):
|
||||
return _redirect_denied()
|
||||
consultant = _get_own_consultant_or_dashboard(request, db, user)
|
||||
if not consultant:
|
||||
return RedirectResponse(url="/consultant/dashboard", status_code=303)
|
||||
progress = get_consultant_engagement_progress(db, consultant=consultant, subscription_id=subscription_id)
|
||||
if not progress:
|
||||
return RedirectResponse(url="/consultant/work", status_code=303)
|
||||
return _render(
|
||||
request,
|
||||
"modules/consultants/templates/consultants/engagement_progress.html",
|
||||
db,
|
||||
user,
|
||||
title="Engagement Progress",
|
||||
consultant=consultant,
|
||||
**progress,
|
||||
)
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
@portal_router.get("/assignments/{task_id}")
|
||||
def consultant_assignment_detail(request: Request, task_id: int):
|
||||
db = CommonSessionLocal()
|
||||
|
||||
Reference in New Issue
Block a user