xref: /webtrees/resources/views/components/select-submission.phtml (revision 3340ecd27b8901a894bff51b7c40bfa2896a552b)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\AbstractSelect2Handler;
4use Fisharebest\Webtrees\Http\RequestHandlers\Select2Submission;
5use Fisharebest\Webtrees\Submission;
6use Fisharebest\Webtrees\Tree;
7
8/**
9 * @var string          $at "@" or "" (or unset).
10 * @var Submission|null $submission
11 * @var string|null     $class
12 * @var string|null     $id
13 * @var string          $name
14 * @var Tree            $tree
15 */
16
17$at = $at ?? '';
18
19?>
20
21<select
22    autocomplete="off"
23    class="form-select select2 <?= $class ?? '' ?>"
24    data-ajax--delay="<?= e(AbstractSelect2Handler::AJAX_DELAY) ?>"
25    data-minimum-input-length="<?= e(AbstractSelect2Handler::MINIMUM_INPUT_LENGTH) ?>"
26    data-ajax--type="POST"
27    data-ajax--url="<?= e(route(Select2Submission::class, ['tree' => $tree->name(), 'at' => $at])) ?>"
28    data-allow-clear="true"
29    data-placeholder=""
30    id="<?= e($id ?? $name) ?>"
31    name="<?= e($name) ?>"
32    <?= ($disabled ?? false) ? 'disabled' : '' ?>
33    <?= ($required ?? false) ? 'required' : '' ?>
34    style="width:100%"
35>
36    <?php if (($submission ?? null) instanceof Submission) : ?>
37        <option value="<?= e($at . $submission->xref() . $at) ?>">
38            <?= view('selects/submission', ['submission' => $submission]) ?>
39        </option>
40    <?php else : ?>
41        <option value="">&nbsp;</option>
42    <?php endif ?>
43</select>
44