xref: /webtrees/resources/views/search-advanced-page.phtml (revision 92676942c36ec78fcaf05911d00218e959b36beb)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedAction;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Individual;
8use Fisharebest\Webtrees\Tree;
9use Illuminate\Support\Collection;
10
11/**
12 * @var array<string,string>       $date_options
13 * @var array<string,string>       $fields
14 * @var array<string,string>       $field_labels
15 * @var Collection<int,Individual> $individuals
16 * @var array<string,string>       $name_options
17 * @var array<string,string>       $other_fields
18 * @var string                     $title
19 * @var Tree                       $tree
20 */
21
22?>
23
24<h2 class="wt-page-title">
25    <?= $title ?>
26</h2>
27
28<div id="advanced-search-page">
29    <form method="post" action="<?= e(route(SearchAdvancedAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-options wt-page-options-search-advanced hidden-print mb-4">
30        <div class="row">
31            <div class="col col-form-label wt-page-options-label">
32                <?= I18N::translate('Individual') ?>
33            </div>
34        </div>
35
36        <?php foreach ($fields as $field_name => $field_value) : ?>
37            <?php if (!str_starts_with($field_name, 'FATHER:') && !str_starts_with($field_name, 'MOTHER:')) : ?>
38                <?= view('search-advanced-field', ['field_label' => $field_labels[$field_name], 'field_name' => $field_name, 'field_value' => $field_value, 'modifier' => $modifiers[$field_name] ?? '', 'date_options' => $date_options, 'name_options' => $name_options, 'tree' => $tree]) ?>
39            <?php endif ?>
40        <?php endforeach ?>
41
42        <div class="row">
43            <div class="col-sm-3 col-form-label wt-page-options-label">
44                <?= I18N::translate('Add more fields') ?>
45            </div>
46
47            <div class="col-sm-3 wt-page-options-value">
48                <?= view('components/select', ['name' => 'other_field', 'selected' => '', 'options' => ['' => ''] + $other_fields]) ?>
49            </div>
50
51            <div class="col-sm-3 wt-page-options-value">
52                <input type="text" class="form-control" name="other_value">
53            </div>
54
55            <div class="col-sm-3 wt-page-options-value">
56            </div>
57        </div>
58
59        <br>
60
61        <div class="row">
62            <div class="col col-form-label wt-page-options-label">
63                <?= I18N::translate('Father') ?>
64            </div>
65        </div>
66
67        <?php foreach ($fields as $field_name => $field_value) : ?>
68            <?php if (str_starts_with($field_name, 'FATHER:')) : ?>
69                <?= view('search-advanced-field', ['field_label' => $field_labels[$field_name], 'field_name' => $field_name, 'field_value' => $field_value, 'modifier' => $modifiers[$field_name] ?? '', 'date_options' => $date_options, 'name_options' => $name_options, 'tree' => $tree]) ?>
70            <?php endif ?>
71        <?php endforeach ?>
72
73        <br>
74
75        <div class="row">
76            <div class="col col-form-label wt-page-options-label">
77                <?= I18N::translate('Mother') ?>
78            </div>
79        </div>
80
81        <?php foreach ($fields as $field_name => $field_value) : ?>
82            <?php if (str_starts_with($field_name, 'MOTHER:')) : ?>
83                <?= view('search-advanced-field', ['field_label' => $field_labels[$field_name], 'field_name' => $field_name, 'field_value' => $field_value, 'modifier' => $modifiers[$field_name] ?? '', 'date_options' => $date_options, 'name_options' => $name_options, 'tree' => $tree]) ?>
84            <?php endif ?>
85        <?php endforeach ?>
86
87        <br>
88
89        <div class="row mb-3">
90            <div class="col">
91                <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */ I18N::translate('search') ?>">
92            </div>
93        </div>
94
95        <?= csrf_field() ?>
96    </form>
97</div>
98
99<?php if (array_filter($fields) !== []) : ?>
100    <?php if ($individuals->isEmpty()) : ?>
101        <div class="alert alert-info">
102            <?= I18N::translate('No results found.') ?>
103        </div>
104    <?php else : ?>
105        <?= view('search-results', ['individuals' => $individuals, 'search_families' => false, 'search_individuals' => true, 'search_locations' => false, 'search_notes' => false, 'search_sources' => false, 'search_repositories' => false, 'tree' => $tree]) ?>
106    <?php endif ?>
107<?php endif ?>
108