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();}"> 252917771cSGreg Roach <?= csrf_field() ?> 262917771cSGreg Roach 27c0dc1dc8SGreg Roach <div class="input-group"> 28*c293a652SGreg Roach <select class="form-control" 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 37*c293a652SGreg Roach <button class="btn btn-primary" type="submit"> 38c0dc1dc8SGreg Roach <?= /* I18N: A button label. */ I18N::translate('add') ?> 39c0dc1dc8SGreg Roach </button> 40c0dc1dc8SGreg Roach </div> 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