xref: /webtrees/resources/views/admin/merge-records-step-1.phtml (revision 0115bc1678cafd957052cd2d256563ad3e242cc1)
1<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3<?php use Fisharebest\Webtrees\View; ?>
4
5<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-trees') => I18N::translate('Manage family trees'), $title]]) ?>
6
7<h1><?= $title ?></h1>
8
9<form>
10    <input type="hidden" name="route" value="merge-records">
11    <input type="hidden" name="ged" value="<?= e($tree->name()) ?>">
12    <div class="row form-group">
13        <label class="col-sm-3 col-form-label" for="record-type">
14            <?= I18N::translate('Select two records to merge.') ?>
15        </label>
16        <div class="col-sm-9">
17            <select class="form-control" id="record-type">
18                <option value="individual"><?= I18N::translate('Individuals') ?></option>
19                <option value="family"><?= I18N::translate('Families') ?></option>
20                <option value="source"><?= I18N::translate('Sources') ?></option>
21                <option value="repository"><?= I18N::translate('Repositories') ?></option>
22                <option value="note"><?= I18N::translate('Notes') ?></option>
23                <option value="media"><?= I18N::translate('Media objects') ?></option>
24            </select>
25        </div>
26    </div>
27
28    <label class="row form-group">
29        <span class="col-sm-3 col-form-label">
30            <?= I18N::translate('First record') ?>
31        </span>
32        <span class="col-sm-9 select-record select-individual">
33            <?= FunctionsEdit::formControlIndividual($tree, $individual1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;']) ?>
34        </span>
35        <span class="col-sm-9 select-record select-family d-none">
36            <?= FunctionsEdit::formControlFamily($tree, $family1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
37        </span>
38        <span class="col-sm-9 select-record select-source d-none">
39            <?= FunctionsEdit::formControlSource($tree, $source1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
40        </span>
41        <span class="col-sm-9 select-record select-repository d-none">
42            <?= FunctionsEdit::formControlRepository($tree, $repository1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
43        </span>
44        <span class="col-sm-9 select-record select-note d-none">
45            <?= FunctionsEdit::formControlNote($tree, $note1, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
46        </span>
47        <span class="col-sm-9 select-record select-media d-none">
48            <?= FunctionsEdit::formControlMediaObject($tree, $media2, ['name' => 'xref1', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
49        </span>
50    </label>
51
52    <label class="row form-group">
53        <span class="col-sm-3 col-form-label">
54            <?= I18N::translate('Second record') ?>
55        </span>
56        <span class="col-sm-9 select-record select-individual">
57            <?= FunctionsEdit::formControlIndividual($tree, $individual2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;']) ?>
58        </span>
59        <span class="col-sm-9 select-record select-family d-none">
60            <?= FunctionsEdit::formControlFamily($tree, $family2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
61        </span>
62        <span class="col-sm-9 select-record select-source d-none">
63            <?= FunctionsEdit::formControlSource($tree, $source2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
64        </span>
65        <span class="col-sm-9 select-record select-repository d-none">
66            <?= FunctionsEdit::formControlRepository($tree, $repository2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
67        </span>
68        <span class="col-sm-9 select-record select-note d-none">
69            <?= FunctionsEdit::formControlNote($tree, $note2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
70        </span>
71        <span class="col-sm-9 select-record select-media d-none">
72            <?= FunctionsEdit::formControlMediaObject($tree, $media2, ['name' => 'xref2', 'class' => 'form-control', 'style' => 'width:100%;', 'disabled' => true]) ?>
73        </span>
74    </label>
75
76    <div class="row form-group">
77        <div class="col-sm-3">
78        </div>
79        <div class="col-sm-9">
80            <button class="btn btn-primary" type="submit">
81            <?= view('icons/save') ?>
82                <?= I18N::translate('continue') ?>
83            </button>
84        </div>
85    </div>
86</form>
87
88<?php View::push('javascript') ?>
89<script>
90  'use strict';
91
92  // Disabled elements do not get submitted with the form.
93  $('#record-type').change(function() {
94    $('.select-record').addClass('d-none').attr("disabled", true);
95    $('.select-' + $(this).val()).removeClass('d-none').attr("disabled", false);
96    // Recalculate width of previously hidden elements
97  });
98</script>
99<?php View::endpush() ?>
100