<?php
/**
 * Shared A4 print header — include at top of every report view.
 * Variables expected: $pageTitle, $from (optional), $to (optional)
 */
?>
<div class="print-header mb-3" style="border-bottom:2px solid #222;padding-bottom:8px">
  <table style="width:100%;border:none">
    <tr>
      <td style="width:60px;vertical-align:middle;border:none;padding:0">
        <?php if (!empty($_SESSION['settings']['shop_logo'])): ?>
        <img src="<?= UPLOAD_URL ?>/<?= e($_SESSION['settings']['shop_logo']) ?>"
             style="height:52px;width:52px;object-fit:contain">
        <?php else: ?>
        <div style="width:52px;height:52px;background:#1a2235;border-radius:8px;
             display:flex;align-items:center;justify-content:center;color:#fff;font-size:22px">
          &#128722;
        </div>
        <?php endif; ?>
      </td>
      <td style="padding-left:12px;vertical-align:middle;border:none">
        <div style="font-size:16px;font-weight:700;letter-spacing:.3px">
          <?= e(setting('shop_name','MJPOS')) ?>
        </div>
        <div style="font-size:9px;color:#444;margin-top:2px">
          <?= e(setting('shop_address','')) ?>
          <?php if(setting('shop_phone')): ?> &nbsp;|&nbsp; <?= e(setting('shop_phone')) ?><?php endif; ?>
          <?php if(setting('shop_email')): ?> &nbsp;|&nbsp; <?= e(setting('shop_email')) ?><?php endif; ?>
        </div>
      </td>
      <td style="text-align:right;vertical-align:middle;border:none;min-width:200px">
        <div style="font-size:15px;font-weight:700;color:#1a2235">
          <?= e($pageTitle ?? 'Report') ?>
        </div>
        <?php if (!empty($from) && !empty($to)): ?>
        <div style="font-size:9px;color:#555;margin-top:3px">
          Period: <?= fDate($from) ?> &mdash; <?= fDate($to) ?>
        </div>
        <?php endif; ?>
        <div style="font-size:9px;color:#555;margin-top:2px">
          Printed: <?= date('d M Y  H:i') ?>
          &nbsp;|&nbsp; By: <?= e(Auth::name()) ?>
        </div>
      </td>
    </tr>
  </table>
</div>
