<?php
$labels = $draft['labels'] ?? [];
$groups = [
    'Sales words' => [
        ['opportunity', 'One deal', 'Example: Deal, Bid, Opportunity'],
        ['opportunities', 'List of deals', 'Shown in the menu'],
        ['lead', 'One lead', 'A possible buyer'],
        ['leads', 'List of leads', 'Shown in the menu'],
    ],
    'Customer words' => [
        ['account', 'One company', 'Example: Account, Customer'],
        ['accounts', 'List of companies', 'Shown in the menu'],
        ['contact', 'One person', 'Someone at the company'],
        ['contacts', 'List of people', 'Shown in the menu'],
    ],
];
?>
<div class="sup-page">
  <?php \App\Core\View::partial('setup_nav', compact('section', 'dirty', 'canUndo', 'publishedAt')); ?>
  <form class="set-section ajax-form" action="<?= e(url('setup/save')) ?>" method="post">
    <?= csrf_field() ?>
    <input type="hidden" name="section" value="names">
    <div class="set-section-head">
      <div>
        <div class="set-section-title"><i class="bi bi-type"></i> 2. Name changer</div>
        <p class="set-section-sub">Change the words on the screen to match how this company talks.</p>
      </div>
      <button class="btn btn-primary" type="submit">Save draft</button>
    </div>
    <?php foreach ($groups as $title => $rows): ?>
      <h2 class="sup-h"><?= e($title) ?></h2>
      <div class="sup-name-grid">
        <?php foreach ($rows as $row): ?>
          <label class="sup-field">
            <span><?= e($row[1]) ?></span>
            <small><?= e($row[2]) ?></small>
            <input class="form-control" name="labels[<?= e($row[0]) ?>]" value="<?= e((string) ($labels[$row[0]] ?? '')) ?>" maxlength="40" required>
          </label>
        <?php endforeach; ?>
      </div>
    <?php endforeach; ?>
  </form>
</div>
