<style>
    .orderLists.newDesg .imgBoxs {
    height: 170px;
    object-fit: cover;
    width: 120px;
}
    p.msg-sts {
    padding: 6px 10px !important;
}
button.submit-popup.create, button.submit-popup.createinpack.mt-3 {
    margin-top: 50px !important;
}   
 .main-popup-contents .rs-flex {
    width: 100%;
}   
  .main-popup-contents p {
    margin-bottom: 30px;
    font-weight: 600;
    font-size: 20px;
}  
 input#datepickerinproduction, #datepickerinpackage, #datepicker {
    border-radius: 30px;
}   
</style>


<?php $__env->startSection('content'); ?>
<div class="common-content">
          <div class="page-content">
                <div class="page-heading">
                    <div class="headings">
                        <h6>My Orders</h6>
                    </div>
                </div>

                <div class="dashboard-cnts">
                    <div class="row">
                        <div class="col-12">
                            <!--<div class="search-bar order-search">
                                 <div class="form-group has-search">
                                    <span class="fa fa-search form-control-feedback"></span>
                                    <input type="text" class="form-control search" placeholder="Search">
                                  </div>
                              </div>-->
                              <?php if(count($order_list) > 0): ?>
                            <?php $__currentLoopData = $order_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$orderlist): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                           <?php  if(date('Y-m-d') == date('Y-m-d',strtotime($orderlist->bidCreated))) {?>
                                <div class="boxings recently-add"  style="border-radius: 15px;">
				            <?php }else{ ?>
				                <div class="boxings" style="border-radius: 15px;">
				            <?php } ?>
                                <div class="product-order orderLists newDesg">
                                    <div class="imgBoxs">
                                        <?php $__currentLoopData = $vendorproducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vproducts): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php //print_r($vproducts->photo); ?>
                                                <?php if($vproducts->product_id == $orderlist->vendor_product_id): ?>
                                                    <?php if(!empty($vproducts->photo)): ?>
                                                        <img src="<?php echo e(url('product_files')); ?>/<?php echo e($vproducts->photo); ?>">
                                                    <?php else: ?>
                                                        <img src="<?php echo e(url('assets/images/1200px-No-Image-Placeholder.svg.png')); ?>">
                                                    <?php endif; ?>
                                                <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                    <div>
                                        <div class="new-pro">
                                            <div class="product-details">
                                                <div class="row">
                                                    <div class="col-md-12">
                                                        <h6 class="Product-id">Master Product&nbsp;&nbsp;: <span class="product"><?php echo e($orderlist->product_name); ?></span></p>
                                                    </div>
                                                    
                                                    <div class="col-md-7">
                                                        <h6 class="Product-id">

                                                            <?php if(Auth::user()->user_type == '3'): ?>
                                                            Manufacturer Product&nbsp;: 
                                                            <?php endif; ?>
                                                            <?php if(Auth::user()->user_type == '2'): ?>

                                                            Vendor Product&nbsp;: 

                                                            <?php endif; ?>
                                                            
                                                           
                                                            
                                                            <span class="product"><?php $__currentLoopData = $vendorproducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vproducts): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <?php if($vproducts->product_id == $orderlist->vendor_product_id): ?>
                                                            <?php echo e($vproducts->product_name); ?>

                                                            <?php endif; ?>
                                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></span></h6>
                                                    </div>
                                                    <div class="col-md-5">
                                                        <h6 class="Product-id">ID : <span><?php $__currentLoopData = $vendorproducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $vproducts): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <?php if($vproducts->product_id == $orderlist->vendor_product_id): ?>
                                                            <?php echo e($vproducts->product_code); ?>

                                                            <?php endif; ?>
                                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></span></h6>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="new-pro">
                                            <div class="row">
                                                <div class="col-md-7">
                                                    <div class="details-vendor">
                                                        <ul>
                                                            <li>
                                                                <div class="specss">
                                                                    Specifications
                                                                </div>
                                                                <div style="margin-left: 10px;">:
                                                                </div>
                                                                <div>
                                                                    <span><?php echo e($orderlist->product_information); ?></span>
                                                                </div>
                                                            </li>
                                                            <li>
                                                                <div class="specss">
                                                                    Reciever
                                                                </div>
                                                                <div style="margin-left: 10px;">:
                                                                </div>
                                                                <div>
                                                                    <span><?php echo e($orderlist->name); ?></span>
                                                                </div>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>

                                                <?php if(!empty($orderlist->bid_price)): ?>
                                                <div class="col-md-5">
                                                    <div class="amount">
                                                        <?php
                                                        $amount = ($orderlist->bid_price * $orderlist->bid_tax / 100);
                                                        $totalamount = $orderlist->bid_price + $amount ;
                                                        ?>
                                                        <span><?php echo e($totalamount); ?>(<?php echo e($orderlist->bid_price); ?> INR + <?php echo e($orderlist->bid_tax); ?>% tax)</span>
                                                    </div>
                                                </div>
                                                <?php else: ?>
                                                <div class="col-md-5">
                                                    <div class="amount">
                                                        <?php
                                                        $amount = ($orderlist->quote_price * $orderlist->bid_tax / 100);
                                                        $totalamount = $orderlist->quote_price + $amount ;
                                                        ?>
                                                        Quoted Price:<span><?php echo e($totalamount); ?>(<?php echo e($orderlist->quote_price); ?> INR + <?php echo e($orderlist->bid_tax); ?>% tax)</span>
                                                    </div>
                                                </div>
                                                <?php endif; ?>
                                            </div>
                                        </div>
                                        <div class="quote-btns">
											<button class="btn common-btn green-btn sendmessage"  onclick="sendmessage(<?php echo e($orderlist->buyer_id); ?>,<?php echo e($orderlist->vendor_product_id); ?>,'<?php echo e(ucfirst($orderlist->name)); ?>')" style="display:block">Send Message</button>
											 <?php if($orderlist->bid_status == '5'): ?>
                                            

                                             <?php if(Auth::user()->user_type == '3'): ?>
                                             <a href="<?php echo e(url('manufacturers/register_sold')); ?>/<?php echo e($orderlist->vendor_product_id); ?>/<?php echo e($orderlist->buyer_id); ?>/<?php echo e($orderlist->bidId); ?>" ><button class="btn common-btn green-btn"><i class="far fa-check-circle"></i> Register Sold Products</button></a>
								             <?php endif; ?>
                                             <?php if(Auth::user()->user_type == '2'): ?>
                                                <a href="<?php echo e(url('vendors/register_sold')); ?>/<?php echo e($orderlist->vendor_product_id); ?>/<?php echo e($orderlist->buyer_id); ?>/<?php echo e($orderlist->bidId); ?>" ><button class="btn common-btn green-btn"><i class="far fa-check-circle"></i> Register Sold Products</button></a>
                                             <?php endif; ?>


											
											
                                            
                                            
                                            <?php endif; ?>
											<?php if($orderlist->bid_status == '4'): ?>
											<button class="btn common-btn green-btn" onclick="inproduction('<?php echo e($orderlist->delivery_date); ?>','<?php echo e($orderlist->bidId); ?>','<?php echo e($orderlist->buyer_id); ?>','<?php echo e($orderlist->vendor_product_id); ?>')"><i class="far fa-check-circle"></i> In Production</button>  
											<?php endif; ?>
											<?php if($orderlist->bid_status == '4' || $orderlist->bid_status == '13'): ?>
											
                                            <button class="btn common-btn green-btn" onclick="inpackage('<?php echo e($orderlist->delivery_date); ?>','<?php echo e($orderlist->bidId); ?>','<?php echo e($orderlist->buyer_id); ?>','<?php echo e($orderlist->vendor_product_id); ?>')"><i class="far fa-check-circle"></i> In Package</button>  
                                            <?php endif; ?>
                                            <?php if($orderlist->bid_status == '4' || $orderlist->bid_status == '13' || $orderlist->bid_status == '14'): ?>
                                     
                                              <button class="btn common-btn green-btn" onclick="dispatchfirst('<?php echo e($orderlist->delivery_date); ?>','<?php echo e($orderlist->bidId); ?>','<?php echo e($orderlist->buyer_id); ?>','<?php echo e($orderlist->vendor_product_id); ?>','<?php echo e($orderlist->product_id); ?>','<?php echo e($orderlist->ordered_date); ?>')"><i class="far fa-check-circle"></i> Dispatch</button>  
                                            <?php else: ?>
                                               <p class="msg-sts">Dispatched</p> 
                                            <?php endif; ?>
                                            </div>

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


                            <!-- Modal -->
                            <div class="modal fade" id="myModalinpackage" role="dialog" >
                                <?php //print_r($allquotes->bidId);?>
                                       <div class="modal-dialog modal-dialog-centered">
                               
                                     <!-- Modal content-->
                                           <div class="modal-content">
                               
                                               <div class="modal-body model-custom">
                                                   <button type="button" class="close close_all" data-dismiss="modal">&times;</button>
                                                   <form  class="dispatchorderpack" method="POST" action="<?php echo e(url('vendors/packing')); ?>">
                                                   <?php echo csrf_field(); ?>
                                                       <div class="main-popup-contents">
                                                           <p>Kindly Confirm the expected date of Product Delivery</p>
                                                           <div class="rs-flex">
                                                               <label>Expected Date of Delivery</label>
                                                               <input id="datepickerinpackage" type="text" class="form-control" data-zdp_readonly_element="false" name="datepickerinpackage" value="" required>
                                                               <input type="hidden" id="bid_id_inpackage" name="bid_id_inpackage" value="">
                                                               
                                                               <input type="hidden" id="buyerid_inpackage" name="buyerid_inpackage" value="">
                                                               <input type="hidden" id="vendorid_inpackage" name="vendorid_inpackage" value="">
                                                               
                                                               
                                                           </div>
                               
                                                           <button class="submit-popup createinpack mt-3">SUBMIT</button>
                                                       </div>
                                                   </form>
                                               </div>
                               
                                           </div>
                               
                                       </div>
                                   </div>
                               <!-- Modal -->


                 <!-- Modal -->
                 <div class="modal fade" id="myModalinpr" role="dialog" >
                    <?php //print_r($allquotes->bidId);?>
                           <div class="modal-dialog modal-dialog-centered">
                   
                         <!-- Modal content-->
                               <div class="modal-content">
                   
                                   <div class="modal-body model-custom">
                                       <button type="button" class="close close_all" data-dismiss="modal">&times;</button>
                                       <form  class="dispatchorderinpr" method="POST" action="<?php echo e(url('vendors/in_production')); ?>">
                                       <?php echo csrf_field(); ?>
                                           <div class="main-popup-contents">
                                               <p>Kindly Confirm the expected date of Product Delivery</p>
                                               <div class="rs-flex">
                                                   <label>Expected Date of Delivery</label>
                                                   <input id="datepickerinproduction" type="text" class="form-control" data-zdp_readonly_element="false" name="datepickerinproduction" value="" required>
                                                   <input type="hidden" id="bid_id_inpr" name="bid_id_inpr" value="">
                                                   <input type="hidden" id="buyerid_inpr" name="buyerid_inpr" value="">
                                                   <input type="hidden" id="vendorid_inpr" name="vendorid_inpr" value="">
                                                </div>
                   
                                               <button class="submit-popup create">SUBMIT</button>
                                           </div>
                                       </form>
                                   </div>
                   
                               </div>
                   
                           </div>
                       </div>
                   <!-- Modal -->


                            <!-- Modal -->
 <div class="modal fade" id="myModal" role="dialog" >
 <?php //print_r($allquotes->bidId);?>
		<div class="modal-dialog modal-dialog-centered">

      <!-- Modal content-->
			<div class="modal-content">

				<div class="modal-body model-custom">
					<button type="button" class="close close_all" data-dismiss="modal">&times;</button>
                    <form  class="dispatchorder" method="POST" action="<?php echo e(url('vendors/dispatch')); ?>">
                    <?php echo csrf_field(); ?>
						<div class="main-popup-contents">
							<p>Kindly Confirm the expected date of Product Delivery</p>
							<div class="rs-flex">
                                <label>Expected Date of Delivery</label>
                                <input id="datepicker" type="text" class="form-control" data-zdp_readonly_element="false" name="delivery_date" value="" required>
                                <input type="hidden" id="bid_id" name="bid_id" value="">
                                <input type="hidden" id="productid" name="productid" value="">
                                <input type="hidden" id="buyerid" name="buyerid" value="">
                                <input type="hidden" id="vendorid" name="vendorid" value="">
                                <input type="hidden" id="ordereddate" name="ordereddate" value="">
                                
                            </div>

							<button class="submit-popup create">SUBMIT</button>
						</div>
                    </form>
				</div>

			</div>

		</div>
	</div>
