<?php $__env->startSection('title', $product->exists ? __('Edit Product') : __('Add Product')); ?>
<?php $__env->startSection('content'); ?>
<form method="POST" action="<?php echo e($product->exists ? route('products.update',$product) : route('products.store')); ?>"><?php echo csrf_field(); ?> <?php if($product->exists): ?><?php echo method_field('PUT'); ?><?php endif; ?><div class="card"><div class="card-body p-4"><div class="row g-3"><div class="col-md-6"><label class="form-label"><?php echo e(__('Product Name')); ?> *</label><input name="name" class="form-control" value="<?php echo e(old('name',$product->name)); ?>" required></div><div class="col-md-3"><label class="form-label">SKU</label><input name="sku" class="form-control" value="<?php echo e(old('sku',$product->sku)); ?>" placeholder="Auto"></div><div class="col-md-3"><label class="form-label"><?php echo e(__('Category')); ?></label><select name="category_id" class="form-select"><option value="">—</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 class="col-md-4"><label class="form-label"><?php echo e(__('Unit')); ?></label><select name="unit" class="form-select"><?php $__currentLoopData = $units; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $unit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($unit->short_name); ?>" <?php if(old('unit',$product->unit ?: 'pc')===$unit->short_name): echo 'selected'; endif; ?>><?php echo e($unit->name); ?> (<?php echo e($unit->short_name); ?>)</option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-md-4"><label class="form-label"><?php echo e(__('Opening / Current Stock')); ?></label><input name="stock_quantity" type="number" step="0.01" class="form-control" value="<?php echo e(old('stock_quantity',$product->stock_quantity ?? 0)); ?>" required></div><div class="col-md-4"><label class="form-label"><?php echo e(__('Low Stock Alert At')); ?></label><input name="low_stock_at" type="number" step="0.01" class="form-control" value="<?php echo e(old('low_stock_at',$product->low_stock_at ?? 0)); ?>" required></div><div class="col-md-4"><label class="form-label"><?php echo e(__('Cost Price')); ?></label><input name="cost_price" type="number" step="0.01" min="0" class="form-control" value="<?php echo e(old('cost_price',$product->cost_price ?? 0)); ?>" required></div><div class="col-md-4"><label class="form-label"><?php echo e(__('Retail Price')); ?></label><input name="retail_price" type="number" step="0.01" min="0" class="form-control" value="<?php echo e(old('retail_price',$product->retail_price ?? 0)); ?>" required></div><div class="col-md-4"><label class="form-label"><?php echo e(__('Wholesale Price')); ?></label><input name="wholesale_price" type="number" step="0.01" min="0" class="form-control" value="<?php echo e(old('wholesale_price',$product->wholesale_price ?? 0)); ?>" required></div><div class="col-12"><label class="form-label"><?php echo e(__('Description')); ?></label><textarea name="description" class="form-control" rows="2"><?php echo e(old('description',$product->description)); ?></textarea></div><div class="col-12"><div class="form-check"><input name="is_active" value="1" class="form-check-input" type="checkbox" id="active" <?php if(old('is_active',$product->exists ? $product->is_active : true)): echo 'checked'; endif; ?>><label class="form-check-label" for="active"><?php echo e(__('Available for sale')); ?></label></div></div></div></div><div class="card-footer bg-white text-end"><a href="<?php echo e(route('products.index')); ?>" class="btn btn-light"><?php echo e(__('Cancel')); ?></a><button class="btn btn-success"><?php echo e(__('Save Product')); ?></button></div></div></form>
<?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\TradeERP\resources\views/products/form.blade.php ENDPATH**/ ?>