     <style>
#def{
  display:none;
}
#hide_cls{
  display:none;
}
.required{
        color:#bf5050;
        
    }
  
</style>  
       <!-- page add content -->
        <div class="right_col" role="main">
        
        <!-- page content -->
          <div class="">
              <div class="page-title">
                <div class="title_left">
                    
                </div>
            </div>
            
         <div class="clearfix"></div>
          <div class="row">
             
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                   
                  <div class="x_title" id="scroll">
                     <h2 style="float:left;">Add Class</h2>
                     <input id="add_cls" class="btn btn-success "  style="margin-left:30%;" value="Add Class"  type="button">
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                    </ul>
                   <div class="clearfix"></div>
                  </div>
                  
                   
                  <div class="x_content">
                     
                      <div id="def">
                          <!--$base_url;?>classes/save-->
                      <form class="form-horizontal form-label-left" id="routePermit" action="" method="post">


                    <?php if($this->user_model->is_super()){ ?>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Branch <span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="branch" class="form-control col-md-7 col-xs-12" name="branch" required="required" style="width:100%" onchange="myFunction()";>
                            <option value=''>Select branch</option>
                      <?php
                            $branch = $this->db->select("name,id")->from("branch")->get()->result();
                            foreach ($branch as $value) {
                      ?>
                            <option value="<?php echo $value->id; ?>"><?php echo $value->name?></option>

                      <?php } ?>
                          </select>
                        </div>
                      </div>
                      <?php  }else{$branch=$this->user_model->getbranch();?>
                          <input id="branch" name="branch" type="hidden" value="<?= $branch ?>">
                      <?php  } ?>
                      <input type="hidden" name="edit_id" id="edit_id">
                      
                     <div class="item form-group" id="msg" style="display:none;">
                           <label class="control-label col-md-2 col-sm-3 col-xs-12" for="name"> 
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12 ">
                          <input id="msgfield" style="background-color:#e86d6d; color:white;" class="form-control col-md-7 col-xs-12" value="Sorry! This Class already exists!"  name="msg" type="text" readonly>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-2 col-sm-3 col-xs-5" for="name">Class Name <span class="required">*</span>
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                          <input type="text" onkeyup="myFunction()" id="class_name" onblur="myFunction()" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="class_name" placeholder="Class Name" required="required" >
                        </div>
                       
                      
                        <label class="control-label col-md-2 col-sm-3 col-xs-12" for="name">Description 
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                          <input id="class_des" class="form-control col-md-7 col-xs-12"  name="description" placeholder="Description" type="text">
                        </div>
                      </div>
                    
                      <div class="item form-group">
                        <label class="control-label col-md-2 col-sm-3 col-xs-12" for="contact"> Fee <span class="required">*</span>
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                          <input type="text" id="tution_fee" name="tution_fee" required="required" onkeypress="return ValidateNumberOnly()" class="form-control col-md-7 col-xs-12" placeholder="Tuition Fee For Class">
                        </div>
                      
                        <label class="control-label col-md-2 col-sm-3 col-xs-12" for="admin_fee">Admission Fee <span class="required">*</span>
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                          <input type="text" id="admin_fee" name="admin_fee" required="required" class="form-control col-md-7 col-xs-12" onkeypress="return ValidateNumberOnly()" placeholder="Admission Fee For Class">
                        </div>
                       
       
                      </div>
                      
                       <div class="item form-group" id="msgs" style="display:none;">
                           <label class="control-label col-md-2 col-sm-3 col-xs-12" for="name"> 
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12 ">
                          <input id="msgfield" style="background-color:#e86d6d; color:white;" class="form-control col-md-7 col-xs-12" value="Sorry! This Order already given!"  name="msg" type="text" readonly>
                        </div>
                      </div>
                        <div class="item form-group">
                              <label class="control-label col-md-2 col-sm-3 col-xs-12" for="orderr">Order<span class="required">*</span>
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                          <input type="number" id="orderr" name="orderr" onKeyup="myFunction1()" required="required" class="form-control col-md-7 col-xs-12 123"  placeholder="Order For Class">
                        </div>
                        
                               <label class="control-label col-md-2 col-sm-3 col-xs-12" for="orderr">Prefix<span class="required">*</span>
                        </label>
                        <div class="col-md-3 col-sm-6 col-xs-12">
                          <input type="text" id="prefix" name="prefix"  required="required" class="form-control col-md-7 col-xs-12"  placeholder="Prefix For Class">
                        </div>
                        
                            </div>
                            
                             
                       
                            
        <div style=" margin-left:200px;color:red;"><h4>  <?php @$e=$_GET['error']; echo @$e; ?><h4></div>
        <div style=" margin-left:200px;color:green;"><h4>  <?php @$s=$_GET['status']; echo @$s; ?><h4></div>               
                      
                      <div class="form-group ">
                        <div class="col-md-7 col-md-offset-3 ">
                         <a href="<?php echo base_url();?>classes"><input id="hide_cls" class="btn btn-sm btn-danger pull-right" value="Cancel"  type="button" style="float:right;"></a> <button id="new_type" type="submit" disabled="disabled" value="add" class="btn btn-sm btn-success pull-right" style="float:right;">Save</button>
                        </div>
                      </div>
                    </form>
                    <hr>
                      </div>

                    <table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap">
                      <thead>
                        <tr>
                          <th>#</th>
                          <th>Class Name</th>
                          <th>Description</th>
                          <th>Fee</th>
                          <th>Admission Fee</th>
                          <th>Prefix</th>
                          <?php if($is_super){ ?>
                          <th>Branch</th>
                          <?php } ?>
                         
                          <th>Actions</th>
                          
                        </tr>
                      </thead>


                      <tbody class="center">
                        
                      </tbody>
                    </table>

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

            </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- footer content -->
        <footer>
          <div class="pull-right">
            Prudmac
          </div>
          <div class="clearfix"></div>
        </footer>
        <!-- /footer content -->
      </div>
    </div>

