122e73debSGreg Roach<?php 222e73debSGreg Roach 3*10e06497SGreg Roachdeclare(strict_types=1); 4*10e06497SGreg Roach 5e381f98dSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MessagePage; 622e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptChange; 722e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptTree; 822e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectChange; 922e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectTree; 1022e73debSGreg Roachuse Fisharebest\Webtrees\I18N; 1122ad3b5bSGreg Roachuse Fisharebest\Webtrees\Tree; 1222ad3b5bSGreg Roach 1322ad3b5bSGreg Roach/** 14f70bcff5SGreg Roach * @var array<array<object>> $changes 1522ad3b5bSGreg Roach * @var int $count 1622ad3b5bSGreg Roach * @var string $title 1722ad3b5bSGreg Roach * @var Tree $tree 1822ad3b5bSGreg Roach * @var string $url 1922ad3b5bSGreg Roach */ 2022e73debSGreg Roach 2122e73debSGreg Roach?> 22dd6b2bfcSGreg Roach 23dd6b2bfcSGreg Roach<h2 class="wt-page-title"> 24dd6b2bfcSGreg Roach <?= $title ?> 2522ad3b5bSGreg Roach <?php if ($count > count($changes)) : ?> 2622ad3b5bSGreg Roach — <?= I18N::translate('Showing %1$s to %2$s of %3$s', I18N::number(1), I18N::number(count($changes)), I18N::number($count)) ?> 2722ad3b5bSGreg Roach <?php endif ?> 28dd6b2bfcSGreg Roach</h2> 29dd6b2bfcSGreg Roach 3054c1ab5eSGreg Roach<?php if ($changes === []) : ?> 31dd6b2bfcSGreg Roach <p> 32dd6b2bfcSGreg Roach <?= I18N::translate('There are no pending changes.') ?> 33dd6b2bfcSGreg Roach </p> 34dd6b2bfcSGreg Roach <p> 35dd6b2bfcSGreg Roach <a class="btn btn-primary" href="<?= e($url) ?>"> 36dd6b2bfcSGreg Roach <?= I18N::translate('continue') ?> 37dd6b2bfcSGreg Roach </a> 38dd6b2bfcSGreg Roach </p> 39dd6b2bfcSGreg Roach<?php endif ?> 40dd6b2bfcSGreg Roach 4122ad3b5bSGreg Roach<?php foreach ($changes as $change) : ?> 42dd6b2bfcSGreg Roach <h3 class="pt-2"> 4322ad3b5bSGreg Roach <a href="<?= e($change[0]->record->url()) ?>"><?= $change[0]->record->fullName() ?></a> 44dd6b2bfcSGreg Roach </h3> 45dd6b2bfcSGreg Roach 46dd6b2bfcSGreg Roach <table class="table table-bordered table-sm"> 47dd6b2bfcSGreg Roach <thead class="thead-default"> 48dd6b2bfcSGreg Roach <tr> 49dd6b2bfcSGreg Roach <th><?= I18N::translate('Accept') ?></th> 50dd6b2bfcSGreg Roach <th><?= I18N::translate('Changes') ?></th> 517524d819SGreg Roach <th><?= I18N::translate('Editor') ?></th> 52dd6b2bfcSGreg Roach <th><?= I18N::translate('Date') ?></th> 53dd6b2bfcSGreg Roach <th><?= I18N::translate('Reject') ?></th> 54dd6b2bfcSGreg Roach </tr> 55dd6b2bfcSGreg Roach </thead> 56dd6b2bfcSGreg Roach <tbody> 5722ad3b5bSGreg Roach <?php foreach ($change as $record_change) : ?> 58dd6b2bfcSGreg Roach <tr> 59dd6b2bfcSGreg Roach <td> 60d4786c66SGreg Roach <button type="button" class="btn btn-primary" data-wt-post-url="<?= e(route(PendingChangesAcceptChange::class, ['tree' => $tree->name(), 'xref' => $record_change->xref, 'change' => $record_change->change_id])) ?>"> 61dd6b2bfcSGreg Roach <?= I18N::translate('Accept') ?> 6222ad3b5bSGreg Roach </button> 63dd6b2bfcSGreg Roach </td> 6422e73debSGreg Roach 65dd6b2bfcSGreg Roach <td> 6630158ae7SGreg Roach <?php foreach ($record_change->record->facts() as $fact) : ?> 67d0889c63SGreg Roach <?php if (!str_ends_with($fact->tag(), ':CHAN') && $fact->isPendingAddition()) : ?> 687c283925SGreg Roach <div class="wt-new"> 69dd6b2bfcSGreg Roach <?= strip_tags($fact->summary()) ?> 70dd6b2bfcSGreg Roach </div> 71d0889c63SGreg Roach <?php elseif (!str_ends_with($fact->tag(), ':CHAN') && $fact->isPendingDeletion()) : ?> 727c283925SGreg Roach <div class="wt-old"> 73dd6b2bfcSGreg Roach <?= strip_tags($fact->summary()) ?> 74dd6b2bfcSGreg Roach </div> 75dd6b2bfcSGreg Roach <?php endif ?> 76dd6b2bfcSGreg Roach <?php endforeach ?> 77dd6b2bfcSGreg Roach </td> 7822e73debSGreg Roach 79dd6b2bfcSGreg Roach <td> 8022ad3b5bSGreg Roach <a href="<?= e(route(MessagePage::class, ['to' => $record_change->user_name, 'subject' => I18N::translate('Pending changes') . ' - ' . strip_tags($record_change->record->fullName()), 'body' => $record_change->record->url(), 'tree' => $tree->name()])) ?>" title="<?= I18N::translate('Send a message') ?>"> 81dd6b2bfcSGreg Roach <?= e($record_change->real_name) ?> - <?= e($record_change->user_name) ?> 82dd6b2bfcSGreg Roach </a> 83dd6b2bfcSGreg Roach </td> 8422e73debSGreg Roach 85dd6b2bfcSGreg Roach <td> 864459dc9aSGreg Roach <?= view('components/datetime', ['timestamp' => $record_change->change_time]) ?> 87dd6b2bfcSGreg Roach </td> 8822e73debSGreg Roach 89dd6b2bfcSGreg Roach <td> 90d4786c66SGreg Roach <button type="button" class="btn btn-secondary" data-wt-post-url="<?= e(route(PendingChangesRejectChange::class, ['tree' => $tree->name(), 'xref' => $record_change->xref, 'change' => $record_change->change_id])) ?>"> 91dd6b2bfcSGreg Roach <?= I18N::translate('Reject') ?> 9222ad3b5bSGreg Roach </button> 93dd6b2bfcSGreg Roach </td> 94dd6b2bfcSGreg Roach </tr> 95dd6b2bfcSGreg Roach <?php endforeach ?> 96dd6b2bfcSGreg Roach </tbody> 97dd6b2bfcSGreg Roach </table> 98dd6b2bfcSGreg Roach<?php endforeach ?> 99dd6b2bfcSGreg Roach 100ba7c3e26SGreg Roach<?php if ($changes !== []) : ?> 101dd6b2bfcSGreg Roach <div class="d-flex justify-content-between"> 102d4786c66SGreg Roach <button type="button" class="btn btn-primary" data-wt-post-url="<?= e(route(PendingChangesAcceptTree::class, ['tree' => $tree->name(), 'n' => count($changes)])) ?>"> 103dd6b2bfcSGreg Roach <?= I18N::translate('Accept all changes') ?> 10422ad3b5bSGreg Roach </button> 105dd6b2bfcSGreg Roach 106d4786c66SGreg Roach <button type="button" class="btn btn-secondary" data-wt-post-url="<?= e(route(PendingChangesRejectTree::class, ['tree' => $tree->name()])) ?>" data-wt-confirm="<?= I18N::translate('Are you sure you want to reject all the changes to this family tree?') ?>"> 107dd6b2bfcSGreg Roach <?= I18N::translate('Reject all changes') ?> 10822ad3b5bSGreg Roach </button> 109dd6b2bfcSGreg Roach </div> 110ba7c3e26SGreg Roach<?php endif ?> 111