<?php
$active = 'home';
$pageTitle = 'I-9 Section 2';
require __DIR__ . '/../layout/workspace_header.php';
?>
<div class="topbar">
  <div><h1>I-9 Section 2 — <?= htmlspecialchars(onb_full_name($hire)) ?></h1>
    <div class="crumbs"><a href="/onboarding" style="color:var(--blue-600);">Employee Onboarding</a> → <a href="/onboarding/view?id=<?= (int)$hire['id'] ?>" style="color:var(--blue-600);"><?= htmlspecialchars(onb_full_name($hire)) ?></a> → I-9</div>
  </div>
</div>
<div class="alert alert-error">Complete within 3 business days of the first day of employment. Examine original physical documents in person.</div>
<div class="card">
  <form method="POST" action="/onboarding/i9/save">
    <input type="hidden" name="id" value="<?= (int)$hire['id'] ?>">
    <h4>List B — Identity</h4>
    <div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;">
      <div class="field"><label>Document title</label><input type="text" name="b_title" required></div>
      <div class="field"><label>Issuing authority</label><input type="text" name="b_auth"></div>
      <div class="field"><label>Document number</label><input type="text" name="b_num"></div>
      <div class="field"><label>Expiration date</label><input type="date" name="b_exp"></div>
    </div>
    <h4>List C — Employment Authorization</h4>
    <div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;">
      <div class="field"><label>Document title</label><input type="text" name="c_title" required></div>
      <div class="field"><label>Issuing authority</label><input type="text" name="c_auth"></div>
      <div class="field"><label>Document number</label><input type="text" name="c_num"></div>
      <div class="field"><label>Expiration date</label><input type="date" name="c_exp"></div>
    </div>
    <div class="field"><label>Additional info</label><input type="text" name="addl"></div>
    <h4>Employer</h4>
    <div style="display:grid;grid-template-columns:1fr 1fr;gap:12px;">
      <div class="field"><label>Company legal name</label><input type="text" name="biz_name" value="Hammer Head Security" required></div>
      <div class="field"><label>Employer representative</label><input type="text" name="rep" value="<?= htmlspecialchars($user['name'] ?? '') ?>"></div>
      <div class="field"><label>Federal EIN</label><input type="text" name="ein" required></div>
      <div class="field"><label>CA Payroll Tax Account #</label><input type="text" name="ca_payroll"></div>
      <div class="field"><label>Company address</label><input type="text" name="addr" value="4551 South B Street, Stockton, CA 95206"></div>
      <div class="field"><label>First day of employment</label><input type="date" name="first_day" value="<?= htmlspecialchars($hire['hire_date'] ?? '') ?>"></div>
    </div>
    <div class="modal-actions" style="margin-top:20px;">
      <a href="/onboarding/view?id=<?= (int)$hire['id'] ?>" class="btn-secondary" style="text-decoration:none;">Cancel</a>
      <button type="submit" class="btn-primary">Complete I-9 §2</button>
    </div>
  </form>
</div>
<?php require __DIR__ . '/../layout/admin_footer.php'; ?>
