<?php
/**
 * Shared dashboard header: welcome line + trajectory chip if provided.
 * Views pass in $data (already available via $this->data).
 */
$fullName = $this->v('full_name');
$roleName = $this->v('role_name');
// View::raw() coerces to string, which would turn our ['bg','label'] into
// the literal "Array" — grab the value from $this->data directly instead.
$chip     = $this->data['chip'] ?? null;   // ['bg'=>'#hex', 'label'=>string]
?>
<div class="d-flex align-items-center justify-content-between mb-3 flex-wrap gap-2">
  <div>
    <h5 class="mb-0 fw-semibold">Welcome back, <?= $fullName; ?></h5>
    <div class="text-muted small" style="letter-spacing:.4px;text-transform:uppercase;">
      <?= $roleName; ?> &middot; <?= date('D, d M Y'); ?>
    </div>
  </div>
  <?php if ($chip): ?>
    <span class="badge" style="background:<?= $chip['bg']; ?>;color:#fff;font-size:.75rem;padding:.4rem .8rem;">
      <i class="fas fa-circle me-1" style="font-size:.5rem;vertical-align:middle;"></i><?= htmlspecialchars($chip['label']); ?>
    </span>
  <?php endif; ?>
</div>
