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