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