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