xref: /webtrees/resources/views/admin/merge-records-step-1.phtml (revision 2ebcf907ed34213f816592af04e6c160335d6311)
1<?php
2
3use Fisharebest\Webtrees\Family;
4use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
5use Fisharebest\Webtrees\Http\RequestHandlers\ManageTrees;
6use Fisharebest\Webtrees\Http\RequestHandlers\MergeRecordsAction;
7use Fisharebest\Webtrees\I18N;
8use Fisharebest\Webtrees\Individual;
9use Fisharebest\Webtrees\Location;
10use Fisharebest\Webtrees\Media;
11use Fisharebest\Webtrees\Note;
12use Fisharebest\Webtrees\Repository;
13use Fisharebest\Webtrees\Source;
14use Fisharebest\Webtrees\Submitter;
15use Fisharebest\Webtrees\Tree;
16use Fisharebest\Webtrees\View;
17
18/**
19 * @var Family|null     $family1
20 * @var Family|null     $family2
21 * @var Individual|null $individual1
22 * @var Individual|null $individual2
23 * @var Location|null   $location1
24 * @var Location|null   $location2
25 * @var Media|null      $media1
26 * @var Media|null      $media2
27 * @var Note|null       $note1
28 * @var Note|null       $note2
29 * @var Repository|null $repository1
30 * @var Repository|null $repository2
31 * @var Source|null     $source1
32 * @var Source|null     $source2
33 * @var Submitter|null  $submitter1
34 * @var Submitter|null  $submitter2
35 * @var string          $title
36 * @var Tree            $tree
37 */
38
39?>
40
41<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ManageTrees::class, ['tree' => $tree->name()]) => I18N::translate('Manage family trees'), $title]]) ?>
42
43<h1><?= $title ?></h1>
44
45<form method="post" action="<?= e(route(MergeRecordsAction::class, ['tree' => $tree->name()])) ?>">
46    <?= csrf_field() ?>
47
48    <div class="row form-group">
49        <label class="col-sm-3 col-form-label" for="record-type">
50            <?= I18N::translate('Select two records to merge.') ?>
51        </label>
52        <div class="col-sm-9">
53            <select class="form-control" id="record-type">
54                <option value="individual"><?= I18N::translate('Individuals') ?></option>
55                <option value="family"><?= I18N::translate('Families') ?></option>
56                <option value="source"><?= I18N::translate('Sources') ?></option>
57                <option value="repository"><?= I18N::translate('Repositories') ?></option>
58                <option value="note"><?= I18N::translate('Notes') ?></option>
59                <option value="media"><?= I18N::translate('Media objects') ?></option>
60                <option value="submitter"><?= I18N::translate('Submitters') ?></option>
61                <option value="location"><?= I18N::translate('Locations') ?></option>
62            </select>
63        </div>
64    </div>
65
66    <label class="row form-group">
67        <span class="col-sm-3 col-form-label">
68            <?= I18N::translate('First record') ?>
69        </span>
70
71        <span class="col-sm-9 select-record select-individual">
72            <?= view('components/select-individual', ['name' => 'xref1', 'id' => 'individual-xref-1', 'individual' => $individual1, 'tree' => $tree]) ?>
73        </span>
74
75        <span class="col-sm-9 select-record select-family d-none">
76            <?= view('components/select-family', ['name' => 'xref1', 'id' => 'family-xref-1', 'family' => $family1, 'tree' => $tree, 'disabled' => true]) ?>
77        </span>
78
79        <span class="col-sm-9 select-record select-source d-none">
80            <?= view('components/select-source', ['name' => 'xref1', 'id' => 'source-xref-1', 'source' => $source1, 'tree' => $tree, 'disabled' => true]) ?>
81        </span>
82
83        <span class="col-sm-9 select-record select-repository d-none">
84            <?= view('components/select-repository', ['name' => 'xref1', 'id' => 'repository-xref-1', 'repository' => $repository1, 'tree' => $tree, 'disabled' => true]) ?>
85        </span>
86
87        <span class="col-sm-9 select-record select-note d-none">
88            <?= view('components/select-note', ['name' => 'xref1', 'id' => 'note-xref-1', 'note' => $note1, 'tree' => $tree, 'disabled' => true]) ?>
89        </span>
90
91        <span class="col-sm-9 select-record select-media d-none">
92            <?= view('components/select-media', ['name' => 'xref1', 'id' => 'media-xref-1', 'media' => $media1, 'tree' => $tree, 'disabled' => true]) ?>
93        </span>
94
95        <span class="col-sm-9 select-record select-submitter d-none">
96            <?= view('components/select-submitter', ['name' => 'xref1', 'id' => 'submitter-xref-1', 'submitter' => $submitter1, 'tree' => $tree, 'disabled' => true]) ?>
97        </span>
98
99        <span class="col-sm-9 select-record select-location d-none">
100            <?= view('components/select-location', ['name' => 'xref1', 'id' => 'location-xref-1', 'location' => $location1, 'tree' => $tree, 'disabled' => true]) ?>
101        </span>
102    </label>
103
104    <label class="row form-group">
105        <span class="col-sm-3 col-form-label">
106            <?= I18N::translate('Second record') ?>
107        </span>
108
109        <span class="col-sm-9 select-record select-individual">
110            <?= view('components/select-individual', ['name' => 'xref2', 'id' => 'individual-xref-2', 'individual' => $individual2, 'tree' => $tree]) ?>
111        </span>
112
113        <span class="col-sm-9 select-record select-family d-none">
114            <?= view('components/select-family', ['name' => 'xref2', 'id' => 'family-xref-2', 'family' => $family2, 'tree' => $tree, 'disabled' => true]) ?>
115        </span>
116
117        <span class="col-sm-9 select-record select-source d-none">
118            <?= view('components/select-source', ['name' => 'xref2', 'id' => 'source-xref-2', 'source' => $source2, 'tree' => $tree, 'disabled' => true]) ?>
119        </span>
120
121        <span class="col-sm-9 select-record select-repository d-none">
122            <?= view('components/select-repository', ['name' => 'xref2', 'id' => 'repository-xref-2', 'repository' => $repository2, 'tree' => $tree, 'disabled' => true]) ?>
123        </span>
124
125        <span class="col-sm-9 select-record select-note d-none">
126            <?= view('components/select-note', ['name' => 'xref2', 'id' => 'note-xref-2', 'note' => $note2, 'tree' => $tree, 'disabled' => true]) ?>
127        </span>
128
129        <span class="col-sm-9 select-record select-media d-none">
130            <?= view('components/select-media', ['name' => 'xref2', 'id' => 'media-xref-2', 'media' => $media2, 'tree' => $tree, 'disabled' => true]) ?>
131        </span>
132
133        <span class="col-sm-9 select-record select-submitter d-none">
134            <?= view('components/select-submitter', ['name' => 'xref2', 'id' => 'submitter-xref-2', 'submitter' => $submitter2, 'tree' => $tree, 'disabled' => true]) ?>
135        </span>
136
137        <span class="col-sm-9 select-record select-location d-none">
138            <?= view('components/select-location', ['name' => 'xref2', 'id' => 'location-xref-2', 'location' => $location2, 'tree' => $tree, 'disabled' => true]) ?>
139        </span>
140    </label>
141
142    <div class="row form-group">
143        <div class="col-sm-3">
144        </div>
145
146        <div class="col-sm-9">
147            <button class="btn btn-primary" type="submit">
148                <?= view('icons/save') ?>
149                <?= I18N::translate('continue') ?>
150            </button>
151        </div>
152    </div>
153</form>
154
155<?php View::push('javascript') ?>
156<script>
157  "use strict";
158
159  // Disabled elements do not get submitted with the form.
160  $("#record-type").change(function() {
161      $(".select-record").addClass('d-none');
162      $(".select-" + $(this).val()).removeClass('d-none');
163      $(".select-record select").attr("disabled", true);
164      $(".select-" + $(this).val() + " select").attr("disabled", false);
165  });
166</script>
167<?php View::endpush() ?>
168