12917771cSGreg Roach<?php 22917771cSGreg Roach 310e06497SGreg Roachdeclare(strict_types=1); 410e06497SGreg Roach 57c2c99faSGreg Roachuse Fisharebest\Webtrees\Fact; 62917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; 72917771cSGreg Roachuse Fisharebest\Webtrees\I18N; 87c2c99faSGreg Roachuse Fisharebest\Webtrees\Individual; 97c2c99faSGreg Roachuse Illuminate\Support\Collection; 107c2c99faSGreg Roach 117c2c99faSGreg Roach/** 127c2c99faSGreg Roach * @var bool $can_edit 1336779af1SGreg Roach * @var Collection<int,Fact> $clipboard_facts 1436779af1SGreg Roach * @var Collection<int,Fact> $facts 157c2c99faSGreg Roach * @var Individual $individual 167c2c99faSGreg Roach */ 172917771cSGreg Roach 182917771cSGreg Roach?> 19dd6b2bfcSGreg Roach 20*4e54fb47SGreg Roach<div class="wt-tab-sources"> 21dd6b2bfcSGreg Roach <table class="table wt-facts-table"> 22dd6b2bfcSGreg Roach <tr> 23dd6b2bfcSGreg Roach <td colspan="2"> 24dd6b2bfcSGreg Roach <label> 250363a7fdSDavid Drury <input id="show-level-2-sources" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-level-two-source" data-wt-persist="level-two-sources" autocomplete="off"> 26dd6b2bfcSGreg Roach <?= I18N::translate('Show all sources') ?> 27dd6b2bfcSGreg Roach </label> 28dd6b2bfcSGreg Roach </td> 29dd6b2bfcSGreg Roach </tr> 30dd6b2bfcSGreg Roach 31dd6b2bfcSGreg Roach <?php foreach ($facts as $fact) : ?> 32b315f3e1SGreg Roach <?php if (str_ends_with($fact->tag(), ':SOUR')) : ?> 33b315f3e1SGreg Roach <?= view('fact', ['fact' => $fact, 'record' => $individual]) ?> 34b315f3e1SGreg Roach <?php else : ?> 35b315f3e1SGreg Roach <?php 36b315f3e1SGreg Roach if ($fact->isPendingAddition()) { 37b315f3e1SGreg Roach $styleadd = 'wt-new '; 38b315f3e1SGreg Roach } elseif ($fact->isPendingDeletion()) { 39b315f3e1SGreg Roach $styleadd = 'wt-old '; 40b315f3e1SGreg Roach } else { 41b315f3e1SGreg Roach $styleadd = ''; 42b315f3e1SGreg Roach } 43b315f3e1SGreg Roach ?> 44b315f3e1SGreg Roach 45b315f3e1SGreg Roach <tr class="wt-level-two-source collapse"> 46b315f3e1SGreg Roach <th scope="row" class="rela <?= $styleadd ?>"> 47b315f3e1SGreg Roach <?= $fact->label() ?> 48b315f3e1SGreg Roach <?= view('fact-edit-links', ['fact' => $fact, 'url' => $fact->record()->url() . '#tab-sources']) ?> 49b315f3e1SGreg Roach </th> 50b315f3e1SGreg Roach 51b315f3e1SGreg Roach <td class="<?= $styleadd ?>"> 52b315f3e1SGreg Roach <?php if (preg_match_all('/\n(2 SOUR\b.*(?:\n[^2].*)*)/', $fact->gedcom(), $matches, PREG_SET_ORDER) > 0) : ?> 53b315f3e1SGreg Roach <?php foreach ($matches as $match) : ?> 54b315f3e1SGreg Roach <?= view('fact-gedcom-fields', ['gedcom' => $match[1], 'parent' => $fact->tag(), 'tree' => $fact->record()->tree()]) ?> 55b315f3e1SGreg Roach <?php endforeach ?> 56b315f3e1SGreg Roach <?php endif ?> 57b315f3e1SGreg Roach </td> 58b315f3e1SGreg Roach </tr> 59b315f3e1SGreg Roach <?php endif ?> 60dd6b2bfcSGreg Roach <?php endforeach ?> 61dd6b2bfcSGreg Roach 6254c1ab5eSGreg Roach <?php if ($facts->isEmpty()) : ?> 63dd6b2bfcSGreg Roach <tr> 64dd6b2bfcSGreg Roach <td colspan="2"> 65dd6b2bfcSGreg Roach <?= I18N::translate('There are no source citations for this individual.') ?> 66dd6b2bfcSGreg Roach </td> 67dd6b2bfcSGreg Roach </tr> 68dd6b2bfcSGreg Roach <?php endif ?> 69dd6b2bfcSGreg Roach 70dd6b2bfcSGreg Roach <?php if ($can_edit) : ?> 71dd6b2bfcSGreg Roach <tr> 72dd6b2bfcSGreg Roach <th scope="row"> 73dd6b2bfcSGreg Roach <?= I18N::translate('Source') ?> 74dd6b2bfcSGreg Roach </th> 75dd6b2bfcSGreg Roach <td> 762917771cSGreg Roach <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'SOUR'])) ?>"> 77dd6b2bfcSGreg Roach <?= I18N::translate('Add a source citation') ?> 78dd6b2bfcSGreg Roach </a> 79dd6b2bfcSGreg Roach </td> 80dd6b2bfcSGreg Roach </tr> 81dd6b2bfcSGreg Roach <?php endif ?> 82dd6b2bfcSGreg Roach </table> 83dd6b2bfcSGreg Roach</div> 84