xref: /webtrees/resources/views/modules/relationships-chart/page.phtml (revision 00efc03c94e245fd7e9a6c7367fdfc2f6bfcf1af)
171378461SGreg Roach<?php
23cfcc809SGreg Roach
371378461SGreg Roachuse Fisharebest\Webtrees\I18N;
471378461SGreg Roachuse Fisharebest\Webtrees\View;
53cfcc809SGreg Roach
671378461SGreg Roach?>
79b5537c3SGreg Roach
89b5537c3SGreg Roach<h2 class="wt-page-title">
99b5537c3SGreg Roach    <?= $title ?>
109b5537c3SGreg Roach</h2>
119b5537c3SGreg Roach
1271378461SGreg Roach<form method="post" class="wt-page-options wt-page-options-relationships-chart d-print-none">
1371378461SGreg Roach    <?= csrf_field() ?>
149b5537c3SGreg Roach
159b5537c3SGreg Roach    <div class="row form-group">
163dcc812bSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="xref">
179b5537c3SGreg Roach            <?= I18N::translate('Individual 1') ?>
189b5537c3SGreg Roach        </label>
199b5537c3SGreg Roach        <div class="col-sm-9 wt-page-options-value">
20*00efc03cSGreg Roach            <?= view('components/select-individual', ['name' => 'xref', 'individual' => $individual1, 'tree' => $tree, 'required' => true]) ?>
219b5537c3SGreg Roach        </div>
229b5537c3SGreg Roach    </div>
239b5537c3SGreg Roach
249b5537c3SGreg Roach    <div class="row form-group">
259b5537c3SGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="xref2">
269b5537c3SGreg Roach            <?= I18N::translate('Individual 2') ?>
279b5537c3SGreg Roach        </label>
289b5537c3SGreg Roach        <div class="col-sm-9 wt-page-options-value">
29*00efc03cSGreg Roach            <?= view('components/select-individual', ['name' => 'xref2', 'individual' => $individual2, 'tree' => $tree, 'required' => true]) ?>
309b5537c3SGreg Roach        </div>
319b5537c3SGreg Roach    </div>
329b5537c3SGreg Roach
339b5537c3SGreg Roach    <fieldset class="form-group">
349b5537c3SGreg Roach        <div class="row">
359b5537c3SGreg Roach            <legend class="col-form-label col-sm-3 wt-page-options-label">
369b5537c3SGreg Roach            </legend>
379b5537c3SGreg Roach            <div class="col-sm-9 wt-page-options-value">
389b5537c3SGreg Roach                <?php if ($ancestors_only) : ?>
399b5537c3SGreg Roach                    <input type="hidden" name="ancestors" value="1">
409b5537c3SGreg Roach                    <?= I18N::translate('Find relationships via ancestors') ?>
419b5537c3SGreg Roach                <?php else : ?>
42b6c326d8SGreg Roach                    <?= view('components/radios', ['name' => 'ancestors', 'options' => $ancestors_options, 'selected' => $ancestors]) ?>
439b5537c3SGreg Roach                <?php endif ?>
449b5537c3SGreg Roach            </div>
459b5537c3SGreg Roach        </div>
469b5537c3SGreg Roach    </fieldset>
479b5537c3SGreg Roach
489b5537c3SGreg Roach    <fieldset class="form-group">
499b5537c3SGreg Roach        <div class="row">
509b5537c3SGreg Roach            <legend class="col-form-label col-sm-3 wt-page-options-label">
519b5537c3SGreg Roach            </legend>
529b5537c3SGreg Roach            <div class="col-sm-9 wt-page-options-value">
539b5537c3SGreg Roach                <?php if ($max_recursion === 0) : ?>
549b5537c3SGreg Roach                    <?= I18N::translate('Find the closest relationships') ?>
559b5537c3SGreg Roach                    <input type="hidden" name="recursion" value="0">
569b5537c3SGreg Roach                <?php else : ?>
57b6c326d8SGreg Roach                    <?= view('components/radios', ['name' => 'recursion', 'options' => $recursion_options, 'selected' => $recursion]) ?>
589b5537c3SGreg Roach                <?php endif ?>
599b5537c3SGreg Roach            </div>
609b5537c3SGreg Roach        </div>
619b5537c3SGreg Roach    </fieldset>
629b5537c3SGreg Roach
639b5537c3SGreg Roach    <div class="row form-group">
649b5537c3SGreg Roach        <div class="col-form-label col-sm-3 wt-page-options-label"></div>
659b5537c3SGreg Roach        <div class="col-sm-9 wt-page-options-value">
663a39d034SGreg Roach            <button class="btn btn-primary" type="submit">
673a39d034SGreg Roach                <?= /* I18N: A button label. */ I18N::translate('view') ?>
683a39d034SGreg Roach            </button>
693a39d034SGreg Roach
703a39d034SGreg Roach            <button class="btn btn-link" id="btn-swap-individuals" type="button">
713a39d034SGreg Roach                <?= /* I18N: Reverse the order of two individuals */
723a39d034SGreg Roach                I18N::translate('Swap individuals') ?>
733a39d034SGreg Roach            </button>
749b5537c3SGreg Roach        </div>
759b5537c3SGreg Roach    </div>
769b5537c3SGreg Roach</form>
779b5537c3SGreg Roach
789b5537c3SGreg Roach<?php if ($individual1 !== null && $individual2 !== null) : ?>
79242a7862SGreg Roach    <div class="wt-ajax-load wt-page-content wt-chart wt-chart-relationships" data-ajax-url="<?= e($ajax_url) ?>"></div>
809b5537c3SGreg Roach<?php endif ?>
819b5537c3SGreg Roach
829b5537c3SGreg Roach<?php View::push('javascript') ?>
839b5537c3SGreg Roach<script>
849b5537c3SGreg Roach  $('#btn-swap-individuals').click(function () {
853a39d034SGreg Roach      // Swap the name attributes
863a39d034SGreg Roach      document.getElementById("xref").name = "xref2";
873a39d034SGreg Roach      document.getElementById("xref2").name = "xref";
883a39d034SGreg Roach      document.querySelector(".wt-page-options-relationships-chart").submit();
899b5537c3SGreg Roach  });
909b5537c3SGreg Roach</script>
919b5537c3SGreg Roach<?php View::endpush() ?>
92