<!-- Modal -->

                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?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 Order available
                                                </h6>
                                            </div>


                                        </div>
                                    </li>


                                </ul>
                            </div>
                        </div>
                        <?php endif; ?>
                        </div>
                    </div>
                </div>
          </div>
	<input name="_token" type="hidden" id="token_vendor" value="<?php echo e(csrf_token()); ?>">
		<!-- Modal -->
<div class="modal fade" id="message_pop" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog barcodePopup" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Send Message</h5>
        <button type="button" class="close closemessage" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>

      <div class="modal-body" id="">
	   <form name="add_msg" id="add_msg" method="POST" action="#">
           <?php echo csrf_field(); ?>
	     <div class="row manufacturerlist manufacturerlist-rs">
    		<div class="col-sm-12 col-xs-12">
                <div class="form-inputs">
                  <div class="form-group">
                    <label>To</label>
                    <input id="to_name" name="to_name" type="text" class="form-control" readonly>
          					<input id="to_id" name="to_id" type="hidden" class="form-control">
          					<input id="p_id" name="p_id" type="hidden" class="form-control">
          					<input id="complaint_id" name="complaint_id" type="hidden" class="form-control">
          					<input id="messagetype" name="messagetype" type="hidden" class="form-control">
                    </div>
                  </div>
                </div>
            </div>

            <div class="col-sm-12 col-xs-12">
                <div class="form-inputs">
                  <div class="form-group">
                    <label>Message</label>
                    <textarea  style="width:100%;border: 1px solid #cacaca;border-radius: 5px;padding: 10px;"  id="messagedetails" name="messagedetails" rows="4" cols="50"></textarea>
                  </div>
                </div>
              </div>

      </div>
		  <div class="modal-footer">
			<button type="button" class="btn btn-secondary closemessage" data-dismiss="modal" id="closebar">Close</button>
			<button type="submit" class="btn btn-primary sendmessage" id="sendmessage">
						  <?php echo e(__('Send')); ?>

					   </button>
		  </div>
	  </form>
    </div>
  </div>
