

<?php $__env->startSection('title', 'Edit Product'); ?>

<?php $__env->startSection('content'); ?>
<div class="max-w-4xl mx-auto space-y-6">
    <div class="rounded-3xl bg-white p-8 shadow-sm">
        <h1 class="text-3xl font-semibold">Edit Product</h1>
        <p class="mt-2 text-slate-600">Update your product details.</p>
    </div>

    <form action="<?php echo e(route('admin.products.update', $product->id)); ?>" method="POST" enctype="multipart/form-data" class="rounded-3xl bg-white p-8 shadow-sm space-y-6">
        <?php echo csrf_field(); ?>
        <?php echo method_field('PUT'); ?>

        <div class="grid gap-6 md:grid-cols-2">
            <div>
                <label class="block text-sm font-medium text-slate-700">Name</label>
                <input type="text" name="name" value="<?php echo e(old('name', $product->name)); ?>" required class="mt-2 w-full rounded-3xl border border-slate-200 bg-slate-50 px-4 py-3 focus:border-slate-900 focus:outline-none">
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700">Category</label>
                <select name="category_id" required class="mt-2 w-full rounded-3xl border border-slate-200 bg-slate-50 px-4 py-3 focus:border-slate-900 focus:outline-none">
                    <option value="">Select category</option>
                    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($category->id); ?>" <?php if(old('category_id', $product->category_id) == $category->id): echo 'selected'; endif; ?>><?php echo e($category->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
        </div>

        <div>
            <label class="block text-sm font-medium text-slate-700">Description</label>
            <textarea name="description" rows="4" class="mt-2 w-full rounded-3xl border border-slate-200 bg-slate-50 px-4 py-3 focus:border-slate-900 focus:outline-none"><?php echo e(old('description', $product->description)); ?></textarea>
        </div>

        <div class="grid gap-6 md:grid-cols-3">
            <div>
                <label class="block text-sm font-medium text-slate-700">Price</label>
                <input type="number" step="0.01" name="price" value="<?php echo e(old('price', $product->price)); ?>" required class="mt-2 w-full rounded-3xl border border-slate-200 bg-slate-50 px-4 py-3 focus:border-slate-900 focus:outline-none">
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700">Sale Price</label>
                <input type="number" step="0.01" name="sale_price" value="<?php echo e(old('sale_price', $product->sale_price)); ?>" class="mt-2 w-full rounded-3xl border border-slate-200 bg-slate-50 px-4 py-3 focus:border-slate-900 focus:outline-none">
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700">Discount %</label>
                <input type="number" name="discount_percent" value="<?php echo e(old('discount_percent', $product->discount_percent)); ?>" class="mt-2 w-full rounded-3xl border border-slate-200 bg-slate-50 px-4 py-3 focus:border-slate-900 focus:outline-none">
            </div>
        </div>

        <div class="grid gap-6 md:grid-cols-3">
            <div>
                <label class="block text-sm font-medium text-slate-700">Rating</label>
                <input type="number" step="0.1" min="0" max="5" name="rating" value="<?php echo e(old('rating', $product->rating)); ?>" class="mt-2 w-full rounded-3xl border border-slate-200 bg-slate-50 px-4 py-3 focus:border-slate-900 focus:outline-none">
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700">Image</label>
                <input type="file" name="image" accept="image/*" class="mt-2 w-full text-slate-700">
            </div>
            <div>
                <label class="block text-sm font-medium text-slate-700">Image URL</label>
                <input type="text" name="image_url" value="<?php echo e(old('image_url', $product->image)); ?>" class="mt-2 w-full rounded-3xl border border-slate-200 bg-slate-50 px-4 py-3 focus:border-slate-900 focus:outline-none">
                <p class="mt-2 text-xs text-slate-500">Use either image upload or an external image URL.</p>
            </div>
        </div>

        <div class="grid gap-4 md:grid-cols-3">
            <label class="inline-flex items-center gap-2 text-sm text-slate-700">
                <input type="checkbox" name="is_special_pick" value="1" <?php if(old('is_special_pick', $product->is_special_pick)): echo 'checked'; endif; ?> class="rounded border-slate-300 text-slate-900 focus:ring-slate-900">
                Special Pick
            </label>
            <label class="inline-flex items-center gap-2 text-sm text-slate-700">
                <input type="checkbox" name="is_flash_deal" value="1" <?php if(old('is_flash_deal', $product->is_flash_deal)): echo 'checked'; endif; ?> class="rounded border-slate-300 text-slate-900 focus:ring-slate-900">
                Flash Deal
            </label>
            <label class="inline-flex items-center gap-2 text-sm text-slate-700">
                <input type="checkbox" name="is_best_seller" value="1" <?php if(old('is_best_seller', $product->is_best_seller)): echo 'checked'; endif; ?> class="rounded border-slate-300 text-slate-900 focus:ring-slate-900">
                Best Seller
            </label>
        </div>

        <div class="flex justify-end gap-3">
            <a href="<?php echo e(route('admin.products.index')); ?>" class="rounded-full border border-slate-300 px-6 py-3 text-slate-700 hover:bg-slate-50">Cancel</a>
            <button type="submit" class="rounded-full bg-slate-900 px-6 py-3 text-white hover:bg-slate-800">Update Product</button>
        </div>
    </form>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\phunt\resources\views/admin/products/edit.blade.php ENDPATH**/ ?>