{% extends "base.html" %} {% from "units/_m.html" import doc_badge with context %} {% block title %}{{ t('Maintenance') }}{% endblock %} {% block content %}

{{ t('Maintenance') }}

{{ t('Factory machines, preventive plans and breakdowns.') }}

{% if can_write %}
{{ t('Equipment') }}{{ t('Maintenance plans') }}
{% endif %}
{{ t('Machines down') }}
{{ equipment|selectattr('state', 'equalto', 'down')|list|length }}
{{ equipment|length }} {{ t('machines') }}
{{ t('Preventive due') }}
{{ plans|selectattr('due')|list|length }}
{{ t('Downtime, 90 days') }}
{{ '%g' % stats.downtime }}{{ t('hours') }}
{{ t('Maintenance cost, 90 days') }}
{{ stats.cost|money }}{{ company.currency }}

{{ t('Maintenance orders') }}

{% for m in orders %} {% else %}{% endfor %}
{{ t('Order') }}{{ t('Machine') }}{{ t('Type') }}{{ t('Work') }}{{ t('Due') }}{{ t('Status') }}
{{ m.number }}{{ m.code }} · {{ nm(m) }}{{ t('Breakdown') if m.kind == 'breakdown' else t('Preventive') }} {{ m.description or '' }}{% if m.state == 'done' %}
{{ m.done_at }} · {{ '%g' % m.downtime_hours }} h · {{ m.cost|money }}{% endif %}
{{ m.due_date }}{{ doc_badge(m.state) }} {% if can_write and m.state == 'open' %}
{% endif %}
{{ t('No maintenance orders.') }}

{{ t('Machines') }}

{% for e in equipment %} {% else %}{% endfor %}
{{ e.code }} · {{ nm(e) }}
{{ e.wc_code or '' }} {{ e.maker or '' }} {{ e.model or '' }}
{{ doc_badge(e.state) }} {% if can_write and e.state == 'running' %}
{% endif %}
{{ t('No equipment yet.') }}

{{ t('Preventive plans') }}

{% for p in plans %} {% else %}{% endfor %}
{{ p.name }}
{{ p.code }} · {{ t('every') }} {{ p.interval_days }} {{ t('days') }}
{{ t('Last') }}: {{ p.last_done or '—' }} {{ t('Next') }}: {{ p.next }}
{{ t('No maintenance plans yet.') }}
{% endblock %}