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