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