{% include "_pwa_head.html" %}
{% set close_requires_transfer_return = transfer_summary.has_active_transfer %} {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %} {% endfor %} {% endif %} {% endwith %}
Job Summary
{% if transfer_summary.has_active_transfer and not job_permissions.can_manage_core %}
This case is visible to your branch because it is currently in specialist service at {{ transfer_summary.active_transfer.to_branch_name }}. Customer-facing edits and closure remain with {{ job.branch_name }}.
{% endif %}

Call Summary

Primary customer and issue details.

Job Number

{{ job.job_number }}

Customer

{{ job.customer_name }}

Email

{{ job.email or 'N/A' }}
{% if job.alt_no %}

Alt Mobile

{{ job.alt_no }}
{% endif %}

Device

{{ job.device }}

Model

{{ job.model }}

Serial

{{ job.serial_number }}

Status

{{ job.status }}

Age

{{ job.age_days }} days ({{ job.age_group }})

Created

{{ job.created_on }}
{% if job.closed_on %}

Closed On

{{ job.closed_on }}
{% endif %} {% if job.get('closure_service_type') %}

Service Type

{{ job.closure_service_type }}
{% endif %}

Complaint

{{ job.complaint }}

Complaint Type

{{ job.complaint_type or 'N/A' }}

Warranty

{{ job.warranty_status or 'N/A' }}

Backup Required

{{ job.backup_required or 'N/A' }}

Priority

{{ job.priority or 'N/A' }}

Call Type

{{ job.call_type or 'N/A' }}

Received By

{{ job.received_by or 'N/A' }}

Assigned Engineer

{{ job.assigned_engineer or 'N/A' }}

Estimate Amount

{{ job.estimate_amount or 'N/A' }}

Service Charges

{{ '%.2f'|format(service_charges|float) }}

Branch

{{ job.branch_name }}
{% if job.accessories_received %}

Accessories Received: {{ job.accessories_received }}

{% endif %} {% if job.engineer_remarks %}

Engineer Remarks: {{ job.engineer_remarks }}

{% endif %} {% if used_spares %}

Used Spares:

{% for s in used_spares %} {% endfor %}
Spare Name Amount
{{ s.spare_name }} {{ s.amount }}
{% endif %} {% set close_requires_spare_billing = spare_billing.has_used_spares and spare_billing.status != 'Billed' %}

Billing Summary:

{% if job.get('closure_status') and bill_total_amount > 0 %} {% endif %} {% if transfer_rows %} {% endif %}
Used Spares Total {{ '%.2f'|format(total_spares_amount|float) }}
Service Charges {{ '%.2f'|format(service_charges|float) }}
Total Bill Amount {{ '%.2f'|format(bill_total_amount|float) }}
Cash {{ '%.2f'|format((job.payment_cash or 0)|float) }}
UPI {{ '%.2f'|format((job.payment_upi or 0)|float) }}
Card {{ '%.2f'|format((job.payment_card or 0)|float) }}
Specialist Share {{ '%.2f'|format(transfer_summary.specialist_service_total|float) }}
{{ job.branch_name }} Service Margin {{ '%.2f'|format(transfer_summary.closing_branch_service_margin|float) }}
{% if transfer_rows %}
Specialist Service Split
Internal service charge is credited to the specialist branch. The balance stays with {{ job.branch_name }}.
{% if transfer_summary.has_active_transfer %} {{ transfer_summary.active_transfer.status }} {% endif %}

Specialist Share: {{ '%.2f'|format(transfer_summary.specialist_service_total|float) }}

{{ job.branch_name }} Margin: {{ '%.2f'|format(transfer_summary.closing_branch_service_margin|float) }}

{% if transfer_summary.active_transfer %}

Current Specialist Branch: {{ transfer_summary.active_transfer.to_branch_name }}

Current Specialist Engineer: {{ transfer_summary.active_transfer.specialist_engineer or 'Pending assignment' }}

Service Type: {{ transfer_summary.active_transfer.service_type or 'Not specified' }}

{% elif transfer_summary.latest_completed_transfer %}

Last Specialist Branch: {{ transfer_summary.latest_completed_transfer.to_branch_name }}

Last Specialist Engineer: {{ transfer_summary.latest_completed_transfer.specialist_engineer or 'Not specified' }}

Last Specialist Status: {{ transfer_summary.latest_completed_transfer.status }}

{% endif %}
{% for transfer in transfer_rows %} {% endfor %}
From Specialist Branch Engineer Service Type Status Internal Charge Updated Notes
{{ transfer.from_branch_name }} {{ transfer.to_branch_name }} {{ transfer.specialist_engineer or '-' }} {{ transfer.service_type or '-' }} {{ transfer.status }} {{ '%.2f'|format(transfer.internal_service_charge|float) }}
{{ transfer.updated_on or transfer.created_on or '-' }}
{{ transfer.updated_by or transfer.sent_by or '-' }}
{{ transfer.request_notes or '-' }}
{% if transfer.status_notes %}
{{ transfer.status_notes }}
{% endif %}
{% endif %} {% set spare_billing_badge_class = 'text-bg-success' if spare_billing.status == 'Billed' else ('text-bg-warning' if spare_billing.status == 'Pending' else 'text-bg-secondary') %}

Spare Billing:

{{ spare_billing.status }}

Invoice No: {{ spare_billing.invoice_no or '-' }}

Invoice Date: {{ spare_billing.invoice_date_display or '-' }}

Billed By: {{ spare_billing.billed_by or '-' }}

Notes:

{{ spare_billing.notes or 'No billing notes added.' }}
{% if spare_billing.pending and spare_billing.has_used_spares %}
Used spare items are pending billing. Invoice details must be entered before this case can be closed.
{% endif %} {% if attachments %}

Attachments: {{ attachments|length }}

Attachments are auto-removed {{ job_attachment_retention_days }} days after case closure.

{% for attachment in attachments %}
Attachment {{ loop.index }} for job {{ job.job_number }} {% if session.role in ['super_admin', 'admin', 'coordinator'] and (not job.get('closure_status') or session.role in ['super_admin', 'admin']) %}
{% endif %}
{% endfor %}
{% endif %}
{% if status_logs %}
Status Change Log
{% for log in status_logs %} {% endfor %}
Status Notes Date Edited By
{{ log.status }} {{ log.notes }} {{ format_datetime_display(log.updated_at) }} {{ log.updated_by }}
{% endif %}
Actions
{% if not job.get('closure_status') %} {% if job_permissions.can_manage_core %} Print WhatsApp Edit Job {% if job_permissions.can_send_transfer %} {% endif %} {% if job_permissions.can_update_transfer %} {% endif %} {% if spare_billing.has_used_spares and not close_requires_spare_billing %} {% endif %} {% if close_requires_transfer_return %}
Return the active specialist transfer before closing this case.
{% elif close_requires_spare_billing %}
Complete spare billing first to continue closing this case.
{% else %} {% endif %} {% elif job_permissions.can_update_transfer %}
Core case edits remain with {{ job.branch_name }}.
{% endif %} {% else %} {% if job_permissions.can_manage_core %} Print WhatsApp {% if session.role in ['super_admin', 'admin'] %} Edit Job
{% if spare_billing.has_used_spares %} {% endif %} {% endif %} {% endif %} {% endif %} Back to List
{% if job_permissions.can_send_transfer %} {% endif %} {% if job_permissions.can_update_transfer and transfer_summary.active_transfer %} {% endif %} {% if transfer_user_options %} {% for username in transfer_user_options %} {% endfor %} {% endif %}