<?php $__env->startSection('main-container'); ?>
<main id="main" class="main">
<?php echo $__env->make('cdn', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<div class="row page-titles mx-0">

    <div class="col-sm-6 p-md-0">

        <div class="breadcrumb-range-picker">

             <h3>Add Product</h3>

        </div>

    </div>

    <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">

         <a href="<?php echo e(route('/')); ?>" class="btn btn-rounded bg-grad-4 ml-4">

            <span class="btn-icon-left text-primary">

                <i class="fa fa-arrow-left color-primary"></i>

            </span>Back

        </a>

    </div>

</div>

<div class="content-wrapper" style="margin-top: 15px">
        <div class="row ">
          <div class="card">
            <div class="card-body">

              <form action="<?php echo e(route('addproduct.store')); ?>" method="POST" class="form-sample" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>

                <div class="row">
                    <div class="form-group col-lg-6">

                        <label>Name <span class="text-danger">*</span></label>

                        <input type="text" class="form-control" name="name" value="<?php echo e(old('name')); ?>" placeholder="Name">

                        <span class="text-danger"> <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><?php echo e($message); ?><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> </span>

                    </div>



                    <div class="form-group col-lg-6">

                        <label>Unit <span class="text-danger">*</span></label>

                        <input type="text" class="form-control" name="unit" value="<?php echo e(old('unit')); ?>" placeholder="Unit">

                        <span class="text-danger"> <?php $__errorArgs = ['unit'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><?php echo e($message); ?><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> </span>

                    </div>

                    <div class="form-group col-lg-6">

                        <label>Price <span class="text-danger">*</span></label>

                        <div class="input-group mb-2">

                            <input type="number" class="form-control" name="price" value="<?php echo e(old('price')); ?>" placeholder="Price" >

                        </div>

                        <span class="text-danger"> <?php $__errorArgs = ['price'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><?php echo e($message); ?><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> </span>

                    </div>


                    <div class="form-group col-lg-6">
                        <label>Brand <span class="text-danger">*</span></label>
                        <select class=" form-control dropdown-toggle" type="button" name="brand" data-toggle="dropdown">
                            <option value="">Select Brand</option>
                             <?php $__currentLoopData = $brand_masters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                             <option value="<?php echo e($brand->id); ?>"><?php echo e($brand->name); ?></option>
                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <span class="text-danger"><?php $__errorArgs = ['brand'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><?php echo e($message); ?><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?></span>
                    </div>


                    <div class="form-group col-lg-6">
                        <label>Category <span class="text-danger">*</span></label>
                        <select class=" form-control dropdown-toggle" name="category" type="button" data-toggle="dropdown">
                            <option value="">Select Category</option>
                             <?php $__currentLoopData = $category_masters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                             <option value="<?php echo e($category->id); ?>"><?php echo e($category->name); ?></option>
                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <span class="text-danger"><?php $__errorArgs = ['category'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><?php echo e($message); ?><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?></span>
                    </div>


                    <div class="form-group col-lg-6">
                        <label>Group <span class="text-danger">*</span></label>
                         <select class=" form-control dropdown-toggle" name="group" type="button" data-toggle="dropdown">
                            <option value="">Select Group</option>
                             <?php $__currentLoopData = $groups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                             <option value="<?php echo e($group->id); ?>"><?php echo e($group->name); ?></option>
                         <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <span class="text-danger"><?php $__errorArgs = ['group'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><?php echo e($message); ?><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?></span>
                    </div>

                    <div class="form-group col-lg-6">

                        <label>Image <span class="text-danger">*</span></label>

                        <input type="file" class="form-control" name="image" id="image">

                        <img id="preview-image-before-upload" height="100" class="mt-2">

                        <span class="text-danger"> <?php $__errorArgs = ['image'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><?php echo e($message); ?><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> </span>

                    </div>

                    <div class="form-group col-lg-12">

                        <label>Description <span class="text-danger">*</span></label>

                        <textarea class="form-control ckeditor" name="description" placeholder="Description"></textarea>

                        <span class="text-danger"> <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><?php echo e($message); ?><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?> </span>

                    </div>



                </div>

                <div class="text-center">
                    <button type="submit" class="btn btn-primary bg-grad-4">Submit</button>
                </div>

              </form>

            </div>
          </div>
        </div>
      </div>


</main><!-- End #main -->
 <?php $__env->stopSection(); ?>

 <script src="//cdn.ckeditor.com/4.14.1/standard/ckeditor.js"></script>
 <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

 <script type="text/javascript">

 $(document).ready(function (e) {

    $('#preview-image-before-upload').hide();

    $('#image').change(function(){

     $('#preview-image-before-upload').show();

     let reader = new FileReader();

     reader.onload = (e) => {

       $('#preview-image-before-upload').attr('src', e.target.result);
     }

     reader.readAsDataURL(this.files[0]);

    });

 });

 </script>




<?php echo $__env->make('frontend.layouts.main', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\TADA\resources\views/product/create.blade.php ENDPATH**/ ?>