1ca2d6785SGreg Roach<?php 2ca2d6785SGreg Roach 3ca2d6785SGreg Roachuse Fisharebest\Webtrees\I18N; 4ca2d6785SGreg Roachuse Fisharebest\Webtrees\Tree; 5ca2d6785SGreg Roachuse Illuminate\Support\Collection; 6ca2d6785SGreg Roach 7ca2d6785SGreg Roach/** 8ca2d6785SGreg Roach * @var Collection<Tree> $all_trees 9ca2d6785SGreg Roach * @var Collection<Tree> $search_trees 10ca2d6785SGreg Roach */ 11ca2d6785SGreg Roach 12ca2d6785SGreg Roach?> 13ca2d6785SGreg Roach 14ca2d6785SGreg Roach<?php if ($all_trees->count() > 1) : ?> 15315eb316SGreg Roach <fieldset class="row form-group"> 16ca2d6785SGreg Roach <div class="col-sm-3 col-form-label wt-page-options-label"> 17ca2d6785SGreg Roach <?= I18N::translate('Family trees') ?> 18ca2d6785SGreg Roach </div> 19ca2d6785SGreg Roach <div class="col-sm-9 wt-page-options-value pt-2"> 20ca2d6785SGreg Roach <div id="search-trees"> 21ca2d6785SGreg Roach <?php if ($all_trees->count() > 3): ?> 22ca2d6785SGreg Roach <div class="d-flex"> 23ca2d6785SGreg Roach <?php if ($all_trees->count() > $search_trees->count()): ?> 24315eb316SGreg Roach <div class="me-2"> 25315eb316SGreg Roach <button type="button" data-bs-toggle="collapse" class="btn btn-secondary btn-sm" href="#more-trees,#select-all" aria-expanded="false" aria-controls="more-trees"> 26ca2d6785SGreg Roach <?= view('icons/expand') ?> 27ca2d6785SGreg Roach <?= view('icons/collapse') ?> 28ca2d6785SGreg Roach </button> 29ca2d6785SGreg Roach </div> 30ca2d6785SGreg Roach <?php endif ?> 31ca2d6785SGreg Roach <div> 32ca2d6785SGreg Roach <?php foreach ($search_trees as $n => $tree) : ?> 33*d6b129cfSGreg Roach <?= view('components/checkbox', ['name' => 'search_trees[]', 'id' => 'chkbx-' . $n, 'checked' => $search_trees->containsStrict($tree), 'value' => e($tree->name()), 'label' => e($tree->title())]) ?> 34ca2d6785SGreg Roach <?php endforeach ?> 35ca2d6785SGreg Roach <div id="more-trees" class="<?= $all_trees->count() > $search_trees->count() ? 'collapse' : '' ?>"> 36ca2d6785SGreg Roach <?php foreach ($all_trees as $n => $tree) : ?> 37ca2d6785SGreg Roach <?php if (!$search_trees->containsStrict($tree)): ?> 38*d6b129cfSGreg Roach <?= view('components/checkbox', ['name' => 'search_trees[]', 'id' => 'chkbx-' . $n, 'checked' => $search_trees->containsStrict($tree), 'value' => e($tree->name()), 'label' => e($tree->title())]) ?> 39ca2d6785SGreg Roach <?php endif ?> 40ca2d6785SGreg Roach <?php endforeach ?> 41ca2d6785SGreg Roach </div> 42ca2d6785SGreg Roach </div> 43315eb316SGreg Roach <div class="ms-auto <?= $all_trees->count() > $search_trees->count() ? 'collapse' : '' ?>" id="select-all"> 44ca2d6785SGreg Roach <button type="button" class="btn btn-sm btn-secondary mx-1" onclick="document.querySelectorAll('#search-trees [type=checkbox]').forEach((element) => {element.checked=true;});"> 45ca2d6785SGreg Roach <?= /* I18N: select all (of a list of options) */ I18N::translate('select all') ?> 46ca2d6785SGreg Roach </button> 47ca2d6785SGreg Roach <button type="button" class="btn btn-sm btn-secondary mx-1" onclick="document.querySelectorAll('#search-trees [type=checkbox]').forEach((element) => {element.checked=false;});"> 48ca2d6785SGreg Roach <?= /* I18N: select none (of a list of options) */ I18N::translate('select none') ?> 49ca2d6785SGreg Roach </button> 50ca2d6785SGreg Roach <?php if ($all_trees->count() > 10) : ?> 51ca2d6785SGreg Roach <button type="button" class="btn btn-sm btn-secondary mx-1" onclick="document.querySelectorAll('#search-trees [type=checkbox]').forEach((element) => {element.checked=!element.checked;});"> 52ca2d6785SGreg Roach <?= /* I18N: reverse the selection (of a list of options) */ I18N::translate('invert selection') ?> 53ca2d6785SGreg Roach </button> 54ca2d6785SGreg Roach <?php endif ?> 55ca2d6785SGreg Roach </div> 56ca2d6785SGreg Roach </div> 57ca2d6785SGreg Roach <?php else: ?> 58ca2d6785SGreg Roach <?php foreach ($all_trees as $n => $tree) : ?> 59*d6b129cfSGreg Roach <?= view('components/checkbox-inline', ['name' => 'search_trees[]', 'id' => 'chkbx-' . $n, 'checked' => $search_trees->containsStrict($tree), 'value' => e($tree->name()), 'label' => e($tree->title())]) ?> 60ca2d6785SGreg Roach <?php endforeach ?> 61ca2d6785SGreg Roach <?php endif ?> 62ca2d6785SGreg Roach </div> 63ca2d6785SGreg Roach </div> 64ca2d6785SGreg Roach </fieldset> 65ca2d6785SGreg Roach<?php endif ?> 66