xref: /webtrees/resources/views/components/select-individual.phtml (revision 0b4a90f10ce443e8dfab4f27be1680bedb19c195)
1b6c326d8SGreg Roach<?php
2b6c326d8SGreg Roach
3b6c326d8SGreg Roachuse Fisharebest\Webtrees\Individual;
4b6c326d8SGreg Roachuse Fisharebest\Webtrees\Tree;
5b6c326d8SGreg Roach
6b6c326d8SGreg Roach/**
7b6c326d8SGreg Roach * @var Individual|null $individual
86bdf2178SGreg Roach * @var string|null     $class
9b6c326d8SGreg Roach * @var string|null     $id
10b6c326d8SGreg Roach * @var string          $name
11b6c326d8SGreg Roach * @var Tree            $tree
12b6c326d8SGreg Roach */
13b6c326d8SGreg Roach
14b6c326d8SGreg Roach?>
15b6c326d8SGreg Roach
16b6c326d8SGreg Roach<select
17b6c326d8SGreg Roach    autocomplete="off"
186bdf2178SGreg Roach    class="form-control select2 <?= $class ?? '' ?>"
19b6c326d8SGreg Roach    data-ajax--delay="350"
20b6c326d8SGreg Roach    data-ajax--minimum-input-length="2"
21b6c326d8SGreg Roach    data-ajax--type="POST"
22b6c326d8SGreg Roach    data-ajax--url="<?= e(route('select2-individual', ['ged' => $tree->name()])) ?>"
23b6c326d8SGreg Roach    data-allow-clear="true"
24*0b4a90f1SGreg Roach    data-placeholder=""
25b6c326d8SGreg Roach    id="<?= e($id ?? $name) ?>"
26b6c326d8SGreg Roach    name="<?= e($name) ?>"
27b6c326d8SGreg Roach    <?= ($disabled ?? false) ? 'disabled' : '' ?>
28b6c326d8SGreg Roach    <?= ($required ?? false) ? 'required' : '' ?>
29b6c326d8SGreg Roach>
30b6c326d8SGreg Roach    <?php if (($individual ?? null) instanceof Individual): ?>
31*0b4a90f1SGreg Roach        <option value="<?= e($individual->xref()) ?>">
32b6c326d8SGreg Roach            <?= view('selects/individual', ['individual' => $individual]) ?>
33b6c326d8SGreg Roach        </option>
34b6c326d8SGreg Roach    <?php else: ?>
35b6c326d8SGreg Roach        <option></option>
36b6c326d8SGreg Roach    <?php endif ?>
37b6c326d8SGreg Roach</select>
38