xref: /webtrees/resources/views/edit/add-fact-row.phtml (revision 4874f72da8279544d9c0a459e2920a9986acfaa0)
1<?php use Fisharebest\Webtrees\GedcomTag; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3
4<tr>
5    <th scope="row">
6        <label for="add-fact">
7            <?= I18N::translate('Fact or event') ?>
8        </label>
9    </th>
10    <td>
11        <form method="get" action="<?= e(route('add-fact')) ?>" onsubmit="if ($('#add-fact').val() === null) {event.preventDefault();}">
12            <input type="hidden" name="route" value="<?= e(route('add-fact')) ?>">
13            <input type="hidden" name="xref" value="<?= e($record->xref()) ?>">
14            <input type="hidden" name="ged" value="<?= e($record->tree()->name()) ?>">
15            <div class="input-group">
16                <select class="custom-select" id="add-fact" name="fact">
17                    <option value="" disabled selected>
18                        <?= I18N::translate('&lt;select&gt;') ?>
19                    </option>
20                    <?php foreach ($add_facts as $fact => $fact_name) : ?>
21                        <option value="<?= $fact ?>"><?= $fact_name ?></option>
22                    <?php endforeach ?>
23                    <?php if ($record::RECORD_TYPE === 'INDI' || $record::RECORD_TYPE === 'FAM') : ?>
24                        <option value="FACT">
25                        <?= I18N::translate('Custom fact') ?>
26                        </option>
27                    <option value="EVEN">
28                        <?= I18N::translate('Custom event') ?>
29                    </option>
30                    <?php endif ?>
31                </select>
32                <div class="input-group-append">
33                    <button class="btn btn-light" type="submit">
34                        <?= /* I18N: A button label. */ I18N::translate('add') ?>
35                    </button>
36                </div>
37            </div>
38        </form>
39
40        <div class="wt-quick-facts">
41            <?php foreach ($quick_facts as $fact) : ?>
42                <a class="btn btn-link btn-sm wt-quick-fact" href="<?= e(route('add-fact', [
43                    'fact' => $fact,
44                    'xref' => $record->xref(),
45                    'ged'  => $tree->name(),
46                ])) ?>">
47                    <?= GedcomTag::getLabel($fact) ?>
48                </a>
49            <?php endforeach ?>
50        </div>
51    </td>
52</tr>
53