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