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