xref: /webtrees/resources/views/lists/individuals-table.phtml (revision 0653586aae4099252bab36305fed980feed7ba49)
1dd6b2bfcSGreg Roach<?php
2d70512abSGreg Roach
31b860509SRico Sonntagdeclare(strict_types=1);
41b860509SRico Sonntag
5054771e9SGreg Roachuse Fisharebest\Webtrees\Age;
61b860509SRico Sonntaguse Fisharebest\Webtrees\Auth;
71b860509SRico Sonntaguse Fisharebest\Webtrees\Date;
81b860509SRico Sonntaguse Fisharebest\Webtrees\I18N;
9054771e9SGreg Roachuse Fisharebest\Webtrees\Individual;
1087cca37cSGreg Roachuse Fisharebest\Webtrees\Module\ModuleChartInterface;
111b860509SRico Sonntaguse Fisharebest\Webtrees\Module\ModuleInterface;
121b860509SRico Sonntaguse Fisharebest\Webtrees\Module\RelationshipsChartModule;
13d97083feSGreg Roachuse Fisharebest\Webtrees\Registry;
141b860509SRico Sonntaguse Fisharebest\Webtrees\Services\ModuleService;
15b9597e06SGreg Roachuse Fisharebest\Webtrees\Tree;
161b860509SRico Sonntaguse Fisharebest\Webtrees\View;
17054771e9SGreg Roachuse Illuminate\Support\Collection;
181b860509SRico Sonntag
19b9597e06SGreg Roach/**
2036779af1SGreg Roach * @var Collection<int,Individual> $individuals
21054771e9SGreg Roach * @var bool                       $sosa
22b9597e06SGreg Roach * @var Tree                       $tree
23b9597e06SGreg Roach */
24b9597e06SGreg Roach
25dd6b2bfcSGreg Roach// lists requires a unique ID in case there are multiple lists per page
262e464181SGreg Roach$table_id = Registry::idFactory()->id();
27dd6b2bfcSGreg Roach
28d97083feSGreg Roach$today_jd          = Registry::timestampFactory()->now()->julianDay();
29d97083feSGreg Roach$hundred_years_ago = Registry::timestampFactory()->now()->subtractYears(100)->julianDay();
301b860509SRico Sonntag
31dd6b2bfcSGreg Roach$unique_indis = []; // Don't double-count indis with multiple names.
3284b37362SGreg Roach
33b2a8cedfSGreg Roach$show_estimated_dates = (bool) $tree->getPreference('SHOW_EST_LIST_DATES');
34b2a8cedfSGreg Roach
35054771e9SGreg Roach$today = new Date(strtoupper(date('d M Y')));
36054771e9SGreg Roach
371b860509SRico Sonntag$module = app(ModuleService::class)
3887cca37cSGreg Roach    ->findByComponent(ModuleChartInterface::class, $tree, Auth::user())
390b5fd0a6SGreg Roach    ->first(static function (ModuleInterface $module) {
4090d97cc8SGreg Roach        return $module instanceof RelationshipsChartModule;
4190d97cc8SGreg Roach    });
42dd6b2bfcSGreg Roach?>
43dd6b2bfcSGreg Roach
44dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
45dd6b2bfcSGreg Roach<script>
4632a5dd8dSGreg Roach$("#<?= e($table_id) ?> > .wt-table-individual").dataTable({
47dd6b2bfcSGreg Roach    processing: true,
48dd6b2bfcSGreg Roach    retrieve: true,
49dd6b2bfcSGreg Roach    columns: [
50dd6b2bfcSGreg Roach        /* Given names  */ { type: "text" },
51dd6b2bfcSGreg Roach        /* Surnames     */ { type: "text" },
52728c8c27SGreg Roach        /* SOSA number  */ { type: "num", visible: <?= json_encode($sosa, JSON_THROW_ON_ERROR) ?> },
53dd6b2bfcSGreg Roach        /* Birth date   */ { type: "num" },
54dd6b2bfcSGreg Roach        /* Anniversary  */ { type: "num" },
55dd6b2bfcSGreg Roach        /* Birthplace   */ { type: "text" },
56dd6b2bfcSGreg Roach        /* Children     */ { type: "num" },
57dd6b2bfcSGreg Roach        /* Deate date   */ { type: "num" },
58dd6b2bfcSGreg Roach        /* Anniversary  */ { type: "num" },
59dd6b2bfcSGreg Roach        /* Age          */ { type: "num" },
60dd6b2bfcSGreg Roach        /* Death place  */ { type: "text" },
61728c8c27SGreg Roach        /* Last change  */ { visible: <?= json_encode($tree->getPreference('SHOW_LAST_CHANGE'), JSON_THROW_ON_ERROR) ?> },
62dd6b2bfcSGreg Roach        /* Filter sex   */ { sortable: false },
63dd6b2bfcSGreg Roach        /* Filter birth */ { sortable: false },
64dd6b2bfcSGreg Roach        /* Filter death */ { sortable: false },
65dd6b2bfcSGreg Roach        /* Filter tree  */ { sortable: false }
66dd6b2bfcSGreg Roach    ],
67728c8c27SGreg Roach    sorting: <?= json_encode($sosa ? [[4, 'asc']] : [[1, 'asc']], JSON_THROW_ON_ERROR) ?>
68dd6b2bfcSGreg Roach});
69dd6b2bfcSGreg Roach
70dd6b2bfcSGreg Roach$("#<?= e($table_id) ?>")
71dd6b2bfcSGreg Roach    /* Hide/show parents */
724843b94fSGreg Roach    .on("click", "#btn-toggle-parents", function() {
735e6816beSGreg Roach        $(".wt-individual-list-parents").slideToggle();
74dd6b2bfcSGreg Roach    })
75dd6b2bfcSGreg Roach    /* Hide/show statistics */
764843b94fSGreg Roach    .on("click", "#btn-toggle-statistics", function() {
771b860509SRico Sonntag        $("#individual-charts-<?= e($table_id) ?>").slideToggle({
781b860509SRico Sonntag            complete: function () {
791b860509SRico Sonntag                // Trigger resize to redraw the chart
801b860509SRico Sonntag                $('div[id^="google-chart-"]').resize();
811b860509SRico Sonntag            }
821b860509SRico Sonntag        });
83dd6b2bfcSGreg Roach    })
84dd6b2bfcSGreg Roach    /* Filter buttons in table header */
85604bfd4bSGreg Roach    .on("click", "input[data-filter-column]", function() {
86604bfd4bSGreg Roach        let checkbox = $(this);
871b860509SRico Sonntag
88604bfd4bSGreg Roach        // Deselect other options
893a976702SJonathan Jaubart        let siblings = checkbox.siblings("input[type='checkbox']");
903a976702SJonathan Jaubart        siblings.prop("checked", false).removeAttr("checked");
91604bfd4bSGreg Roach
92604bfd4bSGreg Roach        // Apply (or clear) this filter
93604bfd4bSGreg Roach        let checked = checkbox.prop("checked");
94604bfd4bSGreg Roach        let filter  = checked ? checkbox.data("filter-value") : "";
9532a5dd8dSGreg Roach        let column  = $("#<?= e($table_id) ?> .wt-table-individual").DataTable().column(checkbox.data("filter-column"));
96604bfd4bSGreg Roach        column.search(filter).draw();
97604bfd4bSGreg Roach    });
98dd6b2bfcSGreg Roach</script>
99dd6b2bfcSGreg Roach<?php View::endpush() ?>
100dd6b2bfcSGreg Roach
10132a5dd8dSGreg Roach<div id="<?= e($table_id) ?>">
10232a5dd8dSGreg Roach    <table class="table table-bordered table-sm wt-table-individual"
103b6c326d8SGreg Roach        <?= view('lists/datatables-attributes') ?>
104b6c326d8SGreg Roach    >
105dd6b2bfcSGreg Roach        <thead>
106dd6b2bfcSGreg Roach            <tr>
107dd6b2bfcSGreg Roach                <th colspan="16">
108dd6b2bfcSGreg Roach                    <div class="btn-toolbar d-flex justify-content-between mb-2" role="toolbar">
1093a976702SJonathan Jaubart                        <div class="btn-group btn-group-sm" role="group">
1103a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-sex-M" class="btn-check" type="checkbox" data-filter-column="12" data-filter-value="M" autocomplete="off">
1113a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-sex-M" class="btn btn-outline-secondary" title="<?= I18N::translate('Show only males.') ?>">
11208362db4SGreg Roach                                <?= view('icons/sex', ['sex' => 'M']) ?>
113604bfd4bSGreg Roach                            </label>
1143a976702SJonathan Jaubart
1153a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-sex-F" class="btn-check" type="checkbox" data-filter-column="12" data-filter-value="F" autocomplete="off">
1163a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-sex-F" class="btn btn-outline-secondary" title="<?= I18N::translate('Show only females.') ?>">
11708362db4SGreg Roach                                <?= view('icons/sex', ['sex' => 'F']) ?>
118604bfd4bSGreg Roach                            </label>
1193a976702SJonathan Jaubart
1203a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-sex-U" class="btn-check" type="checkbox" data-filter-column="12" data-filter-value="U" autocomplete="off">
1213a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-sex-U" class="btn btn-outline-secondary" title="<?= I18N::translate('Show only individuals for whom the gender is not known.') ?>">
12208362db4SGreg Roach                                <?= view('icons/sex', ['sex' => 'U']) ?>
123604bfd4bSGreg Roach                            </label>
124dd6b2bfcSGreg Roach                        </div>
125604bfd4bSGreg Roach
1263a976702SJonathan Jaubart                        <div class="btn-group btn-group-sm" role="group">
1273a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-dead-N" class="btn-check" type="checkbox" data-filter-column="14" data-filter-value="N" autocomplete="off">
1283a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-dead-N" class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who are alive or couples where both partners are alive.') ?>">
129dd6b2bfcSGreg Roach                                <?= I18N::translate('Alive') ?>
130604bfd4bSGreg Roach                            </label>
1313a976702SJonathan Jaubart
1323a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-dead-Y" class="btn-check" type="checkbox" data-filter-column="14" data-filter-value="Y" autocomplete="off">
1333a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-dead-Y" class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who are dead or couples where both partners are dead.') ?>">
134dd6b2bfcSGreg Roach                                <?= I18N::translate('Dead') ?>
135604bfd4bSGreg Roach                            </label>
1363a976702SJonathan Jaubart
1373a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-dead-YES" class="btn-check" type="checkbox" data-filter-column="14" data-filter-value="YES" autocomplete="off">
1383a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-dead-YES" class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who died more than 100 years ago.') ?>">
139dd6b2bfcSGreg Roach                                <?= I18N::translate('Death') ?>&gt;100
140604bfd4bSGreg Roach                            </label>
1413a976702SJonathan Jaubart
1423a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-alive-Y100" class="btn-check" type="checkbox" data-filter-column="14" data-filter-value="Y100" autocomplete="off">
1433a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-alive-Y100" class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals who died within the last 100 years.') ?>">
144392561bbSGreg Roach                                <?= I18N::translate('Death') ?>&lt;=100
145604bfd4bSGreg Roach                            </label>
146dd6b2bfcSGreg Roach                        </div>
147604bfd4bSGreg Roach
1483a976702SJonathan Jaubart                        <div class="btn-group btn-group-sm" role="group">
1493a976702SJonathan Jaubart
1503a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-born-YES" class="btn-check" type="checkbox" data-filter-column="13" data-filter-value="YES" autocomplete="off">
1513a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-born-YES" class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals born more than 100 years ago.') ?>">
152dd6b2bfcSGreg Roach                                <?= I18N::translate('Birth') ?>&gt;100
153604bfd4bSGreg Roach                            </label>
1543a976702SJonathan Jaubart
1553a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-born-Y100" class="btn-check" type="checkbox" data-filter-column="13" data-filter-value="Y100" autocomplete="off">
1563a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-born-Y100" class="btn btn-outline-secondary" title="<?= I18N::translate('Show individuals born within the last 100 years.') ?>">
157dd6b2bfcSGreg Roach                                <?= I18N::translate('Birth') ?>&lt;=100
158604bfd4bSGreg Roach                            </label>
159dd6b2bfcSGreg Roach                        </div>
160604bfd4bSGreg Roach
1613a976702SJonathan Jaubart                        <div class="btn-group btn-group-sm" role="group">
1623a976702SJonathan Jaubart
1633a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-roots-R" class="btn-check" type="checkbox" data-filter-column="15" data-filter-value="R" autocomplete="off">
1643a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-roots-R" class="btn btn-outline-secondary" title="<?= I18N::translate('Show “roots” couples or individuals. These individuals may also be called “patriarchs”. They are individuals who have no parents recorded in the database.') ?>">
165dd6b2bfcSGreg Roach                                <?= I18N::translate('Roots') ?>
166604bfd4bSGreg Roach                            </label>
1673a976702SJonathan Jaubart
1683a976702SJonathan Jaubart                            <input id="<?= e($table_id) ?>-bg-roots-L" class="btn-check" type="checkbox" data-filter-column="15" data-filter-value="L" autocomplete="off">
1693a976702SJonathan Jaubart                            <label for="<?= e($table_id) ?>-bg-roots-L" class="btn btn-outline-secondary" title="<?= I18N::translate('Show “leaves” couples or individuals. These are individuals who are alive but have no children recorded in the database.') ?>">
170dd6b2bfcSGreg Roach                                <?= I18N::translate('Leaves') ?>
171604bfd4bSGreg Roach                            </label>
172dd6b2bfcSGreg Roach                        </div>
173dd6b2bfcSGreg Roach                    </div>
174dd6b2bfcSGreg Roach                </th>
175dd6b2bfcSGreg Roach            </tr>
176dd6b2bfcSGreg Roach            <tr>
177dd6b2bfcSGreg Roach                <th><?= I18N::translate('Given names') ?></th>
178dd6b2bfcSGreg Roach                <th><?= I18N::translate('Surname') ?></th>
179dd6b2bfcSGreg Roach                <th><?= /* I18N: Abbreviation for “Sosa-Stradonitz number”. This is an individual’s surname, so may need transliterating into non-latin alphabets. */
180dd6b2bfcSGreg Roach                    I18N::translate('Sosa') ?></th>
181dd6b2bfcSGreg Roach                <th><?= I18N::translate('Birth') ?></th>
182dd6b2bfcSGreg Roach                <th>
183e39fd5c6SGreg Roach                    <span title="<?= I18N::translate('Anniversary') ?>">
184e39fd5c6SGreg Roach                        <?= view('icons/anniversary') ?>
185e39fd5c6SGreg Roach                    </span>
186dd6b2bfcSGreg Roach                </th>
187dd6b2bfcSGreg Roach                <th><?= I18N::translate('Place') ?></th>
188dd6b2bfcSGreg Roach                <th>
189dd6b2bfcSGreg Roach                    <i class="icon-children" title="<?= I18N::translate('Children') ?>"></i>
190dd6b2bfcSGreg Roach                </th>
191dd6b2bfcSGreg Roach                <th><?= I18N::translate('Death') ?></th>
192dd6b2bfcSGreg Roach                <th>
193e39fd5c6SGreg Roach                    <span title="<?= I18N::translate('Anniversary') ?>">
194e39fd5c6SGreg Roach                        <?= view('icons/anniversary') ?>
195e39fd5c6SGreg Roach                    </span>
196dd6b2bfcSGreg Roach                </th>
197dd6b2bfcSGreg Roach                <th><?= I18N::translate('Age') ?></th>
198dd6b2bfcSGreg Roach                <th><?= I18N::translate('Place') ?></th>
199dd6b2bfcSGreg Roach                <th><?= I18N::translate('Last change') ?></th>
200dd6b2bfcSGreg Roach                <th hidden></th>
201dd6b2bfcSGreg Roach                <th hidden></th>
202dd6b2bfcSGreg Roach                <th hidden></th>
203dd6b2bfcSGreg Roach                <th hidden></th>
204dd6b2bfcSGreg Roach            </tr>
205dd6b2bfcSGreg Roach        </thead>
206dd6b2bfcSGreg Roach
207dd6b2bfcSGreg Roach        <tbody>
208dd6b2bfcSGreg Roach            <?php foreach ($individuals as $key => $individual) : ?>
209b16bf9d4SGreg Roach            <tr class="<?= $individual->isPendingAddition() ? 'wt-new' : '' ?> <?= $individual->isPendingDeletion() ? 'wt-old' : '' ?>">
2108fb4e87cSGreg Roach                <td colspan="2" data-sort="<?= e(str_replace([',', Individual::PRAENOMEN_NESCIO, Individual::NOMEN_NESCIO], 'AAAA', implode(',', array_reverse(explode(',', $individual->sortName()))))) ?>">
211dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllNames() as $num => $name) : ?>
2127a821518SGreg Roach                        <a title="<?= $name['type'] === '_MARNM' ? I18N::translate('Married name') :  '' ?>" href="<?= e($individual->url()) ?>" class="<?= $num === $individual->getPrimaryName() ? '' : 'text-muted' ?>">
213dd6b2bfcSGreg Roach                            <?= $name['full'] ?>
214dd6b2bfcSGreg Roach                        </a>
215dd6b2bfcSGreg Roach                        <?php if ($num === $individual->getPrimaryName()) : ?>
21608362db4SGreg Roach                            <small><?= view('icons/sex', ['sex' => $individual->sex()]) ?></small>
217dd6b2bfcSGreg Roach                        <?php endif ?>
218dd6b2bfcSGreg Roach                        <br>
219dd6b2bfcSGreg Roach                    <?php endforeach ?>
2205e6816beSGreg Roach                    <?= view('lists/individual-table-parents', ['individual' => $individual]) ?>
221dd6b2bfcSGreg Roach                </td>
222dd6b2bfcSGreg Roach
2238fb4e87cSGreg Roach                <td hidden data-sort="<?= e(str_replace([',', Individual::PRAENOMEN_NESCIO, Individual::NOMEN_NESCIO], 'AAAA', $individual->sortName())) ?>"></td>
224dd6b2bfcSGreg Roach
225242a7862SGreg Roach                <td class="text-center" data-sort="<?= $key ?>">
226dd6b2bfcSGreg Roach                    <?php if ($sosa) : ?>
22784b37362SGreg Roach                        <?php if ($module instanceof RelationshipsChartModule) : ?>
22884b37362SGreg Roach                            <a href="<?= e($module->chartUrl($individuals[1], ['xref2' => $individual->xref()])) ?>" rel="nofollow" title="<?= I18N::translate('Relationships') ?>" rel="nofollow">
229dd6b2bfcSGreg Roach                                <?= I18N::number($key) ?>
230dd6b2bfcSGreg Roach                            </a>
23184b37362SGreg Roach                        <?php else : ?>
23284b37362SGreg Roach                            <?= I18N::number($key) ?>
23384b37362SGreg Roach                        <?php endif ?>
234dd6b2bfcSGreg Roach                    <?php endif ?>
235dd6b2bfcSGreg Roach                </td>
236dd6b2bfcSGreg Roach
237dd6b2bfcSGreg Roach                <!-- Birth date -->
238054771e9SGreg Roach                <?php $estimated_birth_date = $individual->getEstimatedBirthDate(); ?>
239054771e9SGreg Roach
240054771e9SGreg Roach                <td data-sort="<?= $estimated_birth_date->julianDay() ?>">
241dd6b2bfcSGreg Roach                    <?php $birth_dates = $individual->getAllBirthDates(); ?>
242dd6b2bfcSGreg Roach
243dd6b2bfcSGreg Roach                    <?php foreach ($birth_dates as $n => $birth_date) : ?>
24466ecd017SGreg Roach                        <?= $birth_date->display($tree, null, true) ?>
245dd6b2bfcSGreg Roach                        <br>
246dd6b2bfcSGreg Roach                    <?php endforeach ?>
24714147f6fSGreg Roach
248b2a8cedfSGreg Roach                    <?php if (empty($birth_dates) && $show_estimated_dates) : ?>
24966ecd017SGreg Roach                        <?= $estimated_birth_date->display($tree, null, true) ?>
25014147f6fSGreg Roach                    <?php endif ?>
251dd6b2bfcSGreg Roach                </td>
252dd6b2bfcSGreg Roach
253dd6b2bfcSGreg Roach                <!-- Birth anniversary -->
25453432476SGreg Roach                <td class="text-center" data-sort="<?= - $estimated_birth_date->julianDay() ?>">
25553432476SGreg Roach                    <?= (new Age($birth_dates[0] ?? new Date(''), $today))->ageYearsString() ?>
256dd6b2bfcSGreg Roach                </td>
257dd6b2bfcSGreg Roach
258*0653586aSGreg Roach                <!-- birthplace -->
2598c0ff4ddSGreg Roach                <td data-sort="<?= e($individual->getBirthPlace()->gedcomName()) ?>">
260dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllBirthPlaces() as $n => $birth_place) : ?>
261392561bbSGreg Roach                        <?= $birth_place->shortName(true) ?>
262dd6b2bfcSGreg Roach                        <br>
263dd6b2bfcSGreg Roach                    <?php endforeach ?>
264dd6b2bfcSGreg Roach                </td>
265dd6b2bfcSGreg Roach
266dd6b2bfcSGreg Roach                <!-- Number of children -->
26739ca88baSGreg Roach                <td class="text-center" data-sort="<?= $individual->numberOfChildren() ?>">
26839ca88baSGreg Roach                    <?= I18N::number($individual->numberOfChildren()) ?>
269dd6b2bfcSGreg Roach                </td>
270dd6b2bfcSGreg Roach
271dd6b2bfcSGreg Roach                <!--    Death date -->
272dd6b2bfcSGreg Roach                <?php $death_dates = $individual->getAllDeathDates() ?>
273dd6b2bfcSGreg Roach                <td data-sort="<?= $individual->getEstimatedDeathDate()->julianDay() ?>">
274dd6b2bfcSGreg Roach                    <?php foreach ($death_dates as $num => $death_date) : ?>
27566ecd017SGreg Roach                        <?= $death_date->display($tree, null, true) ?>
276dd6b2bfcSGreg Roach                    <br>
277dd6b2bfcSGreg Roach                    <?php endforeach ?>
27814147f6fSGreg Roach
279b2a8cedfSGreg Roach                    <?php if (empty($death_dates) && $show_estimated_dates && $individual->getEstimatedDeathDate()->minimumDate()->minimumJulianDay() < $today_jd) : ?>
28066ecd017SGreg Roach                        <?= $individual->getEstimatedDeathDate()->display($tree, null, true) ?>
28114147f6fSGreg Roach                    <?php endif ?>
282dd6b2bfcSGreg Roach                </td>
283dd6b2bfcSGreg Roach
284dd6b2bfcSGreg Roach                <!-- Death anniversary -->
28553432476SGreg Roach                <td class="text-center" data-sort="<?= - $individual->getEstimatedDeathDate()->julianDay() ?>">
28653432476SGreg Roach                    <?= (new Age($death_dates[0] ?? new Date(''), $today))->ageYearsString() ?>
287dd6b2bfcSGreg Roach                </td>
288dd6b2bfcSGreg Roach
289dd6b2bfcSGreg Roach                <!-- Age at death -->
29053432476SGreg Roach                <?php $age = new Age($birth_dates[0] ?? new Date(''), $death_dates[0] ?? new Date('')) ?>
29153432476SGreg Roach                <td class="text-center" data-sort="<?= $age->ageDays() ?>">
29253432476SGreg Roach                    <?= $age->ageYearsString() ?>
293dd6b2bfcSGreg Roach                </td>
294dd6b2bfcSGreg Roach
295dd6b2bfcSGreg Roach                <!-- Death place -->
2968c0ff4ddSGreg Roach                <td data-sort="<?= e($individual->getDeathPlace()->gedcomName()) ?>">
297dd6b2bfcSGreg Roach                    <?php foreach ($individual->getAllDeathPlaces() as $n => $death_place) : ?>
298392561bbSGreg Roach                        <?= $death_place->shortName(true) ?>
299dd6b2bfcSGreg Roach                        <br>
300dd6b2bfcSGreg Roach                    <?php endforeach ?>
301dd6b2bfcSGreg Roach                </td>
302dd6b2bfcSGreg Roach
303dd6b2bfcSGreg Roach                <!-- Last change -->
304d97083feSGreg Roach                <td data-sort="<?= $individual->lastChangeTimestamp()->timestamp() ?>">
3054459dc9aSGreg Roach                    <?= view('components/datetime', ['timestamp' => $individual->lastChangeTimestamp()]) ?>
306dd6b2bfcSGreg Roach                </td>
307dd6b2bfcSGreg Roach
308dd6b2bfcSGreg Roach                <!-- Filter by sex -->
309dd6b2bfcSGreg Roach                <td hidden>
31039ca88baSGreg Roach                    <?= $individual->sex() ?>
311dd6b2bfcSGreg Roach                </td>
312dd6b2bfcSGreg Roach
313dd6b2bfcSGreg Roach                <!-- Filter by birth date -->
314dd6b2bfcSGreg Roach                <td hidden>
315054771e9SGreg Roach                    <?php if ($estimated_birth_date->maximumJulianDay() > $hundred_years_ago && $estimated_birth_date->maximumJulianDay() <= $today_jd) : ?>
316dd6b2bfcSGreg Roach                        Y100
317dd6b2bfcSGreg Roach                    <?php else : ?>
318dd6b2bfcSGreg Roach                        YES
319dd6b2bfcSGreg Roach                    <?php endif ?>
320dd6b2bfcSGreg Roach                </td>
321dd6b2bfcSGreg Roach
322dd6b2bfcSGreg Roach                <!-- Filter by death date -->
323dd6b2bfcSGreg Roach                <td hidden>
324b9597e06SGreg Roach                    <?php if ($individual->getEstimatedDeathDate()->maximumJulianDay() > $hundred_years_ago && $individual->getEstimatedDeathDate()->maximumJulianDay() <= $today_jd) : ?>
325dd6b2bfcSGreg Roach                        Y100
326dd6b2bfcSGreg Roach                    <?php elseif ($individual->isDead()) : ?>
327dd6b2bfcSGreg Roach                        YES
328dd6b2bfcSGreg Roach                    <?php else : ?>
329dd6b2bfcSGreg Roach                        N
330dd6b2bfcSGreg Roach                    <?php endif ?>
331dd6b2bfcSGreg Roach                </td>
332dd6b2bfcSGreg Roach
333dd6b2bfcSGreg Roach                <!-- Filter by roots/leaves -->
334dd6b2bfcSGreg Roach                <td hidden>
33508662657SGreg Roach                    <?php if ($individual->childFamilies()->isEmpty()) : ?>
336dd6b2bfcSGreg Roach                        R
33739ca88baSGreg Roach                    <?php elseif (!$individual->isDead() && $individual->numberOfChildren() < 1) : ?>
338dd6b2bfcSGreg Roach                        L
339dd6b2bfcSGreg Roach                    <?php endif ?>
340dd6b2bfcSGreg Roach                </td>
341dd6b2bfcSGreg Roach            </tr>
342dd6b2bfcSGreg Roach
343c0935879SGreg Roach                <?php $unique_indis[$individual->xref()] = true ?>
344dd6b2bfcSGreg Roach            <?php endforeach ?>
345dd6b2bfcSGreg Roach        </tbody>
3467039fd97SGreg Roach
3477039fd97SGreg Roach        <tfoot>
3487039fd97SGreg Roach            <tr>
3497039fd97SGreg Roach                <th colspan="16">
350604bfd4bSGreg Roach                    <div class="btn-group btn-group-sm">
35133df1db6SGreg Roach                        <input type="checkbox" class="btn-check" id="btn-toggle-parents" data-wt-persist="individuals-parents" autocomplete="off">
3522d8276baSGreg Roach                        <label class="btn btn-secondary" for="btn-toggle-parents">
3537039fd97SGreg Roach                            <?= I18N::translate('Show parents') ?>
3542d8276baSGreg Roach                        </label>
3557039fd97SGreg Roach                    </div>
3567039fd97SGreg Roach                </th>
3577039fd97SGreg Roach            </tr>
3587039fd97SGreg Roach        </tfoot>
359dd6b2bfcSGreg Roach    </table>
3601b860509SRico Sonntag</div>
361dd6b2bfcSGreg Roach
362