<?php

use Fisharebest\Webtrees\Http\RequestHandlers\DeleteRecord;
use Fisharebest\Webtrees\Http\RequestHandlers\EditRecordPage;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Submitter;

/**
 * @var Submitter $record
 */

?>

<div class="dropdown wt-page-menu">
    <button class="btn btn-primary dropdown-toggle wt-page-menu-button" type="button" id="page-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        <?= view('icons/menu') ?>
        <?= I18N::translate('edit') ?>
    </button>

    <div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
        <a class="dropdown-item" href="<?= route(EditRecordPage::class, ['xref' => $record->xref(), 'tree' => $record->tree()->name()]) ?>">
            <?= view('icons/edit') ?>
            <?= I18N::translate('Edit') ?>
        </a>

        <a class="dropdown-item" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($record->fullName())) ?>" data-post-url="<?= e(route(DeleteRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>">
            <?= view('icons/delete') ?>
            <?= I18N::translate('Delete') ?>
        </a>
    </div>
</div>

<?php if ($record->canEdit()) : ?>
<?php endif ?>

