xref: /webtrees/resources/views/search-results.phtml (revision 641b81c6ed185e07de8e76d1f6bbd1a0431f8d36)
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<Family>     $families
16 * @var Collection<Individual> $individuals
17 * @var Collection<Location>   $locations
18 * @var Collection<Note>       $notes
19 * @var Collection<Repository> $repositories
20 * @var Collection<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                <a class="nav-link <?= $individuals->isEmpty() ? 'text-muted' : '' ?>" id="individuals-tab" data-toggle="tab" href="#individuals" role="tab" aria-controls="individuals">
37                    <?= I18N::translate('Individuals') ?>
38                    <span class="badge badge-secondary">
39                        <?= I18N::number(count($individuals)) ?>
40                    </span>
41                </a>
42            </li>
43        <?php endif ?>
44
45        <?php if ($search_families) : ?>
46            <li class="nav-item" role="presentation">
47                <a class="nav-link <?= $families->isEmpty() ? 'text-muted' : '' ?>" id="families-tab" data-toggle="tab" href="#families" role="tab" aria-controls="families">
48                    <?= I18N::translate('Families') ?>
49                    <span class="badge badge-secondary">
50                        <?= I18N::number(count($families)) ?>
51                    </span>
52                </a>
53            </li>
54        <?php endif ?>
55
56        <?php if ($search_sources) : ?>
57            <li class="nav-item" role="presentation">
58                <a class="nav-link <?= $sources->isEmpty() ? 'text-muted' : '' ?>" id="sources-tab" data-toggle="tab" href="#sources" role="tab" aria-controls="sources">
59                    <?= I18N::translate('Sources') ?>
60                    <span class="badge badge-secondary">
61                        <?= I18N::number(count($sources)) ?>
62                    </span>
63                </a>
64            </li>
65        <?php endif ?>
66
67        <?php if ($search_repositories) : ?>
68            <li class="nav-item" role="presentation">
69                <a class="nav-link <?= $repositories->isEmpty() ? 'text-muted' : '' ?>" id="repositories-tab" data-toggle="tab" href="#repositories" role="tab" aria-controls="repositories">
70                    <?= I18N::translate('Repositories') ?>
71                    <span class="badge badge-secondary">
72                        <?= I18N::number(count($repositories)) ?>
73                    </span>
74                </a>
75            </li>
76        <?php endif ?>
77
78        <?php if ($search_notes) : ?>
79            <li class="nav-item" role="presentation">
80                <a class="nav-link <?= $notes->isEmpty() ? 'text-muted' : '' ?>" id="notes-tab" data-toggle="tab" href="#notes" role="tab" aria-controls="notes">
81                    <?= I18N::translate('Notes') ?>
82                    <span class="badge badge-secondary">
83                        <?= I18N::number(count($notes)) ?>
84                    </span>
85                </a>
86            </li>
87        <?php endif ?>
88
89        <?php if ($search_locations) : ?>
90            <li class="nav-item" role="presentation">
91                <a class="nav-link <?= $locations->isEmpty() ? 'text-muted' : '' ?>" id="locations-tab" data-toggle="tab" href="#locations" role="tab" aria-controls="locations">
92                    <?= I18N::translate('Locations') ?>
93                    <span class="badge badge-secondary">
94                        <?= I18N::number(count($locations)) ?>
95                    </span>
96                </a>
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 fade" 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 fade" 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 fade" 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 fade" 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 fade" 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 fade" 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  $('.wt-search-results-tabs li:first-child a').tab('show');
143</script>
144<?php View::endpush() ?>
145