<?php $this->start('body');
    include __DIR__ . '/_dash_header.php';
    include __DIR__ . '/_kpi_strip.php';
?>

<div class="row g-3">
  <div class="col-lg-7">
    <div class="card border-0 shadow-sm h-100"><div class="card-body">
      <div class="d-flex justify-content-between align-items-baseline mb-2">
        <h6 class="text-uppercase text-muted small mb-0">Net payroll paid &middot; 6 months</h6>
        <a href="<?= PROOT; ?>Payroll" class="small text-decoration-none">Periods &rarr;</a>
      </div>
      <div id="c-net" style="min-height: 260px;"></div>
    </div></div>
  </div>
  <div class="col-lg-5">
    <div class="card border-0 shadow-sm h-100"><div class="card-body">
      <div class="d-flex justify-content-between align-items-baseline mb-2">
        <h6 class="text-uppercase text-muted small mb-0">Statutory mix &middot; YTD</h6>
        <a href="<?= PROOT; ?>TaxReturns/statutory" class="small text-decoration-none">Statutory &rarr;</a>
      </div>
      <div id="c-stat" style="min-height: 260px;"></div>
    </div></div>
  </div>
</div>

<div class="row g-3 mt-1">
  <div class="col-lg-7">
    <div class="card border-0 shadow-sm h-100"><div class="card-body">
      <div class="d-flex justify-content-between align-items-baseline mb-2">
        <h6 class="text-uppercase text-muted small mb-0">Driver headcount</h6>
        <a href="<?= PROOT; ?>Drivers" class="small text-decoration-none">Drivers &rarr;</a>
      </div>
      <div id="c-heads" style="min-height: 260px;"></div>
    </div></div>
  </div>
  <div class="col-lg-5">
    <div class="card border-0 shadow-sm h-100"><div class="card-body">
      <div class="d-flex justify-content-between align-items-baseline mb-2">
        <h6 class="text-uppercase text-muted small mb-0">Doc expiry severity</h6>
        <a href="<?= PROOT; ?>DocExpiries" class="small text-decoration-none">Docs &rarr;</a>
      </div>
      <div id="c-sev" style="min-height: 260px;"></div>
    </div></div>
  </div>
</div>

<!-- Zone 3 · Attention + Zone 4 · Activity -->
<div class="row g-3 mt-1">
  <div class="col-lg-6"><?php include __DIR__ . '/_feed_compliance.php'; ?></div>
  <div class="col-lg-6"><?php include __DIR__ . '/_feed_assignments.php'; ?></div>
</div>

<div class="row g-3 mt-1">
  <div class="col-12">
    <div class="card border-0 shadow-sm"><div class="card-body">
      <h6 class="text-uppercase text-muted small mb-3">HR shortcuts</h6>
      <div class="d-flex flex-wrap gap-2">
        <a href="<?= PROOT; ?>Payroll" class="btn btn-sm btn-outline-primary"><i class="fas fa-money-check-alt me-1"></i>Payroll</a>
        <a href="<?= PROOT; ?>TaxReturns/paye" class="btn btn-sm btn-outline-primary"><i class="fas fa-user-tie me-1"></i>PAYE Return</a>
        <a href="<?= PROOT; ?>TaxReturns/statutory" class="btn btn-sm btn-outline-primary"><i class="fas fa-people-arrows me-1"></i>Statutory</a>
        <a href="<?= PROOT; ?>Payroll/p9Batch/<?= date('Y'); ?>" target="_blank" class="btn btn-sm btn-outline-primary"><i class="fas fa-file-invoice me-1"></i>P9 batch (<?= date('Y'); ?>)</a>
        <a href="<?= PROOT; ?>Drivers" class="btn btn-sm btn-outline-primary"><i class="fas fa-id-card me-1"></i>Drivers</a>
        <a href="<?= PROOT; ?>DocExpiries" class="btn btn-sm btn-outline-primary"><i class="fas fa-file-signature me-1"></i>Doc Expiries</a>
      </div>
    </div></div>
  </div>
</div>

<?php $this->end(); $this->start('section_js'); ?>
<script>
document.addEventListener('DOMContentLoaded', function () {
  new PacificChart('#c-net',   'bar',
    <?= json_encode(array_merge($this->data['charts']['net']   ?? [], ['tzs' => true])); ?>);
  new PacificChart('#c-stat',  'donut',
    <?= json_encode(array_merge($this->data['charts']['stat']  ?? [], ['tzs' => true, 'colors' => 'quad'])); ?>);
  new PacificChart('#c-heads', 'line',
    <?= json_encode($this->data['charts']['heads'] ?? []); ?>);
  new PacificChart('#c-sev',   'bar',
    <?= json_encode(array_merge($this->data['charts']['sev']   ?? [], ['horizontal' => true, 'distributed' => true, 'colors' => ['#DC2626','#F59E0B','#0E9F6E']])); ?>);
});
</script>
<?php $this->end(); ?>
