xref: /webtrees/resources/views/modules/sources_tab/tab.phtml (revision 9d627a9e6c00d03faa5d6a39e801ab0bb6f45d6d)
1<?php use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3<?php use Fisharebest\Webtrees\View; ?>
4
5<div class="wt-tab-sources py-4">
6    <table class="table wt-facts-table">
7        <tr>
8            <td colspan="2">
9                <label>
10                    <input id="show-level-2-sources" type="checkbox" data-toggle="collapse" data-target=".wt-level-two-source">
11                    <?= I18N::translate('Show all sources') ?>
12                </label>
13            </td>
14        </tr>
15
16        <?php foreach ($facts as $fact) : ?>
17            <?php FunctionsPrintFacts::printMainSources($fact, 1) ?>
18            <?php FunctionsPrintFacts::printMainSources($fact, 2) ?>
19        <?php endforeach ?>
20
21        <?php if (empty($facts)) : ?>
22            <tr>
23                <td colspan="2">
24                    <?= I18N::translate('There are no source citations for this individual.') ?>
25                    </td>
26            </tr>
27        <?php endif ?>
28
29        <?php if ($can_edit) : ?>
30            <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?>
31
32            <tr>
33                <th scope="row">
34                    <?= I18N::translate('Source') ?>
35                </th>
36                <td>
37                    <a href="<?= e(route('add-fact', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'SOUR'])) ?>">
38                        <?= I18N::translate('Add a source citation') ?>
39                    </a>
40                </td>
41            </tr>
42        <?php endif ?>
43    </table>
44</div>
45
46<?php View::push('javascript') ?>
47<script>
48  'use strict';
49
50  persistent_toggle("show-level-2-sources");
51</script>
52<?php View::endpush() ?>
53