xref: /webtrees/resources/views/modules/relationships-chart/page.phtml (revision 26420f84cb96928cdc566963a4499db677a38ff9)
1<?php use Fisharebest\Webtrees\I18N; ?>
2<?php use Fisharebest\Webtrees\View; ?>
3
4<h2 class="wt-page-title">
5    <?= $title ?>
6</h2>
7
8<form class="wt-page-options wt-page-options-relationships-chart d-print-none">
9    <input type="hidden" name="route" value="module">
10    <input type="hidden" name="module" value="<?= e($module_name) ?>">
11    <input type="hidden" name="action" value="Chart">
12    <input type="hidden" name="ged" value="<?= e($tree->name()) ?>">
13
14    <div class="row form-group">
15        <label class="col-sm-3 col-form-label wt-page-options-label" for="xref">
16            <?= I18N::translate('Individual 1') ?>
17        </label>
18        <div class="col-sm-9 wt-page-options-value">
19            <?= view('components/select-individual', ['name' => 'xref', 'individual' => $individual1, 'tree' => $tree]) ?>
20        </div>
21    </div>
22
23    <div class="row form-group">
24        <label class="col-sm-3 col-form-label wt-page-options-label" for="xref2">
25            <?= I18N::translate('Individual 2') ?>
26        </label>
27        <div class="col-sm-9 wt-page-options-value">
28            <?= view('components/select-individual', ['name' => 'xref2', 'individual' => $individual2, 'tree' => $tree]) ?>
29        </div>
30    </div>
31
32    <fieldset class="form-group">
33        <div class="row">
34            <legend class="col-form-label col-sm-3 wt-page-options-label">
35            </legend>
36            <div class="col-sm-9 wt-page-options-value">
37                <?php if ($ancestors_only) : ?>
38                    <input type="hidden" name="ancestors" value="1">
39                    <?= I18N::translate('Find relationships via ancestors') ?>
40                <?php else : ?>
41                    <?= view('components/radios', ['name' => 'ancestors', 'options' => $ancestors_options, 'selected' => $ancestors]) ?>
42                <?php endif ?>
43            </div>
44        </div>
45    </fieldset>
46
47    <fieldset class="form-group">
48        <div class="row">
49            <legend class="col-form-label col-sm-3 wt-page-options-label">
50            </legend>
51            <div class="col-sm-9 wt-page-options-value">
52                <?php if ($max_recursion === 0) : ?>
53                    <?= I18N::translate('Find the closest relationships') ?>
54                    <input type="hidden" name="recursion" value="0">
55                <?php else : ?>
56                    <?= view('components/radios', ['name' => 'recursion', 'options' => $recursion_options, 'selected' => $recursion]) ?>
57                <?php endif ?>
58            </div>
59        </div>
60    </fieldset>
61
62    <div class="row form-group">
63        <div class="col-form-label col-sm-3 wt-page-options-label"></div>
64        <div class="col-sm-9 wt-page-options-value">
65            <button class="btn btn-primary" type="submit">
66                <?= /* I18N: A button label. */ I18N::translate('view') ?>
67            </button>
68
69            <button class="btn btn-link" id="btn-swap-individuals" type="button">
70                <?= /* I18N: Reverse the order of two individuals */
71                I18N::translate('Swap individuals') ?>
72            </button>
73        </div>
74    </div>
75</form>
76
77<?php if ($individual1 !== null && $individual2 !== null) : ?>
78    <div class="wt-ajax-load wt-page-content wt-chart wt-chart-relationships" data-ajax-url="<?= e($ajax_url) ?>"></div>
79<?php endif ?>
80
81<?php View::push('javascript') ?>
82<script>
83  $('#btn-swap-individuals').click(function () {
84      // Swap the name attributes
85      document.getElementById("xref").name = "xref2";
86      document.getElementById("xref2").name = "xref";
87      document.querySelector(".wt-page-options-relationships-chart").submit();
88  });
89</script>
90<?php View::endpush() ?>
91