<?php $pageTitle = 'Edit Email Template'; ?>
<div class="mb-3"><a href="<?= base_url('admin/email-templates') ?>" class="text-secondary"><i class="fas fa-arrow-left me-1"></i> Back to Templates</a></div>
<div class="card-cix">
    <div class="card-cix-header"><h5 class="mb-0"><i class="fas fa-edit text-orange me-2"></i> <?= e($template['name']) ?></h5></div>
    <p class="text-secondary small mb-3">Code: <code><?= e($template['code']) ?></code></p>
    <form method="POST" action="<?= base_url('admin/email-template-edit/' . $template['id']) ?>">
        <?= csrf_field() ?>
        <div class="form-group-cix"><label class="form-label-cix">Subject</label><input type="text" name="subject" class="form-control-cix" value="<?= e($template['subject']) ?>" required></div>
        <div class="form-group-cix"><label class="form-label-cix">Body (HTML)</label><textarea name="body" class="form-control-cix" rows="15" style="font-family:monospace;font-size:13px;"><?= e($template['body']) ?></textarea></div>
        <div class="form-check mb-3"><input class="form-check-input" type="checkbox" name="is_active" value="1" <?= $template['is_active'] ? 'checked' : '' ?>><label class="form-check-label text-secondary">Active</label></div>
        <button type="submit" class="btn-cix btn-cix-accent"><i class="fas fa-save"></i> Save Template</button>
    </form>
</div>
