<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js"></script>
<!-- TOP Nav Bar END -->
<div class="container-fluid">
   <div class="row">
      <div class="col-sm-12">
         <div class="iq-card">
            <div class="iq-card-header d-flex justify-content-between">
               <div class="iq-header-title">
                  <h4 class="card-title">Hospital Services List</h4>
               </div>
               <span class="table-add float-right mb-3 mr-2">
                  <a href="<?php echo base_url(); ?>HospitalService/add" class="btn btn-sm iq-bg-success" ><i
                     class="ri-add-fill"><span class="pl-1">Add New</span></i>
                  </a>
                  </span>
            </div>
            <div class="iq-card-body">
             <div id="table" class="table-editable">
            <table id="myTable" class="display table" style="width:100%">
              <thead>
                <tr>
                    <th>Sl No.</th>
                    <th>Service Name</th>
                    <th>Short Desc.</th>
                    <th>Image</th>
                    <th>Action</th>
                </tr>
              </thead>
              <tbody>
                <?php  
                $start=0;
                for($i=0;$i<count($recordSet);$i++)
                   { $start++;

                ?>
                <tr>
                    <td scope="row"><?php echo $start; ?></td>
                    <td><?php echo $recordSet[$i]['hs_name'].' - '.$recordSet[$i]['short_name'];?></td>
                    <td><?php echo $recordSet[$i]['short_desc'];?></td>
                    <td><img src="<?php echo '../../uploads/hospital-service/thumbnail/'.$recordSet[$i]['hs_image']; ?>" class="img-responsive" height="80" width="100"></td>
                    
                    <td>
                        <a href="<?php echo base_url().'HospitalService/Edit/'.$recordSet[$i]['hs_id']; ?>" class="edit" title="Edit"><i class="fa fa-pencil" aria-hidden="true"></i>   </a>
                        <a href="javascript:void(0)"  onclick="delete_function(<?php echo $recordSet[$i]['hs_id ']; ?>);" class="delete remScnt" title="Delete"><i class="fa fa-trash" style="color:red;" aria-hidden="true" title="Delete"></i> </a> 
                        <!-- <a href="#" class="view" title="view"><i class="fa fa-eye" aria-hidden="true"></i> </a> -->

                    </td>
                </tr>

              <?php } ?>
              </tbody>
            </table>
          </div>
          </div>
         </div>
      </div>
   </div>
</div>
<script>



function delete_function(id) {

$.confirm({
    title: 'Delete!',
    content: 'Are you want to delete this data?',
    type: 'red',
    typeAnimated: true,
    buttons: {
        tryAgain: {
            text: 'Yes',
            btnClass: 'btn-red',
            action: function(){
              $.ajax({
          type: "POST",
          url: "<?php echo base_url(); ?>HospitalService/Delete/",
          data: {id : id }, 
          success: function(html) {
            $.alert("Your data has been successfully deleted");
            setInterval(function(){
              location.reload();
            }, 3000);
            }
          });
            }
        },
        close: function () {
        }
    }
 });
}

</script>

<style type="text/css">
  table.dataTable thead .sorting, 
table.dataTable thead .sorting_asc, 
table.dataTable thead .sorting_desc {
    background : none;
}
</style>