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

{{ u.serial }} {{ unit_badge(u.state) }}

{{ t('QR label') }} {% if can_write %}{{ t('Report a non-conformance') }} {% if u.state in ('delivered', 'installed') %}
{% if u.state == 'delivered' %}{% endif %}
{% endif %} {% if u.state == 'finished' %}{{ t('Dispatch to site') }}{% endif %}{% endif %}
{{ t('Product') }}
{{ nm(u) }}
{{ u.code }}
{{ t('Production order') }}
{% if u.production_id %}{{ u.mo_number }}{% else %}—{% endif %}
{{ t('Project') }}
{% if u.project_id %}{{ u.pcode }} {{ u.proj_en or '' }}{% else %}—{% endif %}
{{ t('Customer') }}
{{ u.cust_en or '—' }}
{{ t('Site') }}
{{ u.site or '—' }}
{{ t('Cost') }}
{{ u.cost|money }}
{{ t('Produced') }}
{{ u.produced_at or '—' }}
{{ t('Warranty until') }}
{{ u.warranty_until or '—' }}
{% if u.asset_id %}
{{ t('Fixed asset') }}
{{ t('View') }}
{% endif %}
{{ qr|safe }}
{{ t('Scan to open this unit') }}

{{ t('History') }}

    {% for e in events %}
  1. {{ t(states.get(e.state, e.state)) }} {{ e.at[:16]|replace('T', ' ') }}{% if e.full_name %} · {{ e.full_name }}{% endif %}{% if e.ref %} · {{ e.ref }}{% endif %}{% if e.notes %}
    {{ e.notes }}
    {% endif %}
  2. {% endfor %}
{% if dispatches %}

{{ t('Dispatch Notes') }}

{% for d in dispatches %}{% endfor %}
{{ d.number }}{{ d.date }}{{ d.vehicle or '' }} {{ d.driver or '' }}{{ d.site or '' }}{{ doc_badge(d.state) }}
{% endif %} {% if rentals %}

{{ t('Rental Contracts') }}

{% for r in rentals %}{% endfor %}
{{ r.number }}{{ r.cust_en }}{{ r.on_hire or '' }} → {{ r.off_hire or '…' }}{{ r.monthly_rate|money }} / {{ t('month') }}{{ doc_badge(r.state) }}
{% endif %} {% if ncrs %}

{{ t('Non-conformance Reports') }}

{% for n in ncrs %}{% endfor %}
{{ n.number }}{{ n.date }}{{ n.description[:90] }}{{ doc_badge(n.state) }}
{% endif %} {% endblock %}