</div>


<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<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('errormessage')): ?>
      swal({
        title: "",
        text: "<?php echo e(Session::get('errormessage')); ?>",
        type: "error",
        showCancelButton: false,
        dangerMode: true,
        confirmButtonText: 'OK',

    });
<?php endif; ?>
</script>
<script>

window.baseurl = 'https://www.meddbot.com/';

function dispatchfirst(expeddate,bidid,buyer_id,vendor_product_id,masterproduct_id,ordered_date){

    $("#productid").val(masterproduct_id);
    $("#buyerid").val(buyer_id);
    $("#vendorid").val(vendor_product_id);
    $("#bid_id").val(bidid);
    $("#ordereddate").val(ordered_date);
    $("#datepicker").val(expeddate);
    
    
    $('#myModal').modal({
           backdrop: 'static',
           keyboard: false
    });

}





function inproduction(expeddate,bidid,buyer_id,vendor_product_id){

$("#buyerid_inpr").val(buyer_id);
$("#vendorid_inpr").val(vendor_product_id);
$("#bid_id_inpr").val(bidid);

$("#datepickerinproduction").val(expeddate);
$('#myModalinpr').modal({
       backdrop: 'static',
       keyboard: false
});

}

function inpackage(expeddate,bidid,buyer_id,vendor_product_id){

$("#buyerid_inpackage").val(buyer_id);
$("#vendorid_inpackage").val(vendor_product_id);
$("#bid_id_inpackage").val(bidid);

$("#datepickerinpackage").val(expeddate);


$('#myModalinpackage').modal({
       backdrop: 'static',
       keyboard: false
});

}




  function dispatch(bidid,buyer_id,vendor_product_id,masterproduct_id,ordered_date){
	 
	  var data = {
					_token	: $('#token_vendor').val(),
					bid_id	:bidid,
					buyerid:buyer_id,
					vendor_product_id:vendor_product_id,
					masterproduct_id:masterproduct_id,
					ordereddate:ordered_date


				}
				$.ajax({
					url: baseurl + 'dispatch',
					type: "POST",
					data: data,
					success: function (res) {
						if(res==1){
							 //swal("Order Dispatched Successfully");
							 location.reload();
						}
					}


				});

		}



