10c0910bfSGreg Roach<?php 2dd6b2bfcSGreg Roach 3*10e06497SGreg Roachdeclare(strict_types=1); 4*10e06497SGreg Roach 50c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 66fd01894SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ManageTrees; 70c0910bfSGreg Roachuse Fisharebest\Webtrees\I18N; 87c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree; 944f4e696SGreg Roachuse Fisharebest\Webtrees\View; 107c2c99faSGreg Roach 117c2c99faSGreg Roach/** 128993d39aSGreg Roach * @var array<object> $errors 138993d39aSGreg Roach * @var array<object> $infos 14e669bb4bSGreg Roach * @var string $more_url 157c2c99faSGreg Roach * @var string $title 167c2c99faSGreg Roach * @var Tree $tree 178993d39aSGreg Roach * @var array<object> $warnings 187c2c99faSGreg Roach */ 190c0910bfSGreg Roach 200c0910bfSGreg Roach?> 210c0910bfSGreg Roach 226fd01894SGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ManageTrees::class, ['tree' => $tree->name()]) => I18N::translate('Manage family trees'), $title]]) ?> 23dd6b2bfcSGreg Roach 24dd6b2bfcSGreg Roach<h1><?= $title ?></h1> 25dd6b2bfcSGreg Roach 26e669bb4bSGreg Roach<h2> 27e669bb4bSGreg Roach <?= I18N::translate('GEDCOM errors') ?> 28e669bb4bSGreg Roach</h2> 29dd6b2bfcSGreg Roach 30e669bb4bSGreg Roach<ul class="list-group"> 31dd6b2bfcSGreg Roach <?php foreach ($errors as $error) : ?> 3244f4e696SGreg Roach <li class="list-group-item list-group-item-danger" data-wt-tag="<?= e($error->tag) ?>"> 338993d39aSGreg Roach <div class="row"> 348993d39aSGreg Roach <div class="col-auto"><?= $error->message ?></div> 3544f4e696SGreg Roach 368993d39aSGreg Roach <?php if ($error->tag !== '') : ?> 378993d39aSGreg Roach <div class="col-auto ms-auto"> 388993d39aSGreg Roach <button type="button" class="btn btn-link p-0 border-0"> 398993d39aSGreg Roach <?= I18N::translate('Hide these errors') ?> — <?= e($error->tag) ?> 408993d39aSGreg Roach </button> 418993d39aSGreg Roach </div> 428993d39aSGreg Roach <?php endif ?> 438993d39aSGreg Roach </div> 4444f4e696SGreg Roach </li> 45dd6b2bfcSGreg Roach <?php endforeach ?> 46dd6b2bfcSGreg Roach 47dd6b2bfcSGreg Roach <?php foreach ($warnings as $warning) : ?> 4844f4e696SGreg Roach <li class="list-group-item list-group-item-warning" data-wt-tag="<?= e($warning->tag) ?>"> 498993d39aSGreg Roach <div class="row"> 508993d39aSGreg Roach <div class="col-auto"><?= $warning->message ?></div> 5144f4e696SGreg Roach 528993d39aSGreg Roach <?php if ($warning->tag !== '') : ?> 538993d39aSGreg Roach <div class="col-auto ms-auto"> 548993d39aSGreg Roach <button type="button" class="btn btn-link p-0 border-0"> 558993d39aSGreg Roach <?= I18N::translate('Hide these errors') ?> — <?= e($warning->tag) ?> 568993d39aSGreg Roach </button> 578993d39aSGreg Roach </div> 588993d39aSGreg Roach <?php endif ?> 598993d39aSGreg Roach </div> 6044f4e696SGreg Roach </li> 61dd6b2bfcSGreg Roach <?php endforeach ?> 62dd6b2bfcSGreg Roach 6312224cf3SGreg Roach <?php foreach ($infos as $info) : ?> 6444f4e696SGreg Roach <li class="list-group-item list-group-item-info" data-wt-tag="<?= e($info->tag) ?>"> 658993d39aSGreg Roach <div class="row"> 668993d39aSGreg Roach <div class="col-auto"><?= $info->message ?></div> 6744f4e696SGreg Roach 688993d39aSGreg Roach <?php if ($info->tag !== '') : ?> 698993d39aSGreg Roach <div class="col-auto"> 708993d39aSGreg Roach <button type="button" class="btn btn-link p-0 border-0"> 718993d39aSGreg Roach <?= I18N::translate('Hide these errors') ?> — <?= e($info->tag) ?> 728993d39aSGreg Roach </button> 738993d39aSGreg Roach </div> 748993d39aSGreg Roach <?php endif ?> 758993d39aSGreg Roach </div> 7644f4e696SGreg Roach </li> 7712224cf3SGreg Roach <?php endforeach ?> 7812224cf3SGreg Roach 79075d1a05SGreg Roach <?php if ($errors === [] && $warnings === []) : ?> 80dd6b2bfcSGreg Roach <li class="list-group-item"><?= I18N::translate('No errors have been found.') ?></li> 81dd6b2bfcSGreg Roach <?php endif ?> 82dd6b2bfcSGreg Roach</ul> 83e669bb4bSGreg Roach 84e669bb4bSGreg Roach<?php if ($more_url !== '') : ?> 85e669bb4bSGreg Roach <p> 86e669bb4bSGreg Roach <?= I18N::translate('The server’s time limit has been reached.') ?> 87e669bb4bSGreg Roach <a class="btn btn-primary" href="<?= e($more_url) ?>"> 88e669bb4bSGreg Roach <?= I18N::translate('show more') ?> 89e669bb4bSGreg Roach </a> 90e669bb4bSGreg Roach </p> 91e669bb4bSGreg Roach<?php endif ?> 9244f4e696SGreg Roach 9344f4e696SGreg Roach<?php View::push('javascript') ?> 9444f4e696SGreg Roach<script> 9544f4e696SGreg Roach 'use strict'; 9644f4e696SGreg Roach 9744f4e696SGreg Roach document.querySelector('ul.list-group').addEventListener('click', (event) => { 9844f4e696SGreg Roach if (event.target.matches('button')) { 9944f4e696SGreg Roach event.preventDefault(); 10044f4e696SGreg Roach event.stopPropagation(); 10144f4e696SGreg Roach 10244f4e696SGreg Roach // Much quicker to hide elements than remove them. 10344f4e696SGreg Roach document 10444f4e696SGreg Roach .querySelectorAll('[data-wt-tag=' + CSS.escape(event.target.closest('li').dataset.wtTag) + ']') 10544f4e696SGreg Roach .forEach((element) => { element.style.display = 'none'; }); 10644f4e696SGreg Roach } 10744f4e696SGreg Roach }); 10844f4e696SGreg Roach</script> 10944f4e696SGreg Roach<?php View::endpush() ?> 110