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