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