xref: /webtrees/resources/views/pending-changes-page.phtml (revision d4786c66945cca20d5ce34ac3cf08cf5a5110ae2)
122e73debSGreg Roach<?php
222e73debSGreg Roach
3e381f98dSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\MessagePage;
422e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptChange;
522e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptTree;
622e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectChange;
722e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectTree;
822e73debSGreg Roachuse Fisharebest\Webtrees\I18N;
922ad3b5bSGreg Roachuse Fisharebest\Webtrees\Tree;
1022ad3b5bSGreg Roach
1122ad3b5bSGreg Roach/**
1222ad3b5bSGreg Roach * @var array<array<stdClass>> $changes
1322ad3b5bSGreg Roach * @var int                    $count
1422ad3b5bSGreg Roach * @var string                 $title
1522ad3b5bSGreg Roach * @var Tree                   $tree
1622ad3b5bSGreg Roach * @var string                 $url
1722ad3b5bSGreg Roach */
1822e73debSGreg Roach
1922e73debSGreg Roach?>
20dd6b2bfcSGreg Roach
21dd6b2bfcSGreg Roach<h2 class="wt-page-title">
22dd6b2bfcSGreg Roach    <?= $title ?>
2322ad3b5bSGreg Roach    <?php if ($count > count($changes)): ?>
2422ad3b5bSGreg Roach<?= I18N::translate('Showing %1$s to %2$s of %3$s', I18N::number(1), I18N::number(count($changes)), I18N::number($count)) ?>
2522ad3b5bSGreg Roach    <?php endif ?>
26dd6b2bfcSGreg Roach</h2>
27dd6b2bfcSGreg Roach
2854c1ab5eSGreg Roach<?php if ($changes === []) : ?>
29dd6b2bfcSGreg Roach    <p>
30dd6b2bfcSGreg Roach        <?= I18N::translate('There are no pending changes.') ?>
31dd6b2bfcSGreg Roach    </p>
32dd6b2bfcSGreg Roach    <p>
33dd6b2bfcSGreg Roach        <a class="btn btn-primary" href="<?= e($url) ?>">
34dd6b2bfcSGreg Roach            <?= I18N::translate('continue') ?>
35dd6b2bfcSGreg Roach        </a>
36dd6b2bfcSGreg Roach    </p>
37dd6b2bfcSGreg Roach<?php endif ?>
38dd6b2bfcSGreg Roach
3922ad3b5bSGreg Roach<?php foreach ($changes as $change) : ?>
40dd6b2bfcSGreg Roach    <h3 class="pt-2">
4122ad3b5bSGreg Roach        <a href="<?= e($change[0]->record->url()) ?>"><?= $change[0]->record->fullName() ?></a>
42dd6b2bfcSGreg Roach    </h3>
43dd6b2bfcSGreg Roach
44dd6b2bfcSGreg Roach    <table class="table table-bordered table-sm">
45dd6b2bfcSGreg Roach        <thead class="thead-default">
46dd6b2bfcSGreg Roach            <tr>
47dd6b2bfcSGreg Roach                <th><?= I18N::translate('Accept') ?></th>
48dd6b2bfcSGreg Roach                <th><?= I18N::translate('Changes') ?></th>
497524d819SGreg Roach                <th><?= I18N::translate('Editor') ?></th>
50dd6b2bfcSGreg Roach                <th><?= I18N::translate('Date') ?></th>
51dd6b2bfcSGreg Roach                <th><?= I18N::translate('Reject') ?></th>
52dd6b2bfcSGreg Roach            </tr>
53dd6b2bfcSGreg Roach        </thead>
54dd6b2bfcSGreg Roach        <tbody>
5522ad3b5bSGreg Roach            <?php foreach ($change as $record_change) : ?>
56dd6b2bfcSGreg Roach                <tr>
57dd6b2bfcSGreg Roach                    <td>
58*d4786c66SGreg 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])) ?>">
59dd6b2bfcSGreg Roach                            <?= I18N::translate('Accept') ?>
6022ad3b5bSGreg Roach                        </button>
61dd6b2bfcSGreg Roach                    </td>
6222e73debSGreg Roach
63dd6b2bfcSGreg Roach                    <td>
6430158ae7SGreg Roach                        <?php foreach ($record_change->record->facts() as $fact) : ?>
65d0889c63SGreg Roach                            <?php if (!str_ends_with($fact->tag(), ':CHAN') && $fact->isPendingAddition()) : ?>
667c283925SGreg Roach                                <div class="wt-new">
67dd6b2bfcSGreg Roach                                    <?= strip_tags($fact->summary()) ?>
68dd6b2bfcSGreg Roach                                </div>
69d0889c63SGreg Roach                            <?php elseif (!str_ends_with($fact->tag(), ':CHAN') && $fact->isPendingDeletion()) : ?>
707c283925SGreg Roach                                <div class="wt-old">
71dd6b2bfcSGreg Roach                                    <?= strip_tags($fact->summary()) ?>
72dd6b2bfcSGreg Roach                                </div>
73dd6b2bfcSGreg Roach                            <?php endif ?>
74dd6b2bfcSGreg Roach                        <?php endforeach ?>
75dd6b2bfcSGreg Roach                    </td>
7622e73debSGreg Roach
77dd6b2bfcSGreg Roach                    <td>
7822ad3b5bSGreg 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') ?>">
79dd6b2bfcSGreg Roach                            <?= e($record_change->real_name) ?> - <?= e($record_change->user_name) ?>
80dd6b2bfcSGreg Roach                        </a>
81dd6b2bfcSGreg Roach                    </td>
8222e73debSGreg Roach
83dd6b2bfcSGreg Roach                    <td>
844459dc9aSGreg Roach                        <?= view('components/datetime', ['timestamp' => $record_change->change_time]) ?>
85dd6b2bfcSGreg Roach                    </td>
8622e73debSGreg Roach
87dd6b2bfcSGreg Roach                    <td>
88*d4786c66SGreg 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])) ?>">
89dd6b2bfcSGreg Roach                            <?= I18N::translate('Reject') ?>
9022ad3b5bSGreg Roach                        </button>
91dd6b2bfcSGreg Roach                    </td>
92dd6b2bfcSGreg Roach                </tr>
93dd6b2bfcSGreg Roach            <?php endforeach ?>
94dd6b2bfcSGreg Roach        </tbody>
95dd6b2bfcSGreg Roach    </table>
96dd6b2bfcSGreg Roach<?php endforeach ?>
97dd6b2bfcSGreg Roach
98ba7c3e26SGreg Roach<?php if ($changes !== []) : ?>
99dd6b2bfcSGreg Roach    <div class="d-flex justify-content-between">
100*d4786c66SGreg Roach        <button type="button" class="btn btn-primary" data-wt-post-url="<?= e(route(PendingChangesAcceptTree::class, ['tree' => $tree->name(), 'n' => count($changes)])) ?>">
101dd6b2bfcSGreg Roach            <?= I18N::translate('Accept all changes') ?>
10222ad3b5bSGreg Roach        </button>
103dd6b2bfcSGreg Roach
104*d4786c66SGreg 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?') ?>">
105dd6b2bfcSGreg Roach            <?= I18N::translate('Reject all changes') ?>
10622ad3b5bSGreg Roach        </button>
107dd6b2bfcSGreg Roach    </div>
108ba7c3e26SGreg Roach<?php endif ?>
109