       <!-- page content -->
        <div class="right_col" role="main">
          <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">
                    <h2>Add Staff</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;?>staff/save" 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="text-danger">*</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">
                            <option value=''>Select Branch</option>
                      <?php
                            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  } ?>
                          <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Department 
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select id="dpt" class="form-control col-md-7 col-xs-12" name="dpt" >
                              <option value="">Select Department</option>
                              <?php 
                                  foreach ($department as $key => $value) {
                                    echo "<option value= $value[id]>$value[name]</option>";
                                  }
                               ?>
                          </select>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">First Name <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="firstname" class="form-control col-md-7 col-xs-12"   name="firstname" placeholder="First Name"  type="text" required="required" aria-describedby="name-format" pattern="[A-Za-z]{3,}" title="Only alphabatic character">
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Last Name <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="lastname" class="form-control col-md-7 col-xs-12"   name="lastname" placeholder="Last Name" required="required" aria-describedby="name-format" pattern="[A-Za-z]{3,}" type="text" title="Only alphabatic character">
                        </div>
                      </div>
                      
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="cnic">Staff ID <span class="text-danger"></span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="text" id="cnic" name="cnic"   class="form-control col-md-7 col-xs-12" aria-describedby="name-format" placeholder="Staff Id" pattern="\d{4}\d{4}" title="12345678 (8 numbers)">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="contact">Contact No <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="text" id="contact" name="contact" required="required"  class="form-control col-md-7 col-xs-12" placeholder="Contact Number" pattern="[\+]\d{3}\d{4}\d{6}" title='Phone Number Format:+2543027566364'>
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="b_head">Salary<span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="salery" class="form-control col-md-7 col-xs-12"  max="100000" name="salery" placeholder="Salary" required="required" type="number">
                        </div>
                      </div>
                       <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="b_head">Security<span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="security" class="form-control col-md-7 col-xs-12"  max="100000" name="security" placeholder="Security" type="number">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="b_h_contact">Designation <span class="text-danger">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="text" id="designation" name="designation" required="required" pattern="[A-Za-z]{3,}" title="Only alphatatic character" class="form-control col-md-7 col-xs-12" placeholder="e.g teacher">
                        </div>
                      </div>

                        <div class="item form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="b_h_contact">Qualification<span class="text-danger"></span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="text" id="qualification" name="qualification"   class="form-control col-md-7 col-xs-12" placeholder="e.g Diploma">
                        </div>
                      </div>
                        
                        <div class="item form-group">
                        <label for="password" class="control-label col-md-3">Seniority Level<span class="text-danger">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="sen_lev" type="number" name="sen_lev" placeholder="Seniority Level" class="form-control col-md-7 col-xs-12 abc1">
                        </div>
                      </div>
                     
                      
                      <div class="item form-group">
                        <label for="password" class="control-label col-md-3">Date of Birth<span class="text-danger">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="dob" type="date" name="dob" placeholder="Date of Birth" class="form-control col-md-7 col-xs-12" required="required">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label for="password" class="control-label col-md-3">Date of Joining<span class="text-danger">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="doj" type="date" name="doj" placeholder="Date of Joining" class="form-control col-md-7 col-xs-12" required="required">
                        </div>
                      </div>
                      <div class="item form-group">
                        <label for="password" class="control-label col-md-3">Address<span class="text-danger">*</span></label>
                        <div class="col-md-6 col-sm-6 col-xs-12"><textarea id="address"  name="address"  class="form-control col-md-7 col-xs-12" required="required"></textarea></div>
                      </div>
                      <div class="item form-group">
                        <label for="password" class="control-label col-md-3">Bank Name</label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="bank" type="text" name="bank" placeholder="Bank Name" class="form-control col-md-7 col-xs-12 abc1" >
                        </div>
                      </div>
                      <div class="item form-group">
                        <label for="account" class="control-label col-md-3"> Account Number</label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input id="account" type="text" name="account" onkeypress="return ((event.charCode > 47 && event.charCode < 58) || event.charCode == 45  );" placeholder="999-9999999999999-99" class="form-control col-md-7 col-xs-12" >
                        </div>
                      </div>


                    
                      <div class="form-group">
                        <div class="col-md-6 col-md-offset-3">
                          <button id="send" type="submit" class="btn btn-success pull-right">Save</button>
                        </div>
                      </div>
                    </form>
                  </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>
<!-- 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>
    <!-- Jquery UI-daterangepicker -->
    <script src="<?php echo base_url(); ?>assets/vendors/datepicker/jquery-ui.min.js"></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: {
                    firstname: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The firstname is required'
                            }
                        }
                    },
                     designation: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The designation is required'
                            }
                        }
                    },
                    qualification: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The qualification is required'
                            }
                        }
                    },
                    specialization: {
                        trigger:'blur',
                        validators: {
                            Empty: {
                                message: 'The specialization is required'
                            }
                        }
                    },
                    address: {
                        trigger:'blur',
                        validators: {
                            Empty: {
                                message: 'The address is required'
                            }
                        }
                    },
                     security: {
                        trigger:'blur',
                        validators: {
                            Empty: {
                                message: 'The security is required'
                            }
                        }
                    },
                      doj: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The doj is required'
                            }
                        }
                    },
                      dob: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The dob is required'
                            }
                        }
                    },
                     password: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The password is required'
                            }
                        }
                    },
                     lastname: {
                        trigger:'blur',
                        validators: {
                            notEmpty: {
                                message: 'The lastname is required'
                            }
                        }
                    },
                    salery: {
                        message: 'The username is not valid',
                         trigger:'blur',
                        validators: 

                        {
                            notEmpty: {
                                message: 'The salery 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 ID No is required'
                         },
                         stringLength: {
                            min: 8,
                            max: 8,
                            message: 'The ID No must be 8 digit'
                        },
                    
                }
            },

                    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: {
                            Empty: {
                                message: 'The address is required'
                            }
                        }
                    },

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


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

</script>
    
    
<script>
 $( function() {
    $( ".datepicker" ).datepicker({ dateFormat: 'd-m-yy' }).val();
  } );
</script>
  </body>
</html>