<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>Extension date Approvals</h6>
                        <input name="_token" type="hidden" id="token_ex" value="<?php echo e(csrf_token()); ?>">
                    </div>
                </div>

                <div class="dashboard-cnts">
                    <div class="row">
                        <div class="col-12">
                            <div class="search-bar order-search">
                                <?php if($buyer_type == 'proc'): ?>
                                <div class="form-inputs">
                                    <div class="form-group">
                                      <label>Buyers</label>
                                      <select class="form-control" id="buyer_filter" name="buyer_filter">
                                        <option value="all">All</option>
                                        <?php $__currentLoopData = $individual_buyers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $individual_buyers): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($individual_buyers->id); ?>"><?php echo e($individual_buyers->name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                      </select>
                                    </div>
                                </div>
                                <?php endif; ?>
                              </div>
				                <div class="boxings po-sum" style="border-radius: 15px;">
                                  
                                    
                                 <ul class="nav nav-tabs meddbot-tab">
                                    <li><a  href="<?php echo e(url('/buyers/extensiondate_process_pending')); ?>">Pending</a></li>
                                    <li><a href="<?php echo e(url('/buyers/extensiondate_process_approved')); ?>">Approved</a></li>
                                    <li  class="active"><a class="active show" href="<?php echo e(url('/buyers/extensiondate_process_rejected')); ?>">Rejected</a></li>
                                </ul>
                                  <div class="tab-content meddbot-tabcontent">
                                  
                                    <div >
                                      
                                        <?php if(count($extensiondate_reject)!=0): ?>        
                                        <?php $__currentLoopData = $extensiondate_reject; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$summary): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <div class="purchase-order">
                                                 <div class="order-id d-flex justify-content-end">
                                                     <h4>Order ID <span class="green-order" ><?php echo e($summary->po_id); ?></span></h4>
                                                    
                                                    </div>
                                                 <div class="product_details-grd">
                                                     <div class="product-image">
    
                                                    <?php if(!empty($summary->photo)): ?>
                                                        <img src="<?php echo e(url('product_files')); ?>/<?php echo e($summary->photo); ?>">
                                                    <?php else: ?>
                                                        <img src="<?php echo e(url('assets/images/1200px-No-Image-Placeholder.svg.png')); ?>">
                                                    <?php endif; ?>   
                                                     </div>
                                                     <div class="product-details">
                                                         <ul>
                                                             <li><h4 class="product-name" ><?php echo e(ucfirst($summary->product_name)); ?></h4></li> </h4></li>
                                                             <li><label class="p-o-label">Product Code</label>: <span><?php echo e($summary->product_code); ?></span></li>
                                                             <li><label class="p-o-label">Original Date</label>: <span><?php echo e($summary->delivery_date); ?></span></li>
                                                             <li><label class="p-o-label">Extension Date</label>: <span><?php echo e($summary->change_date); ?></span></li>                                                    
                                                         </ul>
                                                     </div>
                                                 </div>
                                                 <div class="product-description">
                                                     <label class="p-o-label" >Product Description</label>
                                                     <p><?php echo e($summary->product_description); ?></p>
                                                 </div>
                                                 <div class="product-description">
                                                    <label class="p-o-label" style="color:red"> Rejected Reason</label>
                                                    <p><?php echo e($summary->extension_date_rejectionreason); ?></p>
                                                </div>
                                                 <div class="p-o-buttons">
                                                   <span style="color:red;">Status:Rejected</span>
                                                 </div>
                                             </div> 
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php echo e($extensiondate_reject->links()); ?>

                                            <?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 Datas available
                                                                    </h6>
                                                                </div>
                                                            </div>
                                                        </li>
                    
                    
                                                    </ul>
                                                </div>
                                            </div>
                                            <?php endif; ?>
                                  </div> 

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



<!-- Modal -->
<div class="modal fade  new-modal" id="approve" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-body">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
        <div class="otp">
            <h4>OTP Verification</h4>
            <p>Please Enter the OTP send to your Phone Number</p>

            <input type="hidden" name="phone" id="phone_no" value="<?php echo Auth::user()->phone_no;?>">
            <input type="hidden" name="email" id="email" value="<?php echo Auth::user()->email;?>">
            
            <div class="otp-dflex">
                <input type="text" placeholder="0" maxlength="1" id="otp1">
                <input type="text" placeholder="0" maxlength="1" id="otp2">
                <input type="text" placeholder="0" maxlength="1" id="otp3">
                <input type="text" placeholder="0" maxlength="1" id="otp4">
                <input type="text" placeholder="0" maxlength="1" id="otp5">
                <input type="text" placeholder="0" maxlength="1" id="otp6">
            </div>
            
          </div>

          <div class="medd-pop-buttons">
              <input type="hidden" name="order_id" id="order_id" value="">
              <button class="btn medd-blue medd-buttons" id="otpverify" >Verify</button>
              
          </div>
      </div>
    </div>
  </div>
