xref: /webtrees/resources/views/admin/merge-records-step-2.phtml (revision a489bbce63e2bf20b248a715bda61beff646f1e7)
1<?php
2
3use Fisharebest\Webtrees\GedcomRecord;
4use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
5use Fisharebest\Webtrees\Http\RequestHandlers\ManageTrees;
6use Fisharebest\Webtrees\Http\RequestHandlers\MergeFactsAction;
7use Fisharebest\Webtrees\I18N;
8
9?>
10
11<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ManageTrees::class, ['tree' => $tree->name()]) => I18N::translate('Manage family trees'), $title]]) ?>
12
13<h1><?= $title ?></h1>
14
15<form method="post" action="<?= e(route(MergeFactsAction::class, ['tree' => $tree->name()])) ?>">
16    <?= csrf_field() ?>
17
18    <input type="hidden" name="xref1" value="<?= e($record1->xref()) ?>">
19    <input type="hidden" name="xref2" value="<?= e($record2->xref()) ?>">
20
21    <p>
22        <?= I18N::translate('Select the facts and events to keep from both records.') ?>
23    </p>
24    <div class="card mb-4">
25        <div class="card-header">
26            <h2 class="card-title">
27                <?= I18N::translate('The following facts and events were found in both records.') ?>
28            </h2>
29        </div>
30        <div class="card-body">
31            <?php if ($facts !== []) : ?>
32                <table class="table table-bordered table-sm">
33                    <thead>
34                        <tr>
35                            <th>
36                                <?= I18N::translate('Select') ?>
37                            </th>
38                            <th>
39                                <?= I18N::translate('Details') ?>
40                            </th>
41                        </tr>
42                    </thead>
43                    <tbody>
44                        <?php foreach ($facts as $fact_id => $fact) : ?>
45                            <tr>
46                                <td>
47                                    <input type="checkbox" name="keep1[]" value="<?= $fact->id() ?>" checked>
48                                </td>
49                                <td>
50                                    <div class="gedcom-data" dir="ltr"><?= e($fact->gedcom()) ?></div>
51                                    <?php if ($fact->target() instanceof GedcomRecord) : ?>
52                                        <a href="<?= e($fact->target()->url()) ?>">
53                                            <?= $fact->target()->fullName() ?>
54                                        </a>
55                                    <?php endif ?>
56                                </td>
57                            </tr>
58                        <?php endforeach ?>
59                    </tbody>
60                </table>
61            <?php else : ?>
62                <p>
63                    <?= I18N::translate('No matching facts found') ?>
64                </p>
65            <?php endif ?>
66        </div>
67    </div>
68
69    <div class="row">
70        <div class="col-sm-6">
71            <div class="card">
72                <div class="card-header">
73                    <h2 class="card-title">
74                        <?= /* I18N: the name of an individual, source, etc. */ I18N::translate('The following facts and events were only found in the record of %s.', '<a href="' . e($record1->url()) . '">' . $record1->fullName()) . '</a>' ?>
75                    </h2>
76                </div>
77                <div class="card-body">
78                    <?php if ($facts1 !== []) : ?>
79                        <table class="table table-bordered table-sm">
80                            <thead>
81                                <tr>
82                                    <th>
83                                        <?= I18N::translate('Select') ?>
84                                    </th>
85                                    <th>
86                                        <?= I18N::translate('Details') ?>
87                                    </th>
88                                </tr>
89                            </thead>
90                            <tbody>
91                                <?php foreach ($facts1 as $fact_id => $fact) : ?>
92                                    <tr>
93                                        <td>
94                                            <input type="checkbox" name="keep1[]" value="<?= $fact->id() ?>" checked>
95                                        </td>
96                                        <td>
97                                            <div class="gedcom-data" dir="ltr"><?= e($fact->gedcom()) ?></div>
98                                            <?php if ($fact->target() instanceof GedcomRecord) : ?>
99                                                <a href="<?= e($fact->target()->url()) ?>">
100                                                    <?= $fact->target()->fullName() ?>
101                                                </a>
102                                            <?php endif ?>
103                                        </td>
104                                    </tr>
105                                <?php endforeach ?>
106                            </tbody>
107                        </table>
108                    <?php else : ?>
109                        <p>
110                            <?= I18N::translate('No matching facts found') ?>
111                        </p>
112                    <?php endif ?>
113                </div>
114            </div>
115        </div>
116        <div class="col-sm-6">
117            <div class="card">
118                <div class="card-header">
119                    <h2 class="card-title">
120                        <?= /* I18N: the name of an individual, source, etc. */ I18N::translate('The following facts and events were only found in the record of %s.', '<a href="' . e($record2->url()) . '">' . $record2->fullName()) . '</a>' ?>
121                    </h2>
122                </div>
123                <div class="card-body">
124                    <?php if ($facts2 !== []) : ?>
125                        <table class="table table-bordered table-sm">
126                            <thead>
127                                <tr>
128                                    <th>
129                                        <?= I18N::translate('Select') ?>
130                                    </th>
131                                    <th>
132                                        <?= I18N::translate('Details') ?>
133                                    </th>
134                                </tr>
135                            </thead>
136                            <tbody>
137                                <?php foreach ($facts2 as $fact_id => $fact) : ?>
138                                    <tr>
139                                        <td>
140                                            <input type="checkbox" name="keep2[]" value="<?= $fact->id() ?>" checked>
141                                        </td>
142                                        <td>
143                                            <div class="gedcom-data" dir="ltr"><?= e($fact->gedcom()) ?></div>
144                                            <?php if ($fact->target() instanceof GedcomRecord) : ?>
145                                                <a href="<?= e($fact->target()->url()) ?>">
146                                                    <?= $fact->target()->fullName() ?>
147                                                </a>
148                                            <?php endif ?>
149                                        </td>
150                                    </tr>
151                                <?php endforeach ?>
152                            </tbody>
153                        </table>
154                    <?php else : ?>
155                        <p>
156                            <?= I18N::translate('No matching facts found') ?>
157                        </p>
158                    <?php endif ?>
159                </div>
160            </div>
161        </div>
162    </div>
163
164    <button type="submit" class="btn btn-primary">
165        <?= view('icons/save') ?>
166        <?= I18N::translate('save') ?>
167    </button>
168</form>
169