<?php

declare(strict_types=1);

use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Statistics;

/** @var Statistics $stats */
?>

<h4 class="border-bottom p-2 mb-4">
    <?= I18N::translate('Total events') ?>
    <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalEvents() ?></span>
</h4>

<div class="row row-cols-1 row-cols-md-2 g-3 mb-3">
    <div class="col">
        <div class="card">
            <?php $type   = $stats->firstEventType() ?>
            <?php $result = $stats->firstEvent() ?>
            <h5 class="card-header">
                <?= I18N::translate('First event') ?>
                <?php if ($type) :
                    ?><?= ' - ', $type ?><?php
                endif; ?>
            </h5>
            <div class="card-body">
                <?= $result ?>
            </div>
        </div>
    </div>

    <div class="col">
        <div class="card">
            <?php $type   = $stats->lastEventType() ?>
            <?php $result = $stats->lastEvent() ?>
            <h5 class="card-header">
                <?= I18N::translate('Last event') ?>
                <?php if ($type) :
                    ?><?= ' - ', $type ?><?php
                endif; ?>
            </h5>
            <div class="card-body">
                <?= $result ?>
            </div>
        </div>
    </div>
</div>
