<script type="text/javascript">

    $(document).ready(function(){
        $("#checkall").click(function(){
            if(this.checked){
                $(".check_class").attr("checked",true);					
                $(".check_class").parent().addClass("checked");					
            }else{
                $(".check_class").attr("checked",false);					
                $(".check_class").parent().removeClass("checked");					
            }
        });
        $("#status_msg").hide();
        $("#alert_msg").hide();

    });

function delete_entry(clinic_id){
  swal({
        title: 'Are you sure?',
        text: "You won't be able to revert this!",
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#0CC27E',
        cancelButtonColor: '#FF586B',
        confirmButtonText: 'Yes, delete it!',
        cancelButtonText: 'No, cancel!',
        confirmButtonClass: 'btn btn-success mr-5',
        cancelButtonClass: 'btn btn-danger',
        buttonsStyling: false
    }).then(function () {
        location.href = 'cliniclist.php?act=delete&clinic_id='+clinic_id;
    }, function (dismiss) {
      return false; 
    });
}


function check_status()
{

  swal({
        title: '',
        text: "Please clinic status active!",
        type: 'warning',
        /*showCancelButton: true,
        confirmButtonColor: '#0CC27E',
        cancelButtonColor: '#FF586B',
        confirmButtonText: 'Yes, delete it!',
        cancelButtonText: 'No, cancel!',
        confirmButtonClass: 'btn btn-success mr-5',
        cancelButtonClass: 'btn btn-danger',
        buttonsStyling: false*/
    }).then(function () {
        //location.href = 'cliniclist.php?act=delete&clinic_id='+clinic_id;
    }, function (dismiss) {
      return false; 
    });
}

