xref: /webtrees/resources/views/search-advanced-page.phtml (revision f78da6783564bad54411db0835818007bfdbaec8)
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">
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]) ?>
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        <br>
60
61        <div class="row form-group">
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]) ?>
70            <?php endif ?>
71        <?php endforeach ?>
72
73        <br>
74
75        <div class="row form-group">
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]) ?>
84            <?php endif ?>
85        <?php endforeach ?>
86
87        <br>
88
89        <div class="row form-group">
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    </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
107