<div id='ajaxload' style='position:fixed;top:0;left:0;bottom:0; width:100%;height:100%;z-index:1000;background:rgba(2,132,130,0.5);display:none;'>
            <i class='fa fa-spinner fa-spin fa-4x' style='position: relative;top: 50%;left: 60%;margin-top: -50px;margin-left: -40px;'></i>
        </div>

    <!-- jQuery -->
    <script src="<?php echo base_url(); ?>assets/vendors/jquery/dist/jquery.min.js"></script>
    <!-- Custom JS -->
    <script src="<?php echo base_url(); ?>assets/js/main.js"></script>
    <!-- Bootstrap -->
    <script src="<?php echo base_url(); ?>assets/vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo base_url(); ?>assets/vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="<?php echo base_url(); ?>assets/vendors/nprogress/nprogress.js"></script>
    <!-- Chart.js -->
    <script src="<?php echo base_url(); ?>assets/vendors/Chart.js/dist/Chart.min.js"></script>
    <!-- gauge.js -->
    <script src="<?php echo base_url(); ?>assets/vendors/gauge.js/dist/gauge.min.js"></script>
    <!-- bootstrap-progressbar -->
    <script src="<?php echo base_url(); ?>assets/vendors/bootstrap-progressbar/bootstrap-progressbar.min.js"></script>
    <!-- iCheck -->
    <script src="<?php echo base_url(); ?>assets/vendors/iCheck/icheck.min.js"></script>
    <!-- Skycons -->
    <script src="<?php echo base_url(); ?>assets/vendors/skycons/skycons.js"></script>
    <!-- Flot -->
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.pie.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.time.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.stack.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/Flot/jquery.flot.resize.js"></script>
    <!-- Flot plugins -->
    <script src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.orderBars.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/date.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/jquery.flot.spline.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/flot/curvedLines.js"></script>
    <!-- jVectorMap -->
    <script src="<?php echo base_url(); ?>assets/js/maps/jquery-jvectormap-2.0.3.min.js"></script>
    <!-- bootstrap-daterangepicker -->
    <script src="<?php echo base_url(); ?>assets/js/moment/moment.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/js/datepicker/daterangepicker.js"></script>

    <!-- Custom Theme Scripts -->
    <script src="<?php echo base_url(); ?>assets/build/js/custom.min.js"></script>

    <!-- Datatables -->
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/jszip/dist/jszip.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/pdfmake/build/vfs_fonts.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="<?php echo base_url(); ?>assets/vendors/datatables.net-scroller/js/datatables.scroller.min.js"></script>
    <!--Notify-->
    <script  src="<?php echo base_url(); ?>assets/js/notify.js"></script>
    <!-- Datatables -->
    
    <!-- Form Validator -->
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/bootstrapValidator.js"></script>
<!-- Form Validator-->
  <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrapValidator.css"/>
   <script src="<?php echo base_url()?>assets/select/js/select2.min.js"></script>