function messagecenter_change_status(messageaccess_id,status,msgaccess_data,clinic_id)
{
  
  var clinicreminder_status = $("#mesg_reminder_"+messageaccess_id).attr('clinicstatus-data');
  var clinicmarketing_status = $("#mesg_marketing_"+messageaccess_id).attr('clinicstatus-data');
  var clinicadministrative_status = $("#mesg_administrative_"+messageaccess_id).attr('clinicstatus-data');
  var clinicdigitaldoc_status = $("#mesg_digitaldoc_"+messageaccess_id).attr('clinicstatus-data');
  var clinictext_sms_status = $("#text_sms_clinic_"+clinic_id).attr('clinicstatus-data');
  var clinicpaymentinvoice_status = $("#mesg_paymentinvoice_"+messageaccess_id).attr('clinicstatus-data');
  var clinicreminderpaymentinvoice_status = $("#mesg_reminderpaymentinvoice_"+messageaccess_id).attr('clinicstatus-data');

  
  if(clinicreminder_status == '0' || clinicmarketing_status == '0' || clinicadministrative_status == '0' || clinicdigitaldoc_status == '0' || clinictext_sms_status == '0' || clinicpaymentinvoice_status == '0' || clinicreminderpaymentinvoice_status == '0')
  {
      
      check_status();
      $("#mesg_reminder_"+messageaccess_id).prop('checked', false);
      $("#mesg_marketing_"+messageaccess_id).prop('checked', false);
      $("#mesg_administrative_"+messageaccess_id).prop('checked', false);
      $("#mesg_digitaldoc_"+messageaccess_id).prop('checked', false);
      $("#text_sms_clinic_"+clinic_id).prop('checked', false);
      $("#mesg_paymentinvoice_"+messageaccess_id).prop('checked', false);
      $("#mesg_reminderpaymentinvoice_"+messageaccess_id).prop('checked', false);

      return false;
  }

  if(messageaccess_id == '0')
  {
    messageaccess_id = clinic_id;
  }

  swal({
        title: 'Are you sure ?',
        text: "change status!",
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#0CC27E',
        cancelButtonColor: '#FF586B',
        confirmButtonText: 'Yes, change status!',
        cancelButtonText: 'No, cancel!',
        confirmButtonClass: 'btn btn-success mr-5',
        cancelButtonClass: 'btn btn-danger',
        buttonsStyling: false
    }).then(function () {
        $.ajax({
          url: "cliniclist.php",
          data: 'act=messagechange_status&messageaccess_id='+messageaccess_id+'&status='+status+'&status_data='+msgaccess_data,
          dataType: 'json',
          cache: false,
          success: function(data){
                      $("#status_msg").show();
                      $("#status_msg").html("<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>Status updated successfully...</div>");
                      $("#status_msg_td").html(data.msg);
                      hideMessage();
                      $("#mesg_reminder_"+messageaccess_id).attr("reminder-data", data.reminder);
                      $("#mesg_marketing_"+messageaccess_id).attr("marketing-data", data.marketing);
                      $("#mesg_administrative_"+messageaccess_id).attr("adminstrative-data", data.adminstrative);
                      $("#mesg_digitaldoc_"+messageaccess_id).attr("digitaldoc-data", data.digitaldoc);
		                  $("#text_sms_clinic_"+clinic_id).attr("text_sms_clinic-data", data.text_sms);
                      $("#mesg_paymentinvoice_"+messageaccess_id).attr("paymentinvoice-data", data.paymentinvoice);
                      $("#mesg_reminderpaymentinvoice_"+messageaccess_id).attr("reminderpaymentinvoice-data", data.reminderpaymentinvoice);
          }
        });
    }, function (dismiss) {
      var chk_reminder = $("#mesg_reminder_"+messageaccess_id).attr('reminder-data');
      var chk_marketing = $("#mesg_marketing_"+messageaccess_id).attr('marketing-data');
      var chk_administrative = $("#mesg_administrative_"+messageaccess_id).attr('adminstrative-data');
      var chk_digitaldoc = $("#mesg_digitaldoc_"+messageaccess_id).attr('digitaldoc-data');
      var chk_text_sms_clinic = $("#text_sms_clinic_"+clinic_id).attr('text_sms_clinic-data');
      var chk_paymentinvoice = $("#mesg_paymentinvoice_"+messageaccess_id).attr('paymentinvoice-data');
      var chk_reminderpaymentinvoice = $("#mesg_reminderpaymentinvoice_"+messageaccess_id).attr('reminderpaymentinvoice-data');


      if(chk_reminder == '1')
      {
        $("#mesg_reminder_"+messageaccess_id).prop('checked', true);
      }else{
        $("#mesg_reminder_"+messageaccess_id).prop('checked', false);
      }

      if(chk_marketing == '1')
      {
        $("#mesg_marketing_"+messageaccess_id).prop('checked', true);
      }else{
        $("#mesg_marketing_"+messageaccess_id).prop('checked', false);
      }

      if(chk_administrative == '1')
      {
        $("#mesg_administrative_"+messageaccess_id).prop('checked', true);
      }else{
        $("#mesg_administrative_"+messageaccess_id).prop('checked', false);
      }

      if(chk_digitaldoc == '1')
      {
        $("#mesg_digitaldoc_"+messageaccess_id).prop('checked', true);
      }else{
        $("#mesg_digitaldoc_"+messageaccess_id).prop('checked', false);
      }

      if(chk_text_sms_clinic == 'on')
      {
        $("#text_sms_clinic_"+clinic_id).prop('checked', true);
      }else{
        $("#text_sms_clinic_"+clinic_id).prop('checked', false);
      }

      if(chk_paymentinvoice == '1')
      {
        $("#mesg_paymentinvoice_"+messageaccess_id).prop('checked', true);
      }else{
        $("#mesg_paymentinvoice_"+messageaccess_id).prop('checked', false);
      }

      if(chk_reminderpaymentinvoice == '1')
      {
        $("#mesg_reminderpaymentinvoice_"+messageaccess_id).prop('checked', true);
      }else{
        $("#mesg_reminderpaymentinvoice_"+messageaccess_id).prop('checked', false);
      }
      
          
      return false; 
    });
}

