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

<?php $__env->startSection('content'); ?>
    <div class="admin-top">
        <h1>Edit product</h1>
        <a href="<?php echo e(route('admin.products.index')); ?>" class="btn btn-ghost">Back</a>
    </div>
    <form method="POST" action="<?php echo e(route('admin.products.update', $product)); ?>" class="card">
        <?php echo csrf_field(); ?>
        <?php echo method_field('PUT'); ?>
        <div class="form-row">
            <label for="category_id">Category</label>
            <select id="category_id" name="category_id" required>
                <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($c->id); ?>" <?php if(old('category_id', $product->category_id) == $c->id): echo 'selected'; endif; ?>><?php echo e($c->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
            <?php $__errorArgs = ['category_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
        <div class="form-row">
            <label for="title">Title</label>
            <input type="text" id="title" name="title" value="<?php echo e(old('title', $product->title)); ?>" required>
            <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
        <div class="form-row">
            <label for="slug">Slug</label>
            <input type="text" id="slug" name="slug" value="<?php echo e(old('slug', $product->slug)); ?>">
            <?php $__errorArgs = ['slug'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
        <div class="form-row">
            <label for="description">Description</label>
            <textarea id="description" name="description"><?php echo e(old('description', $product->description)); ?></textarea>
        </div>
        <div class="form-row">
            <label for="price">Price</label>
            <input type="number" id="price" name="price" value="<?php echo e(old('price', $product->price)); ?>" step="0.01" min="0" required>
            <?php $__errorArgs = ['price'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
        <div class="form-row">
            <label for="compare_at_price">Compare at price</label>
            <input type="number" id="compare_at_price" name="compare_at_price" value="<?php echo e(old('compare_at_price', $product->compare_at_price)); ?>" step="0.01" min="0">
        </div>
        <div class="form-row">
            <label for="image_url">Image URL</label>
            <input type="url" id="image_url" name="image_url" value="<?php echo e(old('image_url', $product->image_url)); ?>" required>
            <?php $__errorArgs = ['image_url'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="error"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
        </div>
        <div class="form-row">
            <label for="variant_label">Variant label</label>
            <input type="text" id="variant_label" name="variant_label" value="<?php echo e(old('variant_label', $product->variant_label)); ?>">
        </div>
        <div class="form-row">
            <label for="review_count">Review count</label>
            <input type="number" id="review_count" name="review_count" value="<?php echo e(old('review_count', $product->review_count)); ?>" min="0">
        </div>
        <div class="form-row">
            <label for="sort_order">Sort order</label>
            <input type="number" id="sort_order" name="sort_order" value="<?php echo e(old('sort_order', $product->sort_order)); ?>" min="0">
        </div>
        <div class="form-row">
            <label><input type="checkbox" name="is_best_seller" value="1" <?php if(old('is_best_seller', $product->is_best_seller)): echo 'checked'; endif; ?>> Best seller</label>
        </div>
        <div class="form-row">
            <label><input type="checkbox" name="is_active" value="1" <?php if(old('is_active', $product->is_active)): echo 'checked'; endif; ?>> Active</label>
        </div>
        <button type="submit" class="btn btn-primary">Save</button>
    </form>
<?php $__env->stopSection(); ?>

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