<script>
    $('#branch').select2();
</script> 
    
<script type="text/javascript">
    $(document).ready(function() {
        $('#routePermit')
            .on('init.form.bv', function(e, data) {
                //console.log(data);
            })
            .bootstrapValidator({
                message: 'This value is not valid',
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {
                    class_name: {
                        trigger:'change keyup',
                        validators: {
                            notEmpty: {
                                message: 'Please Enter Class Name'
                            }
                        }
                    },
                    // description: {
                    //     trigger:'change keyup',
                    //     validators: {
                    //         notEmpty: {
                    //             message: 'Please Enter Description'
                    //         }
                    //     }
                    // },
                    tution_fee: {
                        trigger:'change keyup',
                        validators: {
                            notEmpty: {
                                message: 'Please Enter Tuition Fee'
                            }
                        }
                    },
                
                   
                }
            });
    });
    
$("#zzz").click(function(){
   $('#routePermit').bootstrapValidator("resetForm",true);    
});

</script>
    <script>
$(document).ready(function(){
    $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });
   $.ajax({
    url: '<?php echo base_url(); ?>Classes/fetch_class/',data: {},
         success: function (result) {
             $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
              $("#datatable-buttons").dataTable().fnDestroy();
               setTimeout(function(){ 
               $("tbody.center").html(result);
                $('#datatable-buttons').DataTable({
              dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
            },500);
           }
     });//end ajax for loading form


});
</script>
    
    
 <script>
function edit(id,event){
  event.preventDefault();
  $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });
  $.ajax({
     url: '<?php echo base_url(); ?>Classes/get_record/'+id,
         success: function (result)
          { 
        $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
            var obj=JSON.parse(result);
           $("#edit_id").val(obj.class_id);
            $("#class_name").val(obj.class_name);
            $('#class_name').attr("data-id",obj.class_id);
            $("#class_des").val(obj.description);
            $("#tution_fee").val(obj.tution_fee);
            $("#admin_fee").val(obj.admin_fee);
            $("#branch").val(obj.branch);
             $("#orderr").val(obj.orderr);
             $("#prefix").val(obj.prefix);
            $("#new_type").val("Update");
             $('#def').show();
           $('#hide_cls').show();
           $("#new_type").html('Update');
        $('#add_cls').hide();
         $('html, body').animate({
        scrollTop: $("#scroll").offset().top
    }, 1000);
            //$("tbody.center").html(result);
            }
      });
}
</script>   
    
    

 <script>
