<?php 
define('DOCUMENT_ROOT_CLASS','../');
define('DOCUMENT_ROOT_INC_FOLDER','');
$filepath = realpath(dirname(__FILE__));
require "../inc/header.php";
$msg = Session::get('msg');
Session::set("msg", NULL);
if(!empty($_POST['action']) and $_POST['action'] == "profile"){
	$column = $fileName = "";
    if($_FILES["erp_sys_user_logo"]){
        $target_dir = "../uploads/admin-setting/users/";
        $target_file = $target_dir . basename($_FILES["erp_sys_user_logo"]["name"]);
        $uploadOk = 1;
        $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
        @getimagesize($_FILES["erp_sys_user_logo"]["tmp_name"]);
        if(move_uploaded_file($_FILES["erp_sys_user_logo"]["tmp_name"], $target_file)){
            $column = " erp_sys_user_logo";
            $fileName = " erp_sys_user_logo = '".$_FILES["erp_sys_user_logo"]["name"]."' ";
            $commonFunctions->updateData('sys_erp_adm_user'," WHERE id = '".$_POST['user_id']."' ", $fileName ,'staff-card.php?user_id='.$_POST['user_id']);
        }
    }else{
    	Session::set('msg', '<div class="alert alert-danger alert-dismissible mt-3" id="flash-msg"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Error !</strong> Staff profile picture not saved!</div>');
    	echo "<script>location.href='staff-card.php?user_id=".$_POST['user_id']."';</script>";
    }
}
if(!empty($_POST['action']) and $_POST['action'] == "reset_password"){
	if(!empty($_POST["password"])){
		$commonFunctions->updateData('sys_erp_adm_user'," WHERE id = '".$_POST['user_id']."' ", ' erp_sys_user_secutiry_password = "'.SHA1($_POST['password']).'" ','staff-card.php?user_id='.$_POST['user_id']);
	}else{
		Session::set('msg', '<div class="alert alert-danger alert-dismissible mt-3" id="flash-msg"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a><strong>Error !</strong> Please enter password and confirm password!</div>');
    	echo "<script>location.href='staff-card.php?user_id=".$_POST['user_id']."';</script>";
	}
}
$userData = $commonFunctions->getRowData('sys_erp_adm_user'," WHERE id = '".@$_GET['user_id']."' ");
$userHRMData = $commonFunctions->getRowData('erp_sys_hrm_users'," WHERE user_id = '".@$_GET['user_id']."' ");
?>
	
    <!-- Page-Title -->
    <div class="row">
        <div class="col-sm-12">
            <div class="page-title-box">
                <div class="row">
                    <div class="col form-row">
                    	<div class="col-sm-10">
                            <h4 class="page-title"><?php echo @$userData['erp_sys_user_name_first']." ".$userData['erp_sys_user_name_middle']." ".$userData['erp_sys_user_name_last'];?></h4>
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item"><a href="javascript:void(0);">HR Management</a></li>
                                <li class="breadcrumb-item"><a href="javascript:void(0);">Staff Details</a></li>
                            </ol>
                        </div>
                        <div class="col-sm-2">
                            <a href="staff.php?state=edit&user_id=<?php echo $userData['id'];?>">
                            	<button type="button" class="btn btn-sm btn-outline-primary">Edit</button>
                            </a>
                            <a href="staff.php?state=list">
                            	<button type="button" class="btn btn-sm btn-outline-secondary">Back to Users List</button>
                            </a>
                            <!-- <a href="staff.php?state=copy&user_id=<?php echo $userData['id'];?>">
                            	<button type="button"class="btn btn-sm btn-outline-dark">Duplicate</button>
                            </a> -->
                            <!-- <button type="button" class="btn btn-sm btn-outline-danger">Delete</button> -->
                        </div>
                    </div><!--end col-->
                </div><!--end row-->                                                              
            </div><!--end page-title-box-->
        </div><!--end col-->
    </div><!--end row-->
    <!-- end page title end breadcrumb -->

    <div class="row">
        <div class="col-12">
            <div class="card">
            	<div class="card-body">
                    <div class="dastone-profile">
                        <div class="row">
                            <div class="col-lg-4 align-self-center mb-3 mb-lg-0">
                                <div class="dastone-profile-main">
                                    <div class="dastone-profile-main-pic">
                                        <img src="../uploads/admin-setting/users/<?php echo (@$userData['erp_sys_user_logo'])?$userData['erp_sys_user_logo']:'default-img.jpg';?>" alt="" height="110" class="thumb-lx rounded" style='max-width:140px;'>
                                        <span class="dastone-profile_main-pic-change">
                                            <i class="fas fa-camera"></i>
                                        </span>
                                        <form enctype="multipart/form-data" method="post" id="fileUploadForm">
                                            <input type="hidden" name="action" value="profile">
                                            <input type="hidden" name="user_id" value="<?php echo $userData['id'];?>">
                                            <input type="file" name="erp_sys_user_logo" value="" style='display: none;' id="fileUpload">
                                        </form>
                                    </div>
                                    
                                </div>                                                
                            </div><!--end col-->
                            <div class="col-lg-4 ml-auto align-self-center">
                                <div class="dastone-profile_user-detail">
                                    <h5 class="dastone-user-name"><?php echo @$userData['erp_sys_user_name_first']." ".$userData['erp_sys_user_name_middle']." ".$userData['erp_sys_user_name_last'];?></h5>
                                    <p class="mt-0 mb-0"><i class="text-secondary font-22 align-middle"></i> <b> Designation / Job Title :</b> <?php echo $commonFunctions->getName($userData['erp_sys_user_roleid'],'sys_erp_adm_user_roles','role','id'); ?></p>
                                    <p class="mt-0 mb-0"><i class="text-secondary font-22 align-middle"></i> <b> Branch :</b>  <?php echo $commonFunctions->getName($_SESSION['warehouse_id'],'invty_wrhus','short_name_location','id');?> <?php echo $commonFunctions->getName($_SESSION['warehouse_id'],'invty_wrhus','address','id');?> </p>
                                </div>
                            </div>
                            <div class="col-lg-4 ml-auto align-self-center">
                                <ul class="list-unstyled personal-detail mb-0">
                                    <li class="mt-2"><i class="las la-phone mr-2 text-secondary font-22 align-middle"></i> <b> phone </b> :  <?php echo (@$userData['erp_sys_org_phone_work'])?@$userData['erp_sys_org_phone_work']:"-";?></li>
                                    <li class="mt-2"><i class="las la-mobile mr-2 text-secondary font-22 align-middle"></i> <b> mobile </b> :  <?php echo (@$userData['erp_sys_user_mobile1'])?@$userData['erp_sys_user_mobile1']:"-";?></li>
                                    <li class="mt-2"><i class="las la-envelope text-secondary font-22 align-middle mr-2"></i> <b> Email </b> :   <a href="mailto:<?php echo (@$userData['erp_sys_user_email_work'])?@$userData['erp_sys_user_email_work']:"-";?>"><?php echo (@$userData['erp_sys_user_email_work'])?@$userData['erp_sys_user_email_work']:"-";?></a></li>                                                  
                                </ul>                                               
                            </div><!--end col-->
                            
                            <!-- <div class="col-lg-4 align-self-center">
                                <div class="row">
                                    <div class="col-auto text-right border-right">
                                        <button type="button" class="btn btn-soft-primary btn-icon-circle-sm mb-2">
                                            <i class="fab fa-facebook-f"></i>
                                        </button>
                                        <p class="mb-0 font-weight-semibold">Facebook</p>
                                        <h4 class="m-0 font-weight-bold">0k <span class="text-muted font-12 font-weight-normal">Followers</span></h4>
                                    </div> 
                                    <div class="col-auto">
                                        <button type="button" class="btn btn-soft-info btn-icon-circle-sm mb-2">
                                            <i class="fab fa-twitter"></i>
                                        </button>
                                        <p class="mb-0 font-weight-semibold">Twitter</p>
                                        <h4 class="m-0 font-weight-bold">0k <span class="text-muted font-12 font-weight-normal">Followers</span></h4>
                                    </div>
                                </div>                                               
                            </div> --><!--end col-->
                        </div><!--end row-->
                    </div><!--end f_profile-->                                                                                
                </div>
            </div> 
        </div><!--end col-->
    </div><!--end row-->
    <div class="pb-4">
        <ul class="nav-border nav nav-pills mb-0" id="pills-tab" role="tablist">
            <li class="nav-item">
                <a class="nav-link active" id="user_details_tab" data-toggle="pill" href="#user_details">Employee Details</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="user_details_tab" data-toggle="pill" href="#hrm_details">ID & Passport Details</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="user_permission_tab" data-toggle="pill" href="#permission">Payroll Details</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="user_security_tab" data-toggle="pill" href="#security">Security</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="user_settings_tab" data-toggle="pill" href="#user_settings">Settings</a>
            </li>
        </ul>        
    </div><!--end card-body-->
    <style type="text/css">
    	label.form-control1 {display: block;}
    	label.label-title {font-weight: 600;}
    </style>
    <div class="row">
        <div class="col-12">
        	<?php echo !empty($msg)?$msg:''; ?>        
            <?php echo !empty($msg1)?$msg1:''; ?>      
            <div class="tab-content" id="pills-tabContent">
                <div class="tab-pane fade show active" id="user_details" role="tabpanel" aria-labelledby="user_details_tab">
                    <div class="row" >
                        <div class="col-lg-6 col-xl-6">
                            <div class="card">
                                <div class="card-header">
                                    <div class="row align-items-center">
                                        <div class="col-11">                      
                                            <h4 class="card-title text-left">Personal Information</h4>                      
                                        </div><!--end col-->
                                        <div class="col-1">                      
                                            <a href="staff.php?state=edit&user_id=<?php echo $userData['id'];?>"><button type="button" class="text-right btn btn-sm btn-light waves-effect waves-light">Edit</button></a>              
                                        </div><!--end col-->                                                       
                                    </div>  <!--end row-->                                  
                                </div><!--end card-header-->
                                <div class="card-body">                                                                          
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">First Name</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_name_first'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Middle Name</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_name_middle'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Last Name</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_name_last'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Designation / Job Title</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo $commonFunctions->getName($userData['erp_sys_user_roleid'],'sys_erp_adm_user_roles','role','id'); ?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Reportin Manager</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title">  </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Date of Birth</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title">  </h5>
                                        </div>
                                    </div>                                          
                                </div>                                            
                            </div>
                            <!-- Personal Information Card - End --->
                            <!-- Contact Information Personal Card - End --->
                            <div class="card">
                                <div class="card-header">
                                    <div class="row align-items-center">
                                        <div class="col-11">                      
                                            <h4 class="card-title text-left">Contact Information <label class="col-xl-3 col-lg-3 mb-lg-0 align-self-center">( Personal )</label></h4>                      
                                        </div><!--end col-->
                                        <div class="col-1">                      
                                            <!-- <a href="staff.php?state=edit&user_id=<?php echo $userData['id'];?>"><button type="button" class="text-right btn btn-sm btn-light waves-effect waves-light">Edit</button></a> -->
                                        </div><!--end col-->                                                       
                                    </div>  <!--end row-->                                  
                                </div><!--end card-header-->
                                <div class="card-body">                                                                          
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Mobile Number</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_mobile2'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Whatsapp Number</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_id_msngr_whatsapp'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Email Address</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_email_personal'];?> </h5>
                                        </div>
                                    </div>                                                   
                                </div><!--end card-body-->
                            </div><!--end card-->
                            <div class="card">
                                <div class="card-header">
                                    <div class="row align-items-center">
                                        <div class="col-11">                      
                                            <h4 class="card-title text-left">Social Media </h4>                      
                                        </div><!--end col-->
                                        <div class="col-1">                      
                                            <!-- <a href="staff.php?state=edit&user_id=<?php echo $userData['id'];?>"><button type="button" class="text-right btn btn-sm btn-light waves-effect waves-light">Edit</button></a> -->
                                        </div><!--end col-->                                                       
                                    </div>  <!--end row-->                                  
                                </div><!--end card-header-->
                                <div class="card-body">                                                                          
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Linkedin</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_id_sm_linkedin'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Twitter</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_id_sm_twitter'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Facebook</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_id_sm_facebook'];?> </h5>
                                        </div>
                                    </div>                                                    
                                </div><!--end card-body-->
                            </div><!--end card-->
                        </div>
                        <div class="col-lg-6 col-xl-6">
                            <div class="card">
                                <div class="card-header">
                                    <div class="row align-items-center">
                                        <div class="col-11">                      
                                            <h4 class="card-title text-left">Contact Information <label class="col-xl-3 col-lg-3 mb-lg-0 align-self-center">( Official )</label></h4>                      
                                        </div><!--end col-->
                                        <div class="col-1">                      
                                            <!-- <a href="staff.php?state=edit&user_id=<?php echo $userData['id'];?>"><button type="button" class="text-right btn btn-sm btn-light waves-effect waves-light">Edit</button></a> -->              
                                        </div><!--end col-->                                                       
                                    </div>  <!--end row-->                                  
                                </div><!--end card-header-->
                                <div class="card-body">                                                                          
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Mobile Number</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_mobile_work'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Work Phone </label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_org_phone_work'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Work Fax</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_org_fax'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Email Address</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_email_work'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Website / URL</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title">  </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Branch / Warehouse</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo $commonFunctions->getName($_SESSION['warehouse_id'],'invty_wrhus','short_name_location','id');?> <?php echo $commonFunctions->getName($_SESSION['warehouse_id'],'invty_wrhus','address','id');?> </h5>
                                        </div>
                                    </div> 
                                </div><!--end card-body-->
                            </div><!--end card-->
                            <div class="card">
                                <div class="card-header">
                                    <div class="row align-items-center">
                                        <div class="col-11">                      
                                            <h4 class="card-title text-left">Office Address </h4>                      
                                        </div><!--end col-->
                                        <div class="col-1">                      
                                            <!-- <a href="staff.php?state=edit&user_id=<?php echo $userData['id'];?>"><button type="button" class="text-right btn btn-sm btn-light waves-effect waves-light">Edit</button></a> -->
                                        </div><!--end col-->                                                       
                                    </div>  <!--end row-->                                  
                                </div><!--end card-header-->
                                <div class="card-body">                                                                          
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Address</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_address'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">City</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_city'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">State / Province</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo $commonFunctions->getName(@$userData['erp_sys_user_state'],'sys_erp_adm_countries_states','label','rowid');?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                          
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Zip / Pin / PO Box</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo @$userData['erp_sys_user_zipcode'];?> </h5>
                                        </div>
                                    </div>
                                    <div class="form-group row">                                         
                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Country</label>
                                        <div class="col-lg-9 col-xl-8">
                                            <h5 class="card-title"> <?php echo $commonFunctions->getName(@$userData['erp_sys_user_country'],'sys_erp_adm_countries','label','rowid');?> </h5>
                                        </div>
                                    </div>                                                    
                                </div><!--end card-body-->
                            </div><!--end card-->
                        </div>
                    </div>
                </div>
                <div class="tab-pane" id="hrm_details" role="tabpanel" aria-labelledby="hrm_details">
                    <div class="row">
                        <div class="col-lg-6 col-xl-6">
                            <form action="" class="officeInfoForm">    
                                <div class="card">
                                    <div class="card-header">
                                        <div class="row align-items-center">
                                            <div class="col-11">                      
                                                <h4 class="card-title text-left">National ID Details </h4>                      
                                            </div><!--end col-->
                                            <div class="col-1">             
                                                <a href="staff.php?state=edit&amp;user_id=6"><button type="button" class="text-right btn btn-sm btn-light waves-effect waves-light">Edit</button></a>
                                            </div><!--end col-->                                                       
                                        </div>  <!--end row-->                                  
                                    </div><!--end card-header-->
                                    <div class="card-body">          
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User National ID</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_natsnl_id'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User National ID Date of Issue</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_natsnl_issue_dt'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User National ID Date of Expire</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_natsnl_expry_dt'];?>
                                                </h5>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="card">
                                    <div class="card-header">
                                        <div class="row align-items-center">
                                            <div class="col-11">                      
                                                <h4 class="card-title text-left">Passport Details</h4>
                                            </div><!--end col-->
                                        </div>  <!--end row-->                                  
                                    </div><!--end card-header-->
                                    <div class="card-body">
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Passport No</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_pp_num'];?>
                                                </h5>
                                            </div>
                                        </div>

                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Passport Date of Issue</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_pp_issue_dt'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Passport Date of Expire</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_pp_expry_dt'];?>
                                                </h5>
                                            </div>
                                        </div>

                                    </div>
                                </div>
                            </form>
                            <form action="" class="officeInfoForm"> 
                                <div class="card">
                                    <div class="card-header">
                                        <div class="row align-items-center">
                                            <div class="col-11">                      
                                                <h4 class="card-title text-left">Driving License</h4>
                                            </div><!--end col-->
                                        </div>  <!--end row-->                                  
                                    </div><!--end card-header-->   
                                    <div class="card-body">
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Driving License No</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_dl_num'];?>
                                                </h5>
                                            </div> 
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Driving License Type</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_dl_type'];?>
                                                </h5>
                                            </div> 
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Driving License Date of Issue</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_dl_issue_dt'];?>
                                                </h5>
                                            </div> 
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Driving License Date of Expire</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_dl_expry_dt'];?>
                                                </h5>
                                            </div> 
                                        </div>

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

                        </div>
                        <div class="col-lg-6 col-xl-6">
                            <form action="" class="officeInfoForm"> 
                                <div class="card">
                                    <div class="card-header">
                                        <div class="row align-items-center">
                                            <div class="col-11">                      
                                                <h4 class="card-title text-left">Travel & Vacation Details</h4>                      
                                            </div><!--end col-->                                                       
                                        </div>  <!--end row-->                                  
                                    </div><!--end card-header-->   
                                    <div class="card-body">
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Vacation - Frequency</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_vactn_frq'] == 1 )?"1 Year":"";?>
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_vactn_frq'] == 2 )?"2 Year":"";?>
                                                </h5>
                                            </div>
                                        </div>

                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Air Ticket - Eligibility</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt'] == 1 )?"Yes":"";?>
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt'] == 2 )?"No":"";?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Air Ticket - Self</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_self'] == 1 )?"Yes":"";?>
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_self'] == 2 )?"No":"";?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Air Ticket - Spouse</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_spouse'] == 1 )?"Yes":"";?>
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_spouse'] == 2 )?"No":"";?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Air Ticket - Kids</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_kids'] == 1 )?"Yes":"";?>
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_kids'] == 2 )?"No":"";?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Air Ticket - Kids Number</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_airtkt_kids_number'];?>
                                                </h5>
                                            </div> 
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Air Ticket - Frequency</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_frq'] == 1 )?"1 Year":"";?>
                                                    <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_frq'] == 2 )?"2 Year":"";?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Air Ticket - Limits</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_airtkt_limt'];?>
                                                </h5>
                                            </div> 
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <form action="" class="officeInfoForm">    
                                <div class="card">
                                    <div class="card-header">
                                        <div class="row align-items-center">
                                            <div class="col-11">                      
                                                <h4 class="card-title text-left">VISA Details</h4>
                                            </div><!--end col-->
                                        </div>  <!--end row-->                                  
                                    </div><!--end card-header-->   
                                    <div class="card-body">
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Visa No</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_visa_num'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Visa Type</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_visa_type'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Visa -  Date of Issue</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_visa_type'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Visa -  Date of Expire</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_visa_expry_dt'];?>
                                                </h5>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="tab-pane" id="user_settings" role="tabpanel" aria-labelledby="user_settings">
                    <div class="card">
                		<div class="card-body">
                        	3
                    	</div><!--end row-->    
                    </div>
                </div>
                <div class="tab-pane" id="permission" role="tabpanel" aria-labelledby="permission">
                    <div class="row">
                        <div class="col-lg-6 col-xl-6">
                            <form action="" class="officeInfoForm">
                                <div class="card">
                                    <div class="card-header">
                                        <div class="row align-items-center">
                                            <div class="col-11">                      
                                                <h4 class="card-title text-left">Payroll Details</h4>
                                            </div><!--end col-->
                                            <div class="col-1">             
                                                <a href="staff.php?state=edit&amp;user_id=6"><button type="button" class="text-right btn btn-sm btn-light waves-effect waves-light">Edit</button></a>
                                            </div><!--end col-->
                                        </div>  <!--end row-->                                  
                                    </div><!--end card-header-->   
                                    <div class="card-body">
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Contract Number</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_cntrt_num'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User File Number</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_file_num'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Offer Letter Number</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_ofr_letr_num'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Joining / Hiring  Date</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_jo_dt'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Basic Salary</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_bsc_salry'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Accommodation Allowance</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_acmd_alwn'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Transportation Allowance</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_trnpt_alwn'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Kids Education  Allowance</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_kids_edu_alwn'];?>
                                                </h5>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-xl-4 col-lg-4 text-left mb-lg-0 align-self-center">User Other Allowance</label>
                                            <div class="col-lg-8 col-xl-8">
                                                <h5 class="card-title">
                                                    <?php echo @$userHRMData['erp_sys_hrm_users_othr_alwn'];?>
                                                </h5>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="tab-pane" id="security" role="tabpanel" aria-labelledby="user_security_tab">
                    <div class="card">
                		<div class="card-body">
                        	<form id="reset-password-form" action="" method="post">
                        		<input type="hidden" name="user_id" id="user_id" value="<?php echo $userData['id'];?>" >
                        		<input type="hidden" name="action" value="reset_password">
                        		<div class="form-row">
                            		<div class="col-lg-2"></div>
                            		<div class="col-lg-8">
                            			<div class="form-row">
                                			<div class="form-group searchForm col-md-6">
                                				<label for="password" class="">Password</label>
                                				<input type="password" maxlength="128" name="password" id="password" value="" autofocus="autofocus" class="form-control" placeholder="Password" required="">
                                			</div>
                                			<div class="form-group searchForm col-md-6">
                                				<label for="cnf_password" class="">Confirm Password</label>
                                				<input type="text" maxlength="128" name="cnf_password" id="cnf_password" value="" autofocus="autofocus" class="form-control" placeholder="Confirm Password" required="">
                                			</div>
                                			<div class="form-group searchForm col-md-12" style="text-align: center;">
                                				<br>
                                				<button type="submit" class="btn btn-primary"> Save </button>
                                				<br>
                                				<br>
                                				<br>
                                			</div>
                                		</div>
                            		</div>
                            		<div class="col-lg-2"></div>
                            	</div>
                        	</form>
                    	</div><!--end row-->    
                    </div>
                </div>

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

        
<?php require "../inc/footer.php"; ?>
<script type="text/javascript" src="https://www.jqueryscript.net/demo/Simple-jQuery-Based-Barcode-Generator-Barcode/jquery-barcode.js"></script>
<script type="text/javascript">
    
  	function generateBarcode(){
	    var value = "<?php echo strtolower(@$userData['barcode_value']); ?>";
	    var btype = "<?php echo strtolower(@$barcode_type); ?>";
	    var renderer = "css";
    	var quietZone = false;
	    
	    var settings = {
	      	output:renderer,
	      	bgColor: "#FFFFFF",
	      	color: "#000000",
	      	barWidth: "2",
	     	barHeight: "50",
	      	moduleSize: "5",
	      	posX: "10",
	      	posY: "20",
	      	addQuietZone: "1"
	    };
    	if (renderer == 'canvas'){
      		clearCanvas();
	      	$("#barcodeTarget").hide();
	      	$("#canvasTarget").show().barcode(value, btype, settings);
    	} else {
      		$("#canvasTarget").hide();
      		$("#barcodeTarget").html("").show().barcode(value, btype, settings);
    	}
  	}
      
  	function showConfig1D(){
	    $('.config .barcode1D').show();
	    $('.config .barcode2D').hide();
  	}
  
  	function showConfig2D(){
	    $('.config .barcode1D').hide();
	    $('.config .barcode2D').show();
  	}
  
  	function clearCanvas(){
	    var canvas = $('#canvasTarget').get(0);
	    var ctx = canvas.getContext('2d');
	    ctx.lineWidth = 1;
	    ctx.lineCap = 'butt';
	    ctx.fillStyle = '#FFFFFF';
	    ctx.strokeStyle  = '#000000';
	    ctx.clearRect (0, 0, canvas.width, canvas.height);
	    ctx.strokeRect (0, 0, canvas.width, canvas.height);
  	}
  
  	$(function(){
    	generateBarcode();
  	});
  	$(".dastone-profile_main-pic-change").click(function(){
  		$("#fileUpload").click();
  	});
  	$("#fileUpload").change(function(){
  		if(confirm("Please make sure do you want to change your profile picture?")){
  			$("#fileUploadForm").submit();
  		}else{
  			return false;
  		}
  	});
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.1/jquery.validate.min.js"></script>
<script type="text/javascript">
	var value = $("#password_reg").val();

