{% extends "base.html" %} {% block content %}

{% if viewing_all %}{{ t('system_overview') }} {% elif active_company %}{{ t('viewing_profile') }} {% else %}{{ view_display }}{% endif %}

{% if viewing_all %}{{ t('all_companies') }} {% elif active_company %}{{ active_company.name }} {% else %}{{ t('welcome') }}{% if user.company_name %}, {{ user.company_name }}{% endif %}{% endif %}

{% if viewing_all %} {{ t('add_company') }} {% else %} {{ t('enter_day_prod') }} {% if user.role == 'admin' and active_company %} {{ t('operator_logins') }} {% endif %} {% endif %} {{ t('view_analysis') }}
{% if not is_this_month %} {{ t('this_month') }} {% endif %} {{ t('date') }} — {{ view_display }}
{% if viewing_all and profile_summaries %}

{{ t('company_profiles') }}

{% for row in profile_summaries %}

{{ t('viewing_profile') }}

{{ row.company.name }}

{% if row.status == 'ok' %}{{ t('healthy') }} {% elif row.status == 'watch' %}{{ t('needs_check') }} {% elif row.status == 'alert' %}{{ t('critical') }} {% else %}{{ t('no_readings') }}{% endif %}

{{ row.machine_count }} {{ t('profile_machines') }}

{{ t('critical') }} {{ row.alert_count }} · {{ t('needs_check') }} {{ row.watch_count }}
{% endfor %}
{% endif %}
{{ t('month_tons') }} {{ fmt_tons(month_tons) }}
{{ t('month_target') }} {{ fmt_tons(month_target) }} {% if daily_target is not none %} {{ t('target_tons') }}: {{ fmt_tons(daily_target) }} {% endif %}
{{ t('got_month_output') }} {% if overall_met == 'got_output' %}{{ t('got_yes') }} {% elif overall_met == 'not_yet' %}{{ t('not_yet') }} {% else %}{{ t('no_target') }}{% endif %} {{ days_met }} / {{ days_recorded }} {{ t('days_recorded') }}
{{ t('month_hours') }} {{ fmt_hours(month_hours) }}
{{ t('machines_count') }} {{ machine_count }}
{{ t('today_logs') }} {{ today_count }}
{{ t('healthy') }} {{ ok_count }}
{{ t('needs_check') }} {{ watch_count }}
{{ t('critical') }} {{ alert_count }}
{{ t('amp_changed') }} {{ changed_count }}

{{ t('day_amp_compare') }}

{% if day_amp_rows %}
{% for item in day_amp_rows %} {% for row in item.day_amp.rows %} {% for field in ['on_empty', 'on_loading', 'on_overload', 'off_empty'] %} {% set cell = row.fields[field] %} {% endfor %} {% endfor %} {% endfor %}
{{ t('machine_no') }} {{ t('prev_log_day') }} {{ t('next_log_day') }} On {{ t('empty_amper') }} On {{ t('loading_amper') }} On {{ t('overload_amper') }} Off {{ t('empty_amper') }} {{ t('status') }}
{{ item.machine.machine_number }} {% if row.motor.label %}{{ row.motor.hp|int if row.motor.hp == row.motor.hp|int else row.motor.hp }}HP · {{ row.motor.label }}{% endif %} {{ fmt_date(row.prev_date) if row.prev_date else '—' }} {{ fmt_date(row.curr_date) if row.curr_date else '—' }} {% if cell.prev is none and cell.curr is none %} — {% else %} {{ cell.prev|amp if cell.prev is not none else '—' }} {{ cell.curr|amp if cell.curr is not none else '—' }} {% endif %} {% if row.changed %}{{ t('amp_changed') }}{% else %}{{ t('same_amp') }}{% endif %}
{% else %}

{{ t('no_day_compare') }}

{% endif %}

{{ t('month_production') }} · {{ view_display }}

{% if month_days %}
{% for row in month_days %} {% endfor %}
{{ t('date') }} {{ t('day_tons') }} {{ t('run_hours') }} {{ t('on_off') }} {{ t('got_day_output') }}
{{ row.display }} {{ fmt_tons(row.tons) }} {{ fmt_hours(row.hours) }} {% if row.on_time or row.off_time %}{{ row.on_time or '—' }} – {{ row.off_time or '—' }}{% else %}—{% endif %} {% if row.tons is none %} — {% else %} {% if row.met == 'got_output' %}{{ t('got_yes') }} {% elif row.met == 'not_yet' %}{{ t('not_yet') }} {% else %}{{ t('no_target') }}{% endif %} {% endif %}
{% else %}

{{ t('no_data') }}

{% endif %}

{{ t('alerts') }}

{% if alerts %} {% else %}

{{ t('no_alerts') }}

{% endif %}

{{ t('problem_summary') }}

{% if cards %} {% else %}

{{ t('no_machines') }}

{% endif %}
{% endblock %}