171378461SGreg Roach<?php 23cfcc809SGreg Roach 3*10e06497SGreg Roachdeclare(strict_types=1); 4*10e06497SGreg Roach 571378461SGreg Roachuse Fisharebest\Webtrees\I18N; 67c2c99faSGreg Roachuse Fisharebest\Webtrees\Individual; 77c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree; 871378461SGreg Roachuse Fisharebest\Webtrees\View; 93cfcc809SGreg Roach 107c2c99faSGreg Roach/** 117c2c99faSGreg Roach * @var string $ajax_url 127c2c99faSGreg Roach * @var int $ancestors 137c2c99faSGreg Roach * @var array<string,string> $ancestors_options 147c2c99faSGreg Roach * @var bool $ancestors_only 157c2c99faSGreg Roach * @var Individual|null $individual1 167c2c99faSGreg Roach * @var Individual|null $individual2 177c2c99faSGreg Roach * @var int $max_recursion 187c2c99faSGreg Roach * @var int $recursion 197c2c99faSGreg Roach * @var array<string,string> $recursion_options 207c2c99faSGreg Roach * @var string $title 217c2c99faSGreg Roach * @var Tree $tree 227c2c99faSGreg Roach */ 237c2c99faSGreg Roach 2471378461SGreg Roach?> 259b5537c3SGreg Roach 269b5537c3SGreg Roach<h2 class="wt-page-title"> 279b5537c3SGreg Roach <?= $title ?> 289b5537c3SGreg Roach</h2> 299b5537c3SGreg Roach 3071378461SGreg Roach<form method="post" class="wt-page-options wt-page-options-relationships-chart d-print-none"> 319e3c2cf9SGreg Roach <div class="row"> 323dcc812bSGreg Roach <label class="col-sm-3 col-form-label wt-page-options-label" for="xref"> 339b5537c3SGreg Roach <?= I18N::translate('Individual 1') ?> 349b5537c3SGreg Roach </label> 359b5537c3SGreg Roach <div class="col-sm-9 wt-page-options-value"> 3600efc03cSGreg Roach <?= view('components/select-individual', ['name' => 'xref', 'individual' => $individual1, 'tree' => $tree, 'required' => true]) ?> 379b5537c3SGreg Roach </div> 389b5537c3SGreg Roach </div> 399b5537c3SGreg Roach 409e3c2cf9SGreg Roach <div class="row"> 419b5537c3SGreg Roach <label class="col-sm-3 col-form-label wt-page-options-label" for="xref2"> 429b5537c3SGreg Roach <?= I18N::translate('Individual 2') ?> 439b5537c3SGreg Roach </label> 449b5537c3SGreg Roach <div class="col-sm-9 wt-page-options-value"> 4500efc03cSGreg Roach <?= view('components/select-individual', ['name' => 'xref2', 'individual' => $individual2, 'tree' => $tree, 'required' => true]) ?> 469b5537c3SGreg Roach </div> 479b5537c3SGreg Roach </div> 489b5537c3SGreg Roach 499e3c2cf9SGreg Roach <fieldset class="row mb-3"> 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 ($ancestors_only) : ?> 549b5537c3SGreg Roach <input type="hidden" name="ancestors" value="1"> 559b5537c3SGreg Roach <?= I18N::translate('Find relationships via ancestors') ?> 569b5537c3SGreg Roach <?php else : ?> 57b6c326d8SGreg Roach <?= view('components/radios', ['name' => 'ancestors', 'options' => $ancestors_options, 'selected' => $ancestors]) ?> 589b5537c3SGreg Roach <?php endif ?> 599b5537c3SGreg Roach </div> 609b5537c3SGreg Roach </fieldset> 619b5537c3SGreg Roach 629e3c2cf9SGreg Roach <fieldset class="row mb-3"> 639b5537c3SGreg Roach <legend class="col-form-label col-sm-3 wt-page-options-label"> 649b5537c3SGreg Roach </legend> 659b5537c3SGreg Roach <div class="col-sm-9 wt-page-options-value"> 669b5537c3SGreg Roach <?php if ($max_recursion === 0) : ?> 679b5537c3SGreg Roach <?= I18N::translate('Find the closest relationships') ?> 689b5537c3SGreg Roach <input type="hidden" name="recursion" value="0"> 699b5537c3SGreg Roach <?php else : ?> 70b6c326d8SGreg Roach <?= view('components/radios', ['name' => 'recursion', 'options' => $recursion_options, 'selected' => $recursion]) ?> 719b5537c3SGreg Roach <?php endif ?> 729b5537c3SGreg Roach </div> 739b5537c3SGreg Roach </fieldset> 749b5537c3SGreg Roach 759e3c2cf9SGreg Roach <div class="row mb-3"> 769b5537c3SGreg Roach <div class="col-form-label col-sm-3 wt-page-options-label"></div> 779b5537c3SGreg Roach <div class="col-sm-9 wt-page-options-value"> 783a39d034SGreg Roach <button class="btn btn-primary" type="submit"> 793a39d034SGreg Roach <?= /* I18N: A button label. */ I18N::translate('view') ?> 803a39d034SGreg Roach </button> 813a39d034SGreg Roach 823a39d034SGreg Roach <button class="btn btn-link" id="btn-swap-individuals" type="button"> 833a39d034SGreg Roach <?= /* I18N: Reverse the order of two individuals */ 843a39d034SGreg Roach I18N::translate('Swap individuals') ?> 853a39d034SGreg Roach </button> 869b5537c3SGreg Roach </div> 879b5537c3SGreg Roach </div> 8881443e3cSGreg Roach 8981443e3cSGreg Roach <?= csrf_field() ?> 909b5537c3SGreg Roach</form> 919b5537c3SGreg Roach 929b5537c3SGreg Roach<?php if ($individual1 !== null && $individual2 !== null) : ?> 93d4786c66SGreg Roach <div class="wt-ajax-load wt-page-content wt-chart wt-chart-relationships" data-wt-ajax-url="<?= e($ajax_url) ?>"></div> 949b5537c3SGreg Roach<?php endif ?> 959b5537c3SGreg Roach 969b5537c3SGreg Roach<?php View::push('javascript') ?> 979b5537c3SGreg Roach<script> 989b5537c3SGreg Roach $('#btn-swap-individuals').click(function () { 993a39d034SGreg Roach // Swap the name attributes 1003a39d034SGreg Roach document.getElementById("xref").name = "xref2"; 1013a39d034SGreg Roach document.getElementById("xref2").name = "xref"; 1023a39d034SGreg Roach document.querySelector(".wt-page-options-relationships-chart").submit(); 1039b5537c3SGreg Roach }); 1049b5537c3SGreg Roach</script> 1059b5537c3SGreg Roach<?php View::endpush() ?> 106