xref: /webtrees/resources/views/search-advanced-page.phtml (revision e873f434551745f888937263ff89e80db3b0f785)
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-6 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            </div>
53        </div>
54
55        <br>
56
57        <div class="row">
58            <div class="col col-form-label wt-page-options-label">
59                <?= I18N::translate('Father') ?>
60            </div>
61        </div>
62
63        <?php foreach ($fields as $field_name => $field_value) : ?>
64            <?php if (str_starts_with($field_name, 'FATHER:')) : ?>
65                <?= 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]) ?>
66            <?php endif ?>
67        <?php endforeach ?>
68
69        <br>
70
71        <div class="row">
72            <div class="col col-form-label wt-page-options-label">
73                <?= I18N::translate('Mother') ?>
74            </div>
75        </div>
76
77        <?php foreach ($fields as $field_name => $field_value) : ?>
78            <?php if (str_starts_with($field_name, 'MOTHER:')) : ?>
79                <?= 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]) ?>
80            <?php endif ?>
81        <?php endforeach ?>
82
83        <br>
84
85        <div class="row mb-3">
86            <div class="col">
87                <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */ I18N::translate('search') ?>">
88            </div>
89        </div>
90
91        <?= csrf_field() ?>
92    </form>
93</div>
94
95<?php if (array_filter($fields) !== []) : ?>
96    <?php if ($individuals->isEmpty()) : ?>
97        <div class="alert alert-info">
98            <?= I18N::translate('No results found.') ?>
99        </div>
100    <?php else : ?>
101        <?= 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]) ?>
102    <?php endif ?>
103<?php endif ?>
104