<style>
    .form-inputs.f-adj .form-group {
        display: flex;
        flex-direction: column;
    }
    .form-inputs.f-adj .form-group label.error {
        order: 2;
    }
</style>

<?php $__env->startSection('content'); ?>
    <div class="common-content">
        <div class="page-content">
            <div class="page-heading">
                <div class="headings">
                    <h6><?php echo e($title); ?></h6>
                </div>
            </div>
            <input type="hidden" id="token_medd" name="_tokens" value="<?php echo e(csrf_token()); ?>">

            <input type="hidden" id="type" name="type" value="request">


            <form method="POST" id="saveManufactureproducts" action="<?php echo e(url('/requestsavemanufacturesproducts')); ?>"
                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 class="label">Manufacturer<sup>*</sup></label>
                                        <select id="manufacturer"
                                            class="form-control invoiceselect changemanufactures"
                                            id="manufacturer" name="manufacturer" >
                                            <option value="">Select</option>
                                            <?php $__currentLoopData = $dealers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dealer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                               
                                                   
                                                        <option value="<?php echo e($dealer->id); ?>">
                                                            <?php echo e(ucfirst($dealer->name)); ?></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 f-adj">
                                    <div class="form-group">
                                        <label class="label">Category<sup>*</sup></label>
                                        <select id="category_id" class="form-control invoiceselect" id="category_id"
                                            name="category_id"
                                            autocomplete="category_id" autofocus>
                                            <option value="">Select</option>
                                            <?php $__currentLoopData = $categorylist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $categorylist): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                               <option value="<?php echo e($categorylist->category_id); ?>"><?php echo e(ucfirst($categorylist->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 f-adj">
                                    <div class="form-group">
                                        <label class="label">Master Products<sup>*</sup></label>
                                        <select id="master_product"
                                            class="form-control invoiceselect"
                                            id="master_product" name="master_product"  >
                                            <option value="">Select</option>
                                        </select>
                                    </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 class="label">Product Description<sup>*</sup></label>
                                        <textarea rows='5' id="product_description" name="product_description" readonly></textarea>
                                    </div>
                                </div>
                            </div>
                        
                        </div>
                        <div class="row row23">
                            <div class="col-lg-4 col-md-6 col-sm-12 col-xs-12"  id="links">
                               
                            </div>
                            
                            
                        </div>
                        <input type="hidden" name="resultvalue" id="resultvalue" value="">
                        <div class="row" style="padding-top: 20px;">
                            <div class="col-12">
                                <div class="green-button green-button2 d-flex justify-content-center">
                                    <button id="create">Request</button>
                                </div>
                            </div>
                        </div>
                    </div>
            </form>
        </div>

        
        <div class="tableBox hideshadow">    
            <?php if(count($RequestProducts) > 0){ ?>
            <table id="example" class="table table-striped table-bordered" style="width:100%">
               <thead>
                   <tr>
                       <th>No</th>
                       <th>Manufacturer Name</th>
                       <th>Category</th>
                       <th>Product Name</th>
                       <th>Requested Date</th>
                       <th>Status</th>
                       <th>Reason</th>
                   </tr>
               </thead>
               <tbody>
               <?php $__currentLoopData = $RequestProducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$pr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                   <tr>
                       <td><?php echo e($key+1); ?></td>
                       <td><?php echo e(ucfirst($pr->name)); ?></td>
                       <td><?php echo e(ucfirst($pr->category)); ?></td>
                       <td><?php echo e(ucfirst($pr->product_name)); ?></td>
                       <td><?php echo e(ucfirst($pr->requested_date)); ?></td>
                       <td><?php if($pr->request_status ==1): ?> <span class="status green">Approved</span> <?php endif; ?> <?php if($pr->request_status ==0): ?> <span class="status orange">Pending</span> <?php endif; ?> <?php if($pr->request_status ==2): ?> <span class="status red">Rejected</span> <?php endif; ?></td>
                    <td style="font-size: 13px;"><?php if(!empty($pr->reason)): ?><?php echo e($pr->reason); ?><?php else: ?> - <?php endif; ?></td>                  
                   </tr>
               <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
               </tbody>
           </table>
            <?php }else{ ?>
           <!-- <div class="col-lg-12 col-md-6 col-sm-12 col-xs-12">
                  <div class="product-display">
                           <ul>
                               <li>
                                   <div class="details">
                                       <div>
                                           <h6>
                                           No Data available
                                           </h6>
                                       </div>


                                   </div>
                               </li>


                           </ul>
                  </div>
            </div>-->

           <?php } ?>
          </div>


        
    <?php $__env->stopSection(); ?>
    <?php $__env->startSection('scripts'); ?>    
    <script src="<?php echo e(url('assets/js/common.js')); ?>"></script>
    <script>

            <?php if(Session::has('message')): ?>
                swal({
                    title: "",
                    text: "<?php echo e(Session::get('message')); ?>",
                    type: "success",
                    showCancelButton: false,
                    dangerMode: false,
                    confirmButtonText: 'OK',
                });
            <?php endif; ?>
            <?php if(Session::has('error')): ?>
                swal({
                    title: "",
                    text: "<?php echo e(Session::get('error')); ?>",
                    type: "warning",
                    showCancelButton: false,
                    dangerMode: true,
                    confirmButtonText: 'OK',
                });
            <?php endif; ?>

$(document).ready(function() {
    $('#example').DataTable();
} );
    $('#category_id').on('change', function() {
        $(".pageloader").show();
        var catid = this.value;
        var APP_URL = <?php echo json_encode(url('/getproducts')); ?>;
        var saveData = $.ajax({
            type: 'GET',
            url: APP_URL + '/' + catid,
            data: {
                catid: catid,
                manu_id:$("#manufacturer").val(),
                _token: '<?php echo e(csrf_token()); ?>',

            },
            dataType: "text",
            success: function(resultData) {
                $("#master_product").html(resultData);
                $(".pageloader").hide();
            }
        });
    });

    </script>
    <?php $__env->stopSection(); ?>

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