<?php

use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Module\ModuleSidebarInterface;
use Illuminate\Support\Collection;

/**
 * @var Individual                         $record
 * @var Collection<ModuleSidebarInterface> $sidebars
 */
?>

<div class="col-sm-4 accordion" id="sidebar">
    <?php foreach ($sidebars as $sidebar) : ?>
        <div class="card">
            <div class="card-header" role="tab" id="sidebar-header-<?= $sidebar->name() ?>">
                <div class="card-title mb-0">
                    <a data-toggle="collapse" href="#sidebar-content-<?= $sidebar->name() ?>" aria-expanded="<?= $sidebar->name() === 'family_nav' ? 'true' : 'false' ?>" aria-controls="sidebar-content-<?= $sidebar->name() ?>">
                        <?= view('icons/expand') ?>
                        <?= view('icons/collapse') ?>
                        <?= $sidebar->sidebarTitle($record) ?>
                    </a>
                </div>
            </div>

            <div id="sidebar-content-<?= $sidebar->name() ?>" class="collapse<?= $sidebar->name() === 'family_nav' ? ' show' : '' ?>" data-parent="#sidebar" aria-labelledby="sidebar-header-<?= $sidebar->name() ?>">
                <div class="card-body">
                    <?= $sidebar->getSidebarContent($record) ?>
                </div>
            </div>
        </div>
    <?php endforeach ?>
</div>
