<?php
require_once __DIR__ . '/includes/functions.php';
require_once __DIR__ . '/includes/seo.php';

$seo = [
    'title' => 'Procurement Notices | ' . SITE_NAME,
    'description' => 'Current tenders, requests for proposals and procurement notices from Kigali Yacu Properties for contractors, suppliers and service providers.',
    'path' => '/procurement',
];
$notices = db()->query('SELECT * FROM procurement_notices ORDER BY published_at DESC')->fetchAll();
include __DIR__ . '/includes/header.php';
?>
<section class="section-pad-sm">
  <div class="container">
    <?= breadcrumb_html([['name' => 'Procurement', 'url' => '/procurement']]) ?>
    <div class="section-head" style="max-width:none;">
      <div class="eyebrow">Procurement</div>
      <h1>Tenders &amp; Procurement Notices</h1>
      <p>We regularly engage qualified contractors, suppliers and service providers to support our managed properties and developments. Current opportunities are listed below.</p>
    </div>

    <?php if (empty($notices)): ?>
      <div class="form-card text-center">
        <h3>No open procurement notices right now</h3>
        <p class="text-muted">Check back soon, or contact us to register your company for future opportunities.</p>
      </div>
    <?php else: ?>
      <div class="grid" style="grid-template-columns:1fr;gap:var(--space-4);">
        <?php foreach ($notices as $n): ?>
          <div class="card reveal" style="padding:var(--space-6);display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:var(--space-4);">
            <div>
              <div class="text-xs text-muted uppercase mb-2">Published <?= date('M j, Y', strtotime($n['published_at'])) ?><?= $n['deadline'] ? ' · Deadline ' . date('M j, Y', strtotime($n['deadline'])) : '' ?></div>
              <h3 style="font-size:var(--fs-md);margin-bottom:var(--space-2);"><?= e($n['title']) ?></h3>
              <p class="text-muted text-sm" style="max-width:60ch;"><?= e($n['description']) ?></p>
            </div>
            <a href="/contact?subject=<?= urlencode($n['title']) ?>" class="btn btn-outline btn-sm">Request Documents</a>
          </div>
        <?php endforeach; ?>
      </div>
    <?php endif; ?>
  </div>
</section>
<?php include __DIR__ . '/includes/footer.php'; ?>
