          <style>
    .required{
        color: #bf5050;
    }
    </style>
        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
                <div class="title_left">
                    <h3></h3>
                </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">
                    <h2>Add Biometric Devices</h2>
                    <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">

                    <form class="form-horizontal form-label-left" id="routePermit" action="<?php echo $base_url;?>Biometric/save" method="post">
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Device Name<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          
                          <input name="name" id="Biometric" required="true" class="form-control">
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Device IP<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input name="ip" id="" type="text" class="form-control" title="example: 192.168.10.60" required="true" pattern="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" placeholder="xxx.xxx.xxx" >
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Device Port<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          
                          <input name="port" type="number" id="port" required="true" min=0 class="form-control">
                        </div>
                      </div>

                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          <input id="send" type="submit" class="btn btn-success pull-right" value="Save" />
                        </div>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
            
                <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Group View</h2>
                    <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">
                    <table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap">
                      <thead>
                        <tr>
                          <th>#</th>
                          <th>Device Name</th>
                          <th>IP</th>
                          <th>Port</th>
                          <th>Actions</th>
                        </tr>
                      </thead>


                      <tbody class="center">
                        <?php $i=1; foreach ($biometric as  $value) { ?>
                        <tr>
                          <td><?php echo $i++; ?></td>
                          <td><?php echo $value['name']; ?></td>
                          <td><?php echo $value['ip']; ?></td>
                          <td><?php echo $value['port']; ?></td>
                          <td>
<?php  if($edit_delete['edit']){ ?>

                            <a href='<?php echo base_url();?>Biometric/edit/<?php echo base64_encode(json_encode($value['id'].SALT)); ?>
'><i class="fa fa-edit"></i></a> 
<?php } if($edit_delete['delete']){ ?>

                            <a href="<?php echo base_url();?>Biometric/delete/<?php echo base64_encode(json_encode($value['id'].SALT)); ?>
" <i class="fa fa-trash"></i></a>
<?php } ?>
                          </td>
                        </tr>
                        <?php } ?>
                      </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>

    <!-- 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>
 
    <!-- Datatables -->
<script>
        $(document).ready(function(){
            $(document).on("change","#branch",function(){
                var value = $(this).val();
                $.get("<?php echo base_url(); ?>load/classs/role/"+value,{},function(d){
                    var pre = '<option value="">Select Branch</opiton>';
                    $("#class_id").html(pre+d);
                });
            });
            
        });
    </script>
<script>
      $(function(){
        $(document).on("click","#go-search",function(){
          var p = 1;
          var s = $("#search").val();
          if(s=="")
            s="all";
          window.location = "<?php echo base_url();?>country/index/"+s+"/"+p;
        });
        $(document).on("click","button",function(){
          var val = $(this).attr("data-href");
          window.location = val;
        });
      });
    </script>
     <!-- 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 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: {
                    name: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The name is required'
                            }
                        }
                    },
                     ip: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The ip is required'
                            }
                        }
                    },
                     port: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The port is required'
                            }
                        }
                    },
                    username: {
                        message: 'The username is not valid',
                         trigger:'blur',
                        validators: 

                        {
                            notEmpty: {
                                message: 'The username is required'
                            },
                         //      regexp: {
                         //    regexp: /^[0-9]{10}$/,
                         //     message: 'Plz Enter 10 Digit Number'
                         // },
                       
                            
                        }
                    },

                
                contact: {
                                    validators: {
                                        notEmpty: {
                                            message: 'The contact is required and cannot be empty'
                                        },
                                        
                                    }
                                },

                    'phone[]': {
                      
                    trigger:'blur',
                validators: {
                    
                         stringLength: {
                            min: 13,
                            max: 13,
                            message: 'The phone number must be mobile number'
                        }
                    
                                  // callback: {
                    //     callback: function(value, validator, $field) {
                    //         var $phone          = validator.getFieldElements('phone[]'),
                    //             numphone        = $phone.length,
                    //             notEmptyCount    = 0,
                    //             obj              = {},
                    //             duplicateRemoved = [];

                    //         for (var i = 0; i < numphone; i++) {
                    //             var v = $phone.eq(i).val();
                    //             if (v !== '') {
                    //                 obj[v] = 0;
                    //                 notEmptyCount++;
                    //             }
                    //         }

                    //         for (i in obj) {
                    //             duplicateRemoved.push(obj[i]);
                    //         }

                    //         if (duplicateRemoved.length === 0) {
                    //             return {
                    //                 valid: false,
                    //                 message: 'Phone Number is required'
                    //             };
                    //         } else if (duplicateRemoved.length !== notEmptyCount) {
                    //             return {
                    //                 valid: false,
                    //                 message: 'The phone no must be unique, cannot duplicate'
                    //             };
                    //         }

                    //         validator.updateStatus('phone[]', validator.STATUS_VALID, 'callback');
                    //         return true;
                    //     }
                   
                       
                //  },
                   // remote: {
                    //     url: 'existphonecustomer',
                    //     // Send { email: 'its value', username: 'its value' } to the back-end
                    //     data: function(validator, $field, value) {
                    //         var phone=validator.getFieldElements('phone[]').val();
                    //         console.log(phone);
                    //         return {
                    //             phone: phone
                    //         };
                    //     },
                    //     message: 'This phone number is already exist',
                    //     type: 'POST'
                    // }
                }
            },

                     cnic: {
                    trigger:'blur',
                validators: {
                     notEmpty: {
                             message: 'The cnic is required'
                         },
                         stringLength: {
                            min: 13,
                            max: 13,
                            message: 'The cnic must be 13 digit'
                        },
                    remote: {
                        url: 'existcustomercnic',
                        // Send { email: 'its value', username: 'its value' } to the back-end
                        data: function(validator, $field, value) {
                            var cnic=window.btoa(validator.getFieldElements('cnic').val());
                            console.log(cnic);
                            return {
                                cnic: cnic
                            };
                        },
                        message: 'This cnic is already exist',
                        type: 'POST'
                    }
                }
            },

                    email: {
                                    validators: {
                                        notEmpty: {
                                            message: 'The email address is required and cannot be empty'
                                        },
                                        emailAddress: {
                                            message: 'The email address is not valid'
                                        }
                                    }
                                },
            
            
        

                    address: {
                         trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The address is required'
                            }
                        }
                    },

                    contactname: {
                         trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The Contact Person Name is required'
                            }
                        }
                    },


                   
                }
            });
    });
    
    
    
$("#zzz").click(function(){
   $('#routePermit').bootstrapValidator("resetForm",true);    
});

</script>
<script>
      $(function(){
          var handleDataTableButtons = function() {
          if ($("#datatable-buttons").length) {
            $("#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 ]
                    },
                className: "btn-sm"
                },
                {
                  extend: "pdfHtml5",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3 ]
                    },
                  className: "btn-sm"
                },
                {
                  extend: "print",
                  exportOptions: {
                    columns: [ 0, 1, 2, 3 ]
                },
                  className: "btn-sm"
                },
              ],
              responsive: true
            });
          }
        };

        TableManageButtons = function() {
          "use strict";
          return {
            init: function() {
              handleDataTableButtons();
            }
          };
        }();

        TableManageButtons.init();
      });
    </script>
    <script>
    
    // Select your input element.

var number = document.getElementById('port');

// Listen for input event on numInput.
number.onkeydown = function(e) {
    if(!((e.keyCode > 95 && e.keyCode < 106)
      || (e.keyCode > 47 && e.keyCode < 58) 
      || e.keyCode == 8)) {
        return false;
    }
}

    </script>
  </body>
</html>