xref: /webtrees/resources/views/components/select-submission.phtml (revision b55cbc6b43247e8b2ad14af6f6d24dc6747195ff)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\TomSelectSubmission;
4use Fisharebest\Webtrees\Submission;
5use Fisharebest\Webtrees\Tree;
6
7/**
8 * @var string          $at "@" or "" (or unset).
9 * @var Submission|null $submission
10 * @var string|null     $class
11 * @var string|null     $id
12 * @var string          $name
13 * @var Tree            $tree
14 */
15
16$at = $at ?? '';
17
18?>
19
20<select
21    autocomplete="off"
22    class="form-select tom-select <?= $class ?? '' ?>"
23    data-ajax-type="POST"
24    data-ajax--url="<?= e(route(TomSelectSubmission::class, ['tree' => $tree->name(), 'at' => $at])) ?>"
25    id="<?= e($id ?? $name) ?>"
26    name="<?= e($name) ?>"
27    <?= ($disabled ?? false) ? 'disabled="disabled"' : '' ?>
28    <?= ($required ?? false) ? 'required="required"' : '' ?>
29>
30    <?php if (($submission ?? null) instanceof Submission) : ?>
31        <option value="<?= e($at . $submission->xref() . $at) ?>">
32            <?= view('selects/submission', ['submission' => $submission]) ?>
33        </option>
34    <?php else : ?>
35        <option value="">&nbsp;</option>
36    <?php endif ?>
37</select>
38