</div>

<!-- Modal -->
<div class="modal fade  new-modal" id="reject" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">

        <form id="reject_po" method="POST" action="<?php echo e(url('buyers/extensiondate_reject')); ?>" > <?php echo csrf_field(); ?>
      <div class="modal-body">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
        <div class="otp">
            <h4>Reject Reason</h4>
            <input type="hidden" name="ex_id" value="" id="ex_id">
            <textarea class="w-100 mb-3 form-control" cols="5" rows="5"  placeholder="Reason" name="reject_reason" id="reject_reason"></textarea>
        </div>
          <div class="medd-pop-buttons">
              <button class="btn medd-blue medd-buttons" >Submit</button>
<!--              <button class="btn medd-black medd-buttons" >Resend OTP</button>-->
          </div>
      </div>
    </form>
    </div>
  </div>
</div>

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

$(function() {

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

var $select = $(this);
if ($select.val() == 'all') {
  // No filter selected.  Show all categories
  $('.js-category-filterable').show();
  //$('.js-current-category').text('All');
} else {
    var x=0;
  $('.js-category-filterable').each(function() {
    if ($(this).data('category') == $select.val()) {  
       x=1;
      $(this).show();
    } else {
      $(this).hide();
      x=0;
     
    }

    if(x==0){
        $(".not").css("display","block");
    }
    else{
        $(".not").css("display","none");  
    }
  });
  //$('.js-current-category').text( $select.find('option:selected').text() );
}
// Reset select box so it's easier to use repeatedly.
//$select.val('');
});

});
function downloadpdf(oid){
    window.location = baseurl + 'generate-pdf?id='+oid;
}
$(document).ready(function() {

    //OTP VERIFICATION

   $('#otpverify').on('click', function(event) {
        var oid= $("#order_id").val();
         event.preventDefault();
        if(($('#otp1').val()=='')&&($('#otp2').val()=='')&&($('#otp3').val()=='')&&($('#otp4').val()=='')&&($('#otp5').val()=='')&&($('#otp6').val()=='')){ 
            swal("", "Please Enter a valid OTP", "warning");
        }
       else{

                    var email = $('#email').val();
                    var phoneno = $('#phone_no').val();
                    var otp =  $('#otp1').val()+$('#otp2').val()+$('#otp3').val()+$('#otp4').val()+$('#otp5').val()+$('#otp6').val();
                    var APP_URL = <?php echo json_encode(url('/verifyotpuser')); ?> ;
                    var saveData = $.ajax({
                    type: 'GET',
                    url: APP_URL+'/'+email+'/'+phoneno+'/'+otp+'/'+oid,
                    data: { email: email,phoneno: phoneno, _token: '<?php echo e(csrf_token()); ?>',oid:oid},
                    dataType: "text",
                        success: function(resultData) {

                          if(resultData == '1'){

                              swal({
                                title: "",
                                text: "OTP is verified successfully",
                                type: "success",
                              }, function () {

                                window.location = baseurl + 'buyers/order_summary/';
                               
                              });

                              }else if(resultData == '0'){
                              swal("", "Please Enter a valid OTP", "warning");
                                //alert('Please Enter a valid otp');
                              }else{

                              swal("", "Please Enter a valid OTP", "warning");
                                // alert('Please Enter a valid otp');
                              }
                           
                    }
                    });
        
       }


                 
    });

    $('#approvepo').on('click', function() {
                $(".pageloader").show();
               

                var oid=$(this).data("orderid");
                 $("#order_id").val(oid);
                var email = $('#email').val();
                var phoneno = $('#phone_no').val();
                var otp = Math.floor(100000 + Math.random() * 900000);
             

                var APP_URL = <?php echo json_encode(url('/setotpuser')); ?> ;
                var saveData = $.ajax({
                type: 'GET',
                url: APP_URL+'/'+email+'/'+phoneno+'/'+otp,
                data: { email: email,phoneno: phoneno,otp: otp, _token: '<?php echo e(csrf_token()); ?>' },
                dataType: "text",
                    success: function(resultData) {
                        console.log(resultData);
                        /*if(resultData == 'success'){
                            alert('success');
                        }*/
                    }
                });
                var SMS_URL = 'https://www.meddbot.com/twiliosms/' ;
                var saveData = $.ajax({
                    type: 'POST',
                    url: SMS_URL,
                    data: { phoneno: phoneno, otp:otp, _token: '<?php echo e(csrf_token()); ?>' },
                    dataType: "text",
                    success: function(resultData) {
                       

                       
								swal({
										title: "",
										text: "OTP send to your registered Phone Number",
										type: "success",
										showCancelButton: false,
										dangerMode: false,
										confirmButtonText: 'OK'
									},function () {
										$('#approve').modal({backdrop: 'static', keyboard: false});
                                        $(".pageloader").hide();
									})
                    }
                });


            });

});

<?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>

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