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