<?php
declare(strict_types=1);
/** @var list<array{name:string,percent:int}> $lowStock */
?>
<div class="card card-stock-alert">
  <div class="card-hd"><span><i class="fa-solid fa-triangle-exclamation"></i> 재고 경보</span></div>
  <div class="card-bd">
    <?= view('home/_dashboard_gov_portal_stock_alert_levels', ['stockAlerts' => $stockAlerts]) ?>
  </div>
</div>
<div class="card card-low-stock">
  <div class="card-hd"><span><i class="fa-solid fa-box-open"></i> 부족 재고</span></div>
  <div class="card-bd">
    <div class="low-stock-grid">
      <?php foreach ($lowStock as $item): ?>
      <div class="bar-row">
        <div class="meta"><span><?= esc($item['name']) ?></span><span><?= esc((string) $item['percent']) ?>%</span></div>
        <div class="bar-track"><div class="bar-fill" style="width:<?= (int) $item['percent'] ?>%"></div></div>
      </div>
      <?php endforeach; ?>
    </div>
  </div>
</div>