$.validator.addMethod("checklower", function(value) {
  return /[a-z]/.test(value);
});
$.validator.addMethod("checkupper", function(value) {
  return /[A-Z]/.test(value);
});
$.validator.addMethod("checkdigit", function(value) {
  return /[0-9]/.test(value);
});
$.validator.addMethod("pwcheck", function(value) {
  return /^[A-Za-z0-9\d=!\-@._*]*$/.test(value) && /[a-z]/.test(value) && /\d/.test(value) && /[A-Z]/.test(value);
});
$('#reset-password-form').validate({
  rules: {
    password: {
      minlength: 6,
      maxlength: 30,
      required: true,
      //pwcheck: true,
      checklower: true,
      checkupper: true,
      checkdigit: true
    },
    cnf_password: {
      equalTo: "#password",
    },
  },
  messages: {
    password: {
      pwcheck: "Password is not strong enough",
      checklower: "Need atleast 1 lowercase alphabet",
      checkupper: "Need atleast 1 uppercase alphabet",
      checkdigit: "Need atleast 1 digit"
    }
  },
  highlight: function(element) {
    var id_attr = "#" + $(element).attr("id") + "1";
    $(element).closest('.form-group').removeClass('has-success').addClass('has-error');
    $(id_attr).removeClass('glyphicon-ok').addClass('glyphicon-remove');
    $('.form-group').css('margin-bottom', '5px');
    $('.form').css('padding', '30px 40px');
    $('.tab-group').css('margin', '0 0 25px 0');
    $('.help-block').css('display', '');
  },
  unhighlight: function(element) {
    var id_attr = "#" + $(element).attr("id") + "1";
    $(element).closest('.form-group').removeClass('has-error').addClass('has-success');
    $(id_attr).removeClass('glyphicon-remove').addClass('glyphicon-ok');
    $('#cnf_password').attr('disabled', false);
  },
  errorElement: 'span',
  errorClass: 'validate_cus',
  errorPlacement: function(error, element) {
    x = element.length;
    if (element.length) {
      error.insertAfter(element);
    } else {
      error.insertAfter(element);
    }
  },
  /*submitHandler: function(form) {
  	var user_id = $("#user_id").val();
  	$.ajax({
	    type: 'POST',
	    url: "staff-card.php?user_id="+user_id,
	    data: {"user_id":user_id,"action":"reset_password","password":$("#password").val()},
	    success: function(resultData) { 
	    	alert("Save Complete") 
	    }
	});
  	return false;
  }*/
});
</script>