{% extends "base.html" %}
{% block title %}Vendor{% endblock %}
{% block breadcrumb %}Pengadaan / Vendor{% endblock %}
{% block page_title %}Master Vendor{% endblock %}
{% block topbar_actions %}<a href="{{ url_for('procurement.vendor_create') }}" class="btn btn-primary">+ Tambah Vendor</a>{% endblock %}
{% block content %}
<div class="card">
    <div class="table-wrap">
        <table>
            <thead><tr><th>Kode</th><th>Nama Vendor</th><th>NPWP</th><th>Kontak</th><th>Telp/Email</th><th>Bank</th><th>Status</th></tr></thead>
            <tbody>
            {% for v in vendors %}
            <tr>
                <td class="font-mono text-accent">{{ v.vendor_code }}</td>
                <td><div class="fw-600">{{ v.vendor_name }}</div><div class="fs-13 text-muted">{{ v.contact_person or '' }}</div></td>
                <td class="font-mono fs-13">{{ v.npwp or '—' }}</td>
                <td class="fs-13">{{ v.address[:40] + '…' if v.address and v.address|length > 40 else (v.address or '—') }}</td>
                <td class="fs-13">{{ v.phone or '—' }}<br>{{ v.email or '' }}</td>
                <td class="fs-13">{{ v.bank_name or '—' }}<br><span class="font-mono">{{ v.bank_account or '' }}</span></td>
                <td><span class="badge {% if v.is_active %}badge-success{% else %}badge-danger{% endif %}">{{ 'Aktif' if v.is_active else 'Nonaktif' }}</span></td>
            </tr>
            {% else %}
            <tr><td colspan="7" style="text-align:center;padding:40px;color:var(--text-muted)">Belum ada vendor. <a href="{{ url_for('procurement.vendor_create') }}" style="color:var(--accent)">Tambah vendor</a>.</td></tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}
