xref: /webtrees/resources/views/admin/merge-records-step-1.phtml (revision e87930af40cff2c02454da9cc34bcc9160779aa8)
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            </select>
30        </div>
31    </div>
32
33    <label class="row form-group">
34        <span class="col-sm-3 col-form-label">
35            <?= I18N::translate('First record') ?>
36        </span>
37
38        <span class="col-sm-9 select-record select-individual">
39            <?= view('components/select-individual', ['name' => 'xref1', 'id' => 'indi-xref-1', 'individual' => $individual1, 'tree' => $tree]) ?>
40        </span>
41
42        <span class="col-sm-9 select-record select-family d-none">
43            <?= view('components/select-family', ['name' => 'xref1', 'id' => 'fam-xref-1', 'family' => $family1, 'tree' => $tree, 'disabled' => true]) ?>
44        </span>
45
46        <span class="col-sm-9 select-record select-source d-none">
47            <?= view('components/select-source', ['name' => 'xref1', 'id' => 'sour-xref-1', 'source' => $source1, 'tree' => $tree, 'disabled' => true]) ?>
48        </span>
49
50        <span class="col-sm-9 select-record select-repository d-none">
51            <?= view('components/select-repository', ['name' => 'xref1', 'id' => 'repo-xref-1', 'repository' => $repository1, 'tree' => $tree, 'disabled' => true]) ?>
52        </span>
53
54        <span class="col-sm-9 select-record select-note d-none">
55            <?= view('components/select-note', ['name' => 'xref1', 'id' => 'note-xref-1', 'note' => $note1, 'tree' => $tree, 'disabled' => true]) ?>
56        </span>
57
58        <span class="col-sm-9 select-record select-media d-none">
59            <?= view('components/select-media', ['name' => 'xref1', 'id' => 'media-xref-1', 'media' => $media1, 'tree' => $tree, 'disabled' => true]) ?>
60        </span>
61    </label>
62
63    <label class="row form-group">
64        <span class="col-sm-3 col-form-label">
65            <?= I18N::translate('Second record') ?>
66        </span>
67
68        <span class="col-sm-9 select-record select-individual">
69            <?= view('components/select-individual', ['name' => 'xref2', 'id' => 'indi-xref-2', 'individual' => $individual2, 'tree' => $tree]) ?>
70        </span>
71
72        <span class="col-sm-9 select-record select-family d-none">
73            <?= view('components/select-family', ['name' => 'xref2', 'id' => 'fam-xref-2', 'family' => $family2, 'tree' => $tree, 'disabled' => true]) ?>
74        </span>
75
76        <span class="col-sm-9 select-record select-source d-none">
77            <?= view('components/select-source', ['name' => 'xref2', 'id' => 'sour-xref-2', 'source' => $source2, 'tree' => $tree, 'disabled' => true]) ?>
78        </span>
79
80        <span class="col-sm-9 select-record select-repository d-none">
81            <?= view('components/select-repository', ['name' => 'xref2', 'id' => 'repo-xref-2', 'repository' => $repository2, 'tree' => $tree, 'disabled' => true]) ?>
82        </span>
83
84        <span class="col-sm-9 select-record select-note d-none">
85            <?= view('components/select-note', ['name' => 'xref2', 'id' => 'note-xref-2', 'note' => $note2, 'tree' => $tree, 'disabled' => true]) ?>
86        </span>
87
88        <span class="col-sm-9 select-record select-media d-none">
89            <?= view('components/select-media', ['name' => 'xref2', 'id' => 'obje-xref-2', 'media' => $media2, 'tree' => $tree, 'disabled' => true]) ?>
90        </span>
91    </label>
92
93    <div class="row form-group">
94        <div class="col-sm-3">
95        </div>
96
97        <div class="col-sm-9">
98            <button class="btn btn-primary" type="submit">
99                <?= view('icons/save') ?>
100                <?= I18N::translate('continue') ?>
101            </button>
102        </div>
103    </div>
104</form>
105
106<?php View::push('javascript') ?>
107<script>
108  "use strict";
109
110  // Disabled elements do not get submitted with the form.
111  $("#record-type").change(function() {
112      $(".select-record").addClass('d-none');
113      $(".select-" + $(this).val()).removeClass('d-none');
114      $(".select-record select").attr("disabled", true);
115      $(".select-" + $(this).val() + " select").attr("disabled", false);
116  });
117</script>
118<?php View::endpush() ?>
119