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