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