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