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