function myFunction() {
     $val=$('#class_name').val();
     id = $('#class_name').attr('data-id');
     $branch=$('#branch').val();
     if(id){
         $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });

       $.ajax({
         url: '<?php echo base_url(); ?>Classes/check_editclass/'+ id+ '/'+ $val+ '/'+$branch,
        data: {},
        success: function (res) {
 $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
                            if(res == 1)
                            {
                             //alert("Already exists");
                             
                            $("#msg").css("display", "block");
                            document.getElementById("new_type").disabled = true;
                           
                            }
                             else{
                             //alert("You can add class");
                             $("#msg").css("display", "none");
                             document.getElementById("new_type").disabled = false;
                             }
                    },
                     error: function(){
                                        alert("failure");
                                    }
                });
    
     }else{
         $.ajax({
         url: '<?php echo base_url(); ?>Classes/check_class/'+ $val+ '/'+$branch,
        data: {},
        success: function (res) {
 $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
                            if(res == 1)
                            {
                             //alert("Already exists");
                             
                            $("#msg").css("display", "block");
                            document.getElementById("new_type").disabled = true;
                           
                            }
                             else{
                             //alert("You can add class");
                             $("#msg").css("display", "none");
                             document.getElementById("new_type").disabled = false;
                             }
                    },
                     error: function(){
                                        alert("failure");
                                    }
                });
    
     }
     //alert($val);
    
}
</script>
 <script>
