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