xref: /webtrees/resources/views/search-advanced-page.phtml (revision 707e8a40cf19170ff6c9dbdf2080711fa666f570)
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:')) : ?>
38ca1e6d47SGreg 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
47*707e8a40SGreg Roach            <div class="col-sm-6 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            </div>
53dd6b2bfcSGreg Roach        </div>
54dd6b2bfcSGreg Roach
55315eb316SGreg Roach        <br>
56315eb316SGreg Roach
579e3c2cf9SGreg Roach        <div class="row">
58315eb316SGreg Roach            <div class="col col-form-label wt-page-options-label">
59dd6b2bfcSGreg Roach                <?= I18N::translate('Father') ?>
60dd6b2bfcSGreg Roach            </div>
61dd6b2bfcSGreg Roach        </div>
62dd6b2bfcSGreg Roach
63dd6b2bfcSGreg Roach        <?php foreach ($fields as $field_name => $field_value) : ?>
642f86083cSGreg Roach            <?php if (str_starts_with($field_name, 'FATHER:')) : ?>
65ca1e6d47SGreg 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]) ?>
66dd6b2bfcSGreg Roach            <?php endif ?>
67dd6b2bfcSGreg Roach        <?php endforeach ?>
68dd6b2bfcSGreg Roach
69315eb316SGreg Roach        <br>
70315eb316SGreg Roach
719e3c2cf9SGreg Roach        <div class="row">
72315eb316SGreg Roach            <div class="col col-form-label wt-page-options-label">
73dd6b2bfcSGreg Roach                <?= I18N::translate('Mother') ?>
74dd6b2bfcSGreg Roach            </div>
75dd6b2bfcSGreg Roach        </div>
76dd6b2bfcSGreg Roach
77dd6b2bfcSGreg Roach        <?php foreach ($fields as $field_name => $field_value) : ?>
782f86083cSGreg Roach            <?php if (str_starts_with($field_name, 'MOTHER:')) : ?>
79ca1e6d47SGreg 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]) ?>
80dd6b2bfcSGreg Roach            <?php endif ?>
81dd6b2bfcSGreg Roach        <?php endforeach ?>
82dd6b2bfcSGreg Roach
83315eb316SGreg Roach        <br>
84315eb316SGreg Roach
859e3c2cf9SGreg Roach        <div class="row mb-3">
86315eb316SGreg Roach            <div class="col">
87315eb316SGreg Roach                <input type="submit" class="btn btn-primary" value="<?= /* I18N: A button label. */ I18N::translate('search') ?>">
88dd6b2bfcSGreg Roach            </div>
89dd6b2bfcSGreg Roach        </div>
9081443e3cSGreg Roach
9181443e3cSGreg Roach        <?= csrf_field() ?>
92dd6b2bfcSGreg Roach    </form>
93dd6b2bfcSGreg Roach</div>
94dd6b2bfcSGreg Roach
95dc270d8cSGreg Roach<?php if (array_filter($fields) !== []) : ?>
96075d1a05SGreg Roach    <?php if ($individuals->isEmpty()) : ?>
97315eb316SGreg Roach        <div class="alert alert-info">
98dd6b2bfcSGreg Roach            <?= I18N::translate('No results found.') ?>
99dd6b2bfcSGreg Roach        </div>
100dd6b2bfcSGreg Roach    <?php else : ?>
101058ba724SGreg 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]) ?>
102dd6b2bfcSGreg Roach    <?php endif ?>
103dd6b2bfcSGreg Roach<?php endif ?>
104