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