xref: /webtrees/resources/views/search-advanced-page.phtml (revision af7b1f136d0947b42fda7a736f4b48319cc835dd)
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<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        <?= csrf_field() ?>
29
30        <div class="row form-group wt-page-options-label mt-4">
31            <div class="mx-auto">
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]) ?>
39            <?php endif ?>
40        <?php endforeach ?>
41
42        <div class="row form-group">
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        <div class="row form-group wt-page-options-label mt-4">
60            <div class="mx-auto">
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        <div class="row form-group wt-page-options-label mt-4">
72            <div class="mx-auto">
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]) ?>
80            <?php endif ?>
81        <?php endforeach ?>
82
83        <div class="row form-group my-3">
84            <div class="mx-auto">
85                <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */
86                I18N::translate('search') ?>">
87            </div>
88        </div>
89    </form>
90</div>
91
92<?php if (array_filter($fields) !== []) : ?>
93    <?php if ($individuals->isEmpty()) : ?>
94        <div class="alert alert-info row">
95            <?= I18N::translate('No results found.') ?>
96        </div>
97    <?php else : ?>
98        <?= 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]) ?>
99    <?php endif ?>
100<?php endif ?>
101
102