xref: /webtrees/resources/views/edit/add-fact-row.phtml (revision d096182f738fe85f4cf7242cfdfc13bf18579ef0)
12917771cSGreg Roach<?php
22917771cSGreg Roach
3ac107fcfSGreg Roachuse Fisharebest\Webtrees\Family;
4*d096182fSGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
52917771cSGreg Roachuse Fisharebest\Webtrees\GedcomTag;
62917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
72917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact;
82917771cSGreg Roachuse Fisharebest\Webtrees\I18N;
9ac107fcfSGreg Roachuse Fisharebest\Webtrees\Individual;
102917771cSGreg Roach
11*d096182fSGreg Roach/**
12*d096182fSGreg Roach * @var array<string,string> $add_facts
13*d096182fSGreg Roach * @var array<string,string> $quick_facts
14*d096182fSGreg Roach * @var GedcomRecord         $record
15*d096182fSGreg Roach */
16*d096182fSGreg Roach
172917771cSGreg Roach?>
18c0dc1dc8SGreg Roach
19c0dc1dc8SGreg Roach<tr>
20c0dc1dc8SGreg Roach    <th scope="row">
21b906b74eSGreg Roach        <label for="add-fact">
22c0dc1dc8SGreg Roach            <?= I18N::translate('Fact or event') ?>
23b906b74eSGreg Roach        </label>
24c0dc1dc8SGreg Roach    </th>
25c0dc1dc8SGreg Roach    <td>
262917771cSGreg Roach        <form method="post" action="<?= e(route(SelectNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" onsubmit="if ($('#add-fact').val() === null) {event.preventDefault();}">
272917771cSGreg Roach            <?= csrf_field() ?>
282917771cSGreg Roach
29c0dc1dc8SGreg Roach            <div class="input-group">
30b906b74eSGreg Roach                <select class="custom-select" id="add-fact" name="fact">
31c0dc1dc8SGreg Roach                    <option value="" disabled selected>
32c0dc1dc8SGreg Roach                        <?= I18N::translate('&lt;select&gt;') ?>
33c0dc1dc8SGreg Roach                    </option>
34c0dc1dc8SGreg Roach                    <?php foreach ($add_facts as $fact => $fact_name) : ?>
35c0dc1dc8SGreg Roach                        <option value="<?= $fact ?>"><?= $fact_name ?></option>
36c0dc1dc8SGreg Roach                    <?php endforeach ?>
37ac107fcfSGreg Roach                    <?php if ($record::RECORD_TYPE === Individual::RECORD_TYPE || $record::RECORD_TYPE === Family::RECORD_TYPE) : ?>
38c0dc1dc8SGreg Roach                        <option value="FACT">
39c0dc1dc8SGreg Roach                        <?= I18N::translate('Custom fact') ?>
40c0dc1dc8SGreg Roach                        </option>
41c0dc1dc8SGreg Roach                    <option value="EVEN">
42c0dc1dc8SGreg Roach                        <?= I18N::translate('Custom event') ?>
43c0dc1dc8SGreg Roach                    </option>
44c0dc1dc8SGreg Roach                    <?php endif ?>
45c0dc1dc8SGreg Roach                </select>
46c0dc1dc8SGreg Roach                <div class="input-group-append">
47c0dc1dc8SGreg Roach                    <button class="btn btn-light" type="submit">
48c0dc1dc8SGreg Roach                        <?= /* I18N: A button label. */ I18N::translate('add') ?>
49c0dc1dc8SGreg Roach                    </button>
50c0dc1dc8SGreg Roach                </div>
51c0dc1dc8SGreg Roach            </div>
52c0dc1dc8SGreg Roach        </form>
53c0dc1dc8SGreg Roach
54c0dc1dc8SGreg Roach        <div class="wt-quick-facts">
55c0dc1dc8SGreg Roach            <?php foreach ($quick_facts as $fact) : ?>
562917771cSGreg Roach                <a class="btn btn-link btn-sm wt-quick-fact" href="<?= e(route(AddNewFact::class, [
57c0dc1dc8SGreg Roach                    'fact' => $fact,
58c0dc1dc8SGreg Roach                    'xref' => $record->xref(),
599022ab66SGreg Roach                    'tree' => $tree->name(),
60c0dc1dc8SGreg Roach                ])) ?>">
61*d096182fSGreg Roach                    <?= GedcomTag::getLabel($record::RECORD_TYPE . ':' . $fact) ?>
62c0dc1dc8SGreg Roach                </a>
63c0dc1dc8SGreg Roach            <?php endforeach ?>
64c0dc1dc8SGreg Roach        </div>
65c0dc1dc8SGreg Roach    </td>
66c0dc1dc8SGreg Roach</tr>
67