xref: /webtrees/resources/views/search-advanced-page.phtml (revision ddb212c271282b3397d1e5ede6cc4df078bce9b4)
1<?php
2
3use Fisharebest\Webtrees\GedcomTag;
4use Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedAction;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Tree;
7
8/**
9 * @var array<string,string> $date_options
10 * @var array<string,string> $fields
11 * @var array<string,string> $field_labels
12 * @var array<string,string> $name_options
13 * @var array<string,string> $other_options
14 * @var string               $title
15 * @var Tree                 $tree
16 */
17
18?>
19
20<h2 class="wt-page-title">
21    <?= $title ?>
22</h2>
23
24<div id="advanced-search-page">
25    <form method="post" action="<?= e(route(SearchAdvancedAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-options wt-page-options-search-advanced hidden-print mb-4">
26        <?= csrf_field() ?>
27
28        <div class="row form-group wt-page-options-label mt-4">
29            <div class="form-row mx-auto">
30                <?= I18N::translate('Individual') ?>
31            </div>
32        </div>
33
34        <?php foreach ($fields as $field_name => $field_value) : ?>
35            <?php if (substr($field_name, 0, 5) !== 'FAMC:') : ?>
36                <?= view('search-advanced-field', ['field_label' => $field_labels[$field_name] ?? GedcomTag::getLabel($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 form-group">
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        <div class="row form-group wt-page-options-label mt-4">
58            <div class="form-row mx-auto">
59                <?= I18N::translate('Father') ?>
60            </div>
61        </div>
62
63        <?php foreach ($fields as $field_name => $field_value) : ?>
64            <?php if (substr($field_name, 0, 10) === 'FAMC:HUSB:') : ?>
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]) ?>
66            <?php endif ?>
67        <?php endforeach ?>
68
69        <div class="row form-group wt-page-options-label mt-4">
70            <div class="form-row mx-auto">
71                <?= I18N::translate('Mother') ?>
72            </div>
73        </div>
74
75        <?php foreach ($fields as $field_name => $field_value) : ?>
76            <?php if (substr($field_name, 0, 10) === 'FAMC:WIFE:') : ?>
77                <?= 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]) ?>
78            <?php endif ?>
79        <?php endforeach ?>
80
81        <div class="row form-group my-3">
82            <div class="form-row mx-auto">
83                <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */
84                I18N::translate('search') ?>">
85            </div>
86        </div>
87    </form>
88</div>
89
90<?php if (true) : ?>
91    <?php if ($individuals->isEmpty()) : ?>
92        <div class="alert alert-info row">
93            <?= I18N::translate('No results found.') ?>
94        </div>
95    <?php else : ?>
96        <?= view('search-results', ['individuals' => $individuals, 'search_families' => false, 'search_individuals' => true, 'search_notes' => false, 'search_sources' => false, 'search_repositories' => false, 'tree' => $tree]) ?>
97    <?php endif ?>
98<?php endif ?>
99
100