xref: /webtrees/resources/views/search-results.phtml (revision d97083fe315dad9b7d0a150d4fb5f563e57d1869)
1<?php
2
3use Fisharebest\Webtrees\Family;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\Individual;
6use Fisharebest\Webtrees\Location;
7use Fisharebest\Webtrees\Note;
8use Fisharebest\Webtrees\Repository;
9use Fisharebest\Webtrees\Source;
10use Fisharebest\Webtrees\Tree;
11use Fisharebest\Webtrees\View;
12use Illuminate\Support\Collection;
13
14/**
15 * @var Collection<int,Family>     $families
16 * @var Collection<int,Individual> $individuals
17 * @var Collection<int,Location>   $locations
18 * @var Collection<int,Note>       $notes
19 * @var Collection<int,Repository> $repositories
20 * @var Collection<int,Source>     $sources
21 * @var bool                       $search_families
22 * @var bool                       $search_individuals
23 * @var bool                       $search_locations
24 * @var bool                       $search_notes
25 * @var bool                       $search_repositories
26 * @var bool                       $search_sources
27 * @var Tree                       $tree
28 */
29
30?>
31
32<div class="wt-search-results">
33    <ul class="nav nav-tabs wt-search-results-tabs" role="tablist">
34        <?php if ($search_individuals) : ?>
35            <li class="nav-item" role="presentation">
36                <button class="nav-link <?= $individuals->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#individuals" data-bs-toggle="tab" href="#individuals" role="tab" aria-controls="individuals">
37                    <?= I18N::translate('Individuals') ?>
38                    <span class="badge bg-secondary">
39                        <?= I18N::number(count($individuals)) ?>
40                    </span>
41                </button>
42            </li>
43        <?php endif ?>
44
45        <?php if ($search_families) : ?>
46            <li class="nav-item" role="presentation">
47                <button class="nav-link <?= $families->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#families" data-bs-toggle="tab" href="#families" role="tab" aria-controls="families">
48                    <?= I18N::translate('Families') ?>
49                    <span class="badge bg-secondary">
50                        <?= I18N::number(count($families)) ?>
51                    </span>
52                </button>
53            </li>
54        <?php endif ?>
55
56        <?php if ($search_sources) : ?>
57            <li class="nav-item" role="presentation">
58                <button class="nav-link <?= $sources->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#sources" data-bs-toggle="tab" href="#sources" role="tab" aria-controls="sources">
59                    <?= I18N::translate('Sources') ?>
60                    <span class="badge bg-secondary">
61                        <?= I18N::number(count($sources)) ?>
62                    </span>
63                </button>
64            </li>
65        <?php endif ?>
66
67        <?php if ($search_repositories) : ?>
68            <li class="nav-item" role="presentation">
69                <button class="nav-link <?= $repositories->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#repositories" data-bs-toggle="tab" href="#repositories" role="tab" aria-controls="repositories">
70                    <?= I18N::translate('Repositories') ?>
71                    <span class="badge bg-secondary">
72                        <?= I18N::number(count($repositories)) ?>
73                    </span>
74                </button>
75            </li>
76        <?php endif ?>
77
78        <?php if ($search_notes) : ?>
79            <li class="nav-item" role="presentation">
80                <button class="nav-link <?= $notes->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#notes" data-bs-toggle="tab" href="#notes" role="tab" aria-controls="notes">
81                    <?= I18N::translate('Notes') ?>
82                    <span class="badge bg-secondary">
83                        <?= I18N::number(count($notes)) ?>
84                    </span>
85                </button>
86            </li>
87        <?php endif ?>
88
89        <?php if ($search_locations) : ?>
90            <li class="nav-item" role="presentation">
91                <button class="nav-link <?= $locations->isEmpty() ? 'text-muted' : '' ?>" data-bs-target="#locations" data-bs-toggle="tab" href="#locations" role="tab" aria-controls="locations">
92                    <?= I18N::translate('Locations') ?>
93                    <span class="badge bg-secondary">
94                        <?= I18N::number(count($locations)) ?>
95                    </span>
96                </button>
97            </li>
98        <?php endif ?>
99    </ul>
100
101    <div class="tab-content wt-search-results-content">
102        <?php if ($search_individuals) : ?>
103            <div class="tab-pane" id="individuals" role="tabpanel" aria-labelledby="individuals-tab">
104                <?= view('lists/individuals-table', ['individuals' => $individuals, 'sosa' => false, 'tree' => $tree]) ?>
105            </div>
106        <?php endif ?>
107
108        <?php if ($search_families) : ?>
109            <div class="tab-pane" id="families" role="tabpanel" aria-labelledby="families-tab">
110                <?= view('lists/families-table', ['families' => $families, 'tree' => $tree]) ?>
111            </div>
112        <?php endif ?>
113
114        <?php if ($search_sources) : ?>
115            <div class="tab-pane" id="sources" role="tabpanel" aria-labelledby="sources-tab">
116                <?= view('lists/sources-table', ['sources' => $sources, 'tree' => $tree]) ?>
117            </div>
118        <?php endif ?>
119
120        <?php if ($search_repositories) : ?>
121            <div class="tab-pane" id="repositories" role="tabpanel" aria-labelledby="repositories-tab">
122                <?= view('lists/repositories-table', ['repositories' => $repositories, 'tree' => $tree]) ?>
123            </div>
124        <?php endif ?>
125
126        <?php if ($search_notes) : ?>
127            <div class="tab-pane" id="notes" role="tabpanel" aria-labelledby="notes-tab">
128                <?= view('lists/notes-table', ['notes' => $notes, 'tree' => $tree]) ?>
129            </div>
130        <?php endif ?>
131
132        <?php if ($search_locations) : ?>
133            <div class="tab-pane" id="locations" role="tabpanel" aria-labelledby="locations-tab">
134                <?= view('lists/locations-table', ['locations' => $locations, 'tree' => $tree]) ?>
135            </div>
136        <?php endif ?>
137    </div>
138</div>
139
140<?php View::push('javascript') ?>
141<script>
142  document.querySelector('.wt-search-results-tabs li button').click();
143</script>
144<?php View::endpush() ?>
145