Months {{ (syscare_chart_labels|length) if syscare_chart_labels else 0 }}Achieved Total {{ syscare_chart_total_achieved or 0 }}Monthly Target {{ syscare_chart_target_value or 0 }}
{% if syscare_chart_has_data %}
{% else %}
No SYSCARE chart data
Set a branch target or upload SYSCARE records to see the monthly trend.
{% endif %}
Branch Progress (Top)
Branch
Target
Achieved
Balance
Progress
{% if branch_stats %}
{% for bs in branch_stats %}
{{ bs.branch_name }}
{{ bs.monthly_target }}
{{ bs.achieved }}
{{ bs.remaining }}
{% set progress_class = 'bg-success' if bs.percentage >= 100 else 'bg-primary' if bs.percentage >= 50 else 'bg-warning' %}
{% set progress_width = [bs.percentage, 100]|min %}
{{ bs.percentage }}%
{% endfor %}
{% else %}
No branch stats available
{% endif %}
{% if can_manage %}
{% else %}
Branch target management is available only for Admin / Super Admin.
{% if records %}
{% for r in records %}
{% set row_model = (r.product_model or '')|trim %}
{% set row_serial = (r.serial_number or '')|trim %}
{% set row_combined = (r.model_serial or '')|trim %}
{% if row_combined and (not row_model or not row_serial) %}
{% if ' / ' in row_combined %}
{% set row_parts = row_combined.split(' / ', 1) %}
{% if not row_model %}{% set row_model = row_parts[0]|trim %}{% endif %}
{% if not row_serial and (row_parts|length) > 1 %}{% set row_serial = row_parts[1]|trim %}{% endif %}
{% elif 'SN:' in row_combined %}
{% set row_parts = row_combined.split('SN:', 1) %}
{% if not row_model %}{% set row_model = row_parts[0]|replace('/', ' ')|trim %}{% endif %}
{% if not row_serial and (row_parts|length) > 1 %}{% set row_serial = row_parts[1]|trim %}{% endif %}
{% elif ',' in row_combined %}
{% set row_parts = row_combined.split(',', 1) %}
{% if not row_model %}{% set row_model = row_parts[0]|trim %}{% endif %}
{% if not row_serial and (row_parts|length) > 1 %}{% set row_serial = row_parts[1]|trim %}{% endif %}
{% endif %}
{% endif %}