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