<?php $this->start('body'); ?>
<?php $v = $this->data['v']; ?>

<div class="d-flex align-items-center justify-content-between mb-3 flex-wrap gap-2">
  <div>
    <h5 class="mb-0 fw-semibold"><i class="fas fa-store me-2 text-muted"></i><?= htmlspecialchars($v['vendor_name']); ?></h5>
    <div class="text-muted small">Vendor #<?= htmlspecialchars($v['vendor_no']); ?><?php if ($v['vendor_category']): ?> · <?= htmlspecialchars(ucwords(str_replace('_',' ',$v['vendor_category']))); ?><?php endif; ?></div>
  </div>
  <div class="d-flex gap-2">
    <a href="<?= PROOT; ?>Vendors" class="btn btn-sm btn-outline-secondary"><i class="fas fa-arrow-left me-1"></i>Back</a>
    <a href="<?= PROOT; ?>Vendors/edit/<?= (int)$v['c0d']; ?>" class="btn btn-sm btn-primary"><i class="fas fa-pen me-1"></i>Edit</a>
  </div>
</div>

<?= flashHtml(); ?>

<div class="row g-3">
  <div class="col-lg-6">
    <div class="card border-0 shadow-sm">
      <div class="card-body">
        <h6 class="text-uppercase text-muted small mb-3">Identity</h6>
        <dl class="row mb-0">
          <dt class="col-4 text-muted fw-normal">Vendor #</dt><dd class="col-8 font-monospace small"><?= htmlspecialchars($v['vendor_no']); ?></dd>
          <dt class="col-4 text-muted fw-normal">Category</dt><dd class="col-8"><?= htmlspecialchars(ucwords(str_replace('_',' ',$v['vendor_category'] ?? '—'))); ?></dd>
          <?php if ($v['vendor_tin']): ?><dt class="col-4 text-muted fw-normal">TIN</dt><dd class="col-8 font-monospace small"><?= htmlspecialchars($v['vendor_tin']); ?></dd><?php endif; ?>
          <?php if ($v['vendor_vrn']): ?><dt class="col-4 text-muted fw-normal">VRN</dt><dd class="col-8 font-monospace small"><?= htmlspecialchars($v['vendor_vrn']); ?></dd><?php endif; ?>
        </dl>
      </div>
    </div>
  </div>
  <div class="col-lg-6">
    <div class="card border-0 shadow-sm">
      <div class="card-body">
        <h6 class="text-uppercase text-muted small mb-3">Contact</h6>
        <dl class="row mb-0">
          <dt class="col-4 text-muted fw-normal">Phone</dt><dd class="col-8"><?= htmlspecialchars($v['vendor_phone_1'] ?: '—'); ?><?php if ($v['vendor_phone_2']): ?> · <?= htmlspecialchars($v['vendor_phone_2']); ?><?php endif; ?></dd>
          <?php if ($v['vendor_email']):   ?><dt class="col-4 text-muted fw-normal">Email</dt>  <dd class="col-8"><?= htmlspecialchars($v['vendor_email']); ?></dd><?php endif; ?>
          <?php if ($v['vendor_website']): ?><dt class="col-4 text-muted fw-normal">Website</dt><dd class="col-8"><a href="<?= htmlspecialchars($v['vendor_website']); ?>" target="_blank"><?= htmlspecialchars($v['vendor_website']); ?></a></dd><?php endif; ?>
          <dt class="col-4 text-muted fw-normal">Address</dt><dd class="col-8"><?= htmlspecialchars(trim(($v['vendor_address'] ?? '') . ($v['vendor_city'] ? ', ' . $v['vendor_city'] : ''))) ?: '—'; ?></dd>
          <?php if ($v['vendor_po_box']): ?><dt class="col-4 text-muted fw-normal">PO Box</dt><dd class="col-8"><?= htmlspecialchars($v['vendor_po_box']); ?></dd><?php endif; ?>
          <dt class="col-4 text-muted fw-normal">Country</dt><dd class="col-8"><?= htmlspecialchars($v['vendor_country'] ?? '—'); ?></dd>
        </dl>
      </div>
    </div>
  </div>
</div>

<?php $this->end(); ?>
