xref: /webtrees/resources/views/search-results.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
5dc270d8cSGreg Roachuse Fisharebest\Webtrees\Family;
6d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
7dc270d8cSGreg Roachuse Fisharebest\Webtrees\Individual;
8058ba724SGreg Roachuse Fisharebest\Webtrees\Location;
9dc270d8cSGreg Roachuse Fisharebest\Webtrees\Note;
10dc270d8cSGreg Roachuse Fisharebest\Webtrees\Repository;
11dc270d8cSGreg Roachuse Fisharebest\Webtrees\Source;
12dc270d8cSGreg Roachuse Fisharebest\Webtrees\Tree;
13dc270d8cSGreg Roachuse Fisharebest\Webtrees\View;
14dc270d8cSGreg Roachuse Illuminate\Support\Collection;
15dc270d8cSGreg Roach
16dc270d8cSGreg Roach/**
1736779af1SGreg Roach * @var Collection<int,Family>     $families
1836779af1SGreg Roach * @var Collection<int,Individual> $individuals
1936779af1SGreg Roach * @var Collection<int,Location>   $locations
2036779af1SGreg Roach * @var Collection<int,Note>       $notes
2136779af1SGreg Roach * @var Collection<int,Repository> $repositories
2236779af1SGreg Roach * @var Collection<int,Source>     $sources
23dc270d8cSGreg Roach * @var bool                       $search_families
24dc270d8cSGreg Roach * @var bool                       $search_individuals
25058ba724SGreg Roach * @var bool                       $search_locations
26dc270d8cSGreg Roach * @var bool                       $search_notes
27dc270d8cSGreg Roach * @var bool                       $search_repositories
28dc270d8cSGreg Roach * @var bool                       $search_sources
29dc270d8cSGreg Roach * @var Tree                       $tree
30dc270d8cSGreg Roach */
31d70512abSGreg Roach
32d70512abSGreg Roach?>
33dd6b2bfcSGreg Roach
34dd6b2bfcSGreg Roach<div class="wt-search-results">
35dd6b2bfcSGreg Roach    <ul class="nav nav-tabs wt-search-results-tabs" role="tablist">
36dd6b2bfcSGreg Roach        <?php if ($search_individuals) : ?>
376a4003b9SGreg Roach            <li class="nav-item" role="presentation">
38a6b8f374SGreg Roach                <button class="nav-link <?= $individuals->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#individuals" data-bs-toggle="tab" href="#individuals" role="tab" aria-controls="individuals">
39dd6b2bfcSGreg Roach                    <?= I18N::translate('Individuals') ?>
404ab569c4SGreg Roach                    <span class="badge bg-secondary">
41dd6b2bfcSGreg Roach                        <?= I18N::number(count($individuals)) ?>
42dd6b2bfcSGreg Roach                    </span>
43a6b8f374SGreg Roach                </button>
44dd6b2bfcSGreg Roach            </li>
45dd6b2bfcSGreg Roach        <?php endif ?>
46dd6b2bfcSGreg Roach
47dd6b2bfcSGreg Roach        <?php if ($search_families) : ?>
486a4003b9SGreg Roach            <li class="nav-item" role="presentation">
49a6b8f374SGreg Roach                <button class="nav-link <?= $families->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#families" data-bs-toggle="tab" href="#families" role="tab" aria-controls="families">
50dd6b2bfcSGreg Roach                    <?= I18N::translate('Families') ?>
514ab569c4SGreg Roach                    <span class="badge bg-secondary">
52dd6b2bfcSGreg Roach                        <?= I18N::number(count($families)) ?>
53dd6b2bfcSGreg Roach                    </span>
54a6b8f374SGreg Roach                </button>
55dd6b2bfcSGreg Roach            </li>
56dd6b2bfcSGreg Roach        <?php endif ?>
57dd6b2bfcSGreg Roach
58dd6b2bfcSGreg Roach        <?php if ($search_sources) : ?>
596a4003b9SGreg Roach            <li class="nav-item" role="presentation">
60a6b8f374SGreg Roach                <button class="nav-link <?= $sources->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#sources" data-bs-toggle="tab" href="#sources" role="tab" aria-controls="sources">
61dd6b2bfcSGreg Roach                    <?= I18N::translate('Sources') ?>
624ab569c4SGreg Roach                    <span class="badge bg-secondary">
63dd6b2bfcSGreg Roach                        <?= I18N::number(count($sources)) ?>
64dd6b2bfcSGreg Roach                    </span>
65a6b8f374SGreg Roach                </button>
66dd6b2bfcSGreg Roach            </li>
67dd6b2bfcSGreg Roach        <?php endif ?>
68dd6b2bfcSGreg Roach
69dd6b2bfcSGreg Roach        <?php if ($search_repositories) : ?>
706a4003b9SGreg Roach            <li class="nav-item" role="presentation">
71a6b8f374SGreg Roach                <button class="nav-link <?= $repositories->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#repositories" data-bs-toggle="tab" href="#repositories" role="tab" aria-controls="repositories">
72dd6b2bfcSGreg Roach                    <?= I18N::translate('Repositories') ?>
734ab569c4SGreg Roach                    <span class="badge bg-secondary">
74dd6b2bfcSGreg Roach                        <?= I18N::number(count($repositories)) ?>
75dd6b2bfcSGreg Roach                    </span>
76a6b8f374SGreg Roach                </button>
77dd6b2bfcSGreg Roach            </li>
78dd6b2bfcSGreg Roach        <?php endif ?>
79dd6b2bfcSGreg Roach
80dd6b2bfcSGreg Roach        <?php if ($search_notes) : ?>
816a4003b9SGreg Roach            <li class="nav-item" role="presentation">
82a6b8f374SGreg Roach                <button class="nav-link <?= $notes->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#notes" data-bs-toggle="tab" href="#notes" role="tab" aria-controls="notes">
83dd6b2bfcSGreg Roach                    <?= I18N::translate('Notes') ?>
844ab569c4SGreg Roach                    <span class="badge bg-secondary">
85dd6b2bfcSGreg Roach                        <?= I18N::number(count($notes)) ?>
86dd6b2bfcSGreg Roach                    </span>
87a6b8f374SGreg Roach                </button>
88dd6b2bfcSGreg Roach            </li>
89dd6b2bfcSGreg Roach        <?php endif ?>
90058ba724SGreg Roach
91058ba724SGreg Roach        <?php if ($search_locations) : ?>
92058ba724SGreg Roach            <li class="nav-item" role="presentation">
93a6b8f374SGreg Roach                <button class="nav-link <?= $locations->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#locations" data-bs-toggle="tab" href="#locations" role="tab" aria-controls="locations">
94058ba724SGreg Roach                    <?= I18N::translate('Locations') ?>
954ab569c4SGreg Roach                    <span class="badge bg-secondary">
96058ba724SGreg Roach                        <?= I18N::number(count($locations)) ?>
97058ba724SGreg Roach                    </span>
98a6b8f374SGreg Roach                </button>
99058ba724SGreg Roach            </li>
100058ba724SGreg Roach        <?php endif ?>
101dd6b2bfcSGreg Roach    </ul>
102dd6b2bfcSGreg Roach
103dd6b2bfcSGreg Roach    <div class="tab-content wt-search-results-content">
104dd6b2bfcSGreg Roach        <?php if ($search_individuals) : ?>
105a6b8f374SGreg Roach            <div class="tab-pane" id="individuals" role="tabpanel" aria-labelledby="individuals-tab">
106dd6b2bfcSGreg Roach                <?= view('lists/individuals-table', ['individuals' => $individuals, 'sosa' => false, 'tree' => $tree]) ?>
107dd6b2bfcSGreg Roach            </div>
108dd6b2bfcSGreg Roach        <?php endif ?>
109dd6b2bfcSGreg Roach
110dd6b2bfcSGreg Roach        <?php if ($search_families) : ?>
111a6b8f374SGreg Roach            <div class="tab-pane" id="families" role="tabpanel" aria-labelledby="families-tab">
112dd6b2bfcSGreg Roach                <?= view('lists/families-table', ['families' => $families, 'tree' => $tree]) ?>
113dd6b2bfcSGreg Roach            </div>
114dd6b2bfcSGreg Roach        <?php endif ?>
115dd6b2bfcSGreg Roach
116dd6b2bfcSGreg Roach        <?php if ($search_sources) : ?>
117a6b8f374SGreg Roach            <div class="tab-pane" id="sources" role="tabpanel" aria-labelledby="sources-tab">
118dd6b2bfcSGreg Roach                <?= view('lists/sources-table', ['sources' => $sources, 'tree' => $tree]) ?>
119dd6b2bfcSGreg Roach            </div>
120dd6b2bfcSGreg Roach        <?php endif ?>
121dd6b2bfcSGreg Roach
122dd6b2bfcSGreg Roach        <?php if ($search_repositories) : ?>
123a6b8f374SGreg Roach            <div class="tab-pane" id="repositories" role="tabpanel" aria-labelledby="repositories-tab">
124dd6b2bfcSGreg Roach                <?= view('lists/repositories-table', ['repositories' => $repositories, 'tree' => $tree]) ?>
125dd6b2bfcSGreg Roach            </div>
126dd6b2bfcSGreg Roach        <?php endif ?>
127dd6b2bfcSGreg Roach
128dd6b2bfcSGreg Roach        <?php if ($search_notes) : ?>
129a6b8f374SGreg Roach            <div class="tab-pane" id="notes" role="tabpanel" aria-labelledby="notes-tab">
130dd6b2bfcSGreg Roach                <?= view('lists/notes-table', ['notes' => $notes, 'tree' => $tree]) ?>
131dd6b2bfcSGreg Roach            </div>
132dd6b2bfcSGreg Roach        <?php endif ?>
133058ba724SGreg Roach
134058ba724SGreg Roach        <?php if ($search_locations) : ?>
135a6b8f374SGreg Roach            <div class="tab-pane" id="locations" role="tabpanel" aria-labelledby="locations-tab">
136058ba724SGreg Roach                <?= view('lists/locations-table', ['locations' => $locations, 'tree' => $tree]) ?>
137058ba724SGreg Roach            </div>
138058ba724SGreg Roach        <?php endif ?>
139dd6b2bfcSGreg Roach    </div>
140dd6b2bfcSGreg Roach</div>
141dd6b2bfcSGreg Roach
142dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
143dd6b2bfcSGreg Roach<script>
144a6b8f374SGreg Roach  document.querySelector('.wt-search-results-tabs li button').click();
145dd6b2bfcSGreg Roach</script>
146dd6b2bfcSGreg Roach<?php View::endpush() ?>
147