{% extends "base.html" %} {% from "_macros.html" import wf_badge with context %} {% block title %}{{ nm(v) }}{% endblock %} {% block content %}
{{ t('Vendor Management') }}

{{ nm(v) }} {{ wf_badge(v.vendor_status) }}

{{ v.vendor_category or '' }}{% if overall %} · {{ t('Rating') }} {{ '%.1f' % overall }} / 5{% endif %}
{% if can_write %}
{% if v.vendor_status != 'approved' and can_approve %}
{% endif %} {% if v.vendor_status != 'prospect' %}
{% endif %} {% if v.vendor_status != 'blocked' %}
{% endif %}
{% endif %}
{{ t('Purchase orders (12 months)') }}
{{ perf.po_count }}
{{ perf.po_total|money }}
{{ t('On-time delivery') }}
{{ ('%.0f%%' % perf.ontime) if perf.ontime is not none else '—' }}
{{ perf.receipts }} {{ t('receipts') }}
{{ t('RFQ response') }}
{{ perf.rfq_quoted }} / {{ perf.rfq_invited }}
{{ perf.rfq_awarded }} {{ t('awarded') }}
{{ t('Amount Due') }}
{{ perf.due|money }}
{{ perf.open_bills }} {{ t('open bills') }}
{{ t('Rating') }}
{{ ('%.1f' % overall) if overall else '—' }}
{{ evals|length }} {{ t('evaluations') }}
{% if bank_pending %}
{{ icon('shield') }}{{ t('New bank details are waiting for finance approval') }} (IBAN …{{ bank_pending.iban[-4:] }}). {{ t('Payments use the current account until it is approved.') }} {{ t('Open') }}
{% endif %}

{{ t('Vendor profile') }}

{% if not bank_pending %}
{{ t('Changing the bank details needs finance approval.') }}
{% endif %}
{% if can_write %}
{% endif %}
{% if doc_updates or bank_history %}

{{ t('Changes waiting for review') }}

{% for d in doc_updates %}{% endfor %} {% for c in bank_history %}{% endfor %}
{{ icon('file') }} {{ t(d.doc_type) }} {{ d.number or '' }}{% if d.expiry_date %} · {{ t('expires') }} {{ d.expiry_date }}{% endif %}
{{ t('Sent through the supplier portal') }} {{ d.submitted_at[:10] }}
{% if can_write %}
{% endif %}
{{ icon('bank') }} {{ t('Bank details change') }} · IBAN …{{ c.iban[-4:] }} {{ c.created_at[:10] }} {{ t({'pending': 'Waiting for approval', 'approved': 'Approved', 'rejected': 'Rejected'}.get(c.state, c.state)) }}
{% endif %}

{{ t('Documents') }}

{% for d in docs %} {% else %}{% endfor %}
{{ t('Type') }}{{ t('Number') }}{{ t('Issue date') }}{{ t('Expiry date') }}{{ t('File') }}
{{ t(d.doc_type) }}{% if d.notes %}
{{ d.notes }}{% endif %}
{{ d.number or '' }}{{ d.issue_date or '' }} {{ d.expiry_date or '' }} {% if d.expiry_date and d.expiry_date < today %}{{ t('Expired') }} {% elif d.expiry_date and d.expiry_date <= soon %}{{ t('Expires soon') }}{% endif %} {% if d.filename %}{{ d.original_name }}{% endif %} {% if can_write %}
{% endif %}
{{ t('Nothing yet.') }}
{% if can_write %}
{% endif %}
{% if has('portal') %}

{{ t('Supplier portal access') }}

{% for u in portal_users %} {% else %}{% endfor %}
{{ u.full_name or '' }}
{{ u.email }}
{% if not u.active %}{{ t('No access') }} {% elif u.activated_at %}{{ t('Active') }}{% if u.last_login %} {{ t('last sign-in') }} {{ u.last_login[:16].replace('T', ' ') }}{% endif %} {% elif u.activation_expires and u.activation_expires > now_iso %}{{ t('Invited') }} {{ t('link valid until') }} {{ u.activation_expires[:16].replace('T', ' ') }} {% else %}{{ t('Link expired') }}{% endif %} {% if can_write %}
{% if u.active %}
{% endif %} {% endif %}
{{ t('No portal users yet.') }}
{% if can_write and v.vendor_status == 'approved' %}
{{ t('They receive an activation link and choose their own password.') }}
{% endif %}
{% endif %}

{{ t('Evaluations') }}

{% for c in criteria %}{% endfor %} {% for e in evals %} {% for c in criteria %}{% endfor %} {% else %}{% endfor %} {% if evals %}{% for c in criteria %}{% endfor %}{% endif %}
{{ t('Date') }}{{ t('Period') }}{{ t(c|capitalize) }}{{ t('Average') }}{{ t('Comments') }}{{ t('Evaluated by') }}
{{ e.date }}{{ e.period or '' }}{{ e[c] }}{{ '%.1f' % ((e.quality + e.delivery + e.price + e.service) / 4) }}{{ e.comments or '' }}{{ e.full_name or e.username or '' }}
{{ t('Nothing yet.') }}
{{ t('Average') }}{{ '%.1f' % scores[c] }}{{ '%.1f' % overall }}
{% if can_write %}
{% for c in criteria %}
{% endfor %}
{% endif %}
{% if history %}

{{ t('History') }}

{% for h in history %}{% endfor %}
{{ h.ts.replace('T', ' ') }}{{ h.action }}{{ h.details or '' }}
{% endif %} {% endblock %}