
<link rel="stylesheet" type="text/css" href="<?php echo e(url('dropzone/dist/min/dropzone.min.css')); ?>">
<style>
    .img-prew {
        width: 100px;
        height: 100px;
        margin-top: -95px;
        border-radius: 50%;
        margin-left: -5px;
    }

    .post-imgPrw {
        height: 50px;
        margin-left: 10px;
        width: 50px;
        margin-top: 0px;
    }

    .invalid-feedback {
        display: block;
    }

    .image img {
        width: 247px;
        height: 271px;
        object-fit: cover;
    }
</style>
<?php $__env->startSection('content'); ?>
    <div class="common-content">
        <div class="page-content">
            <div class="page-heading">
                <div class="headings">
                    <h6>Add Products</h6>
                </div>
            </div>
            <form method="POST" id="master_product" action="<?php echo e(url('admin/createproducts')); ?>" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="dashboard-cnts">
                    <div class="bid-stats bidplace">
                        <div class="row">
                            <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs">
                                    <div class="form-group">
                                        <label>Category</label>
                                        <select id="category_id"
                                            class="form-control <?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]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="sel1"
                                            name="category_id" value="<?php echo e(old('category_id')); ?>" required
                                            autocomplete="category_id" autofocus>
                                            <option value="">Select</option>
                                            <?php $__currentLoopData = $category_lists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($category->category_id); ?>"><?php echo e($category->category); ?>

                                                </option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs">
                                    <div class="form-group">
                                        <label>Product Name</label>
                                        <input type="text" class="form-control" name="product_name" value=""
                                            required>
                                    </div>
                                </div>
                            </div>
                            <!--   <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                            <div class="form-inputs">
                                                 <div class="form-group">
                                                    <label>Product Code</label>
                                                    <input type="text" class="form-control" name="product_code" value="" required >
                                                  </div>
                                            </div>
                                          </div> -->
                            <!--<div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                            <div class="form-inputs">
                                                 <div class="form-group">
                                                    <label>Product Warranty Date</label>
                                                    <input id="datepicker" type="text" class="form-control" data-zdp_readonly_element="false" name="product_warranty" value="">
                                                  </div>
                                            </div>
                                          </div>-->
                            <div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs">
                                    <div class="form-group rs-form-group">
                                        <label>Product Description</label>
                                        <textarea rows='5' name="product_description" required></textarea>
                                    </div>
                                </div>
                            </div>
                            <!--  <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                            <div class="form-inputs">
                                                 <div class="form-group">
                                                 <label>Manufacturer</label>
                                                   <select id="manufacturer" class="form-control <?php $__errorArgs = ['manufacturer'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" id="sel1" name="manufacturer" value="<?php echo e(old('manufacturer')); ?>" required autocomplete="manufacturer" autofocus>
                                                    <option value="">Select</option>
                                                    <?php $__currentLoopData = $manufacturers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $manufacturer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <option value="<?php echo e($manufacturer->id); ?>"><?php echo e($manufacturer->name); ?></option>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                  </select>
                                                  </div>
                                            </div>
                                          </div> -->
                        </div>
                        <div class="row">
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
                                <div class="form-inputs">
                                    <div class="form-group">
                                        <label>Product Image</label>
                                        <div class="custom-file">
                                            <!-- <input type="file" class="custom-file-input" id="customFile" name="productcatalouge">
                                                        <label class="custom-file-label" for="customFile">Browse</label> -->
                                            <div class="dropzone dz-clickable Dz-box happy-box" id="dropzonewidget"
                                                onClick="changePicimage()" style="width: 120px;">
                                                <img src="<?php echo e(url('assets/images/upload.png')); ?>"
                                                    title="Click here to upload" id="uploadimageimage"
                                                    style="border-style: outset;width: 50px;height: 50px;cursor: pointer;">
                                                <input type="file" name="productimage" id="post_imageimage"
                                                    onchange="readURLimage(this);" style="display:none">
                                                <img id="blahimage" src="#" class="post-imgPrw"
                                                    style="display:none" />
                                                <iframe id="blah1image" class="post-imgPrw" style="display:none"
                                                    src="#">
                                                </iframe>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--      <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                            <div class="form-inputs">
                                                 <div class="form-group">
                                                    <label>Product Catalogue</label>
                                                    <div class="custom-file">
                                                            <label for="fileInput" class="custom-file">Choose file</label>
                                                            <button type= "button" class="choosefile">Browse...</button>
                                                            <input id="productcatalouge" name="productcatalouge" type="file" style="display:none" />
                                                             <span class="fileuploadspan">No file selected</span>
                                                      </div>
                                                  </div>
                                                  </div>
                                          </div>
                                          <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                            <div class="form-inputs">
                                                 <div class="form-group">
                                                    <label>Product Certificate</label>
                                                    <div class="custom-file">
                                                            <label for="fileInput" class="custom-file">Choose file</label>
                                                            <button type= "button" class="choosefilecertificate">Browse...</button>
                                                            <input id="productcertificate" name="productcertificate" type="file" style="display:none" />
                                                             <span class="fileuploadspancertificate">No file selected</span>
                                                      </div>
                                                  </div>
                                                  </div>
                                          </div>
                                          <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                            <div class="form-inputs">
                                                 <div class="form-group">
                                                    <label style="margin-top: 20px;" >Performance Report</label>
                                                    <div class="custom-file">
                                                            <label for="fileInput" class="custom-file">Choose file</label>
                                                            <button type= "button" class="choosefilereport">Browse...</button>
                                                            <input id="productperformancereport" name="productperformancereport" type="file" style="display:none" />
                                                             <span class="fileuploadspanreport">No file selected</span>
                                                      </div>
                                                  </div>
                                                  </div>
                                          </div>
                                    </div> -->
                                    <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12">
                                      <div class="form-inputs">
                                          <div class="form-group">
                                              <label style="margin-top: 20px;">Product Video</label>
                                              <div class="custom-file">
                                                  <label for="fileInput" class="custom-file">Choose file</label>
                                                  <button type="button" class="choosefileproductvideo"
                                                      style="cursor: pointer;">Browse...</button>
                                                  <input id="product_video" name="product_video" type="file"
                                                      style="display:none" />
                                                  <span class="fileuploadspanproductvideo">No file selected</span>
                                              </div>
                                          </div>
                                      </div>
                                  </div>
                        </div>
                        <div class="row" style="padding-top: 20px;">
                            <div class="col-12">
                                <div class="green-button green-button2">
                                    <button id="create">Submit</button>
                                </div>
                            </div>
                        </div>
            </form>
        </div>
    <?php $__env->stopSection(); ?>
    <?php $__env->startSection('scripts'); ?>
        <script src="<?php echo e(url('dropzone/dist/min/dropzone.min.js')); ?>" type="text/javascript"></script>
        <script>
            function readURLimage(input) {
                if (input.files && input.files[0]) {
                    var file = input.files[0];
                    var fileType = file["type"];
                    var validImageTypes = ["image/png", "image/jpeg", "image/png"];
                    if ($.inArray(fileType, validImageTypes) < 0) {
                        var reader = new FileReader();
                        reader.onload = function(e) {
                            $('#blah1image')
                                .attr('src', e.target.result)
                        };
                        reader.readAsDataURL(input.files[0]);
                    } else {
                        var reader = new FileReader();
                        reader.onload = function(e) {
                            $('#blahimage')
                                .attr('src', e.target.result)
                        };
                        reader.readAsDataURL(input.files[0]);
                    }
                }
            }

            function changePicimage() {
                document.getElementById('post_imageimage').click();
                $('#post_imageimage').change(function() {
                    var filename = $('#post_imageimage').val();
                    var fileExtension = ['jpeg', 'jpg', 'png', 'gif'];
                    if ($.inArray(filename.split('.').pop().toLowerCase(), fileExtension) == -1) {
                        if (filename) {
                            $('#blahimage').hide();
                            $('#blah1image').show();
                            $('#uploadimageimage').hide();
                            $(".invalid-feedback").css("display", "none");
                        }
                        $('#post_imageimage').html(filename);
                    } else {
                        if (filename) {
                            $('#blah1image').hide();
                            $('#blahimage').show();
                            $('#uploadimageimage').hide();
                            $(".invalid-feedback").css("display", "none");
                        }
                        $('#post_imageimage').html(filename);
                    }
                });
            }
        </script>
        <script>
            $("#create").click(function() {
                //alert("bbbb");
                $("#master_product").validate({
                    ignore: [],
                    rules: {
                        "category_id": {
                            required: true
                        },
                        "product_name": {
                            required: true
                        },
                        "product_description": {
                            required: true
                        },
                    },
                    submitHandler: function(form, e) {
                        $(".pageloader").show();
                        $(".pageloader").delay(5000).fadeOut("slow");
                        form.submit();
                    }
                });
            });
            $(function() {
                $('#master_product').on('submit', function(event) {
                    event.preventDefault();
                });
            });
        </script>
        <script>
          $(document).ready(function() {
            $('.choosefileproductvideo').click(function() {
                $('#product_video').click();
            });
            $('#product_video').change(function(e) {
                var filename = this.files[0].name;
                $('.fileuploadspanproductvideo').text(filename);
            });
          });
        </script>
    <?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.main_admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/meddbot/public_html/resources/views/admin/addproduct.blade.php ENDPATH**/ ?>