{% extends "base.html" %} {% block title %}Internal Task Detail{% endblock %} {% block header %}Internal Task Detail{% endblock %} {% set jc = svc.jobcard %} {% set quote = jc.quote if jc else none %} {% set item = svc.quote_item %} {% set internal_transfer_users = internal_transfer_users if internal_transfer_users is defined else [] %} {% set is_child_task = assignment.parent_assignment_id is not none %} {% set is_delegated_parent = assignment.parent_assignment_id is none and assignment.status == "Delegated" %} {% set can_modify_assignment = jc and jc.status not in ["Ready For Billing", "Closure Approval Pending"] %} {% set parent_qty = delegation_summary.parent_qty if delegation_summary is defined else assignment.assigned_qty %} {% set delegated_qty_value = delegated_qty if delegated_qty is defined else 0 %} {% set remaining_qty_value = remaining_delegatable_qty if remaining_delegatable_qty is defined else assignment.assigned_qty %} {% set child_rows = delegated_child_rows if delegated_child_rows is defined else [] %} {% set can_transfer_assignment = assignment.status not in ["Completed", "Delegated"] and can_modify_assignment %} {% set can_submit_checklist = assignment.checklist_status != "Submitted" and not is_delegated_parent %} {% set can_update_status = assignment.status != "Delegated" %} {% block content %}
Operations Task

{{ svc.service_name or 'Service Not Mapped' }}

Jobcard: {{ jc.jobcard_code if jc else '—' }} {% if quote %} • Quote: {{ quote.quote_code }} {% endif %} {% if is_child_task %} • Delegated Task {% endif %}
{% if assignment.status == "Completed" %} Completed {% elif assignment.status == "In Progress" %} In Progress {% elif assignment.status == "On Hold" %} On Hold {% elif assignment.status == "Delegated" %} Delegated {% else %} {{ assignment.status or 'Assigned' }} {% endif %}
{% if can_delegate_assignment %} {% endif %} {% if can_transfer_assignment %} {% endif %} Back to Tasks
{% if is_delegated_parent %}
This task has been fully delegated.
The parent task cannot be completed directly. Completion will be counted through delegated child task completion.
{% endif %} {% if is_child_task %}
This is a delegated task.
Complete your assigned quantity and submit checklist, if applicable.
{% endif %}
Assigned Qty

{{ assignment.assigned_qty or 0 }}

Line item quantity
Assigned On
{{ assignment.assigned_at.strftime('%d %b %Y') if assignment.assigned_at else '—' }}
{{ assignment.assigned_at.strftime('%I:%M %p') if assignment.assigned_at else '' }}
Deadline
{{ assignment.deadline.strftime('%d %b %Y') if assignment.deadline else '—' }}
{{ assignment.deadline.strftime('%I:%M %p') if assignment.deadline else '' }}
Checklist
{% if assignment.checklist_status == "Submitted" %} Submitted {% elif is_delegated_parent %} Delegated {% else %} Pending {% endif %}
{% if not is_child_task %}
Delegation
Delegated Users
Track delegated quantity and completion by user.
{% if can_delegate_assignment %} {% endif %}
Parent Qty
{{ parent_qty or 0 }}
Original assigned quantity
Delegated Qty
{{ delegated_qty_value or 0 }}
Quantity assigned to child users
Remaining Qty
{{ remaining_qty_value or 0 }}
Still available for delegation
{% for child in child_rows %} {% else %} {% endfor %}
User Qty Deadline Status Checklist Assigned On Instruction
{{ child.internal_user.name if child.internal_user else '—' }}
{% if child.internal_user and child.internal_user.email %}
{{ child.internal_user.email }}
{% endif %}
{{ child.assigned_qty or 0 }} {% if child.deadline %} {{ child.deadline.strftime('%d-%m-%Y %I:%M %p') }} {% else %} — {% endif %} {% if child.status == "Completed" %} Completed {% elif child.status == "In Progress" %} In Progress {% elif child.status == "On Hold" %} On Hold {% else %} {{ child.status or 'Assigned' }} {% endif %} {% if child.checklist_status == "Submitted" %} Submitted {% else %} Pending {% endif %} {% if child.assigned_at %} {{ child.assigned_at.strftime('%d-%m-%Y %I:%M %p') }} {% else %} — {% endif %} {% if child.instruction or child.additional_instruction %} {{ child.instruction or child.additional_instruction }} {% else %} — {% endif %}
No delegation added yet.
{% endif %}
Assignment Details
Line Item Information
{% if item %}
Assigned Line Item
{{ item.item_name }}
{% if item.description %}
{{ item.description }}
{% endif %}
{% endif %} {% if assignment.instruction %}
Instruction
{{ assignment.instruction }}
{% endif %} {% if assignment.additional_instruction %}
Additional Instruction
{{ assignment.additional_instruction }}
{% endif %} {% if assignment.file_path %} {% endif %}
Service Fields
Additional Captured Details
{% for f in svc.field_values %} {% else %} {% endfor %}
Field Value
{{ f.field_master.field_label if f.field_master else f.field_key }} {% if f.file_path %} View File {% elif f.field_value %} {{ f.field_value }} {% else %} — {% endif %}
No additional fields captured for this service.
Update Task Status
{% if can_update_status %}
Deadline exceeded
A completion remark is mandatory when closing this internal task after the assigned deadline.
If checklist exists, it must be submitted before marking task Completed.
{% else %}
This parent task is delegated. Complete delegated child tasks instead.
{% endif %}
Related Records
Jobcard
{{ jc.jobcard_code if jc else '—' }}
Quote
{% if quote %} {{ quote.quote_code }} {% else %}
—
{% endif %}
Client
{{ jc.client.company_name if jc and jc.client else '—' }}
Completion Checklist
Checklist Responses
Submit the checklist before marking the task as Completed.
{% if assignment.checklist_status == "Submitted" %} Checklist Submitted {% elif is_delegated_parent %} Delegated Parent {% else %} Pending Checklist {% endif %}
{% if is_delegated_parent %}
This task has been fully delegated. Checklist submission is required from the delegated child task users.
{% elif svc.checklist_questions.count() > 0 %}
{% for q in checklist_questions %} {% set existing_response = q.responses.filter_by(jobcard_service_id=svc.id, assignment_id=assignment.id).first() %}
{{ q.question_text }} {% if q.is_required %} * {% endif %}
Type: {{ q.question_type|upper }}
{% if q.options %}
Options: {{ q.options }}
{% endif %}
{% if assignment.checklist_status == "Submitted" %} {% if existing_response %} {% if existing_response.file_path %} View Uploaded File {% else %}
{{ existing_response.response_value or '—' }}
{% endif %} {% else %} No response {% endif %} {% else %} {% if q.question_type == "checkbox" %}
{% elif q.question_type == "mcq" %} {% elif q.question_type == "file" %} {% else %} {% endif %} {% endif %}
{% endfor %} {% if can_submit_checklist %}
{% endif %}
{% else %}
No checklist configured for this task.
{% endif %}
{% if can_transfer_assignment %} {% endif %} {% if can_delegate_assignment %} {% endif %} {% endblock %}