xref: /webtrees/resources/views/edit/add-fact-row.phtml (revision 81443e3cbe4eef5ccdcf8dae716a7e35f7417b60)
12917771cSGreg Roach<?php
22917771cSGreg Roach
3d096182fSGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
42917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
52917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact;
62917771cSGreg Roachuse Fisharebest\Webtrees\I18N;
72917771cSGreg Roach
8d096182fSGreg Roach/**
9d096182fSGreg Roach * @var array<string,string> $add_facts
10d096182fSGreg Roach * @var array<string,string> $quick_facts
11d096182fSGreg Roach * @var GedcomRecord         $record
12d096182fSGreg Roach */
13d096182fSGreg Roach
142917771cSGreg Roach?>
15c0dc1dc8SGreg Roach
16c0dc1dc8SGreg Roach<tr>
17c0dc1dc8SGreg Roach    <th scope="row">
18b906b74eSGreg Roach        <label for="add-fact">
190f5fd22fSGreg Roach            <?= I18N::translate('Add a fact') ?>
20b906b74eSGreg Roach        </label>
21c0dc1dc8SGreg Roach    </th>
22c0dc1dc8SGreg Roach    <td>
230f5fd22fSGreg Roach        <?php if ($add_facts !== []) : ?>
242917771cSGreg Roach            <form method="post" action="<?= e(route(SelectNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" onsubmit="if ($('#add-fact').val() === null) {event.preventDefault();}">
25c0dc1dc8SGreg Roach                <div class="input-group">
264b9213b3SGreg Roach                    <select class="form-select" id="add-fact" name="fact">
27c0dc1dc8SGreg Roach                        <option value="" disabled selected>
28c0dc1dc8SGreg Roach                            <?= I18N::translate('&lt;select&gt;') ?>
29c0dc1dc8SGreg Roach                        </option>
300f5fd22fSGreg Roach                        <?php foreach ($add_facts as $fact => $label) : ?>
310f5fd22fSGreg Roach                            <option value="<?= $fact ?>"><?= $label ?></option>
32c0dc1dc8SGreg Roach                        <?php endforeach ?>
33c0dc1dc8SGreg Roach                    </select>
340f5fd22fSGreg Roach
35c293a652SGreg Roach                    <button class="btn btn-primary" type="submit">
36c0dc1dc8SGreg Roach                        <?= /* I18N: A button label. */ I18N::translate('add') ?>
37c0dc1dc8SGreg Roach                    </button>
38c0dc1dc8SGreg Roach                </div>
39*81443e3cSGreg Roach
40*81443e3cSGreg Roach                <?= csrf_field() ?>
41c0dc1dc8SGreg Roach            </form>
420f5fd22fSGreg Roach        <?php endif ?>
43c0dc1dc8SGreg Roach
44c0dc1dc8SGreg Roach        <div class="wt-quick-facts">
450f5fd22fSGreg Roach            <?php foreach ($quick_facts as $fact => $label) : ?>
460f5fd22fSGreg Roach                <a class="btn btn-link wt-quick-fact" href="<?= e(route(AddNewFact::class, [
47c0dc1dc8SGreg Roach                    'fact' => $fact,
48c0dc1dc8SGreg Roach                    'xref' => $record->xref(),
497c2c99faSGreg Roach                    'tree' => $record->tree()->name(),
50c0dc1dc8SGreg Roach                ])) ?>">
510f5fd22fSGreg Roach                    <?= $label ?>
52c0dc1dc8SGreg Roach                </a>
53c0dc1dc8SGreg Roach            <?php endforeach ?>
54c0dc1dc8SGreg Roach        </div>
55c0dc1dc8SGreg Roach    </td>
56c0dc1dc8SGreg Roach</tr>
57