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