xref: /webtrees/resources/views/modules/sources_tab/tab.phtml (revision c8d78f19d0bdf4c0ec4728253bd37250d2e6cec4)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
5use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Individual;
8use Illuminate\Support\Collection;
9
10/**
11 * @var bool             $can_edit
12 * @var Collection<Fact> $clipboard_facts
13 * @var Collection<Fact> $facts
14 * @var Individual       $individual
15 */
16
17?>
18
19<div class="wt-tab-sources py-4">
20    <table class="table wt-facts-table">
21        <tr>
22            <td colspan="2">
23                <label>
24                    <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">
25                    <?= I18N::translate('Show all sources') ?>
26                </label>
27            </td>
28        </tr>
29
30        <?php foreach ($facts as $fact) : ?>
31            <?php FunctionsPrintFacts::printMainSources($fact, 1) ?>
32            <?php FunctionsPrintFacts::printMainSources($fact, 2) ?>
33        <?php endforeach ?>
34
35        <?php if ($facts->isEmpty()) : ?>
36            <tr>
37                <td colspan="2">
38                    <?= I18N::translate('There are no source citations for this individual.') ?>
39                    </td>
40            </tr>
41        <?php endif ?>
42
43        <?php if ($can_edit) : ?>
44            <tr>
45                <th scope="row">
46                    <?= I18N::translate('Source') ?>
47                </th>
48                <td>
49                    <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'SOUR'])) ?>">
50                        <?= I18N::translate('Add a source citation') ?>
51                    </a>
52                </td>
53            </tr>
54        <?php endif ?>
55    </table>
56</div>
57