xref: /webtrees/resources/views/components/select-submitter.phtml (revision 64b4a65497760edc6bdbc85189d54699c42b1d6a)
1b6c326d8SGreg Roach<?php
2b6c326d8SGreg Roach
3b6c326d8SGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
4203b6ccfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\Select2Submitter;
5b6c326d8SGreg Roachuse Fisharebest\Webtrees\Tree;
6b6c326d8SGreg Roach
7b6c326d8SGreg Roach/**
8b6c326d8SGreg Roach * @var GedcomRecord|null $submitter
96bdf2178SGreg Roach * @var string|null       $class
10b6c326d8SGreg Roach * @var string|null       $id
11b6c326d8SGreg Roach * @var string            $name
12b6c326d8SGreg Roach * @var Tree              $tree
13b6c326d8SGreg Roach */
14b6c326d8SGreg Roach
15b6c326d8SGreg Roach?>
16b6c326d8SGreg Roach
17b6c326d8SGreg Roach<select
18b6c326d8SGreg Roach    autocomplete="off"
196bdf2178SGreg Roach    class="form-control select2 <?= $class ?? '' ?>"
20203b6ccfSGreg Roach    data-ajax--delay="<?= e(Select2Submitter::AJAX_DELAY) ?>"
21203b6ccfSGreg Roach    data-minimum-input-length="<?= e(Select2Submitter::MINIMUM_INPUT_LENGTH) ?>"
22b6c326d8SGreg Roach    data-ajax--type="POST"
23203b6ccfSGreg Roach    data-ajax--url="<?= e(route(Select2Submitter::class, ['tree' => $tree->name()])) ?>"
24b6c326d8SGreg Roach    data-allow-clear="true"
250b4a90f1SGreg Roach    data-placeholder=""
26b6c326d8SGreg Roach    id="<?= e($id ?? $name) ?>"
27b6c326d8SGreg Roach    name="<?= e($name) ?>"
28b6c326d8SGreg Roach    <?= ($disabled ?? false) ? 'disabled' : '' ?>
29b6c326d8SGreg Roach    <?= ($required ?? false) ? 'required' : '' ?>
30*64b4a654SGreg Roach    style="width:100%"
31b6c326d8SGreg Roach>
32b6c326d8SGreg Roach    <?php if (($submitter ?? null) instanceof GedcomRecord) : ?>
330b4a90f1SGreg Roach        <option value="<?= e($submitter->xref()) ?>">
34b6c326d8SGreg Roach            <?= view('selects/submitter', ['submitter' => $submitter]) ?>
35b6c326d8SGreg Roach        </option>
36b6c326d8SGreg Roach    <?php else : ?>
37b6c326d8SGreg Roach        <option></option>
38b6c326d8SGreg Roach    <?php endif ?>
39b6c326d8SGreg Roach</select>
40