<style>
    .quote-flex > div:last-child {
    padding-left: 20px;
    width: 100%;
}
    
   p.quoteee {
    margin-bottom: 13px;
} 
 .quote-btns > div:nth-child(2) a button {
    background: #02bcb1;
}  
 .partner-details i, .dates i {
    color: #0398d5 !important;
}   
p.quoteee {
    margin-bottom: 12px !important;
}  
 .quote-img-rs {
    height: 120px !important;
    display: flex;
    align-items: center;
    width: 120px !important;
}   
 
</style>


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

                 <div class="dashboard-cnts">
                  
                    <div class="row">
                      <div class="col-12 new_request">
                    <?php if(count($requests) > '0'){ ?>
                       <?php $__currentLoopData = $requests; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$allrequests): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> 
                        <?php  if(date('Y-m-d') == date('Y-m-d',strtotime($allrequests->requested_date))) {?>
                            <div class="bid-stats boxings recently-add">
                                <?php }else{ ?>
				                <div class="bid-stats boxings">
				            <?php } ?>
                                  <div class="w-100 d-flex justify-content-end">
                                        <p style="font-weight: bold;"><span style="    color: #1f2348;" >Request Id : <?php echo e($allrequests->id); ?></span><p>
                                    </p></div>  
                                <div class="product-order quote-order" style="padding: 0;">
                                    <div><?php //print_r($allrequests->bidUser); ?>
                                        <div class="quote-flex">
                                            <div>
                                                <div class="quote-img quote-img-rs">
                                                    <?php if(!empty($allrequests->pro_pic)): ?>
                                                    <img src="<?php echo e(url('user_files')); ?>/<?php echo e($allrequests->pro_pic); ?>">
                                                    <?php else: ?>
                                                    <img class="place-image" src="<?php echo e(url('assets/images/1200px-No-Image-Placeholder.svg.png')); ?>">
                                                    <?php endif; ?>
                                                </div>
                                            </div>
                                            <div>
                                                <div class="partner-details">
                                                    <h6><?php echo e($allrequests->name); ?></h6>
                                                    <p class="quoteee" style="float: left;width: 100%;">
                                                        <i  style="float:left;    margin-top: 5px;"  class="fas fa-map-marker-alt" aria-hidden="true"></i>
                                                        <span class="alignTxt">
                                                        <?php echo e($allrequests->address); ?>,
                                                         <?php echo e($allrequests->statename); ?>

                                                       </span>    
                                                    </p>
                                                    <div class="call"><i class="fas fa-phone-alt"></i> <?php echo e($allrequests->phone_no); ?></div>
                                                    <span>Status:</span> <?php if($allrequests->status==1): ?> <span class="status" style="color:orange">Pending</span> <?php elseif($allrequests->status==2): ?><span class="status" style="color:orange">Pending</span>
                                                    <?php elseif($allrequests->status==4): ?>
                                                    <span class="status" style="color:green">Approved</span>
                                                    <?php else: ?>
                                                    <span class="status" style="color:red">Rejected</span>
                                                    <p class="status"><span style="color:red">Reason:</span><span style="color:red"><?php echo e(ucfirst($allrequests->rejected_reason)); ?></span></p>
                                                    <?php endif; ?>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                     <div>
                                        <div class="pro-des">

                                            <?php if($allrequests->producttype == 'approve'): ?>
                                            <?php
                                                $pname = App\Helpers\CustomHelper::product_name($allrequests->product_id);
                                            ?>
                                           
                                        <?php else: ?>
                                            <?php
                                                $pname = App\Helpers\CustomHelper::product_existing_name($allrequests->product_id);
                                            ?>
                                            
                                        <?php endif; ?>
										    
                                            <h6 class="bgtitle"><span class="ip-qwe" >Product :</span><span><?php echo e(ucfirst($pname)); ?></span></h6>
                                            <?php
                                            $thirdparty = App\Helpers\CustomHelper::thirdpartyvendor($allrequests->register_id);
                                            ?>
                                            <div class="amc_cmc product-status-r">
                                                <div class="d-flex"> <span>Maintenance Count </span>
                                                    <p>:</p><?php echo e($thirdparty['thirdpartydetails']->maintanance_count); ?>

                                                </div>
                                                <div class="d-flex"> <span>Maintenance Contract Type </span>
                                                    <p>:</p><?php if($thirdparty['thirdpartydetails']->contract_type): ?> AMC <?php else: ?> CMC <?php endif; ?>
                                                </div>
                                            </div>
                                            <div class="dates">
                                                <p class="row"> <span class="col-lg-4 on-date ip-qwe w-50"><i class="fas fa-calendar-alt"></i> Requested On </span>
                                                    <span class="col-lg-1">:</span>
                                                    <span class="col-lg-7" ><?php echo e($allrequests->requested_date); ?></span></p>
                                            </div>

                                            <?php if(($allrequests->status==1)||($allrequests->status==3)): ?>
                                            <div class="quote-btns">
                                                
                                                <div>

                                                    <?php if($thirdparty['thirdpartydetails']->contract_type=='amc'): ?> <a href="#"><button class="btn common-btn green-btn" onClick="updatemaintenance(<?php echo e($allrequests->id); ?>,<?php echo e($allrequests->register_id); ?>)">Update AMC</button></a> <?php else: ?> <a href="#"><button class="btn common-btn green-btn" onClick="updatemaintenance(<?php echo e($allrequests->id); ?>,<?php echo e($allrequests->register_id); ?>)">Update CMC</button></a> <?php endif; ?>


                                                  </div>
                                            </div>
                                            <?php endif; ?>

                                 <?php if(($thirdparty['thirdpartydetails']->status==2)||($thirdparty['thirdpartydetails']->status==3)||($thirdparty['thirdpartydetails']->status==4)): ?>

                                    <div class="row">
                                        <div class="col-md-6 certWraper">
                                            <h1 class="amc_title"> <?php echo strtoupper($thirdparty['thirdpartydetails']->contract_type); ?> Details</h1>
                                            <div class="amc_cmc">
                                                <div class="amc_details">
                                                    <div>Start Date :<?php echo e($thirdparty['thirdpartydetails']->start_date); ?></div>
                                                </div>
                                                <div class="amc_details">
                                                    <div>End Date : <?php echo e($thirdparty['thirdpartydetails']->end_date); ?></div>
                                                </div>
                                                <div class="amc_details">
                                                    <div>Price : <?php echo e($thirdparty['thirdpartydetails']->price); ?></div>
                                                </div>
                                                <div class="amc_details">
                                                    <div>Certificate : <a target="_blank" class="eye"
                                                            href="<?php echo e(url('uploads/document/' . $thirdparty['thirdpartydetails']->document)); ?>"><i
                                                                class="fa fa-eye" aria-hidden="true"></i> View Certificate</a>
                                                    </div>
                                                </div>
                                           
                                            </div>
                                        </div>
                                    </div>
                                      

                                        <?php endif; ?>
                                           
                                         </div>
                                    </div>
                                </div>
                            
                            </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> 
                    <?php } ?>


                        </div>
                    </div>
                    <?php if(count($requests) == '0'){ ?>
                        <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>
           

          </div>

      



          <!-- Modal AMC/CMC Updation start -->
<div class="modal fade" id="amc_cmc_updation" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
	<div class="modal-dialog"> 
	  <div class="modal-content">
		<div class="modal-header">
		  <h5 class="modal-title" id="amc_cmc_updation_title"></h5>
		  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
			<span aria-hidden="true">&times;</span>
		  </button>
		</div>
  
		<div class="modal-body imageArea" id="demo1">
		   
			<form name="update_amc_cmc" id="update_amc_cmc" method="POST" action="<?php echo e(url('vendors/update_amc_cmc_thirdparty')); ?>"  enctype="multipart/form-data">
				 <?php echo csrf_field(); ?>
				 <input type="hidden" name="request_id" id="request_id" value="">
				

			   <div class="row manufacturerlist manufacturerlist-rs">
				  <div class="col-sm-12 col-xs-12">
					  <div class="form-inputs">
						<div class="form-group">
						   <label>Start Date<sup>*</sup> </label>
						  
						   <input id="start_date" type="text" class="form-control" data-zdp_readonly_element="false" name="start_date" value="">
						 
						</div>
						</div>
					  </div>
				  </div>
				  <div class="row manufacturerlist manufacturerlist-rs">
				  <div class="col-sm-12 col-xs-12">
					  <div class="form-inputs">
						<div class="form-group">
						   <label>End Date<sup>*</sup> </label>
						  
						   <input id="end_date" type="text" class="form-control" data-zdp_readonly_element="false" name="end_date"  value="">
						   
						</div>
						</div>
					  </div>
				  </div>
				  <div class="row manufacturerlist manufacturerlist-rs">
				  <div class="col-sm-12 col-xs-12">
					  <div class="form-inputs">
						<div class="form-group">
						   <label>Price<sup>*</sup></label>
						  
						   <input id="price" type="number" class="form-control" data-zdp_readonly_element="false" name="price"  value="">
						  
						  
						</div>
						</div>
					  </div>
				  </div>
				  
				  <div class="row manufacturerlist manufacturerlist-rs">
				  <div class="col-sm-12 col-xs-12">
					  <div class="form-inputs">
						<div class="form-group">
						   <label>Upload Certificate<sup>*</sup></label>
							<input id="certificate" name="certificate" type="file" class="form-control">
						   
						</div>
						</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="sendobservation">
								<?php echo e(__('Send')); ?>

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

	  </div>
	</div>
<!-- Modal AMC/CMC Updation end -->



<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<script>

function updatemaintenance(requestid,registerid){
    $("#request_id").val(requestid);
    $('#amc_cmc_updation').modal({backdrop: 'static', keyboard: false});
}

$(document).ready( function () {
   
	
	$('#start_date').Zebra_DatePicker({
    format: 'd-m-Y',
	direction: 1
    });
	
	$('#end_date').Zebra_DatePicker({
    format: 'd-m-Y',
	direction: 1
    });
});

///Update maintenance contract validation

$("#update_amc_cmc").validate({

rules: {
    "start_date": {
        required: true
       
    },
    "end_date": {
        required: true
       
    },
    "price": {
        required: true
       
    },
    "certificate": {
        required: true
       
    }
},
submitHandler: function(form, e) {
   form.submit();
 }
});


 

function approve(requestid,register_id){

swal({
      title: "Are you sure  you want to  Approve?",
      text: "",
      type: "warning",
      showCancelButton: true,
      confirmButtonColor: "#DD6B55",
      confirmButtonText: "Yes, Approve it!",
      closeOnConfirm: false,
      html: false
    }, function(){
    $(".pageloader").show();
       
        var data = {
                _token	     :$('#token_pbg').val(),
                requestid    :requestid,
                register_id  :register_id
       
    }
            $.ajax({
                url: baseurl + 'approve_thirdparty',
                type: "POST",
                data: data,
                success: function (res) {

          $(".pageloader").hide();
              
                    swal({
                            title: "",
                            text: "Successfully Approved",
                            type: "success",
                            showCancelButton: false,
                            dangerMode: false,
                            confirmButtonText: 'OK'
                        },function () {
                            window.location = baseurl + 'vendors/buyer_request';
                        })
                  
                }
            });
        });

}




function reject(request_id){

        $("#requestid").val(request_id);
        $("#reject").modal({ backdrop: "static", keyboard: false });

}
<?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/vendors/buyer_requests.blade.php ENDPATH**/ ?>