12c3dad18SGreg Roach<?php 22c3dad18SGreg Roachuse Fisharebest\Webtrees\Auth; 32c3dad18SGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrint; 4*2917771cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; 522e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord; 622e73debSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord; 72c3dad18SGreg Roachuse Fisharebest\Webtrees\I18N; 82c3dad18SGreg Roachuse Fisharebest\Webtrees\Individual; 92c3dad18SGreg Roachuse Fisharebest\Webtrees\View; 102c3dad18SGreg Roachuse Illuminate\Support\Collection; 112c3dad18SGreg Roach 122c3dad18SGreg Roach/** 132c3dad18SGreg Roach * @var Individual $individual 142c3dad18SGreg Roach * @var string $user_link 152c3dad18SGreg Roach * @var int $count_names 162c3dad18SGreg Roach * @var Collection $sidebars 178e64ca84SGreg Roach * @var Collection $individual_media 182c3dad18SGreg Roach * @var Collection $name_records 192c3dad18SGreg Roach * @var Collection $sex_records 202c3dad18SGreg Roach * @var Collection $tabs 212c3dad18SGreg Roach */ 222c3dad18SGreg Roach?> 23dd6b2bfcSGreg Roach 24dd6b2bfcSGreg Roach<?php if ($individual->isPendingDeletion()) : ?> 25f4afa648SGreg Roach <?php if (Auth::isModerator($individual->tree())) : ?> 26dd6b2bfcSGreg Roach <?= view('components/alert-warning-dismissible', [ 27dd6b2bfcSGreg Roach 'alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ 2822e73debSGreg 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" data-post-url="' . e(route(PendingChangesAcceptRecord::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) . '">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesRejectRecord::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) . '">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes'), 29dd6b2bfcSGreg Roach ]) ?> 30f4afa648SGreg Roach <?php elseif (Auth::isEditor($individual->tree())) : ?> 31dd6b2bfcSGreg 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')]) ?> 32dd6b2bfcSGreg Roach <?php endif ?> 33dd6b2bfcSGreg Roach<?php elseif ($individual->isPendingAddition()) : ?> 34f4afa648SGreg Roach <?php if (Auth::isModerator($individual->tree())) : ?> 35dd6b2bfcSGreg Roach <?= view('components/alert-warning-dismissible', [ 36dd6b2bfcSGreg Roach 'alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ 3722e73debSGreg 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" data-post-url="' . e(route(PendingChangesAcceptRecord::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) . '">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesRejectRecord::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) . '">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes'), 38dd6b2bfcSGreg Roach ]) ?> 39f4afa648SGreg Roach <?php elseif (Auth::isEditor($individual->tree())) : ?> 40dd6b2bfcSGreg 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')]) ?> 41dd6b2bfcSGreg Roach <?php endif ?> 42dd6b2bfcSGreg Roach<?php endif ?> 43dd6b2bfcSGreg Roach 44dd6b2bfcSGreg Roach<div class="d-flex mb-4"> 45dd6b2bfcSGreg Roach <h2 class="wt-page-title mx-auto"> 4639ca88baSGreg Roach <?= $individual->fullName() ?><?= $user_link ?>, <?= $individual->getLifeSpan() ?> <?= $age ?> 47dd6b2bfcSGreg Roach </h2> 481450f098SGreg Roach <?php if ($individual->canEdit()) : ?> 49dd6b2bfcSGreg Roach <?= view('individual-page-menu', ['individual' => $individual, 'count_names' => $count_names, 'count_sex' => $count_sex]) ?> 50dd6b2bfcSGreg Roach <?php endif ?> 51dd6b2bfcSGreg Roach</div> 52dd6b2bfcSGreg Roach 53dd6b2bfcSGreg Roach<div class="row"> 548d38dd5aSGreg Roach <div class="<?= $sidebars->isEmpty() ? 'col-sm-12' : 'col-sm-8' ?>"> 55dd6b2bfcSGreg Roach <div class="row mb-4"> 56dd6b2bfcSGreg Roach <!-- Individual images --> 578e64ca84SGreg Roach <?php if ($individual_media->isNotEmpty() || $tree->getPreference('USE_SILHOUETTE') === '1') : ?> 58dd6b2bfcSGreg Roach <div class="col-sm-3"> 598e64ca84SGreg Roach <?php if ($individual_media->isEmpty()) : ?> 608e64ca84SGreg Roach <div class="img-thumbnail"> 6139ca88baSGreg Roach <i class="wt-individual-silhouette wt-individual-silhouette-<?= strtolower($individual->sex()) ?>"></i> 628e64ca84SGreg Roach </div> 638e64ca84SGreg Roach <?php elseif ($individual_media->count() === 1) : ?> 648e64ca84SGreg Roach <?= $individual_media->first()->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?> 65dd6b2bfcSGreg Roach <?php else : ?> 66dd6b2bfcSGreg Roach <div id="individual-images" class="carousel slide" data-ride="carousel" data-interval="false"> 67dd6b2bfcSGreg Roach <div class="carousel-inner"> 68dd6b2bfcSGreg Roach <?php foreach ($individual_media as $n => $media_file) : ?> 69dd6b2bfcSGreg Roach <div class="carousel-item <?= $n === 0 ? 'active' : '' ?>"> 70dd6b2bfcSGreg Roach <?= $media_file->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?> 71dd6b2bfcSGreg Roach </div> 72dd6b2bfcSGreg Roach <?php endforeach ?> 73dd6b2bfcSGreg Roach </div> 74dd6b2bfcSGreg Roach <a class="carousel-control-prev" href="#individual-images" role="button" data-slide="prev"> 75dd6b2bfcSGreg Roach <span class="carousel-control-prev-icon" aria-hidden="true"></span> 76dd6b2bfcSGreg Roach <span class="sr-only"><?= I18N::translate('previous') ?></span> 77dd6b2bfcSGreg Roach </a> 78dd6b2bfcSGreg Roach <a class="carousel-control-next" href="#individual-images" role="button" data-slide="next"> 79dd6b2bfcSGreg Roach <span class="carousel-control-next-icon" aria-hidden="true"></span> 80dd6b2bfcSGreg Roach <span class="sr-only"><?= I18N::translate('next') ?></span> 81dd6b2bfcSGreg Roach </a> 82dd6b2bfcSGreg Roach </div> 83dd6b2bfcSGreg Roach <?php endif ?> 84dd6b2bfcSGreg Roach 85f4afa648SGreg Roach <?php if (Auth::isEditor($individual->tree())) : ?> 868e64ca84SGreg Roach <div class="text-center"> 87*2917771cSGreg Roach <a href="<?= e(route(AddNewFact::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'OBJE'])) ?>"> 88dd6b2bfcSGreg Roach <?= I18N::translate('Add a media object') ?> 89dd6b2bfcSGreg Roach </a> 90dd6b2bfcSGreg Roach </div> 91dd6b2bfcSGreg Roach <?php endif ?> 92dd6b2bfcSGreg Roach </div> 938e64ca84SGreg Roach <?php endif ?> 94dd6b2bfcSGreg Roach 95dd6b2bfcSGreg Roach <!-- Name accordion --> 968e64ca84SGreg Roach <div class="col-sm" id="individual-names" role="tablist"> 97dd6b2bfcSGreg Roach <?php foreach ($name_records as $name_record) : ?> 98dd6b2bfcSGreg Roach <?= $name_record ?> 99dd6b2bfcSGreg Roach <?php endforeach ?> 100dd6b2bfcSGreg Roach 101dd6b2bfcSGreg Roach <?php foreach ($sex_records as $sex_record) : ?> 102dd6b2bfcSGreg Roach <?= $sex_record ?> 103dd6b2bfcSGreg Roach <?php endforeach ?> 104dd6b2bfcSGreg Roach </div> 105dd6b2bfcSGreg Roach </div> 106dd6b2bfcSGreg Roach 1074a2590a5SGreg Roach <div class="wt-tabs-individual" id="individual-tabs"> 108dd6b2bfcSGreg Roach <ul class="nav nav-tabs flex-wrap"> 109dd6b2bfcSGreg Roach <?php foreach ($tabs as $tab) : ?> 110dd6b2bfcSGreg Roach <li class="nav-item"> 111d72b284aSGreg Roach <a class="nav-link<?= $tab->isGrayedOut($individual) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" data-href="<?= e(route('individual-tab', ['xref' => $individual->xref(), 'tree' => $individual->tree()->name(), 'module' => $tab->name()])) ?>" href="#<?= $tab->name() ?>"> 112defb8071SRichard Cissée <?= $tab->tabTitle() ?> 113dd6b2bfcSGreg Roach </a> 114dd6b2bfcSGreg Roach </li> 115dd6b2bfcSGreg Roach <?php endforeach ?> 116dd6b2bfcSGreg Roach </ul> 117dd6b2bfcSGreg Roach <div class="tab-content"> 118dd6b2bfcSGreg Roach <?php foreach ($tabs as $tab) : ?> 119677aaceaSGreg Roach <div id="<?= $tab->name() ?>" class="tab-pane fade wt-ajax-load" role="tabpanel"><?php if (!$tab->canLoadAjax()) : 120dd6b2bfcSGreg Roach ?><?= $tab->getTabContent($individual) ?><?php 121dd6b2bfcSGreg Roach endif ?></div> 122dd6b2bfcSGreg Roach <?php endforeach ?> 123dd6b2bfcSGreg Roach </div> 124dd6b2bfcSGreg Roach </div> 125dd6b2bfcSGreg Roach </div> 126c72fc94cSGreg Roach <?php if ($sidebars->isNotEmpty()) : ?> 127dd6b2bfcSGreg Roach <div class="col-sm-4" id="sidebar" role="tablist"> 128dd6b2bfcSGreg Roach <?php foreach ($sidebars as $sidebar) : ?> 129dd6b2bfcSGreg Roach <div class="card"> 130677aaceaSGreg Roach <div class="card-header" role="tab" id="sidebar-header-<?= $sidebar->name() ?>"> 131dd6b2bfcSGreg Roach <div class="card-title mb-0"> 132677aaceaSGreg 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() ?>"> 133defb8071SRichard Cissée <?= $sidebar->sidebarTitle() ?> 134dd6b2bfcSGreg Roach </a> 135dd6b2bfcSGreg Roach </div> 136dd6b2bfcSGreg Roach </div> 137677aaceaSGreg Roach <div id="sidebar-content-<?= $sidebar->name() ?>" class="collapse<?= $sidebar->name() === 'family_nav' ? ' show' : '' ?>" role="tabpanel" aria-labelledby="sidebar-header-<?= $sidebar->name() ?>"> 138dd6b2bfcSGreg Roach <div class="card-body"> 139dd6b2bfcSGreg Roach <?= $sidebar->getSidebarContent($individual) ?></div> 140dd6b2bfcSGreg Roach </div> 141dd6b2bfcSGreg Roach </div> 142dd6b2bfcSGreg Roach <?php endforeach ?> 143dd6b2bfcSGreg Roach </div> 144c72fc94cSGreg Roach <?php endif ?> 145dd6b2bfcSGreg Roach</div> 146dd6b2bfcSGreg Roach 147dd6b2bfcSGreg Roach<?php View::push('javascript') ?> 148dd6b2bfcSGreg Roach<script> 149dd6b2bfcSGreg Roach "use strict"; 150dd6b2bfcSGreg Roach 151dd6b2bfcSGreg Roach // Bootstrap tabs - load content dynamically using AJAX 152dd6b2bfcSGreg Roach $('a[data-toggle="tab"][data-href]').on('show.bs.tab', function () { 153dd6b2bfcSGreg Roach $(this.getAttribute('href') + ':empty').load($(this).data('href')); 154dd6b2bfcSGreg Roach }); 155dd6b2bfcSGreg Roach 156dd6b2bfcSGreg Roach // If the URL contains a fragment, then activate the corresponding tab. 157dd6b2bfcSGreg Roach // Use a prefix on the fragment, to prevent scrolling to the element. 158dd6b2bfcSGreg Roach var target = window.location.hash.replace("tab-", ""); 159dd6b2bfcSGreg Roach var tab = $("#individual-tabs .nav-link[href='" + target + "']"); 160dd6b2bfcSGreg Roach // If not, then activate the first tab. 161dd6b2bfcSGreg Roach if (tab.length === 0) { 162dd6b2bfcSGreg Roach tab = $("#individual-tabs .nav-link:first"); 163dd6b2bfcSGreg Roach } 164dd6b2bfcSGreg Roach tab.tab("show"); 165dd6b2bfcSGreg Roach 166dd6b2bfcSGreg Roach // If the user selects a tab, update the URL to reflect this 167dd6b2bfcSGreg Roach $('#individual-tabs a[data-toggle="tab"]').on('shown.bs.tab', function (e) { 168dd6b2bfcSGreg Roach window.location.hash = "tab-" + e.target.href.substring(e.target.href.indexOf('#') + 1); 169dd6b2bfcSGreg Roach }); 170dd6b2bfcSGreg Roach</script> 171dd6b2bfcSGreg Roach<?php View::endpush() ?> 172dd6b2bfcSGreg Roach 173dd6b2bfcSGreg Roach<?= view('modals/ajax') ?> 174