<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>تعديل إعدادات: <?= e($group) ?><?php $__template->endSection(); ?>
<?php $__template->section('content'); ?>
<form method="POST" action="/settings/group/<?= urlencode($group) ?>">
    <?= csrf_field() ?>
    <div class="card" style="padding:20px;">
        <?php foreach ($settings as $s): ?>
        <div class="form-group" style="margin-bottom:20px;padding-bottom:20px;border-bottom:1px solid #F3F4F6;">
            <label class="form-label" style="font-weight:600;">
                <?= e($s['description_ar'] ?? $s['config_key']) ?>
                <small style="color:#9CA3AF;display:block;font-weight:400;"><?= e($s['config_key']) ?> (<?= e($s['config_type']) ?>)</small>
            </label>
            <?php if (!$s['is_editable']): ?>
                <input type="text" value="<?= e($s['config_value'] ?? '') ?>" class="form-input" disabled style="background:#f3f4f6;">
                <small style="color:#DC2626;">هذا الإعداد غير قابل للتعديل</small>
            <?php elseif ($s['config_type'] === 'boolean'): ?>
                <select name="config_<?= e(str_replace('.', '_', $s['config_key'])) ?>" class="form-select">
                    <option value="1" <?= $s['config_value'] === '1' ? 'selected' : '' ?>>نعم</option>
                    <option value="0" <?= $s['config_value'] !== '1' ? 'selected' : '' ?>>لا</option>
                </select>
            <?php elseif ($s['config_type'] === 'json'): ?>
                <textarea name="config_<?= e(str_replace('.', '_', $s['config_key'])) ?>" class="form-textarea" rows="4"><?= e($s['config_value'] ?? '') ?></textarea>
            <?php else: ?>
                <input type="text" name="config_<?= e(str_replace('.', '_', $s['config_key'])) ?>" value="<?= e($s['config_value'] ?? '') ?>" class="form-input">
            <?php endif; ?>
        </div>
        <?php endforeach; ?>
    </div>
    <button type="submit" class="btn btn-primary" style="margin-top:20px;">حفظ الإعدادات</button>
    <a href="/settings" class="btn btn-outline" style="margin-top:20px;">إلغاء</a>
</form>
<?php $__template->endSection(); ?>