<?php $__env->startSection('title', 'تعديل خطة'); ?>
<?php $__env->startSection('heading', 'تعديل خطة: '.$plan->name); ?>
<?php $__env->startSection('subheading', 'الحدود تؤثر فوراً على تطبيق Flutter بعد التحديث'); ?>

<?php $__env->startSection('content'); ?>
    <div class="mb-6">
        <a href="<?php echo e(route('admin.subscription-plans.index')); ?>" class="text-sm font-medium text-teal-700 hover:underline">← العودة إلى الخطط</a>
    </div>

    <div class="mx-auto max-w-3xl rounded-2xl border border-zinc-200 bg-white p-6 shadow-sm">
        <form method="post" action="<?php echo e(route('admin.subscription-plans.update', $plan)); ?>">
            <?php echo csrf_field(); ?>
            <?php echo method_field('PUT'); ?>

            <div class="space-y-5">
                <div>
                    <label class="mb-1 block text-sm font-medium text-zinc-700">المعرّف (slug)</label>
                    <p class="rounded-xl border border-zinc-100 bg-zinc-50 px-3 py-2 font-mono text-sm text-zinc-700"><?php echo e($plan->slug); ?></p>
                </div>

                <div>
                    <label for="name" class="mb-1 block text-sm font-medium text-zinc-700">الاسم المعروض</label>
                    <input id="name" name="name" type="text" value="<?php echo e(old('name', $plan->name)); ?>" required maxlength="120"
                           class="w-full rounded-xl border border-zinc-300 px-3 py-2 text-sm">
                    <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-xs text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="grid gap-5 sm:grid-cols-2">
                    <div>
                        <label for="price" class="mb-1 block text-sm font-medium text-zinc-700">السعر (عرضي — بدون دفع)</label>
                        <input id="price" name="price" type="text" inputmode="decimal" value="<?php echo e(old('price', $plan->price)); ?>" required
                               class="w-full rounded-xl border border-zinc-300 px-3 py-2 text-sm font-mono">
                        <?php $__errorArgs = ['price'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-xs text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                    <div>
                        <label for="status" class="mb-1 block text-sm font-medium text-zinc-700">الحالة</label>
                        <select id="status" name="status" class="w-full rounded-xl border border-zinc-300 px-3 py-2 text-sm">
                            <option value="active" <?php if(old('status', $plan->status) === 'active'): echo 'selected'; endif; ?>>active</option>
                            <option value="inactive" <?php if(old('status', $plan->status) === 'inactive'): echo 'selected'; endif; ?>>inactive</option>
                        </select>
                        <?php $__errorArgs = ['status'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-xs text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                </div>

                <div class="grid gap-5 sm:grid-cols-2">
                    <div>
                        <label for="daily_ai_limit" class="mb-1 block text-sm font-medium text-zinc-700">الحد اليومي (رسائل)</label>
                        <input id="daily_ai_limit" name="daily_ai_limit" type="number" min="1" value="<?php echo e(old('daily_ai_limit', $plan->daily_ai_limit)); ?>" required
                               class="w-full rounded-xl border border-zinc-300 px-3 py-2 text-sm">
                        <?php $__errorArgs = ['daily_ai_limit'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-xs text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                    <div>
                        <label for="monthly_ai_limit" class="mb-1 block text-sm font-medium text-zinc-700">الحد الشهري (فارغ = غير محدود)</label>
                        <input id="monthly_ai_limit" name="monthly_ai_limit" type="number" min="0"
                               value="<?php echo e(old('monthly_ai_limit', $plan->monthly_ai_limit)); ?>"
                               class="w-full rounded-xl border border-zinc-300 px-3 py-2 text-sm">
                        <?php $__errorArgs = ['monthly_ai_limit'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-xs text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                </div>

                <div>
                    <label for="features_json" class="mb-1 block text-sm font-medium text-zinc-700">المميزات (JSON — مصفوفة نصوص)</label>
                    <textarea id="features_json" name="features_json" rows="8" maxlength="20000"
                              class="w-full rounded-xl border border-zinc-300 px-3 py-2 font-mono text-xs leading-relaxed"><?php echo e(old('features_json', json_encode($plan->features ?? [], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT))); ?></textarea>
                    <?php $__errorArgs = ['features_json'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="mt-1 text-xs text-red-600"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>

            <div class="mt-8">
                <button type="submit" class="rounded-xl bg-madar-950 px-6 py-2.5 text-sm font-bold text-white hover:bg-madar-900">حفظ التعديلات</button>
            </div>
        </form>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\wamp64\www\madar-backend\resources\views\admin\subscription-plans\edit.blade.php ENDPATH**/ ?>