<?php

use Fisharebest\Webtrees\Http\RequestHandlers\DeletePath;
use Fisharebest\Webtrees\I18N;

?>

<div class="btn-group">
    <?php if (!empty($media)) : ?>
        <form method="post" action="<?= e(route('admin-webtrees1-thumbs-action')) ?>">
            <input type="hidden" name="thumbnail" value="<?= e($thumbnail) ?>">
            <?php foreach ($media as $medium) : ?>
                <input type="hidden" name="ged[]" value="<?= e($medium->tree()->name()) ?>">
                <input type="hidden" name="xref[]" value="<?= e($medium->xref()) ?>">
            <?php endforeach ?>
            <button class="btn <?= $difference < 99 ? 'btn-primary' : 'btn-secondary' ?> wt-fix-button" type="button" data-action="add">
                <?= view('icons/add') ?>
                <?= I18N::translate('add') ?>
                <?php if (count($media) > 1) : ?>
                    <?= I18N::number(count($media)) ?>
                <?php endif ?>
            </button>
        </form>
    <?php endif ?>
    <a href="#" data-post-url="<?= e(route(DeletePath::class, ['path' => $thumbnail])) ?>" class="btn <?= $difference >= 99 ? 'btn-primary' : 'btn-secondary' ?>">
        <?= view('icons/delete') ?>
        <?= I18N::translate('delete') ?>
    </a>
</div>
