xref: /webtrees/resources/views/modules/yahrzeit/list.phtml (revision 4a9a60957058ca2a34e30a0d6f783e1540606590)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\View;
7use Illuminate\Support\Collection;
8
9/**
10 * @var int                    $id
11 * @var int                    $limit_low
12 * @var int                    $limit_high
13 * @var Collection<int,object> $yahrzeits
14 */
15
16?>
17
18<?php foreach ($yahrzeits as $n => $yahrzeit) : ?>
19    <?php if ($n === $limit_low && $yahrzeits->count() > $limit_high) : ?>
20        <div>
21            <button class="btn btn-sm btn-secondary" id="show-more-<?= e($id) ?>">
22                <?= view('icons/add') ?>
23                <?= /* I18N: button label */ I18N::translate('show more') ?>
24            </button>
25        </div>
26
27        <?php View::push('javascript') ?>
28        <script>
29            document.getElementById("show-more-<?= e($id) ?>").addEventListener("click", function (ev) {
30                document.querySelectorAll("#block-<?= e($id) ?> .d-none").forEach(function (el) {
31                    el.classList.remove("d-none");
32                });
33                ev.target.parentNode.removeChild(ev.target);
34            });
35        </script>
36        <?php View::endpush() ?>
37    <?php endif ?>
38
39    <div class="<?= $n >= $limit_low && $yahrzeits->count() > $limit_high ? 'd-none' : '' ?>">
40        <a href="<?= e($yahrzeit->individual->url()) ?>" class="list_item">
41            <?= $yahrzeit->individual->fullName() ?>
42        </a>
43        <small><?= view('icons/sex', ['sex' => $yahrzeit->individual->sex()]) ?></small>
44        <div class="indent">
45            <?= $yahrzeit->fact->date()->display($yahrzeit->individual->tree()) ?>,
46            <?= $yahrzeit->yahrzeit_date->display($yahrzeit->individual->tree()) ?>,
47            <?= I18N::translate('%s year anniversary', $yahrzeit->fact->anniv) ?>
48        </div>
49    </div>
50<?php endforeach ?>
51