

<style>
/* The container */
.container {
  display: block;
  position: relative;
  padding-left: 35px;
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 22px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Hide the browser's default radio button */
.container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

/* Create a custom radio button */
.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 25px;
  width: 25px;
  background-color: #3e90a9;
  border-radius: 50%;
}

/* On mouse-over, add a grey background color */
.container:hover input ~ .checkmark {
  background-color: #ccc;
}

/* When the radio button is checked, add a blue background */
.container input:checked ~ .checkmark {
  background-color: #2196F3;
}

/* Create the indicator (the dot/circle - hidden when not checked) */
.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

/* Show the indicator (dot/circle) when checked */
.container input:checked ~ .checkmark:after {
  display: block;
}

/* Style the indicator (dot/circle) */
.container .checkmark:after {
  top: 9px;
  left: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}
</style>

<!-- PAGE-INDEX-STARTS -->

<div class="breadcrumbs">
    <div class="breadcrumbs-inner">
        <?php
        if($this->session->flashdata('message')) {
        $message = $this->session->flashdata('message');
        ?>
            <div class="alert alert-<?php echo $message['class']; ?>">
                <button class="close" data-dismiss="alert" type="button">×</button>
                <?php echo $message['message']; ?>
            </div>
        <?php } ?>
        <div class="row m-0">
            <div class="col-sm-4">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><?= $pTitle ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-8">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li><a href="<?= base_url() ?>">Dashboard</a></li>
                            <li><a ><?= $menu ?></a></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- PAGE-INDEX-ENDS -->

<!-- PAGE-CONTENT-STARTS -->

<div class="content">
    <div class="animated fadeIn">
      <div class="row">
           <div class="col-md-12">
                <div class="card">
                  <div class="card-header">
                        <strong class="card-title">Service Details</strong>
                    </div>
                    <div class="card-body">
                      <div class="row">

                        <div class="col-md-4">  <label><b>Request Code:</b></label><?= $response[0]->request_code ?></div>
                        <div class="col-md-4"><label><b>Subservices:</b></label><?= $response[0]->sub_services ?></div>
                        <div class="col-md-4"><label><b>Customer Name:</b></label><?= $response[0]->customer_name ?></div>
                      </div>
                      <div class="row">
                        <div class="col-md-4"> <label><b>Customer Phone:</b></label><?= $response[0]->phone_no ?></div>
                        <div class="col-md-4"><label><b>Location:</b></label><?= $response[0]->area ?></div>
                        <div class="col-md-4"><label><b>Booking Date:</b></label><?= $response[0]->booking_date ?></div>
                      </div>
                    </div>
                </div>
              </div>
      </div>

      <div class="row">
           <div class="col-md-12">
                <div class="card">
                  <div class="card-header">
                        <strong class="card-title">Vehicle Details</strong>
                    </div>
                    <div class="card-body">
                      <div class="row">
 <div class="col-md-4">  <label><b>Make:</b></label><?= $response[0]->make ?></div>
  <div class="col-md-4">  <label><b>Model:</b></label><?= $response[0]->model ?></div>
  <div class="col-md-4">  <label><b>Year:</b></label><?= $response[0]->year ?></div>
                      </div>
                      <div class="row">
 <div class="col-md-4">  <label><b>Vehicle Name:</b></label><?= $response[0]->vehicle_name ?></div>
  <div class="col-md-4">  <label><b>Mileage:</b></label><?= $response[0]->mileage ?></div>
  <div class="col-md-4">  <label><b></b></label></div>
                      </div>
                    </div>
                </div>
              </div>
      </div>

        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header">
                        <strong class="card-title"><?= $pDescription ?></strong>
                    </div>
                    <input type="hidden" value="<?= $response[0]->id ?>" id="req_id" class="req_id">  
                    <div class="card-body">
                        <table id="" class="table table-striped table-bordered " style='border-bottom-width: 2px;' >
                            <thead>
                                <tr><th>Quote Code</th>
                                    <th>Garage Code</th>                                    
                                    <th>Garage Name</th>
                                    <th>Quote Type</th>
                                    <th>Labour Cost</th>
                                    <th>Parts Cost</th>
                                    <th>Select</th>
                                    <!-- <th>Status</th> -->
                                </tr>
                            </thead>
                             <?php foreach ($prod_list  as $r) { ?>

                                                       <?php    if($r->quote_type ='1') { $quote_types = "BASE";}  
if($r->quote_type ='2') { $quote_types = "MEDIUM";}   
if($r->quote_type ='3') { $quote_types = "PREMIUM";} ?>
                            <tbody>
                              <tr> 
                              <td><?= $r->quote_code ?></td>
                              <td><?= $r->garage_code ?></td>
                              <td><?= $r->garage_name ?></td>
                              <td><?= $quote_types ?></td>
                              <td><?= $r->labour_cost ?></td>
                              <td><?= $r->parts_cost ?></td>
                              <td>
<?php if ($r->status == '0') { ?>
    <label class="container"><input type="checkbox" value="<?= $r->id ?>">
  <span class="checkmark"></span></label>
<?php } if ($r->status == '1') { ?>
<button type='button' class='btn btn-warning'>Quate Send</button>
<!-- <?php } if ($r->parts_cost == '2') { ?>

  <?php } if ($r->parts_cost == '3') { ?> -->

<?php } ?>


</td>
                              <!-- <td> -->
                                <!-- <input type="checkbox" name="vehicle1" value="Bike"> <br> -->
                             <!--  </td> -->
                             </tr>

                            </tbody>
                          <?php  }  ?>  
                          <td colspan="7">
                           <button type="button" class="btn btn-info" id="add_prod" data-dismiss="modal" style="float: right;">Send Quote</button>
                                </a>
                              </tb>     
                          <!--   <tfoot>
                               <tr> <th>NO</th>  
                                  
                                    <th>Garage Code</th>                                    
                                    <th>Garage Name</th>
                                    
                                    <th>Quote Type</th>
                                    <th>Labour Cost</th>
                                    <th>Parts Cost</th>
                                    <th>Action</th>
                               </tr>

                     </tfoot> -->
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- PAGE-CONTENT-ENDS -->
        
 
<!-- PAGE-CONTENT-ENDS -->
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>     
<script type="text/javascript">
  
    
      $("#add_prod").on('click', function(){
        var selectedValues = [];
        $("input[type=checkbox]:checked").each ( function() {
            selectedValues.push($(this).val());     
        });
         
        var req_id = $('#req_id').val();
       
        if(req_id){
            var post_data = {"responce_id": selectedValues,"req_id":req_id};
          // var ids = JSON.stringify(selectedValues);
        
           $.ajax({
            type: "POST",
            url: '<?php echo base_url('Garage_response/approve_quote'); ?>',
            data: post_data,

            success: function(response){
            //alert("sds");  
window.location.reload();
            }
          });
        }        
      })

    

    </script>

</script

