1<?php 2 3use Fisharebest\Webtrees\Family; 4use Fisharebest\Webtrees\Http\RequestHandlers\AddChildToIndividualPage; 5use Fisharebest\Webtrees\Http\RequestHandlers\AddParentToIndividualPage; 6use Fisharebest\Webtrees\Http\RequestHandlers\AddSpouseToIndividualPage; 7use Fisharebest\Webtrees\Http\RequestHandlers\LinkChildToFamilyPage; 8use Fisharebest\Webtrees\Http\RequestHandlers\LinkSpouseToIndividualPage; 9use Fisharebest\Webtrees\Http\RequestHandlers\ReorderFamiliesPage; 10use Fisharebest\Webtrees\I18N; 11use Fisharebest\Webtrees\Individual; 12use Illuminate\Support\Collection; 13 14/** 15 * @var bool $can_edit 16 * @var int $fam_access_level 17 * @var Individual $individual 18 * @var Collection<Family> $parent_families 19 * @var Collection<Family> $spouse_families 20 * @var Collection<Family> $step_child_families 21 * @var Collection<Family> $step_parent_families 22 */ 23 24?> 25<?php 26?> 27 28<div class="wt-tab-relatives py-4"> 29 <table class="table table-sm wt-facts-table" role="presentation"> 30 <tbody> 31 <tr> 32 <td> 33 <label> 34 <input id="show-date-differences" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-date-difference" data-wt-persist="date-differences"> 35 <?= I18N::translate('Date differences') ?> 36 </label> 37 </td> 38 </tr> 39 </tbody> 40</table> 41 42<?php if ($can_edit && $parent_families->isEmpty()) : ?> 43 <table class="table table-sm wt-facts-table" role="presentation"> 44 <tbody> 45 <tr> 46 <td> 47 <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'M', 'url' => $individual->url() . '#tab-relatives'])) ?>"> 48 <?= I18N::translate('Add a father') ?> 49 </a> 50 </td> 51 </tr> 52 <tr> 53 <td> 54 <a href="<?= e(route(AddParentToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'F', 'url' => $individual->url() . '#tab-relatives'])) ?>"> 55 <?= I18N::translate('Add a mother') ?> 56 </a> 57 </td> 58 </tr> 59 </tbody> 60 </table> 61<?php endif ?> 62 63<!-- Parents --> 64<?php foreach ($parent_families as $family) : ?> 65 <?= view('modules/relatives/family', [ 66 'individual' => $individual, 67 'family' => $family, 68 'type' => 'FAMC', 69 'label' => $individual->getChildFamilyLabel($family), 70 'fam_access_level' => $fam_access_level, 71 ]) ?> 72<?php endforeach ?> 73 74<!-- step-parents --> 75<?php foreach ($step_parent_families as $family) : ?> 76 <?= view('modules/relatives/family', [ 77 'individual' => $individual, 78 'family' => $family, 79 'type' => 'FAMC', 80 'label' => $individual->getStepFamilyLabel($family), 81 'fam_access_level' => $fam_access_level, 82 ]) ?> 83<?php endforeach ?> 84 85<!-- spouses --> 86<?php foreach ($spouse_families as $family) : ?> 87 <?= view('modules/relatives/family', [ 88 'individual' => $individual, 89 'family' => $family, 90 'type' => 'FAMS', 91 'label' => $individual->getSpouseFamilyLabel($family), 92 'fam_access_level' => $fam_access_level, 93 ]) ?> 94<?php endforeach ?> 95 96<!-- step-children --> 97<?php foreach ($step_child_families as $family) : ?> 98 <?= view('modules/relatives/family', [ 99 'individual' => $individual, 100 'family' => $family, 101 'type' => 'FAMS', 102 'label' => $family->fullName(), 103 'fam_access_level' => $fam_access_level, 104 ]) ?> 105<?php endforeach ?> 106 107<?php if ($can_edit) : ?> 108 <br> 109 <table class="table table-sm wt-facts-table" role="presentation"> 110 <tbody> 111 <?php if ($spouse_families->count() > 1) : ?> 112 <tr> 113 <td> 114 <a href="<?= e(route(ReorderFamiliesPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>"> 115 <?= view('icons/reorder') ?> 116 <?= I18N::translate('Re-order families') ?> 117 </a> 118 </td> 119 </tr> 120 <?php endif ?> 121 <tr> 122 <td> 123 <a href="<?= e(route(LinkChildToFamilyPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>"> 124 <?= I18N::translate('Link this individual to an existing family as a child') ?> 125 </a> 126 </td> 127 </tr> 128 129 <tr> 130 <td> 131 <a href="<?= e(route(AddSpouseToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'url' => $individual->url() . '#tab-relatives'])) ?>"> 132 <?php if ($individual->sex() !== 'F') : ?> 133 <?= I18N::translate('Add a wife') ?> 134 <?php else : ?> 135 <?= I18N::translate('Add a husband') ?> 136 <?php endif ?> 137 </a> 138 </td> 139 </tr> 140 141 <tr> 142 <td> 143 <a href="<?= e(route(LinkSpouseToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>"> 144 <?php if ($individual->sex() !== 'F') : ?> 145 <?= I18N::translate('Add a wife using an existing individual') ?> 146 <?php else : ?> 147 <?= I18N::translate('Add a husband using an existing individual') ?> 148 <?php endif ?> 149 </a> 150 </td> 151 </tr> 152 153 <tr> 154 <td> 155 <a href="<?= e(route(AddChildToIndividualPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'sex' => 'U'])) ?>"> 156 <?= I18N::translate('Add a child to create a one-parent family') ?> 157 </a> 158 </td> 159 </tr> 160 </tbody> 161 </table> 162<?php endif ?> 163</div> 164