17 lines
1.3 KiB
PHP
17 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
return static function (AppContext $ctx): void {
|
|
$id = $ctx->query('id');
|
|
$rule = $ctx->rules->find($ctx->daUser->username(), $id);
|
|
if ($rule === null) {
|
|
$ctx->render('Preview autoresponder', '<div class="alert alert-err">Rule not found</div>');
|
|
return;
|
|
}
|
|
$body = '<div class="grid grid-2"><div class="panel"><h3>' . AppContext::e($ctx->t('Preview autoresponder')) . '</h3>' . render_preview_box($rule) . '</div>' .
|
|
'<div class="panel"><h3>Szczegóły reguły</h3><div class="summary-card"><div class="kv"><strong>Status</strong><span>' . AppContext::e($ctx->t(!empty($rule['enabled']) ? 'Enabled' : 'Disabled')) . '</span></div>' .
|
|
'<div class="kv"><strong>Okres</strong><span>' . AppContext::e(date('Y-m-d H:i', (int)$rule['start_ts']) . ' - ' . date('Y-m-d H:i', (int)$rule['end_ts'])) . '</span></div></div>' .
|
|
'<div class="actions"><a class="btn" href="' . AppContext::e($ctx->url('update.html', ['id' => $id])) . '">' . AppContext::e($ctx->t('Edit')) . '</a><a class="btn danger" href="' . AppContext::e($ctx->url('delete.html', ['id' => $id])) . '">' . AppContext::e($ctx->t('Delete')) . '</a><a class="btn" href="' . AppContext::e($ctx->url('index.html')) . '">Powrót</a></div></div></div>';
|
|
$ctx->render('Preview autoresponder', $body);
|
|
};
|