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