/*$('#myModal').on('show.bs.modal', function (event) {
  var button = $(event.relatedTarget) // Button that triggered the modal
  var id = button.data('id') // Extract info from data-* attributes
  var productid = button.data('productid')
  var buyerid = button.data('buyerid')
  var vendorid = button.data('vendorid')
  var ordereddate = button.data('ordereddate')
  var modal = $(this)
  modal.find('.modal-body input[name="bid_id"]').val(id);
  modal.find('.modal-body input[name="productid"]').val(productid);
  modal.find('.modal-body input[name="buyerid"]').val(buyerid);
  modal.find('.modal-body input[name="vendorid"]').val(vendorid);
  modal.find('.modal-body input[name="ordereddate"]').val(ordereddate);

})*/
</script>
<script>
function sendmessage(buyer_id,prdid,name){
	 $('#message_pop').modal({backdrop: 'static', keyboard: false});
	 $("#messagetype").val('orderlist_message_sent');
	 $("#to_id").val(buyer_id);
	 $("#p_id").val(prdid);
	 $("#to_name").val(name);

     event.preventDefault();

}

 $("#add_msg").validate({

        rules: {
            "messagedetails": {
                required: true

            }
        },
        submitHandler: function(form, e) {

			var data = {
					_token	: $('#token_vendor').val(),
					product_id	:$("#p_id").val(),
					to_id:$("#to_id").val(),
					msg:$("#messagedetails").val(),
					complaint_id:$("#complaint_id").val(),
					messagetype:$("#messagetype").val()


				}
				$.ajax({
					url: baseurl + 'add_msg',
					type: "POST",
					data: data,
					success: function (res) {
						if(res==1){
							swal({
								title: "",
								text: "Successfully sent",
								type: "success",
								showCancelButton: false,
								dangerMode: false,
								confirmButtonText: 'OK',

							});
							$('#messagedetails').val('').empty();
							$('#message_pop').modal('hide');


						}

					}

				});

        }
    });
    $(".createinpr").click(function(){
    //alert("bbbb");
	$(".dispatchorderinpr").validate({
		ignore: [],
        rules: {
            "datepickerinproduction": {
                required: true

            },

        },
        submitHandler: function(form, e) {
             $(".pageloader").show();
            $(".pageloader").delay(5000).fadeOut("slow");
		   form.submit();
        }
    });
}); 
    $(".createinpack").click(function(){
    //alert("bbbb");
	$(".dispatchorderpack").validate({
		ignore: [],
        rules: {
            "datepickerinpackage": {
                required: true

            },

        },
        submitHandler: function(form, e) {
             $(".pageloader").show();
            $(".pageloader").delay(5000).fadeOut("slow");
		   form.submit();
        }
    });
});


$(".create").click(function(){
    //alert("bbbb");
	$(".dispatchorder").validate({
		ignore: [],
        rules: {
            "delivery_date": {
                required: true

            },

        },
        submitHandler: function(form, e) {
             $(".pageloader").show();
            $(".pageloader").delay(5000).fadeOut("slow");
		   form.submit();
        }
    });
});
$(function(){
    $('.dispatchorder').on('submit', function(event){
        event.preventDefault();

    });
});
$(".close_all").click(function(){
    $('#datepicker').val('');
});

</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/orderlist.blade.php ENDPATH**/ ?>