xref: /webtrees/resources/views/search-advanced-page.phtml (revision ca1e6d47754d1d3667ac160664ddb033e3d5755e)
1f5402f3dSGreg Roach<?php
2f5402f3dSGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
5f5402f3dSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SearchAdvancedAction;
6f5402f3dSGreg Roachuse Fisharebest\Webtrees\I18N;
7dc270d8cSGreg Roachuse Fisharebest\Webtrees\Individual;
86f922bb8SGreg Roachuse Fisharebest\Webtrees\Tree;
9dc270d8cSGreg Roachuse Illuminate\Support\Collection;
106f922bb8SGreg Roach
116f922bb8SGreg Roach/**
126f922bb8SGreg Roach * @var array<string,string>       $date_options
136f922bb8SGreg Roach * @var array<string,string>       $fields
146f922bb8SGreg Roach * @var array<string,string>       $field_labels
1536779af1SGreg Roach * @var Collection<int,Individual> $individuals
166f922bb8SGreg Roach * @var array<string,string>       $name_options
17dc270d8cSGreg Roach * @var array<string,string>       $other_fields
186f922bb8SGreg Roach * @var string                     $title
196f922bb8SGreg Roach * @var Tree                       $tree
206f922bb8SGreg Roach */
21f5402f3dSGreg Roach
22f5402f3dSGreg Roach?>
23dd6b2bfcSGreg Roach
24dd6b2bfcSGreg Roach<h2 class="wt-page-title">
25dd6b2bfcSGreg Roach    <?= $title ?>
26dd6b2bfcSGreg Roach</h2>
27dd6b2bfcSGreg Roach
28dd6b2bfcSGreg Roach<div id="advanced-search-page">
29f5402f3dSGreg 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">
309e3c2cf9SGreg Roach        <div class="row">
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:')) : ?>
38*ca1e6d47SGreg 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, 'tree' => $tree]) ?>
39dd6b2bfcSGreg Roach            <?php endif ?>
40dd6b2bfcSGreg Roach        <?php endforeach ?>
41dd6b2bfcSGreg Roach
429e3c2cf9SGreg Roach        <div class="row">
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
619e3c2cf9SGreg Roach        <div class="row">
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:')) : ?>
69*ca1e6d47SGreg 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, 'tree' => $tree]) ?>
70dd6b2bfcSGreg Roach            <?php endif ?>
71dd6b2bfcSGreg Roach        <?php endforeach ?>
72dd6b2bfcSGreg Roach
73315eb316SGreg Roach        <br>
74315eb316SGreg Roach
759e3c2cf9SGreg Roach        <div class="row">
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:')) : ?>
83*ca1e6d47SGreg 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, 'tree' => $tree]) ?>
84dd6b2bfcSGreg Roach            <?php endif ?>
85dd6b2bfcSGreg Roach        <?php endforeach ?>
86dd6b2bfcSGreg Roach
87315eb316SGreg Roach        <br>
88315eb316SGreg Roach
899e3c2cf9SGreg Roach        <div class="row 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>
9481443e3cSGreg Roach
9581443e3cSGreg Roach        <?= csrf_field() ?>
96dd6b2bfcSGreg Roach    </form>
97dd6b2bfcSGreg Roach</div>
98dd6b2bfcSGreg Roach
99dc270d8cSGreg Roach<?php if (array_filter($fields) !== []) : ?>
100075d1a05SGreg Roach    <?php if ($individuals->isEmpty()) : ?>
101315eb316SGreg Roach        <div class="alert alert-info">
102dd6b2bfcSGreg Roach            <?= I18N::translate('No results found.') ?>
103dd6b2bfcSGreg Roach        </div>
104dd6b2bfcSGreg Roach    <?php else : ?>
105058ba724SGreg 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]) ?>
106dd6b2bfcSGreg Roach    <?php endif ?>
107dd6b2bfcSGreg Roach<?php endif ?>
108