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