function change_status(clinic_id,status){
  //$(".loading_image").show();
  swal({
        title: 'Are you sure ?',
        text: "change status!",
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#0CC27E',
        cancelButtonColor: '#FF586B',
        confirmButtonText: 'Yes, change status!',
        cancelButtonText: 'No, cancel!',
        confirmButtonClass: 'btn btn-success mr-5',
        cancelButtonClass: 'btn btn-danger',
        buttonsStyling: false
    }).then(function () {
        $.ajax({
          url: "cliniclist.php",
          data: 'act=change_status&clinic_id='+clinic_id+'&status='+status,
          dataType: 'json',
          cache: false,
          success: function(data){
                      $("#status_msg").show();
                      $("#status_msg").html("<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>Status updated successfully...</div>");
                      $("#status_msg_td").html(data.msg);
                      hideMessage();
                      if(status==0){
                        
                          $("#td_status_"+clinic_id).html("<a href=\"javascript:void(0)\" onclick=\"change_status('"+clinic_id+"','1')\" ><span class=\"badge badge-success\">Active</span></a>");

                          $("#mesg_reminder_"+data.messagecenterid).attr("clinicstatus-data", '1');
                          $("#mesg_marketing_"+data.messagecenterid).attr("clinicstatus-data", '1');
                          $("#mesg_administrative_"+data.messagecenterid).attr("clinicstatus-data", '1');
                          $("#mesg_digitaldoc_"+data.messagecenterid).attr("clinicstatus-data", '1');
                          $("#text_sms_clinic_"+clinic_id).attr("clinicstatus-data", '1');
                          $("#mesg_paymentinvoice_"+data.messagecenterid).attr("clinicstatus-data", '1');
                          $("#mesg_reminderpaymentinvoice_"+data.messagecenterid).attr("clinicstatus-data", '1');
                          
                      }else{
                        
                          $("#td_status_"+clinic_id).html("<a href=\"javascript:void(0)\" onclick=\"change_status('"+clinic_id+"','0')\" ><span class=\"badge badge-danger\">Inactive</span></a>");
                          $("#mesg_reminder_"+data.messagecenterid).prop('checked', false);
                          $("#mesg_marketing_"+data.messagecenterid).prop('checked', false);
                          $("#mesg_administrative_"+data.messagecenterid).prop('checked', false);
                          $("#mesg_digitaldoc_"+data.messagecenterid).prop('checked', false);
                          $("#text_sms_clinic_"+clinic_id).prop('checked', false);
                          $("#mesg_paymentinvoice_"+data.messagecenterid).prop('checked', false);
                          $("#mesg_reminderpaymentinvoice_"+data.messagecenterid).prop('checked', false);
                          
                          $("#mesg_reminder_"+data.messagecenterid).attr("reminder-data", '0');
                          $("#mesg_marketing_"+data.messagecenterid).attr("marketing-data", '0');
                          $("#mesg_administrative_"+data.messagecenterid).attr("adminstrative-data", '0');
                          $("#mesg_digitaldoc_"+data.messagecenterid).attr("digitaldoc-data", '0');
                          $("#text_sms_clinic_"+clinic_id).attr("text_sms_clinic-data", 'off');
                          $("#mesg_paymentinvoice_"+data.messagecenterid).attr("paymentinvoice-data", '0');
                          $("#mesg_reminderpaymentinvoice_"+data.messagecenterid).attr("reminderpaymentinvoice-data", '0');

                         
                          $("#mesg_reminder_"+data.messagecenterid).attr("clinicstatus-data", '0');
                          $("#mesg_marketing_"+data.messagecenterid).attr("clinicstatus-data", '0');
                          $("#mesg_administrative_"+data.messagecenterid).attr("clinicstatus-data", '0');
                          $("#mesg_digitaldoc_"+data.messagecenterid).attr("clinicstatus-data", '0');
                          $("#text_sms_clinic_"+clinic_id).attr("clinicstatus-data", '0');
                          $("#mesg_paymentinvoice_"+data.messagecenterid).attr("clinicstatus-data", '0');
                          $("#mesg_reminderpaymentinvoice_"+data.messagecenterid).attr("clinicstatus-data", '0');
                          
                      }
          }
        });
    }, function (dismiss) {    
        return false; 
    });    
}

