xref: /webtrees/resources/views/components/select-submission.phtml (revision 9dcd14745b56f6fe4313ffc54cb41b25d2dcc9fd)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\AbstractTomSelectHandler;
4use Fisharebest\Webtrees\Http\RequestHandlers\TomSelectSubmission;
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 tom-select <?= $class ?? '' ?>"
24    data-ajax-type="POST"
25    data-ajax--url="<?= e(route(TomSelectSubmission::class, ['tree' => $tree->name(), 'at' => $at])) ?>"
26    id="<?= e($id ?? $name) ?>"
27    name="<?= e($name) ?>"
28    <?= ($disabled ?? false) ? 'disabled="disabled"' : '' ?>
29    <?= ($required ?? false) ? 'required="required"' : '' ?>
30>
31    <?php if (($submission ?? null) instanceof Submission) : ?>
32        <option value="<?= e($at . $submission->xref() . $at) ?>">
33            <?= view('selects/submission', ['submission' => $submission]) ?>
34        </option>
35    <?php else : ?>
36        <option value="">&nbsp;</option>
37    <?php endif ?>
38</select>
39