function myFunction1() {
     $val=$('#orderr').val();
     id = $('#orderr').attr('data-id');
     $branch=$('#branch').val();
     if(id){
         $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });

       $.ajax({
         url: '<?php echo base_url(); ?>Classes/check_editorderr/'+ id+ '/'+ $val+ '/'+$branch,
        data: {},
        success: function (res) {
 $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
                            if(res == 1)
                            {
                             //alert("Already exists");
                             
                            $("#msgs").css("display", "block");
                            
                           
                            }
                             else{
                             //alert("You can add class");
                             $("#msgs").css("display", "none");
                             
                             }
                    },
                     error: function(){
                                        alert("failure");
                                    }
                });
    
     }else{
         $.ajax({
         url: '<?php echo base_url(); ?>Classes/check_orderr/'+ $val+ '/'+$branch,
        data: {},
        success: function (res) {
 $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
                            if(res == 1)
                            {
                             //alert("Already exists");
                             
                            $("#msgs").css("display", "block");
                            document.getElementById("new_type").disabled = true;
                           
                            }
                             else{
                             //alert("You can add class");
                             $("#msgs").css("display", "none");
                             document.getElementById("new_type").disabled = false;
                             }
                    },
                     error: function(){
                                        alert("failure");
                                    }
                });
    
     }
     //alert($val);
    
}
</script>
  <script>
   $(document).ready(function() {
$("#add_cls").click(function(event){
 $('#def').show();
 $('#hide_cls').show();
 $('#add_cls').hide();
});
});
</script>
 <script>
   $(document).ready(function() {
$("#hide_cls").click(function(event){
 $('#def').hide();
 $('#hide_cls').hide();
 $('#add_cls').show();
});
});
</script>
<script>
   $(document).ready(function() { 
    $("#new_type").click(function(event){
  event.preventDefault();
   $('#def').hide();
 $('#hide_cls').hide();
 $('#add_cls').show();
  var value=$("#new_type").val();
  var name=$("#class_name").val();
  var des=$("#class_des").val();
  //alert(des);
  if(des === ''){
      des = '-';
  }
   var tu_fee=$("#tution_fee").val();
  var adm_fee=$("#admin_fee").val();
  var branch=$("#branch").val();
   var orderr=$("#orderr").val();
   var pref=$("#prefix").val();
if(name=="" || tu_fee=="" || adm_fee=="" || branch=="" || orderr=="" || pref=="")
  {
    alert("Please fill the fields");
    $('#def').show();
 $('#hide_cls').show();
 $('#add_cls').hide();
    return false;
    
  }
if(value=="add")
{
    $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });

$.ajax({
 url:'<?php echo base_url();?>classes/save/'+name+'/'+des+'/'+tu_fee+'/'+adm_fee+'/'+branch+'/'+orderr+'/'+pref,data:{},
        success: function (result) {
 $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
      $.notify("Successfully Added..", "success");
           $("#datatable-buttons").dataTable().fnDestroy();
           setTimeout(function(){ 
                $("tbody.center").html(result);
                $('#datatable-buttons').DataTable({
                    dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
            },500);
            
           
            
           }
    });
$("#new_type").val("add");
 $("#class_name").val("");
 $("#class_des").val("");
 $("#tution_fee").val("");
 $("#admin_fee").val("");
 $("#orderr").val("");
 $("#prefix").val("");
}
else if(value=="Update")
{
  var id=$("#edit_id").val();
  var up_name=$("#class_name").val();
  if(up_name == ''){up_name= '-' }
  var up_des=$("#class_des").val();
  if(up_des == ''){up_des= '-' }
   var up_tu_fee=$("#tution_fee").val();
  if(up_tu_fee == ''){up_tu_fee= 0 }
  var up_adm_fee=$("#admin_fee").val();
  if(up_adm_fee == ''){up_adm_fee= 0 }
  var up_orderr=$("#orderr").val();
  if(up_orderr == ''){up_orderr= 0 }
  var up_prefix=$("#prefix").val();
  if(up_prefix == ''){up_prefix= 0 }
  $(document).ajaxStart(function() {
                $('#ajaxload').show();
            });
   $.ajax({
    url:'<?php echo base_url()?>classes/up_cls/'+id+"/"+up_name+"/"+up_des+'/'+up_tu_fee+'/'+up_adm_fee+'/'+up_orderr+'/'+up_prefix,data:{},
    success: function (result) {
 $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
      $.notify("Successfully Updated..", "success");
           $("#datatable-buttons").dataTable().fnDestroy();
           setTimeout(function(){ 
                $("tbody.center").html(result);
                $('#datatable-buttons').DataTable({
                    dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
            },500);
           }
  });
  $("#new_type").val("add");
 $("#class_name").val("");
 $("#class_des").val("");
 $("#tution_fee").val("");
 $("#admin_fee").val("");
  $("#orderr").val("");
  $("#prefix").val("");
}
});//end if for button type checking
});
</script>
<script>
   
function active(id,event){
event.preventDefault();
$(document).ajaxStart(function() {
                $('#ajaxload').show();
            });

  $.ajax({
     url: '<?php echo base_url(); ?>classes/cl_active/'+id,
      success: function (result) {
 $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
            $.notify("Successfully Activated..", "info");
           $("#datatable-buttons").dataTable().fnDestroy();
           setTimeout(function(){ 
                $("tbody.center").html(result);
                $('#datatable-buttons').DataTable({
                    dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
            },500);
           }
      });
}
</script>
<script>
   
function deactive(id,event){
event.preventDefault();
$(document).ajaxStart(function() {
                $('#ajaxload').show();
            });
  $.ajax({
     url: '<?php echo base_url(); ?>classes/cl_deactive/'+id,
      success: function (result) {
 $(document).ajaxStop(function() {
           $('#ajaxload').hide();
      });
            $.notify("Successfully Deactivated..", "info");
           $("#datatable-buttons").dataTable().fnDestroy();
           setTimeout(function(){ 
                $("tbody.center").html(result);
                $('#datatable-buttons').DataTable({
                    dom: "lBfrtip",
              "bPaginate": true,
              "pageLength":35,
              "lengthMenu": [[35, 70, 100, -1], [35, 70, 100, "All"]],
              buttons: [
                {
                  extend: "copy",
                  className: "btn-sm"
                },
                {
                  extend: "csv",
                  className: "btn-sm"
                },
                {
                  extend: "excel",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3, 4 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
            },500);
           }
      });
}
</script>
<script>
function ValidateNumberOnly()
{
if ((event.keyCode < 48 || event.keyCode > 57)) 
{
   event.returnValue = false;
}
}
</script>
  </body>
</html>