<?php

use Fisharebest\Webtrees\Fact;
use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Illuminate\Support\Collection;

/**
 * @var bool             $can_edit
 * @var Collection<Fact> $clipboard_facts
 * @var Collection<Fact> $facts
 * @var Individual       $individual
 */

?>
<div class="wt-tab-media py-4">
    <table class="table wt-facts-table">
        <?php foreach ($facts as $fact) : ?>
            <?php FunctionsPrintFacts::printMainMedia($fact, 1) ?>
            <?php FunctionsPrintFacts::printMainMedia($fact, 2) ?>
            <?php FunctionsPrintFacts::printMainMedia($fact, 3) ?>
            <?php FunctionsPrintFacts::printMainMedia($fact, 4) ?>
        <?php endforeach ?>

        <?php if ($facts->isEmpty()) : ?>
            <tr>
                <td colspan="2">
                    <?= I18N::translate('There are no media objects for this individual.') ?>
                </td>
            </tr>
        <?php endif ?>

        <?php if ($can_edit) : ?>
            <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?>
        <?php endif ?>
    </table>
</div>