function change_status_bk(clinic_id,status){
	$(".loading_image").show();
	$.ajax({
	  url: "cliniclist.php",
	  data: 'act=change_status&clinic_id='+clinic_id+'&status='+status,
    dataType: 'json',
    cache: false,
	  success: function(data){
                $("#status_msg").show();
                $("#status_msg").html("<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>Status updated successfully...</div>");
                $("#status_msg_td").html(data.msg);
                hideMessage();
                if(status==0){
                  console.log('0');
                    $("#td_status_"+clinic_id).html("<a href=\"javascript:void(0)\" onclick=\"change_status('"+clinic_id+"','1')\" ><span class=\"badge badge-success\">Active</span></a>");

                    $("#mesg_reminder_"+data.messagecenterid).attr("clinicstatus-data", '1');
                    $("#mesg_marketing_"+data.messagecenterid).attr("clinicstatus-data", '1');
                    $("#mesg_administrative_"+data.messagecenterid).attr("clinicstatus-data", '1');
                    $("#mesg_digitaldoc_"+data.messagecenterid).attr("clinicstatus-data", '1');
                    $("#text_sms_clinic_"+clinic_id).attr("clinicstatus-data", '1');
                }else{
                  console.log('1');
                    $("#td_status_"+clinic_id).html("<a href=\"javascript:void(0)\" onclick=\"change_status('"+clinic_id+"','0')\" ><span class=\"badge badge-danger\">Inactive</span></a>");
                    $("#mesg_reminder_"+data.messagecenterid).prop('checked', false);
                    $("#mesg_marketing_"+data.messagecenterid).prop('checked', false);
                    $("#mesg_administrative_"+data.messagecenterid).prop('checked', false);
                    $("#mesg_digitaldoc_"+data.messagecenterid).prop('checked', false);
                    $("#text_sms_clinic_"+clinic_id).prop('checked', false);
                    
                    $("#mesg_reminder_"+data.messagecenterid).attr("reminder-data", '0');
                    $("#mesg_marketing_"+data.messagecenterid).attr("marketing-data", '0');
                    $("#mesg_administrative_"+data.messagecenterid).attr("adminstrative-data", '0');
                    $("#mesg_digitaldoc_"+data.messagecenterid).attr("digitaldoc-data", '0');
                    $("#text_sms_clinic_"+clinic_id).attr("text_sms_clinic-data", 'off');
                   
                    $("#mesg_reminder_"+data.messagecenterid).attr("clinicstatus-data", '0');
                    $("#mesg_marketing_"+data.messagecenterid).attr("clinicstatus-data", '0');
                    $("#mesg_administrative_"+data.messagecenterid).attr("clinicstatus-data", '0');
                    $("#mesg_digitaldoc_"+data.messagecenterid).attr("clinicstatus-data", '0');
                    $("#text_sms_clinic_"+clinic_id).attr("clinicstatus-data", '0');
                }
	  }
	});
}

function validate_all(act){
    var act = $("#act").val();
    if(act==''){
        $("#alert_msg").show();
        $("#alert_msg").html("<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>Please select action to apply on selected records.</div>");
        return false;
    }else if($(".check_class:checked").length == 0){
  	$("#alert_msg").show();
  	$("#alert_msg").html("<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>Please select atleast one checkbox.</div>");
		return false;
	}else{
	  	$("#alert_msg").hide();
	}
        
  if(act == 'delete_all'){
      var msg = 'delete';
  }else if(act == 'activate_all'){
      var msg = 'activate';
  }else{
      var msg = 'inactivate';
  }
  
    swal({
        title: 'Are you sure to '+act.replace("_"," ")+' ?',
        text: "You won't be able to revert this!",
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#0CC27E',
        cancelButtonColor: '#FF586B',
        confirmButtonText: 'Yes, '+msg+' it!',
        cancelButtonText: 'No, cancel!',
        confirmButtonClass: 'btn btn-success mr-5',
        cancelButtonClass: 'btn btn-danger',
        buttonsStyling: false
    }).then(function () {
        $("#action").val(act);
        $("#listFrm").submit();
    }, function (dismiss) {
      return false; 
    });
}

function practicedata(clinic_id){
  //$(".loading_image").show();
  swal({
        title: 'Are you sure ?',
        text: "Add Practice!",
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#0CC27E',
        cancelButtonColor: '#FF586B',
        confirmButtonText: 'Yes, Add Practice!',
        cancelButtonText: 'No, cancel!',
        confirmButtonClass: 'btn btn-success mr-5',
        cancelButtonClass: 'btn btn-danger',
        buttonsStyling: false
    }).then(function () {
        $.ajax({

          url: "cliniclist.php",
          data: 'act=add_practicedata&clinic_id='+clinic_id,
          dataType: 'json',
          cache: false,
          success: function(data){
                      $("#status_msg").show();
                      $("#status_msg").html("<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>"+data.msg+"</div>");
                      $("#status_msg_td").html(data.msg);
                      hideMessage();
          }
        });
    }, function (dismiss) {    
        return false; 
    });    
}
	
</script>
<!-- <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />  -->

<!-- <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script> -->

<div class="breadcrumb">
    <h1>Clinic</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Clinic list</li>
    </ul>
</div>
<div class="separator-breadcrumb border-top"></div>

