12c3dad18SGreg Roach<?php 22c3dad18SGreg Roachuse Fisharebest\Webtrees\Auth; 32c3dad18SGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrint; 42c3dad18SGreg Roachuse Fisharebest\Webtrees\I18N; 52c3dad18SGreg Roachuse Fisharebest\Webtrees\Individual; 62c3dad18SGreg Roachuse Fisharebest\Webtrees\View; 72c3dad18SGreg Roachuse Illuminate\Support\Collection; 82c3dad18SGreg Roach 92c3dad18SGreg Roach/** 102c3dad18SGreg Roach * @var Individual $individual 112c3dad18SGreg Roach * @var string $user_link 122c3dad18SGreg Roach * @var int $count_names 132c3dad18SGreg Roach * @var Collection $sidebars 14*8e64ca84SGreg Roach * @var Collection $individual_media 152c3dad18SGreg Roach * @var Collection $name_records 162c3dad18SGreg Roach * @var Collection $sex_records 172c3dad18SGreg Roach * @var Collection $tabs 182c3dad18SGreg Roach */ 192c3dad18SGreg Roach?> 20dd6b2bfcSGreg Roach 21dd6b2bfcSGreg Roach<?php if ($individual->isPendingDeletion()) : ?> 22f4afa648SGreg Roach <?php if (Auth::isModerator($individual->tree())) : ?> 23dd6b2bfcSGreg Roach <?= view('components/alert-warning-dismissible', [ 24dd6b2bfcSGreg Roach 'alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ 25f4afa648SGreg Roach I18N::translate('This individual has been deleted. You should review the deletion and then %1$s or %2$s it.', '<a href="#" class="alert-link" onclick="accept_changes(\'' . e($individual->xref()) . '\', \'' . e($individual->tree()->name()) . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" class="alert-link" onclick="reject_changes(\'' . e($individual->xref()) . '\', \'' . e($individual->tree()->name()) . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes'), 26dd6b2bfcSGreg Roach ]) ?> 27f4afa648SGreg Roach <?php elseif (Auth::isEditor($individual->tree())) : ?> 28dd6b2bfcSGreg Roach <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This individual has been deleted. The deletion will need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?> 29dd6b2bfcSGreg Roach <?php endif ?> 30dd6b2bfcSGreg Roach<?php elseif ($individual->isPendingAddition()) : ?> 31f4afa648SGreg Roach <?php if (Auth::isModerator($individual->tree())) : ?> 32dd6b2bfcSGreg Roach <?= view('components/alert-warning-dismissible', [ 33dd6b2bfcSGreg Roach 'alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ 34f4afa648SGreg Roach I18N::translate('This individual has been edited. You should review the changes and then %1$s or %2$s them.', '<a href="#" class="alert-link" onclick="accept_changes(\'' . e($individual->xref()) . '\', \'' . e($individual->tree()->name()) . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" class="alert-link" onclick="reject_changes(\'' . e($individual->xref()) . '\', \'' . e($individual->tree()->name()) . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes'), 35dd6b2bfcSGreg Roach ]) ?> 36f4afa648SGreg Roach <?php elseif (Auth::isEditor($individual->tree())) : ?> 37dd6b2bfcSGreg Roach <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This individual has been edited. The changes need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?> 38dd6b2bfcSGreg Roach <?php endif ?> 39dd6b2bfcSGreg Roach<?php endif ?> 40dd6b2bfcSGreg Roach 41dd6b2bfcSGreg Roach<div class="d-flex mb-4"> 42dd6b2bfcSGreg Roach <h2 class="wt-page-title mx-auto"> 4339ca88baSGreg Roach <?= $individual->fullName() ?><?= $user_link ?>, <?= $individual->getLifeSpan() ?> <?= $age ?> 44dd6b2bfcSGreg Roach </h2> 451450f098SGreg Roach <?php if ($individual->canEdit()) : ?> 46dd6b2bfcSGreg Roach <?= view('individual-page-menu', ['individual' => $individual, 'count_names' => $count_names, 'count_sex' => $count_sex]) ?> 47dd6b2bfcSGreg Roach <?php endif ?> 48dd6b2bfcSGreg Roach</div> 49dd6b2bfcSGreg Roach 50dd6b2bfcSGreg Roach<div class="row"> 518d38dd5aSGreg Roach <div class="<?= $sidebars->isEmpty() ? 'col-sm-12' : 'col-sm-8' ?>"> 52dd6b2bfcSGreg Roach <div class="row mb-4"> 53dd6b2bfcSGreg Roach <!-- Individual images --> 54*8e64ca84SGreg Roach <?php if ($individual_media->isNotEmpty() || $tree->getPreference('USE_SILHOUETTE') === '1') : ?> 55dd6b2bfcSGreg Roach <div class="col-sm-3"> 56*8e64ca84SGreg Roach <?php if ($individual_media->isEmpty()) : ?> 57*8e64ca84SGreg Roach <div class="img-thumbnail"> 5839ca88baSGreg Roach <i class="wt-individual-silhouette wt-individual-silhouette-<?= strtolower($individual->sex()) ?>"></i> 59*8e64ca84SGreg Roach </div> 60*8e64ca84SGreg Roach <?php elseif ($individual_media->count() === 1) : ?> 61*8e64ca84SGreg Roach <?= $individual_media->first()->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?> 62dd6b2bfcSGreg Roach <?php else : ?> 63dd6b2bfcSGreg Roach <div id="individual-images" class="carousel slide" data-ride="carousel" data-interval="false"> 64dd6b2bfcSGreg Roach <div class="carousel-inner"> 65dd6b2bfcSGreg Roach <?php foreach ($individual_media as $n => $media_file) : ?> 66dd6b2bfcSGreg Roach <div class="carousel-item <?= $n === 0 ? 'active' : '' ?>"> 67dd6b2bfcSGreg Roach <?= $media_file->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?> 68dd6b2bfcSGreg Roach </div> 69dd6b2bfcSGreg Roach <?php endforeach ?> 70dd6b2bfcSGreg Roach </div> 71dd6b2bfcSGreg Roach <a class="carousel-control-prev" href="#individual-images" role="button" data-slide="prev"> 72dd6b2bfcSGreg Roach <span class="carousel-control-prev-icon" aria-hidden="true"></span> 73dd6b2bfcSGreg Roach <span class="sr-only"><?= I18N::translate('previous') ?></span> 74dd6b2bfcSGreg Roach </a> 75dd6b2bfcSGreg Roach <a class="carousel-control-next" href="#individual-images" role="button" data-slide="next"> 76dd6b2bfcSGreg Roach <span class="carousel-control-next-icon" aria-hidden="true"></span> 77dd6b2bfcSGreg Roach <span class="sr-only"><?= I18N::translate('next') ?></span> 78dd6b2bfcSGreg Roach </a> 79dd6b2bfcSGreg Roach </div> 80dd6b2bfcSGreg Roach <?php endif ?> 81dd6b2bfcSGreg Roach 82f4afa648SGreg Roach <?php if (Auth::isEditor($individual->tree())) : ?> 83*8e64ca84SGreg Roach <div class="text-center"> 84f4afa648SGreg Roach <a href="<?= e(route('add-fact', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'OBJE'])) ?>"> 85dd6b2bfcSGreg Roach <?= I18N::translate('Add a media object') ?> 86dd6b2bfcSGreg Roach </a> 87dd6b2bfcSGreg Roach </div> 88dd6b2bfcSGreg Roach <?php endif ?> 89dd6b2bfcSGreg Roach </div> 90*8e64ca84SGreg Roach <?php endif ?> 91dd6b2bfcSGreg Roach 92dd6b2bfcSGreg Roach <!-- Name accordion --> 93*8e64ca84SGreg Roach <div class="col-sm" id="individual-names" role="tablist"> 94dd6b2bfcSGreg Roach <?php foreach ($name_records as $name_record) : ?> 95dd6b2bfcSGreg Roach <?= $name_record ?> 96dd6b2bfcSGreg Roach <?php endforeach ?> 97dd6b2bfcSGreg Roach 98dd6b2bfcSGreg Roach <?php foreach ($sex_records as $sex_record) : ?> 99dd6b2bfcSGreg Roach <?= $sex_record ?> 100dd6b2bfcSGreg Roach <?php endforeach ?> 101dd6b2bfcSGreg Roach </div> 102dd6b2bfcSGreg Roach </div> 103dd6b2bfcSGreg Roach 1044a2590a5SGreg Roach <div class="wt-tabs-individual" id="individual-tabs"> 105dd6b2bfcSGreg Roach <ul class="nav nav-tabs flex-wrap"> 106dd6b2bfcSGreg Roach <?php foreach ($tabs as $tab) : ?> 107dd6b2bfcSGreg Roach <li class="nav-item"> 108677aaceaSGreg Roach <a class="nav-link<?= $tab->isGrayedOut($individual) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" data-href="<?= e(route('individual-tab', ['xref' => $individual->xref(), 'ged' => $individual->tree()->name(), 'module' => $tab->name()])) ?>" href="#<?= $tab->name() ?>"> 109defb8071SRichard Cissée <?= $tab->tabTitle() ?> 110dd6b2bfcSGreg Roach </a> 111dd6b2bfcSGreg Roach </li> 112dd6b2bfcSGreg Roach <?php endforeach ?> 113dd6b2bfcSGreg Roach </ul> 114dd6b2bfcSGreg Roach <div class="tab-content"> 115dd6b2bfcSGreg Roach <?php foreach ($tabs as $tab) : ?> 116677aaceaSGreg Roach <div id="<?= $tab->name() ?>" class="tab-pane fade wt-ajax-load" role="tabpanel"><?php if (!$tab->canLoadAjax()) : 117dd6b2bfcSGreg Roach ?><?= $tab->getTabContent($individual) ?><?php 118dd6b2bfcSGreg Roach endif ?></div> 119dd6b2bfcSGreg Roach <?php endforeach ?> 120dd6b2bfcSGreg Roach </div> 121dd6b2bfcSGreg Roach </div> 122dd6b2bfcSGreg Roach </div> 123c72fc94cSGreg Roach <?php if ($sidebars->isNotEmpty()) : ?> 124dd6b2bfcSGreg Roach <div class="col-sm-4" id="sidebar" role="tablist"> 125dd6b2bfcSGreg Roach <?php foreach ($sidebars as $sidebar) : ?> 126dd6b2bfcSGreg Roach <div class="card"> 127677aaceaSGreg Roach <div class="card-header" role="tab" id="sidebar-header-<?= $sidebar->name() ?>"> 128dd6b2bfcSGreg Roach <div class="card-title mb-0"> 129677aaceaSGreg Roach <a data-toggle="collapse" data-parent="#sidebar" href="#sidebar-content-<?= $sidebar->name() ?>" aria-expanded="<?= $sidebar->name() === 'family_nav' ? 'true' : 'false' ?>" aria-controls="sidebar-content-<?= $sidebar->name() ?>"> 130defb8071SRichard Cissée <?= $sidebar->sidebarTitle() ?> 131dd6b2bfcSGreg Roach </a> 132dd6b2bfcSGreg Roach </div> 133dd6b2bfcSGreg Roach </div> 134677aaceaSGreg Roach <div id="sidebar-content-<?= $sidebar->name() ?>" class="collapse<?= $sidebar->name() === 'family_nav' ? ' show' : '' ?>" role="tabpanel" aria-labelledby="sidebar-header-<?= $sidebar->name() ?>"> 135dd6b2bfcSGreg Roach <div class="card-body"> 136dd6b2bfcSGreg Roach <?= $sidebar->getSidebarContent($individual) ?></div> 137dd6b2bfcSGreg Roach </div> 138dd6b2bfcSGreg Roach </div> 139dd6b2bfcSGreg Roach <?php endforeach ?> 140dd6b2bfcSGreg Roach </div> 141c72fc94cSGreg Roach <?php endif ?> 142dd6b2bfcSGreg Roach</div> 143dd6b2bfcSGreg Roach 144dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 145dd6b2bfcSGreg Roach<script> 146dd6b2bfcSGreg Roach "use strict"; 147dd6b2bfcSGreg Roach 148dd6b2bfcSGreg Roach // Bootstrap tabs - load content dynamically using AJAX 149dd6b2bfcSGreg Roach $('a[data-toggle="tab"][data-href]').on('show.bs.tab', function () { 150dd6b2bfcSGreg Roach $(this.getAttribute('href') + ':empty').load($(this).data('href')); 151dd6b2bfcSGreg Roach }); 152dd6b2bfcSGreg Roach 153dd6b2bfcSGreg Roach // If the URL contains a fragment, then activate the corresponding tab. 154dd6b2bfcSGreg Roach // Use a prefix on the fragment, to prevent scrolling to the element. 155dd6b2bfcSGreg Roach var target = window.location.hash.replace("tab-", ""); 156dd6b2bfcSGreg Roach var tab = $("#individual-tabs .nav-link[href='" + target + "']"); 157dd6b2bfcSGreg Roach // If not, then activate the first tab. 158dd6b2bfcSGreg Roach if (tab.length === 0) { 159dd6b2bfcSGreg Roach tab = $("#individual-tabs .nav-link:first"); 160dd6b2bfcSGreg Roach } 161dd6b2bfcSGreg Roach tab.tab("show"); 162dd6b2bfcSGreg Roach 163dd6b2bfcSGreg Roach // If the user selects a tab, update the URL to reflect this 164dd6b2bfcSGreg Roach $('#individual-tabs a[data-toggle="tab"]').on('shown.bs.tab', function (e) { 165dd6b2bfcSGreg Roach window.location.hash = "tab-" + e.target.href.substring(e.target.href.indexOf('#') + 1); 166dd6b2bfcSGreg Roach }); 167dd6b2bfcSGreg Roach</script> 168dd6b2bfcSGreg Roach<?php View::endpush() ?> 169dd6b2bfcSGreg Roach 170dd6b2bfcSGreg Roach<?= view('modals/ajax') ?> 171