{% include "_pwa_head.html" %}
{% set filter_count = (status_filters|length) + (branch_filters|length) + (transfer_filters|length) + (age_bucket_filters|length) + (call_type_filters|length) + (device_filters|length) + (priority_filters|length) + (complaint_type_filters|length) + (engineer_filters|length) + (closure_results|length) %} {% set filters_open = filter_count > 0 or chart_from_date or chart_to_date or (chart_mode and chart_mode != 'created') %}
{{ view_title or 'Cases' }}
{% macro checkbox_filter(name, label, options, selected_values) %}
{% endmacro %}
{{ checkbox_filter('status', 'Status', jobs_filter_options.status, status_filters) }} {% if session.role in ['super_admin', 'admin'] and branch == 'ALL' %} {{ checkbox_filter('branch_name', 'Branch', jobs_filter_options.branch, branch_filters) }} {% else %} {% for value in branch_filters or [] %}{% endfor %} {% endif %} {{ checkbox_filter('device_filter', 'Device', jobs_filter_options.device, device_filters) }} {{ checkbox_filter('priority_filter', 'Priority', jobs_filter_options.priority, priority_filters) }} {{ checkbox_filter('call_type_filter', 'Call Type', jobs_filter_options.call_type, call_type_filters) }} {{ checkbox_filter('complaint_type_filter', 'Complaint Type', jobs_filter_options.complaint_type, complaint_type_filters) }} {{ checkbox_filter('engineer_filter', 'Assigned Engineer', jobs_filter_options.engineer, engineer_filters) }} {{ checkbox_filter('age_bucket', 'Age', ['0-2', '3-5', '6-10', '11-15', '16-30', '31-90', '91-180', '181+'], age_bucket_filters) }} {{ checkbox_filter('closure_result', 'Closure', ['success', 'failed'], closure_results) }} {{ checkbox_filter('transfer_filter', 'Transfer', ['active'], transfer_filters) }}
{% if (current_view or 'active') in ['all', 'closed'] %} {% if (current_view or 'active') == 'all' %} {% endif %} {% endif %} {% if session.role == 'super_admin' and (current_view or 'active') == 'all' %} {% endif %} {% for job in jobs %} {% if job.status == 'Observation' %}{% set row_class = 'table-warning' %} {% elif job.status == 'Waiting For Customer Approval' %}{% set row_class = 'table-info' %} {% elif job.status == 'Spare Waiting' %}{% set row_class = 'table-primary' %} {% elif job.status == 'Outside Service' %}{% set row_class = 'table-secondary' %} {% elif job.status == 'Ready-Waiting for Customer' %}{% set row_class = 'table-success' %} {% elif job.status == 'Non-Repairable Waiting for Customer' %}{% set row_class = 'table-danger' %} {% elif job.status == 'Inspire' %}{% set row_class = 'table-light' %} {% else %}{% set row_class = '' %}{% endif %} {% set can_manage_job_row = ((session.role in ['super_admin', 'admin']) and branch == 'ALL') or branch == job.branch_name %} {% if (current_view or 'active') in ['all', 'closed'] %} {% if (current_view or 'active') == 'all' %} {% endif %} {% endif %} {% if session.role == 'super_admin' and can_manage_job_row and (current_view or 'active') == 'all' %} {% endif %} {% endfor %}
# Job No Status Customer Mobile Device Model Serial Number Complaint Branch Name Priority Call Type Complaint Type Assigned EngineerClosure ResultOutcomeActionAge Age Group Created On Warranty Backup
{{ (page - 1) * 20 + loop.index }} {{ job.job_number }} {% if job.specialist_transfer_branch_name %}
Specialist: {{ job.specialist_transfer_branch_name }}{% if job.specialist_transfer_engineer %} | {{ job.specialist_transfer_engineer }}{% endif %}
{{ job.specialist_transfer_status or 'Transferred' }} {% if not job.specialist_transfer_is_active and job.specialist_service_total %} | Share: {{ '%.2f'|format(job.specialist_service_total|float) }} {% endif %}
{% endif %}
{% if session.role in ["super_admin", "admin", "coordinator"] and can_manage_job_row and (job.closure_status is not defined or not job.closure_status) and job.status != 'Closed' %}
{% else %} {{ job.status }} {% endif %}
{{ job.customer_name or '-' }} {{ job.mobile or '-' }} {{ job.device or '-' }} {{ job.model or '-' }} {{ job.serial_number or '-' }} {{ job.complaint or '-' }} {{ job.branch_name or '-' }} {{ job.priority or '-' }} {{ job.call_type or '-' }} {{ job.complaint_type or '-' }} {{ job.assigned_engineer or '-' }} {% if job.specialist_transfer_branch_name %}
Specialist: {{ job.specialist_transfer_branch_name }}{% if job.specialist_transfer_engineer %} | {{ job.specialist_transfer_engineer }}{% endif %}
{{ job.specialist_transfer_status or 'Transferred' }} {% if not job.specialist_transfer_is_active and job.specialist_service_total %} | Share: {{ '%.2f'|format(job.specialist_service_total|float) }} {% endif %}
{% endif %}
{% set closure_text = (job.closure_status or '')|trim %} {% set closure_lower = closure_text|lower %} {% if 'closed success' in closure_lower %} Closed Success {% elif 'closed failed' in closure_lower %} Closed Failed {% else %} Open {% endif %} {% if 'closed success' in closure_lower %} Won {% elif 'closed failed' in closure_lower %} {{ closure_text.split(' - ', 1)[1] if ' - ' in closure_text else 'Closed Failed' }} {% else %} - {% endif %}
{{ job.age_days if job.age_days is not none else '-' }} {{ job.age_group or '-' }} {{ job.created_on or '-' }} {{ job.warranty_status }} {{ job.backup_required }}
{% if total_pages > 1 %}
Page {{ page }} of {{ total_pages }} — {{ total_count }} total record(s)
{% endif %}