<form action="" method="post">
<div class="row">
    <div class="col-lg-12 col-md-12">
        <div class="card mb-5">
            <div class="card-body">
                <div class="row row-xs">
                    
                    <div class="col-md-2 mt-3 mt-md-0"  id="div_clinic_id">
                        <label for="clinic_id">Clinic Id</label>
                        <input type="text" class="form-control" name="clinic_id" id="clinic_id"  />
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_clinic_fullname">
                        <label for="clinic_fullname">Clinic Name</label>
                        <input type="text" class="form-control" name="clinic_fullname" id="clinic_fullname"  />
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_clinic_unique_id">
                        <label for="clinic_unique_id">Unique Id</label>
                        <input type="text" class="form-control" name="clinic_unique_id" id="clinic_unique_id"  />
                    </div>

                    <div class="col-md-2  mt-3 mt-md-0">
                        <label for="clinic_email">Email</label>
                        <input type="text" class="form-control" name="clinic_email" id="clinic_email" />
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0" id="div_clinic_phones" >
                      <label for="clinic_phones">Phone</label>
                      <input type="text" class="form-control" name="clinic_phones" id="clinic_phones" />
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0" id="div_clinic_website" >
                      <label for="clinic_website">Website</label>
                      <input type="text" class="form-control" name="clinic_website" id="clinic_website" />
                    </div>

                    <div class="col-md-2  mt-3 mt-md-0" id="div_clinic_user">
                        <br/>
                        <label for="clinic_user">User</label>
                        <select class="form-control" id="clinic_user" name="clinic_user">
                            <option value="">Select User</option>
                            <?php
                                  $userobj = new user;
                                  $fields = array('user_id,user_fname,user_lname');
                                  $userArg = array("fields"=>$fields);
                                  $userdata = $userobj->getAllRecords($userArg);
                                  foreach ($userdata as $ukey => $userdata_value) 
                                    { 
                                      $username = $userdata_value->user_fname."".$userdata_value->user_lname;
                                      ?>
                                        <option value="<?php echo $userdata_value->user_id; ?>"><?php echo $username; ?></option>
                              <?php }
                            ?>

                        </select>
                    </div>

                    <div class="col-md-2  mt-3 mt-md-0" id="div_clinic_specality">
                      <br/>
                        <label for="clinic_specality">Specality</label>
                        <select class="form-control" id="clinic_specality" name="clinic_specality">
                            <option value="">Select Specality</option>
                            <?php
                                  $specality_obj = new speciality;
                                  $fields = array('speciality_id,speciality_name');
                                  $specalityArg = array("fields"=>$fields);
                                  $specialitydata = $specality_obj->getAllRecords($specalityArg);
                                  foreach ($specialitydata as $skey => $specality_value) 
                                    { ?>
                                        <option value="<?php echo $specality_value->speciality_id; ?>"><?php echo $specality_value->speciality_name; ?></option>
                              <?php }
                            ?>

                        </select>
                    </div>

                    <div class="col-md-2  mt-3 mt-md-0" id="div_clinic_specality">
                      <br/>
                        <label for="clinic_feature">Feature</label>
                        <select class="form-control" id="clinic_feature" name="clinic_feature">
                            <option value="">Select Feature</option>
                            <?php
                                  $feature_obj = new feature;
                                  $fields = array('feature_id,feature_name');
                                  $featureArg = array("fields"=>$fields);
                                  $featuredata = $feature_obj->getAllRecords($featureArg);
                                  foreach ($featuredata as $skey => $feature_value) 
                                    { ?>
                                        <option value="<?php echo $feature_value->feature_id; ?>"><?php echo $feature_value->feature_name; ?></option>
                              <?php }
                            ?>

                        </select>
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_clinic_status">
                      <br/>
                        <label for="clinic_date">Date</label>
                        <input type="date" class="form-control" name="clinic_date" id="clinic_date" />
                        
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_clinic_status">
                      <br/>
                        <label for="clinic_status">Status</label>
                        <select class="form-control" id="clinic_status" name="clinic_status">
                            <option value="">Select Status</option>
                            <option value="1">Active</option>
                            <option value="0">Inactive</option>
                        </select>
                        
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0">
                       <br/>
                        <label for="">&nbsp;</label>
                        <button type="submit" name="submit" class="btn btn-primary btn-block">Search</button>
                    </div>
                    <div class="col-md-2 mt-3 mt-md-0">
                       <br/>
                        <label for="">&nbsp;</label>
                        <button type="reset" name="reset" class="btn btn-primary btn-block" onClick="window.location.reload()">Reset</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</form>

