xref: /webtrees/resources/views/pending-changes-page.phtml (revision d72b284a0846ca045e548a1c77ad11813bcbab92)
1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
2dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Tree; ?>
3dd6b2bfcSGreg Roach
4dd6b2bfcSGreg Roach<h2 class="wt-page-title">
5dd6b2bfcSGreg Roach    <?= $title ?>
6dd6b2bfcSGreg Roach</h2>
7dd6b2bfcSGreg Roach
8dd6b2bfcSGreg Roach<?php if (empty($changes)) : ?>
9dd6b2bfcSGreg Roach    <p>
10dd6b2bfcSGreg Roach        <?= I18N::translate('There are no pending changes.') ?>
11dd6b2bfcSGreg Roach    </p>
12dd6b2bfcSGreg Roach    <p>
13dd6b2bfcSGreg Roach        <a class="btn btn-primary" href="<?= e($url) ?>">
14dd6b2bfcSGreg Roach            <?= I18N::translate('continue') ?>
15dd6b2bfcSGreg Roach        </a>
16dd6b2bfcSGreg Roach    </p>
17dd6b2bfcSGreg Roach<?php endif ?>
18dd6b2bfcSGreg Roach
19dd6b2bfcSGreg Roach<ul class="nav nav-tabs" role="tablist">
20dd6b2bfcSGreg Roach    <?php foreach ($changes as $tree_id => $gedcom_changes) : ?>
21dd6b2bfcSGreg Roach        <li class="nav-item">
22dd6b2bfcSGreg Roach            <a class="nav-link <?= $tree_id === $active_tree_id ? 'active' : '' ?>" data-toggle="tab" href="#tree-<?= e($tree_id) ?>" aria-controls="tree-<?= e($tree_id) ?>" id="tree-<?= e($tree_id) ?>-tab">
23cc13d6d8SGreg Roach                <?= e(Tree::findById($tree_id)->title()) ?>
24dd6b2bfcSGreg Roach                <span class="badge badge-secondary">
25dd6b2bfcSGreg Roach                <?= I18N::number(count($gedcom_changes)) ?>
26dd6b2bfcSGreg Roach            </span>
27dd6b2bfcSGreg Roach            </a>
28dd6b2bfcSGreg Roach        </li>
29dd6b2bfcSGreg Roach    <?php endforeach ?>
30dd6b2bfcSGreg Roach</ul>
31dd6b2bfcSGreg Roach
32dd6b2bfcSGreg Roach<div class="tab-content">
33dd6b2bfcSGreg Roach    <?php foreach ($changes as $tree_id => $gedcom_changes) : ?>
34dd6b2bfcSGreg Roach        <div class="tab-pane fade <?= $tree_id === $active_tree_id ? 'show active' : '' ?>" id="tree-<?= e($tree_id) ?>" role="tabpanel" aria-labelledby="tree-<?= e($tree_id) ?>-tab">
35dd6b2bfcSGreg Roach            <?php foreach ($gedcom_changes as $xref => $record_changes) : ?>
36dd6b2bfcSGreg Roach                <h3 class="pt-2">
3739ca88baSGreg Roach                    <a href="<?= e($record_changes[0]->record->url()) ?>"><?= $record_changes[0]->record->fullName() ?></a>
38dd6b2bfcSGreg Roach                </h3>
39dd6b2bfcSGreg Roach
40dd6b2bfcSGreg Roach                <table class="table table-bordered table-sm">
41dd6b2bfcSGreg Roach                    <thead class="thead-default">
42dd6b2bfcSGreg Roach                        <tr>
43dd6b2bfcSGreg Roach                            <th><?= I18N::translate('Accept') ?></th>
44dd6b2bfcSGreg Roach                            <th><?= I18N::translate('Changes') ?></th>
45dd6b2bfcSGreg Roach                            <th><?= I18N::translate('User') ?></th>
46dd6b2bfcSGreg Roach                            <th><?= I18N::translate('Date') ?></th>
47dd6b2bfcSGreg Roach                            <th><?= I18N::translate('Reject') ?></th>
48dd6b2bfcSGreg Roach                        </tr>
49dd6b2bfcSGreg Roach                    </thead>
50dd6b2bfcSGreg Roach                    <tbody>
51dd6b2bfcSGreg Roach                        <?php foreach ($record_changes as $record_change) : ?>
52dd6b2bfcSGreg Roach                            <tr>
53dd6b2bfcSGreg Roach                                <td>
54*d72b284aSGreg Roach                                    <form method="post" action="<?= e(route('accept-pending', ['change_id' => $record_change->change_id, 'xref' => $record_change->xref, 'tree' => $record_change->gedcom_name, 'url' => $url])) ?>">
55dd6b2bfcSGreg Roach                                        <?= csrf_field() ?>
56dd6b2bfcSGreg Roach                                        <button class="btn btn-primary" type="submit">
57dd6b2bfcSGreg Roach                                            <?= I18N::translate('Accept') ?>
58dd6b2bfcSGreg Roach                                        </button>
59dd6b2bfcSGreg Roach                                    </form>
60dd6b2bfcSGreg Roach                                </td>
61dd6b2bfcSGreg Roach                                <td>
6230158ae7SGreg Roach                                    <?php foreach ($record_change->record->facts() as $fact) : ?>
63dd6b2bfcSGreg Roach                                        <?php if ($fact->getTag() !== 'CHAN' && $fact->isPendingAddition()) : ?>
64dd6b2bfcSGreg Roach                                            <div class="new">
65dd6b2bfcSGreg Roach                                                <?= strip_tags($fact->summary()) ?>
66dd6b2bfcSGreg Roach                                            </div>
67dd6b2bfcSGreg Roach                                        <?php elseif ($fact->getTag() !== 'CHAN' && $fact->isPendingDeletion()) : ?>
68dd6b2bfcSGreg Roach                                            <div class="old">
69dd6b2bfcSGreg Roach                                                <?= strip_tags($fact->summary()) ?>
70dd6b2bfcSGreg Roach                                            </div>
71dd6b2bfcSGreg Roach                                        <?php endif ?>
72dd6b2bfcSGreg Roach                                    <?php endforeach ?>
73dd6b2bfcSGreg Roach                                </td>
74dd6b2bfcSGreg Roach                                <td>
75*d72b284aSGreg Roach                                    <a href="<?= e(route('message', ['to' => $record_change->user_name, 'subject' => I18N::translate('Pending changes') . ' - ' . strip_tags($record_change->record->fullName()), 'body' => $record_change->record->url(), 'tree' => $record_change->gedcom_name])) ?>" title="<?= I18N::translate('Send a message') ?>">
76dd6b2bfcSGreg Roach                                        <?= e($record_change->real_name) ?> - <?= e($record_change->user_name) ?>
77dd6b2bfcSGreg Roach                                    </a>
78dd6b2bfcSGreg Roach                                </td>
79dd6b2bfcSGreg Roach                                <td>
804459dc9aSGreg Roach                                    <?= view('components/datetime', ['timestamp' => $record_change->change_time]) ?>
81dd6b2bfcSGreg Roach                                </td>
82dd6b2bfcSGreg Roach                                <td>
83*d72b284aSGreg Roach                                    <form method="post" action="<?= e(route('reject-pending', ['change_id' => $record_change->change_id, 'xref' => $record_change->xref, 'tree' => $record_change->gedcom_name, 'url' => $url])) ?>">
84dd6b2bfcSGreg Roach                                        <?= csrf_field() ?>
85dd6b2bfcSGreg Roach                                        <button class="btn btn-secondary" type="submit">
86dd6b2bfcSGreg Roach                                            <?= I18N::translate('Reject') ?>
87dd6b2bfcSGreg Roach                                        </button>
88dd6b2bfcSGreg Roach                                    </form>
89dd6b2bfcSGreg Roach                                </td>
90dd6b2bfcSGreg Roach                            </tr>
91dd6b2bfcSGreg Roach                        <?php endforeach ?>
92dd6b2bfcSGreg Roach                    </tbody>
93dd6b2bfcSGreg Roach                </table>
94dd6b2bfcSGreg Roach            <?php endforeach ?>
95dd6b2bfcSGreg Roach
96dd6b2bfcSGreg Roach            <div class="d-flex justify-content-between">
97*d72b284aSGreg Roach                <form method="post" action="<?= e(route('accept-all-changes', ['tree' => $tree->name(), 'url' => $url])) ?>">
98dd6b2bfcSGreg Roach                    <?= csrf_field() ?>
99dd6b2bfcSGreg Roach                    <button class="btn btn-primary" type="submit">
100dd6b2bfcSGreg Roach                        <?= I18N::translate('Accept all changes') ?>
101dd6b2bfcSGreg Roach                    </button>
102dd6b2bfcSGreg Roach                </form>
103dd6b2bfcSGreg Roach
104*d72b284aSGreg Roach                <form method="post" action="<?= e(route('reject-all-changes', ['tree' => $tree->name(), 'url' => $url])) ?>">
105dd6b2bfcSGreg Roach                    <?= csrf_field() ?>
106dd6b2bfcSGreg Roach                    <button class="btn btn-secondary" type="submit" data-confirm="<?= I18N::translate('Are you sure you want to reject all the changes to this family tree?') ?>" onclick="return confirm(this.dataset.confirm);">
107dd6b2bfcSGreg Roach                        <?= I18N::translate('Reject all changes') ?>
108dd6b2bfcSGreg Roach                    </button>
109dd6b2bfcSGreg Roach                </form>
110dd6b2bfcSGreg Roach            </div>
111dd6b2bfcSGreg Roach        </div>
112dd6b2bfcSGreg Roach    <?php endforeach ?>
113dd6b2bfcSGreg Roach</div>
114