12917771cSGreg Roach<?php 22917771cSGreg Roach 3*10e06497SGreg Roachdeclare(strict_types=1); 4*10e06497SGreg Roach 5d096182fSGreg Roachuse Fisharebest\Webtrees\GedcomRecord; 62917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; 72917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SelectNewFact; 82917771cSGreg Roachuse Fisharebest\Webtrees\I18N; 92917771cSGreg Roach 10d096182fSGreg Roach/** 11d096182fSGreg Roach * @var array<string,string> $add_facts 12d096182fSGreg Roach * @var array<string,string> $quick_facts 13d096182fSGreg Roach * @var GedcomRecord $record 14d096182fSGreg Roach */ 15d096182fSGreg Roach 162917771cSGreg Roach?> 17c0dc1dc8SGreg Roach 18c0dc1dc8SGreg Roach<tr> 19c0dc1dc8SGreg Roach <th scope="row"> 20b906b74eSGreg Roach <label for="add-fact"> 210f5fd22fSGreg Roach <?= I18N::translate('Add a fact') ?> 22b906b74eSGreg Roach </label> 23c0dc1dc8SGreg Roach </th> 24c0dc1dc8SGreg Roach <td> 250f5fd22fSGreg Roach <?php if ($add_facts !== []) : ?> 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();}"> 27c0dc1dc8SGreg Roach <div class="input-group"> 284b9213b3SGreg Roach <select class="form-select" id="add-fact" name="fact"> 29c0dc1dc8SGreg Roach <option value="" disabled selected> 30c0dc1dc8SGreg Roach <?= I18N::translate('<select>') ?> 31c0dc1dc8SGreg Roach </option> 320f5fd22fSGreg Roach <?php foreach ($add_facts as $fact => $label) : ?> 330f5fd22fSGreg Roach <option value="<?= $fact ?>"><?= $label ?></option> 34c0dc1dc8SGreg Roach <?php endforeach ?> 35c0dc1dc8SGreg Roach </select> 360f5fd22fSGreg Roach 37c293a652SGreg Roach <button class="btn btn-primary" type="submit"> 38c0dc1dc8SGreg Roach <?= /* I18N: A button label. */ I18N::translate('add') ?> 39c0dc1dc8SGreg Roach </button> 40c0dc1dc8SGreg Roach </div> 4181443e3cSGreg Roach 4281443e3cSGreg Roach <?= csrf_field() ?> 43c0dc1dc8SGreg Roach </form> 440f5fd22fSGreg Roach <?php endif ?> 45c0dc1dc8SGreg Roach 46c0dc1dc8SGreg Roach <div class="wt-quick-facts"> 470f5fd22fSGreg Roach <?php foreach ($quick_facts as $fact => $label) : ?> 480f5fd22fSGreg Roach <a class="btn btn-link wt-quick-fact" href="<?= e(route(AddNewFact::class, [ 49c0dc1dc8SGreg Roach 'fact' => $fact, 50c0dc1dc8SGreg Roach 'xref' => $record->xref(), 517c2c99faSGreg Roach 'tree' => $record->tree()->name(), 52c0dc1dc8SGreg Roach ])) ?>"> 530f5fd22fSGreg Roach <?= $label ?> 54c0dc1dc8SGreg Roach </a> 55c0dc1dc8SGreg Roach <?php endforeach ?> 56c0dc1dc8SGreg Roach </div> 57c0dc1dc8SGreg Roach </td> 58c0dc1dc8SGreg Roach</tr> 59