diff --git a/app/modules/partner_dashboard/service.py b/app/modules/partner_dashboard/service.py index 25153ba..975fd29 100644 --- a/app/modules/partner_dashboard/service.py +++ b/app/modules/partner_dashboard/service.py @@ -193,6 +193,11 @@ def _task_label(task: ClientServiceTaskInstance) -> dict[str, Any]: catalogue = getattr(task, "catalogue", None) assignee = getattr(task, "assigned_to", None) status = (task.status or "pending").replace("_", " ").title() + status_code = (getattr(task, "status", None) or "pending").strip().lower() + is_locked = bool(getattr(task, "is_locked", False) or getattr(subscription, "is_locked", False)) + is_task_assignee = int(getattr(task, "assigned_to_user_id", 0) or 0) == int(getattr(current_user, "id", 0) or 0) + can_execute = bool(is_task_assignee and not is_locked and status_code not in {"completed", "not_applicable"}) + return { "id": task.id, "subscription_id": task.subscription_id, @@ -543,10 +548,13 @@ def _partner_task_payload(task: ClientServiceTaskInstance, subscription: ClientS "review_kind_label": "Normal Review" if review_level == "normal_partner" else ("AQMM Review Partner" if review_level == "review_partner" else ("AQMM Partner Review" if review_level == "partner" else "")), "review_state": review_state, "can_review": review_level is not None and review_state in {"pending_review", "reviewed", "rework"}, + "is_task_assignee": is_task_assignee, + "can_execute": can_execute, + "execution_mode_label": "Assigned to you for execution" if can_execute else "", "is_exception": getattr(task, "checklist_response", None) == "NO" or getattr(task, "rework_status", "none") == "open", "evidence_count": len(documents), "comments": comments, - "is_locked": bool(getattr(task, "is_locked", False) or getattr(subscription, "is_locked", False)), + "is_locked": is_locked, } diff --git a/app/modules/partner_dashboard/templates/partner_dashboard/partner_review_workspace.html b/app/modules/partner_dashboard/templates/partner_dashboard/partner_review_workspace.html index 0f5cc0c..0d50932 100644 --- a/app/modules/partner_dashboard/templates/partner_dashboard/partner_review_workspace.html +++ b/app/modules/partner_dashboard/templates/partner_dashboard/partner_review_workspace.html @@ -38,7 +38,9 @@ {% if request.query_params.get('reviewed') %}
Review decision saved.
{% endif %} + {% if request.query_params.get('executed') %}
Assigned Partner task saved successfully.
{% endif %} {% if request.query_params.get('review_error') %}
The review could not be saved. Check readiness, review note, assignment and lock status.
{% endif %} + {% if request.query_params.get('execution_error') %}
The assigned task could not be saved. Check prior task approvals, required response/evidence, assignment and lock status.
{% endif %}