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