xref: /webtrees/resources/views/pending-changes-page.phtml (revision aa6f03bb51be5a55a78fe8aed18753116689a6d3)
1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Functions\FunctionsDate; ?>
2dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
3dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Tree; ?>
4dd6b2bfcSGreg Roach
5dd6b2bfcSGreg Roach<h2 class="wt-page-title">
6dd6b2bfcSGreg Roach    <?= $title ?>
7dd6b2bfcSGreg Roach</h2>
8dd6b2bfcSGreg Roach
9dd6b2bfcSGreg Roach<?php if (empty($changes)) : ?>
10dd6b2bfcSGreg Roach    <p>
11dd6b2bfcSGreg Roach        <?= I18N::translate('There are no pending changes.') ?>
12dd6b2bfcSGreg Roach    </p>
13dd6b2bfcSGreg Roach    <p>
14dd6b2bfcSGreg Roach        <a class="btn btn-primary" href="<?= e($url) ?>">
15dd6b2bfcSGreg Roach            <?= I18N::translate('continue') ?>
16dd6b2bfcSGreg Roach        </a>
17dd6b2bfcSGreg Roach    </p>
18dd6b2bfcSGreg Roach<?php endif ?>
19dd6b2bfcSGreg Roach
20dd6b2bfcSGreg Roach<ul class="nav nav-tabs" role="tablist">
21dd6b2bfcSGreg Roach    <?php foreach ($changes as $tree_id => $gedcom_changes) : ?>
22dd6b2bfcSGreg Roach        <li class="nav-item">
23dd6b2bfcSGreg 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">
24dd6b2bfcSGreg Roach                <?= e(Tree::findById($tree_id)->getTitle()) ?>
25dd6b2bfcSGreg Roach                <span class="badge badge-secondary">
26dd6b2bfcSGreg Roach                <?= I18N::number(count($gedcom_changes)) ?>
27dd6b2bfcSGreg Roach            </span>
28dd6b2bfcSGreg Roach            </a>
29dd6b2bfcSGreg Roach        </li>
30dd6b2bfcSGreg Roach    <?php endforeach ?>
31dd6b2bfcSGreg Roach</ul>
32dd6b2bfcSGreg Roach
33dd6b2bfcSGreg Roach<div class="tab-content">
34dd6b2bfcSGreg Roach    <?php foreach ($changes as $tree_id => $gedcom_changes) : ?>
35dd6b2bfcSGreg 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">
36dd6b2bfcSGreg Roach            <?php foreach ($gedcom_changes as $xref => $record_changes) : ?>
37dd6b2bfcSGreg Roach                <h3 class="pt-2">
38dd6b2bfcSGreg Roach                    <a href="<?= e($record_changes[0]->record->url()) ?>"><?= $record_changes[0]->record->getFullName() ?></a>
39dd6b2bfcSGreg Roach                </h3>
40dd6b2bfcSGreg Roach
41dd6b2bfcSGreg Roach                <table class="table table-bordered table-sm">
42dd6b2bfcSGreg Roach                    <thead class="thead-default">
43dd6b2bfcSGreg Roach                        <tr>
44dd6b2bfcSGreg Roach                            <th><?= I18N::translate('Accept') ?></th>
45dd6b2bfcSGreg Roach                            <th><?= I18N::translate('Changes') ?></th>
46dd6b2bfcSGreg Roach                            <th><?= I18N::translate('User') ?></th>
47dd6b2bfcSGreg Roach                            <th><?= I18N::translate('Date') ?></th>
48dd6b2bfcSGreg Roach                            <th><?= I18N::translate('Reject') ?></th>
49dd6b2bfcSGreg Roach                        </tr>
50dd6b2bfcSGreg Roach                    </thead>
51dd6b2bfcSGreg Roach                    <tbody>
52dd6b2bfcSGreg Roach                        <?php foreach ($record_changes as $record_change) : ?>
53dd6b2bfcSGreg Roach                            <tr>
54dd6b2bfcSGreg Roach                                <td>
55dd6b2bfcSGreg Roach                                    <form action="<?= e(route('accept-pending', ['change_id' => $record_change->change_id, 'xref' => $record_change->xref, 'ged' => $record_change->gedcom_name, 'url' => $url])) ?>" method="POST">
56dd6b2bfcSGreg Roach                                        <?= csrf_field() ?>
57dd6b2bfcSGreg Roach                                        <button class="btn btn-primary" type="submit">
58dd6b2bfcSGreg Roach                                            <?= I18N::translate('Accept') ?>
59dd6b2bfcSGreg Roach                                        </button>
60dd6b2bfcSGreg Roach                                    </form>
61dd6b2bfcSGreg Roach                                </td>
62dd6b2bfcSGreg Roach                                <td>
63dd6b2bfcSGreg Roach                                    <?php foreach ($record_change->record->getFacts() as $fact) : ?>
64dd6b2bfcSGreg Roach                                        <?php if ($fact->getTag() !== 'CHAN' && $fact->isPendingAddition()) : ?>
65dd6b2bfcSGreg Roach                                            <div class="new">
66dd6b2bfcSGreg Roach                                                <?= strip_tags($fact->summary()) ?>
67dd6b2bfcSGreg Roach                                            </div>
68dd6b2bfcSGreg Roach                                        <?php elseif ($fact->getTag() !== 'CHAN' && $fact->isPendingDeletion()) : ?>
69dd6b2bfcSGreg Roach                                            <div class="old">
70dd6b2bfcSGreg Roach                                                <?= strip_tags($fact->summary()) ?>
71dd6b2bfcSGreg Roach                                            </div>
72dd6b2bfcSGreg Roach                                        <?php endif ?>
73dd6b2bfcSGreg Roach                                    <?php endforeach ?>
74dd6b2bfcSGreg Roach                                </td>
75dd6b2bfcSGreg Roach                                <td>
76dd6b2bfcSGreg Roach                                    <a href="<?= e(route('message', ['to' => $record_change->user_name, 'subject' => I18N::translate('Pending changes') . ' - ' . strip_tags($record_change->record->getFullName()), 'body' => WT_BASE_URL . $record_change->record->url(), 'ged' => $record_change->gedcom_name])) ?>" title="<?= I18N::translate('Send a message') ?>">
77dd6b2bfcSGreg Roach                                        <?= e($record_change->real_name) ?> - <?= e($record_change->user_name) ?>
78dd6b2bfcSGreg Roach                                    </a>
79dd6b2bfcSGreg Roach                                </td>
80dd6b2bfcSGreg Roach                                <td>
81dd6b2bfcSGreg Roach                                    <?= FunctionsDate::formatTimestamp($record_change->change_timestamp) ?>
82dd6b2bfcSGreg Roach                                </td>
83dd6b2bfcSGreg Roach                                <td>
84dd6b2bfcSGreg Roach                                    <form action="<?= e(route('reject-pending', ['change_id' => $record_change->change_id, 'xref' => $record_change->xref, 'ged' => $record_change->gedcom_name, 'url' => $url])) ?>" method="POST">
85dd6b2bfcSGreg Roach                                        <?= csrf_field() ?>
86dd6b2bfcSGreg Roach                                        <button class="btn btn-secondary" type="submit">
87dd6b2bfcSGreg Roach                                            <?= I18N::translate('Reject') ?>
88dd6b2bfcSGreg Roach                                        </button>
89dd6b2bfcSGreg Roach                                    </form>
90dd6b2bfcSGreg Roach                                </td>
91dd6b2bfcSGreg Roach                            </tr>
92dd6b2bfcSGreg Roach                        <?php endforeach ?>
93dd6b2bfcSGreg Roach                    </tbody>
94dd6b2bfcSGreg Roach                </table>
95dd6b2bfcSGreg Roach            <?php endforeach ?>
96dd6b2bfcSGreg Roach
97dd6b2bfcSGreg Roach            <div class="d-flex justify-content-between">
98*aa6f03bbSGreg Roach                <form action="<?= e(route('accept-all-changes', ['ged' => $tree->name(), 'url' => $url])) ?>" method="POST">
99dd6b2bfcSGreg Roach                    <?= csrf_field() ?>
100dd6b2bfcSGreg Roach                    <button class="btn btn-primary" type="submit">
101dd6b2bfcSGreg Roach                        <?= I18N::translate('Accept all changes') ?>
102dd6b2bfcSGreg Roach                    </button>
103dd6b2bfcSGreg Roach                </form>
104dd6b2bfcSGreg Roach
105*aa6f03bbSGreg Roach                <form action="<?= e(route('reject-all-changes', ['ged' => $tree->name(), 'url' => $url])) ?>" method="POST">
106dd6b2bfcSGreg Roach                    <?= csrf_field() ?>
107dd6b2bfcSGreg 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);">
108dd6b2bfcSGreg Roach                        <?= I18N::translate('Reject all changes') ?>
109dd6b2bfcSGreg Roach                    </button>
110dd6b2bfcSGreg Roach                </form>
111dd6b2bfcSGreg Roach            </div>
112dd6b2bfcSGreg Roach        </div>
113dd6b2bfcSGreg Roach    <?php endforeach ?>
114dd6b2bfcSGreg Roach</div>
115