12917771cSGreg Roach<?php 22917771cSGreg Roach 37c2c99faSGreg Roachuse Fisharebest\Webtrees\Fact; 42917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; 52917771cSGreg Roachuse Fisharebest\Webtrees\I18N; 67c2c99faSGreg Roachuse Fisharebest\Webtrees\Individual; 77c2c99faSGreg Roachuse Illuminate\Support\Collection; 87c2c99faSGreg Roach 97c2c99faSGreg Roach/** 107c2c99faSGreg Roach * @var bool $can_edit 117c2c99faSGreg Roach * @var Collection<Fact> $clipboard_facts 127c2c99faSGreg Roach * @var Collection<Fact> $facts 137c2c99faSGreg Roach * @var Individual $individual 147c2c99faSGreg Roach */ 152917771cSGreg Roach 162917771cSGreg Roach?> 17dd6b2bfcSGreg Roach 184a2590a5SGreg Roach<div class="wt-tab-sources py-4"> 19dd6b2bfcSGreg Roach <table class="table wt-facts-table"> 20dd6b2bfcSGreg Roach <tr> 21dd6b2bfcSGreg Roach <td colspan="2"> 22dd6b2bfcSGreg Roach <label> 232d8276baSGreg Roach <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"> 24dd6b2bfcSGreg Roach <?= I18N::translate('Show all sources') ?> 25dd6b2bfcSGreg Roach </label> 26dd6b2bfcSGreg Roach </td> 27dd6b2bfcSGreg Roach </tr> 28dd6b2bfcSGreg Roach 29dd6b2bfcSGreg Roach <?php foreach ($facts as $fact) : ?> 30*b315f3e1SGreg Roach <?php if (str_ends_with($fact->tag(), ':SOUR')) : ?> 31*b315f3e1SGreg Roach <?= view('fact', ['fact' => $fact, 'record' => $individual]) ?> 32*b315f3e1SGreg Roach <?php else : ?> 33*b315f3e1SGreg Roach <?php 34*b315f3e1SGreg Roach if ($fact->isPendingAddition()) { 35*b315f3e1SGreg Roach $styleadd = 'wt-new '; 36*b315f3e1SGreg Roach } elseif ($fact->isPendingDeletion()) { 37*b315f3e1SGreg Roach $styleadd = 'wt-old '; 38*b315f3e1SGreg Roach } else { 39*b315f3e1SGreg Roach $styleadd = ''; 40*b315f3e1SGreg Roach } 41*b315f3e1SGreg Roach ?> 42*b315f3e1SGreg Roach 43*b315f3e1SGreg Roach <tr class="wt-level-two-source collapse"> 44*b315f3e1SGreg Roach <th scope="row" class="rela <?= $styleadd ?>"> 45*b315f3e1SGreg Roach <?= $fact->label() ?> 46*b315f3e1SGreg Roach <?= view('fact-edit-links', ['fact' => $fact, 'url' => $fact->record()->url() . '#tab-sources']) ?> 47*b315f3e1SGreg Roach </th> 48*b315f3e1SGreg Roach 49*b315f3e1SGreg Roach <td class="<?= $styleadd ?>"> 50*b315f3e1SGreg Roach <?php if (preg_match_all('/\n(2 SOUR\b.*(?:\n[^2].*)*)/', $fact->gedcom(), $matches, PREG_SET_ORDER) > 0) : ?> 51*b315f3e1SGreg Roach <?php foreach($matches as $match) : ?> 52*b315f3e1SGreg Roach <?= view('fact-gedcom-fields', ['gedcom' => $match[1], 'parent' => $fact->tag(), 'tree' => $fact->record()->tree()]) ?> 53*b315f3e1SGreg Roach <?php endforeach ?> 54*b315f3e1SGreg Roach <?php endif ?> 55*b315f3e1SGreg Roach </td> 56*b315f3e1SGreg Roach </tr> 57*b315f3e1SGreg Roach <?php endif ?> 58dd6b2bfcSGreg Roach <?php endforeach ?> 59dd6b2bfcSGreg Roach 6054c1ab5eSGreg Roach <?php if ($facts->isEmpty()) : ?> 61dd6b2bfcSGreg Roach <tr> 62dd6b2bfcSGreg Roach <td colspan="2"> 63dd6b2bfcSGreg Roach <?= I18N::translate('There are no source citations for this individual.') ?> 64dd6b2bfcSGreg Roach </td> 65dd6b2bfcSGreg Roach </tr> 66dd6b2bfcSGreg Roach <?php endif ?> 67dd6b2bfcSGreg Roach 68dd6b2bfcSGreg Roach <?php if ($can_edit) : ?> 69dd6b2bfcSGreg Roach <tr> 70dd6b2bfcSGreg Roach <th scope="row"> 71dd6b2bfcSGreg Roach <?= I18N::translate('Source') ?> 72dd6b2bfcSGreg Roach </th> 73dd6b2bfcSGreg Roach <td> 742917771cSGreg Roach <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'SOUR'])) ?>"> 75dd6b2bfcSGreg Roach <?= I18N::translate('Add a source citation') ?> 76dd6b2bfcSGreg Roach </a> 77dd6b2bfcSGreg Roach </td> 78dd6b2bfcSGreg Roach </tr> 79dd6b2bfcSGreg Roach <?php endif ?> 80dd6b2bfcSGreg Roach </table> 81dd6b2bfcSGreg Roach</div> 82