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