xref: /webtrees/resources/views/search-advanced-page.phtml (revision 36779af1bd0601de7819554b13a393f6edb92507)
1f5402f3dSGreg Roach<?php
2f5402f3dSGreg Roach
3f5402f3dSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedAction;
4f5402f3dSGreg Roachuse Fisharebest\Webtrees\I18N;
5dc270d8cSGreg Roachuse Fisharebest\Webtrees\Individual;
66f922bb8SGreg Roachuse Fisharebest\Webtrees\Tree;
7dc270d8cSGreg Roachuse Illuminate\Support\Collection;
86f922bb8SGreg Roach
96f922bb8SGreg Roach/**
106f922bb8SGreg Roach * @var array<string,string>       $date_options
116f922bb8SGreg Roach * @var array<string,string>       $fields
126f922bb8SGreg Roach * @var array<string,string>       $field_labels
13*36779af1SGreg Roach * @var Collection<int,Individual> $individuals
146f922bb8SGreg Roach * @var array<string,string>       $name_options
15dc270d8cSGreg Roach * @var array<string,string>       $other_fields
166f922bb8SGreg Roach * @var string                     $title
176f922bb8SGreg Roach * @var Tree                       $tree
186f922bb8SGreg Roach */
19f5402f3dSGreg Roach
20f5402f3dSGreg Roach?>
21dd6b2bfcSGreg Roach
22dd6b2bfcSGreg Roach<h2 class="wt-page-title">
23dd6b2bfcSGreg Roach    <?= $title ?>
24dd6b2bfcSGreg Roach</h2>
25dd6b2bfcSGreg Roach
26dd6b2bfcSGreg Roach<div id="advanced-search-page">
27f5402f3dSGreg Roach    <form method="post" action="<?= e(route(SearchAdvancedAction::class, ['tree' => $tree->name()])) ?>" class="wt-page-options wt-page-options-search-advanced hidden-print mb-4">
28f5402f3dSGreg Roach        <?= csrf_field() ?>
29dd6b2bfcSGreg Roach
3089950eb4SGreg Roach        <div class="row form-group">
31315eb316SGreg Roach            <div class="col col-form-label wt-page-options-label">
32dd6b2bfcSGreg Roach                <?= I18N::translate('Individual') ?>
33dd6b2bfcSGreg Roach            </div>
34dd6b2bfcSGreg Roach        </div>
35dd6b2bfcSGreg Roach
36dd6b2bfcSGreg Roach        <?php foreach ($fields as $field_name => $field_value) : ?>
37c8fd9348SGreg Roach            <?php if (!str_starts_with($field_name, 'FATHER:') && !str_starts_with($field_name, 'MOTHER:')) : ?>
38c8fd9348SGreg Roach                <?= 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]) ?>
39dd6b2bfcSGreg Roach            <?php endif ?>
40dd6b2bfcSGreg Roach        <?php endforeach ?>
41dd6b2bfcSGreg Roach
4289950eb4SGreg Roach        <div class="row form-group">
43dd6b2bfcSGreg Roach            <div class="col-sm-3 col-form-label wt-page-options-label">
44dd6b2bfcSGreg Roach                <?= I18N::translate('Add more fields') ?>
45dd6b2bfcSGreg Roach            </div>
46dd6b2bfcSGreg Roach
47dd6b2bfcSGreg Roach            <div class="col-sm-3 wt-page-options-value">
48c9e11c2aSGreg Roach                <?= view('components/select', ['name' => 'other_field', 'selected' => '', 'options' => ['' => ''] + $other_fields]) ?>
49dd6b2bfcSGreg Roach            </div>
50dd6b2bfcSGreg Roach
51dd6b2bfcSGreg Roach            <div class="col-sm-3 wt-page-options-value">
52dd6b2bfcSGreg Roach                <input type="text" class="form-control" name="other_value">
53dd6b2bfcSGreg Roach            </div>
54dd6b2bfcSGreg Roach
55dd6b2bfcSGreg Roach            <div class="col-sm-3 wt-page-options-value">
56dd6b2bfcSGreg Roach            </div>
57dd6b2bfcSGreg Roach        </div>
58dd6b2bfcSGreg Roach
59315eb316SGreg Roach        <br>
60315eb316SGreg Roach
6189950eb4SGreg Roach        <div class="row form-group">
62315eb316SGreg Roach            <div class="col col-form-label wt-page-options-label">
63dd6b2bfcSGreg Roach                <?= I18N::translate('Father') ?>
64dd6b2bfcSGreg Roach            </div>
65dd6b2bfcSGreg Roach        </div>
66dd6b2bfcSGreg Roach
67dd6b2bfcSGreg Roach        <?php foreach ($fields as $field_name => $field_value) : ?>
682f86083cSGreg Roach            <?php if (str_starts_with($field_name, 'FATHER:')) : ?>
696f922bb8SGreg Roach                <?= 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]) ?>
70dd6b2bfcSGreg Roach            <?php endif ?>
71dd6b2bfcSGreg Roach        <?php endforeach ?>
72dd6b2bfcSGreg Roach
73315eb316SGreg Roach        <br>
74315eb316SGreg Roach
7589950eb4SGreg Roach        <div class="row form-group">
76315eb316SGreg Roach            <div class="col col-form-label wt-page-options-label">
77dd6b2bfcSGreg Roach                <?= I18N::translate('Mother') ?>
78dd6b2bfcSGreg Roach            </div>
79dd6b2bfcSGreg Roach        </div>
80dd6b2bfcSGreg Roach
81dd6b2bfcSGreg Roach        <?php foreach ($fields as $field_name => $field_value) : ?>
822f86083cSGreg Roach            <?php if (str_starts_with($field_name, 'MOTHER:')) : ?>
836f922bb8SGreg Roach                <?= 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]) ?>
84dd6b2bfcSGreg Roach            <?php endif ?>
85dd6b2bfcSGreg Roach        <?php endforeach ?>
86dd6b2bfcSGreg Roach
87315eb316SGreg Roach        <br>
88315eb316SGreg Roach
89afc2d190SGreg Roach        <div class="row form-group mb-3">
90315eb316SGreg Roach            <div class="col">
91315eb316SGreg Roach                <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */ I18N::translate('search') ?>">
92dd6b2bfcSGreg Roach            </div>
93dd6b2bfcSGreg Roach        </div>
94dd6b2bfcSGreg Roach    </form>
95dd6b2bfcSGreg Roach</div>
96dd6b2bfcSGreg Roach
97dc270d8cSGreg Roach<?php if (array_filter($fields) !== []) : ?>
98075d1a05SGreg Roach    <?php if ($individuals->isEmpty()) : ?>
99315eb316SGreg Roach        <div class="alert alert-info">
100dd6b2bfcSGreg Roach            <?= I18N::translate('No results found.') ?>
101dd6b2bfcSGreg Roach        </div>
102dd6b2bfcSGreg Roach    <?php else : ?>
103058ba724SGreg Roach        <?= 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]) ?>
104dd6b2bfcSGreg Roach    <?php endif ?>
105dd6b2bfcSGreg Roach<?php endif ?>
106dd6b2bfcSGreg Roach
107