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