<div class="row mb-4">
  <div class="col-md-6">
        <select id="act" name="act" class="form-control maction">
          <option value="">Multiple action</option>              
          <option value="activate_all">Activate selected</option>
          <option value="inactivate_all">De-activate selected</option>
          <!-- <option value="delete_all">Delete selected</option> -->
        </select>
        <button type="button" class="btn btn-primary m-1" onclick="return validate_all();">Apply</button>
  </div>
  <div class="col-md-6 pull-right">
        <div class="button-group">
            <!-- <a href="clinicadd.php" class="btn btn-dark m-1"><i class="i-Add-User"></i> Add New</a> -->
      </div>    
  </div>  
</div>        
<div class="widget-body">
    <div class="portlet-body">
                        
    <?php echo (isset($successMsg) && $successMsg!='') ? "<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($successMsg)."</div>" : '' ; ?>
    <?php echo (isset($failedMsg) && $failedMsg!='') ? "<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($failedMsg)."</div>" : '' ?>
   
    <div id="status_msg" style="display: none;"><div class="alert alert-success"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>
    <div id="alert_msg" style="display: none;"><div class="alert alert-danger"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>

    </div>
</div>

<div class="row mb-4">
    <div class="col-md-12 mb-4">
        <div class="card text-left">

            <div class="card-body">
                <div class="table-responsive">
                  <form id="listFrm" name="listFrm" action="" method="post">       
                    <input type="hidden" id="action" name="action" value="">
                    <table id="list" class="display table table-striped table-bordered" style="width:100%">
                        <thead>
                            <tr>
                                <th class="center"><input type="checkbox" name="checkall" id="checkall"></th>
                                <th>ID</th>
                                <th>Unique Id</th>
                                <th>Name</th>
                                <th>Details</th>
                                <th>Date</th>
                                <th>Status</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                    </table>
                  </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="application/javascript">
   $(document).ready(function() {

      // Initialize select2
      /*$("#clinic_status").select2();
      $("#clinic_specality").select2();*/

     $('#list').DataTable( { 
          "ajax": "cliniclist.php?act=load",
          "processing": true,
          "serverSide": true,
          "pageLength": 25,
                "aaSorting": [],
                "aoColumnDefs": [
                    { 'bSortable': false, 'aTargets': [0,4,6] }
                ],
          language: {
              "processing" : "<div class='loader-bubble loader-bubble-primary m-5'></div>",
                    "sEmptyTable" :  "No records found."
          }
          
      } );

     $( "form" ).on( "submit", function(e) {
        e.preventDefault();
        
        var clinic_id = $("#clinic_id").val();
        var clinic_fullname = $("#clinic_fullname").val();
        var clinic_unique_id = $("#clinic_unique_id").val();
        var clinic_email = $("#clinic_email").val();
        var clinic_phone = $("#clinic_phones").val();
        var clinic_website = $("#clinic_website").val();
        var clinic_user = $("#clinic_user").val();
        var clinic_specality = $("#clinic_specality").val();
        var clinic_status = $('#clinic_status').val();
        var clinic_date = $('#clinic_date').val();
        var clinic_feature = $("#clinic_feature").val();

        $('#list').DataTable().destroy();
          $('#list').DataTable( { 
            "ajax": "cliniclist.php?act=load&fullname="+clinic_fullname+"&clinic_unique_id="+clinic_unique_id+"&clinic_email="+clinic_email+"&clinic_phone="+clinic_phone+"&clinic_website="+clinic_website+"&clinic_user="+clinic_user+"&clinic_specality="+clinic_specality+"&clinic_status="+clinic_status+"&clinic_id="+clinic_id+"&clinic_date="+clinic_date+"&clinic_feature="+clinic_feature,
            "processing": true,
            "serverSide": true,
            "pageLength": 25,
                  "aaSorting": [],
                  "aoColumnDefs": [
                      { 'bSortable': false, 'aTargets': [0,4,6] }
                  ],
            language: {
                "processing" : "<div class='loader-bubble loader-bubble-primary m-5'></div>",
                "sEmptyTable" :  "No records found."
            }
            
        } );

      });
    });
</script>

