<?php
// pages/components/calendar_rotate_token_confirm.php
require_once BEEZUI_ROOT . '/components/index.php';

use Components\Router;
use Components\Base;
use Components\Button;

$filter = mh_get('filter', 'all', 'string');
$rotateUrl = Router::url('calendar_rotate_token', ['partial' => 1, 'filter' => $filter, 'confirmed' => 1]);

ob_start();
?>
    <div class="space-y-4">
        <p class="text-sm text-gray-500">
            <?= Base::h(mh_lng('UI_CALENDAR_SUBSCRIBE_ROTATE_DESC', 'Your existing subscriptions will stop working immediately and you will need to set them up again with the new link.')); ?>
        </p>

        <template x-teleport="#confirm-modal-footer">
            <div class="grid grid-cols-1 sm:grid-cols-2 gap-3 w-full">
                <?= Button::render(mh_lng('UI_CANCEL', 'Cancel'), [
                        'variant' => 'outline',
                        'fullWidth' => true,
                        'attrs' => [
                                'command' => 'close',
                                'commandfor' => 'confirm-modal',
                        ],
                ]) ?>

                <?= Button::render(mh_lng('UI_CALENDAR_SUBSCRIBE_SECURITY_RENEW', 'Renew calendar link'), [
                        'variant' => 'danger',
                        'fullWidth' => true,
                        'attrs' => [
                                'hx-post' => $rotateUrl,
                                'hx-target' => '#confirm-modal-body',
                                'hx-swap' => 'innerHTML',
                        ],
                ]) ?>
            </div>
        </template>
    </div>
<?php
echo ob_get_clean();
