xref: /webtrees/resources/views/edit/add-fact-row.phtml (revision ac107fcfa25ff40aa9e3e8ade403ba46ab641242)
12917771cSGreg Roach<?php
22917771cSGreg Roach
3*ac107fcfSGreg Roachuse Fisharebest\Webtrees\Family;
42917771cSGreg Roachuse Fisharebest\Webtrees\GedcomTag;
52917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
62917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact;
72917771cSGreg Roachuse Fisharebest\Webtrees\I18N;
8*ac107fcfSGreg Roachuse Fisharebest\Webtrees\Individual;
92917771cSGreg Roach
102917771cSGreg Roach?>
11c0dc1dc8SGreg Roach
12c0dc1dc8SGreg Roach<tr>
13c0dc1dc8SGreg Roach    <th scope="row">
14b906b74eSGreg Roach        <label for="add-fact">
15c0dc1dc8SGreg Roach            <?= I18N::translate('Fact or event') ?>
16b906b74eSGreg Roach        </label>
17c0dc1dc8SGreg Roach    </th>
18c0dc1dc8SGreg Roach    <td>
192917771cSGreg Roach        <form method="post" action="<?= e(route(SelectNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" onsubmit="if ($('#add-fact').val() === null) {event.preventDefault();}">
202917771cSGreg Roach            <?= csrf_field() ?>
212917771cSGreg Roach
22c0dc1dc8SGreg Roach            <div class="input-group">
23b906b74eSGreg Roach                <select class="custom-select" id="add-fact" name="fact">
24c0dc1dc8SGreg Roach                    <option value="" disabled selected>
25c0dc1dc8SGreg Roach                        <?= I18N::translate('&lt;select&gt;') ?>
26c0dc1dc8SGreg Roach                    </option>
27c0dc1dc8SGreg Roach                    <?php foreach ($add_facts as $fact => $fact_name) : ?>
28c0dc1dc8SGreg Roach                        <option value="<?= $fact ?>"><?= $fact_name ?></option>
29c0dc1dc8SGreg Roach                    <?php endforeach ?>
30*ac107fcfSGreg Roach                    <?php if ($record::RECORD_TYPE === Individual::RECORD_TYPE || $record::RECORD_TYPE === Family::RECORD_TYPE) : ?>
31c0dc1dc8SGreg Roach                        <option value="FACT">
32c0dc1dc8SGreg Roach                        <?= I18N::translate('Custom fact') ?>
33c0dc1dc8SGreg Roach                        </option>
34c0dc1dc8SGreg Roach                    <option value="EVEN">
35c0dc1dc8SGreg Roach                        <?= I18N::translate('Custom event') ?>
36c0dc1dc8SGreg Roach                    </option>
37c0dc1dc8SGreg Roach                    <?php endif ?>
38c0dc1dc8SGreg Roach                </select>
39c0dc1dc8SGreg Roach                <div class="input-group-append">
40c0dc1dc8SGreg Roach                    <button class="btn btn-light" type="submit">
41c0dc1dc8SGreg Roach                        <?= /* I18N: A button label. */ I18N::translate('add') ?>
42c0dc1dc8SGreg Roach                    </button>
43c0dc1dc8SGreg Roach                </div>
44c0dc1dc8SGreg Roach            </div>
45c0dc1dc8SGreg Roach        </form>
46c0dc1dc8SGreg Roach
47c0dc1dc8SGreg Roach        <div class="wt-quick-facts">
48c0dc1dc8SGreg Roach            <?php foreach ($quick_facts as $fact) : ?>
492917771cSGreg Roach                <a class="btn btn-link btn-sm wt-quick-fact" href="<?= e(route(AddNewFact::class, [
50c0dc1dc8SGreg Roach                    'fact' => $fact,
51c0dc1dc8SGreg Roach                    'xref' => $record->xref(),
529022ab66SGreg Roach                    'tree' => $tree->name(),
53c0dc1dc8SGreg Roach                ])) ?>">
54c0dc1dc8SGreg Roach                    <?= GedcomTag::getLabel($fact) ?>
55c0dc1dc8SGreg Roach                </a>
56c0dc1dc8SGreg Roach            <?php endforeach ?>
57c0dc1dc8SGreg Roach        </div>
58c0dc1dc8SGreg Roach    </td>
59c0dc1dc8SGreg Roach</tr>
60