<?php 
define('DOCUMENT_ROOT_CLASS','../');
define('DOCUMENT_ROOT_INC_FOLDER','');
$filepath = realpath(dirname(__FILE__));
if(!empty($_POST["action"]) and $_POST["action"] == "ajax_call"){
    require "../inc/ajax_header.php";
    $country_id = $_POST["country_id"];
    $getData = $commonFunctions->getData('sys_erp_adm_countries_states'," WHERE country_id = '".$country_id."' and active = 1 ");
    $html = "";
    foreach ($getData as $rw) {
        $html .= "<option value='".$rw['rowid']."'>".$rw['label']."</option>";
    }
    echo json_encode(array("option"=>$html));
    exit();
}
if(!empty($_GET["action"]) and $_GET["action"] == "ajax_call1"){
    require "../inc/ajax_header.php";
    $country_id = $_GET["country_id"];
    $state_id = $_GET["state_id"];
    $keyword = $_GET["keyword"]; 
    $getData = $commonFunctions->getData('sys_erp_adm_countries_states_cities'," WHERE country_id = '".$country_id."' and state_id = '".$state_id."' and name LIKE '%".$keyword."%' ");
    $html = "";
    $skillData = array(); 
    foreach ($getData as $rw) {
        $data['id'] = $rw['name']; 
        $data['value'] = $rw['name']; 
        array_push($skillData, $data); 
    } 
    echo json_encode($skillData);
    exit();
}
if(!empty($_POST["action"]) and $_POST["action"] == "ajax_call_1"){
    require "../inc/ajax_header.php";
    /*echo "<pre>";
    print_r($_POST);*/
    $commonFunctions->updateData('sys_erp_adm_user'," WHERE id = '".$_POST['user_id']."' ", ' erp_sys_user_name_first = "'.$_POST['erp_sys_user_name_first'].'",erp_sys_user_name_middle = "'.$_POST['erp_sys_user_name_middle'].'" ,erp_sys_user_name_last = "'.$_POST['erp_sys_user_name_last'].'",erp_sys_user_roleid = "'.$_POST['erp_sys_user_roleid'].'",erp_sys_user_mobile2 = "'.$_POST['erp_sys_user_mobile2'].'",erp_sys_user_id_msngr_whatsapp = "'.$_POST['erp_sys_user_id_msngr_whatsapp'].'",erp_sys_user_email_personal = "'.$_POST['erp_sys_user_email_personal'].'",erp_sys_user_id_sm_linkedin = "'.$_POST['erp_sys_user_id_sm_linkedin'].'",erp_sys_user_id_sm_twitter = "'.$_POST['erp_sys_user_id_sm_twitter'].'",erp_sys_user_id_sm_facebook = "'.$_POST['erp_sys_user_id_sm_facebook'].'",erp_sys_user_mobile_work = "'.$_POST['erp_sys_user_mobile_work'].'",erp_sys_org_phone_work = "'.$_POST['erp_sys_org_phone_work'].'",erp_sys_org_fax = "'.$_POST['erp_sys_org_fax'].'",erp_sys_user_email_work = "'.$_POST['erp_sys_user_email_work'].'",erp_sys_user_address = "'.$_POST['erp_sys_user_address'].'",erp_sys_user_city = "'.$_POST['erp_sys_user_city'].'",erp_sys_user_zipcode = "'.$_POST['erp_sys_user_zipcode'].'",erp_sys_user_state = "'.$_POST['erp_sys_user_state'].'",erp_sys_user_country = "'.$_POST['erp_sys_user_country'].'" ','');

    $user_id = $_POST['user_id'];
    $countRow = $commonFunctions->getRowDataCount('erp_sys_hrm_users',' WHERE user_id = "'.$user_id.'"');
    if($countRow > 0){
        $commonFunctions->updateData('erp_sys_hrm_users'," WHERE user_id = '".$user_id."' ", " erp_sys_hrm_users_natsnl_id = '".$_POST['erp_sys_hrm_users_natsnl_id']."',erp_sys_hrm_users_natsnl_issue_dt='".$_POST['erp_sys_hrm_users_natsnl_issue_dt']."', erp_sys_hrm_users_natsnl_expry_dt='".$_POST['erp_sys_hrm_users_natsnl_expry_dt']."' , erp_sys_hrm_users_pp_num='".$_POST['erp_sys_hrm_users_pp_num']."' , erp_sys_hrm_users_pp_issue_dt='".$_POST['erp_sys_hrm_users_pp_issue_dt']."', erp_sys_hrm_users_pp_expry_dt='".$_POST['erp_sys_hrm_users_pp_expry_dt']."', erp_sys_hrm_users_visa_num='".$_POST['erp_sys_hrm_users_visa_num']."' , erp_sys_hrm_users_visa_type='".$_POST['erp_sys_hrm_users_visa_type']."' , erp_sys_hrm_users_visa_issue_dt='".$_POST['erp_sys_hrm_users_visa_issue_dt']."', erp_sys_hrm_users_visa_expry_dt='".$_POST['erp_sys_hrm_users_visa_expry_dt']."', erp_sys_hrm_users_cntrt_num='".$_POST['erp_sys_hrm_users_cntrt_num']."', erp_sys_hrm_users_file_num='".$_POST['erp_sys_hrm_users_file_num']."', erp_sys_hrm_users_ofr_letr_num='".$_POST['erp_sys_hrm_users_ofr_letr_num']."', erp_sys_hrm_users_jo_dt='".$_POST['erp_sys_hrm_users_jo_dt']."', erp_sys_hrm_users_bsc_salry='".$_POST['erp_sys_hrm_users_bsc_salry']."', erp_sys_hrm_users_acmd_alwn='".$_POST['erp_sys_hrm_users_acmd_alwn']."', erp_sys_hrm_users_trnpt_alwn='".$_POST['erp_sys_hrm_users_trnpt_alwn']."', erp_sys_hrm_users_kids_edu_alwn='".$_POST['erp_sys_hrm_users_kids_edu_alwn']."', erp_sys_hrm_users_othr_alwn='".$_POST['erp_sys_hrm_users_othr_alwn']."', erp_sys_hrm_users_vactn_frq='".$_POST['erp_sys_hrm_users_vactn_frq']."', erp_sys_hrm_users_airtkt='".$_POST['erp_sys_hrm_users_airtkt']."', erp_sys_hrm_users_airtkt_self='".$_POST['erp_sys_hrm_users_airtkt_self']."', erp_sys_hrm_users_airtkt_spouse='".$_POST['erp_sys_hrm_users_airtkt_spouse']."', erp_sys_hrm_users_airtkt_kids='".$_POST['erp_sys_hrm_users_airtkt_kids']."', erp_sys_hrm_users_airtkt_kids_number='".$_POST['erp_sys_hrm_users_airtkt_kids_number']."', erp_sys_hrm_users_airtkt_frq='".$_POST['erp_sys_hrm_users_airtkt_frq']."', erp_sys_hrm_users_airtkt_limt='".$_POST['erp_sys_hrm_users_airtkt_limt']."', erp_sys_hrm_users_dl_num='".$_POST['erp_sys_hrm_users_dl_num']."', erp_sys_hrm_users_dl_type='".$_POST['erp_sys_hrm_users_dl_type']."', erp_sys_hrm_users_dl_issue_dt='".$_POST['erp_sys_hrm_users_dl_issue_dt']."', erp_sys_hrm_users_dl_expry_dt='".$_POST['erp_sys_hrm_users_dl_expry_dt']."'",'');
    }else{
        $commonFunctions->addData('erp_sys_hrm_users'," (erp_sys_hrm_users_natsnl_id,erp_sys_hrm_users_natsnl_issue_dt,erp_sys_hrm_users_natsnl_expry_dt,erp_sys_hrm_users_pp_num,erp_sys_hrm_users_pp_issue_dt,erp_sys_hrm_users_pp_expry_dt,erp_sys_hrm_users_visa_num,erp_sys_hrm_users_visa_type,erp_sys_hrm_users_visa_issue_dt,erp_sys_hrm_users_visa_expry_dt,erp_sys_hrm_users_cntrt_num,erp_sys_hrm_users_file_num,erp_sys_hrm_users_ofr_letr_num,erp_sys_hrm_users_jo_dt,erp_sys_hrm_users_bsc_salry,erp_sys_hrm_users_acmd_alwn,erp_sys_hrm_users_trnpt_alwn,erp_sys_hrm_users_kids_edu_alwn,erp_sys_hrm_users_othr_alwn,erp_sys_hrm_users_vactn_frq,erp_sys_hrm_users_airtkt,erp_sys_hrm_users_airtkt_self,erp_sys_hrm_users_airtkt_spouse,erp_sys_hrm_users_airtkt_kids,erp_sys_hrm_users_airtkt_kids_number,erp_sys_hrm_users_airtkt_frq,erp_sys_hrm_users_airtkt_limt,erp_sys_hrm_users_dl_num,erp_sys_hrm_users_dl_type,erp_sys_hrm_users_dl_issue_dt,erp_sys_hrm_users_dl_expry_dt,user_id) VALUES ('".$_POST['erp_sys_hrm_users_natsnl_id']."','".$_POST['erp_sys_hrm_users_natsnl_issue_dt']."','".$_POST['erp_sys_hrm_users_natsnl_expry_dt']."','".$_POST['erp_sys_hrm_users_pp_num']."','".$_POST['erp_sys_hrm_users_pp_issue_dt']."','".$_POST['erp_sys_hrm_users_pp_expry_dt']."','".$_POST['erp_sys_hrm_users_visa_num']."','".$_POST['erp_sys_hrm_users_visa_type']."','".$_POST['erp_sys_hrm_users_visa_issue_dt']."','".$_POST['erp_sys_hrm_users_visa_expry_dt']."','".$_POST['erp_sys_hrm_users_cntrt_num']."','".$_POST['erp_sys_hrm_users_file_num']."','".$_POST['erp_sys_hrm_users_ofr_letr_num']."','".$_POST['erp_sys_hrm_users_jo_dt']."','".$_POST['erp_sys_hrm_users_bsc_salry']."','".$_POST['erp_sys_hrm_users_acmd_alwn']."','".$_POST['erp_sys_hrm_users_trnpt_alwn']."','".$_POST['erp_sys_hrm_users_kids_edu_alwn']."','".$_POST['erp_sys_hrm_users_othr_alwn']."','".$_POST['erp_sys_hrm_users_vactn_frq']."','".$_POST['erp_sys_hrm_users_airtkt']."','".$_POST['erp_sys_hrm_users_airtkt_self']."','".$_POST['erp_sys_hrm_users_airtkt_spouse']."','".$_POST['erp_sys_hrm_users_airtkt_kids']."','".$_POST['erp_sys_hrm_users_airtkt_kids_number']."','".$_POST['erp_sys_hrm_users_airtkt_frq']."','".$_POST['erp_sys_hrm_users_airtkt_limt']."','".$_POST['erp_sys_hrm_users_dl_num']."','".$_POST['erp_sys_hrm_users_dl_type']."','".$_POST['erp_sys_hrm_users_dl_issue_dt']."','".$_POST['erp_sys_hrm_users_dl_expry_dt']."','".$user_id."' ) ",'');
    }

    echo 'staff-card.php?user_id='.$_POST['user_id'];
    exit();
}
require "../inc/header.php";
Session::CheckSession(); 
$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>";
    }
    exit();
}
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>";
    }
    exit();
}
if(!empty($_POST)){
    $error_ = 0;
    if(empty($_POST['erp_sys_user_id'])){
        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 code !</div>');
    }else{
        $id = $_POST['user_id'];
        $cntA = $commonFunctions->getRowData('sys_erp_adm_user',' WHERE id NOT IN('.$id.') AND erp_sys_user_id = "'.$_POST['erp_sys_user_id'].'" ');
        if(@count($cntA) > 1){
           $error_ = 1;
           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> Customer code already exists !</div>');
        }
    }

    if(!empty($_POST['erp_sys_user_id']) and $error_ == 0){
        if($_POST['action'] == "add"){
            $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 = " , '".$_FILES["erp_sys_user_logo"]["name"]."'";
                }
            }
            $rand = rand(0,999999999999999);
            $commonFunctions->addData('global_contacts'," (cont_random_num,global_user_name_first,global_user_name_middle,global_user_name_last,global_user_email_personal,global_user_mobile1,global_user_mobile2,global_user_mobile_work,global_org_name,global_user_job_title,global_org_phone_work,global_user_org_phone_work_ext,global_org_fax,global_user_email_work,global_user_id_sm_linkedin,global_user_id_sm_twitter,global_user_id_sm_facebook,global_user_id_sm_instagram,global_user_id_msngr_skype,global_user_id_msngr_whatsapp,global_user_id_msngr_imo,global_user_id_msngr_telegram,global_user_id_msngr_signal,global_user_id_msngr_botim,global_user_id_messanger_viber) VALUES ('".$rand."','".$_POST['erp_sys_user_name_first']."','".$_POST['erp_sys_user_name_middle']."','".$_POST['erp_sys_user_name_last']."','".$_POST['erp_sys_user_email_personal']."','".$_POST['erp_sys_user_mobile1']."','".$_POST['erp_sys_user_mobile2']."','".$_POST['erp_sys_user_mobile_work']."','".$_POST['erp_sys_org_name']."','".$_POST['erp_sys_user_job_title']."','".$_POST['erp_sys_org_phone_work']."','".$_POST['erp_sys_user_org_phone_work_ext']."','".$_POST['erp_sys_org_fax']."','".$_POST['erp_sys_user_email_work']."','".$_POST['erp_sys_user_id_sm_linkedin']."','".$_POST['erp_sys_user_id_sm_twitter']."','".$_POST['erp_sys_user_id_sm_facebook']."','".$_POST['erp_sys_user_id_sm_instagram']."','".$_POST['erp_sys_user_id_msngr_skype']."','".$_POST['erp_sys_user_id_msngr_whatsapp']."','".$_POST['erp_sys_user_id_msngr_imo']."','".$_POST['erp_sys_user_id_msngr_telegram']."','".$_POST['erp_sys_user_id_msngr_signal']."','".$_POST['erp_sys_user_id_msngr_botim']."','".$_POST['erp_sys_user_id_messanger_viber']."' ) ",'');

            $user_id = $commonFunctions->addData('sys_erp_adm_user'," (erp_sys_user_name_first,erp_sys_user_name_middle,erp_sys_user_name_last,erp_sys_user_id,erp_sys_user_email_personal,erp_sys_user_mobile1,erp_sys_user_mobile2,erp_sys_user_mobile_work,erp_sys_org_name,erp_sys_user_job_title,erp_sys_org_phone_work,erp_sys_user_org_phone_work_ext,erp_sys_org_fax,erp_sys_user_email_work,erp_sys_user_id_sm_linkedin,erp_sys_user_id_sm_twitter,erp_sys_user_id_sm_facebook,erp_sys_user_id_sm_instagram,erp_sys_user_id_msngr_skype,erp_sys_user_id_msngr_whatsapp,erp_sys_user_id_msngr_imo,erp_sys_user_id_msngr_telegram,erp_sys_user_id_msngr_signal,erp_sys_user_id_msngr_botim,erp_sys_user_id_messanger_viber,erp_sys_user_secutiry_permission,erp_sys_user_roleid,erp_sys_user_isActive".$column.",erp_sys_user_address,erp_sys_user_city,erp_sys_user_country,erp_sys_user_state,erp_sys_user_zipcode) VALUES ('".$_POST['erp_sys_user_name_first']."','".$_POST['erp_sys_user_name_middle']."','".$_POST['erp_sys_user_name_last']."','".$_POST['erp_sys_user_id']."','".$_POST['erp_sys_user_email_personal']."','".$_POST['erp_sys_user_mobile1']."','".$_POST['erp_sys_user_mobile2']."','".$_POST['erp_sys_user_mobile_work']."','".$_POST['erp_sys_org_name']."','".$_POST['erp_sys_user_job_title']."','".$_POST['erp_sys_org_phone_work']."','".$_POST['erp_sys_user_org_phone_work_ext']."','".$_POST['erp_sys_org_fax']."','".$_POST['erp_sys_user_email_work']."','".$_POST['erp_sys_user_id_sm_linkedin']."','".$_POST['erp_sys_user_id_sm_twitter']."','".$_POST['erp_sys_user_id_sm_facebook']."','".$_POST['erp_sys_user_id_sm_instagram']."','".$_POST['erp_sys_user_id_msngr_skype']."','".$_POST['erp_sys_user_id_msngr_whatsapp']."','".$_POST['erp_sys_user_id_msngr_imo']."','".$_POST['erp_sys_user_id_msngr_telegram']."','".$_POST['erp_sys_user_id_msngr_signal']."','".$_POST['erp_sys_user_id_msngr_botim']."','".$_POST['erp_sys_user_id_messanger_viber']."','".$_POST['erp_sys_user_secutiry_permission']."','".$_POST['erp_sys_user_roleid']."','".$_POST['erp_sys_user_isActive']."'".$fileName.",'".$_POST['erp_sys_user_address']."','".$_POST['erp_sys_user_city']."','".$_POST['erp_sys_user_country']."','".$_POST['erp_sys_user_state']."','".$_POST['erp_sys_user_zipcode']."' ) ",'');
            $countRow = $commonFunctions->getRowDataCount('erp_sys_hrm_users',' WHERE user_id = "'.$user_id.'"');
            if($countRow > 0){
                $commonFunctions->updateData('erp_sys_hrm_users'," WHERE user_id = '".$user_id."' ", " erp_sys_hrm_users_natsnl_id = '".$_POST['erp_sys_hrm_users_natsnl_id']."',erp_sys_hrm_users_natsnl_issue_dt='".$_POST['erp_sys_hrm_users_natsnl_issue_dt']."', erp_sys_hrm_users_natsnl_expry_dt='".$_POST['erp_sys_hrm_users_natsnl_expry_dt']."' , erp_sys_hrm_users_pp_num='".$_POST['erp_sys_hrm_users_pp_num']."' , erp_sys_hrm_users_pp_issue_dt='".$_POST['erp_sys_hrm_users_pp_issue_dt']."', erp_sys_hrm_users_pp_expry_dt='".$_POST['erp_sys_hrm_users_pp_expry_dt']."', erp_sys_hrm_users_visa_num='".$_POST['erp_sys_hrm_users_visa_num']."' , erp_sys_hrm_users_visa_type='".$_POST['erp_sys_hrm_users_visa_type']."' , erp_sys_hrm_users_visa_issue_dt='".$_POST['erp_sys_hrm_users_visa_issue_dt']."', erp_sys_hrm_users_visa_expry_dt='".$_POST['erp_sys_hrm_users_visa_expry_dt']."', erp_sys_hrm_users_cntrt_num='".$_POST['erp_sys_hrm_users_cntrt_num']."', erp_sys_hrm_users_file_num='".$_POST['erp_sys_hrm_users_file_num']."', erp_sys_hrm_users_ofr_letr_num='".$_POST['erp_sys_hrm_users_ofr_letr_num']."', erp_sys_hrm_users_jo_dt='".$_POST['erp_sys_hrm_users_jo_dt']."', erp_sys_hrm_users_bsc_salry='".$_POST['erp_sys_hrm_users_bsc_salry']."', erp_sys_hrm_users_acmd_alwn='".$_POST['erp_sys_hrm_users_acmd_alwn']."', erp_sys_hrm_users_trnpt_alwn='".$_POST['erp_sys_hrm_users_trnpt_alwn']."', erp_sys_hrm_users_kids_edu_alwn='".$_POST['erp_sys_hrm_users_kids_edu_alwn']."', erp_sys_hrm_users_othr_alwn='".$_POST['erp_sys_hrm_users_othr_alwn']."', erp_sys_hrm_users_vactn_frq='".$_POST['erp_sys_hrm_users_vactn_frq']."', erp_sys_hrm_users_airtkt='".$_POST['erp_sys_hrm_users_airtkt']."', erp_sys_hrm_users_airtkt_self='".$_POST['erp_sys_hrm_users_airtkt_self']."', erp_sys_hrm_users_airtkt_spouse='".$_POST['erp_sys_hrm_users_airtkt_spouse']."', erp_sys_hrm_users_airtkt_kids='".$_POST['erp_sys_hrm_users_airtkt_kids']."', erp_sys_hrm_users_airtkt_kids_number='".$_POST['erp_sys_hrm_users_airtkt_kids_number']."', erp_sys_hrm_users_airtkt_frq='".$_POST['erp_sys_hrm_users_airtkt_frq']."', erp_sys_hrm_users_airtkt_limt='".$_POST['erp_sys_hrm_users_airtkt_limt']."', erp_sys_hrm_users_dl_num='".$_POST['erp_sys_hrm_users_dl_num']."', erp_sys_hrm_users_dl_type='".$_POST['erp_sys_hrm_users_dl_type']."', erp_sys_hrm_users_dl_issue_dt='".$_POST['erp_sys_hrm_users_dl_issue_dt']."', erp_sys_hrm_users_dl_expry_dt='".$_POST['erp_sys_hrm_users_dl_expry_dt']."'",'staff.php?state=form');
            }else{
                $commonFunctions->addData('erp_sys_hrm_users'," (erp_sys_hrm_users_natsnl_id,erp_sys_hrm_users_natsnl_issue_dt,erp_sys_hrm_users_natsnl_expry_dt,erp_sys_hrm_users_pp_num,erp_sys_hrm_users_pp_issue_dt,erp_sys_hrm_users_pp_expry_dt,erp_sys_hrm_users_visa_num,erp_sys_hrm_users_visa_type,erp_sys_hrm_users_visa_issue_dt,erp_sys_hrm_users_visa_expry_dt,erp_sys_hrm_users_cntrt_num,erp_sys_hrm_users_file_num,erp_sys_hrm_users_ofr_letr_num,erp_sys_hrm_users_jo_dt,erp_sys_hrm_users_bsc_salry,erp_sys_hrm_users_acmd_alwn,erp_sys_hrm_users_trnpt_alwn,erp_sys_hrm_users_kids_edu_alwn,erp_sys_hrm_users_othr_alwn,erp_sys_hrm_users_vactn_frq,erp_sys_hrm_users_airtkt,erp_sys_hrm_users_airtkt_self,erp_sys_hrm_users_airtkt_spouse,erp_sys_hrm_users_airtkt_kids,erp_sys_hrm_users_airtkt_kids_number,erp_sys_hrm_users_airtkt_frq,erp_sys_hrm_users_airtkt_limt,erp_sys_hrm_users_dl_num,erp_sys_hrm_users_dl_type,erp_sys_hrm_users_dl_issue_dt,erp_sys_hrm_users_dl_expry_dt,user_id) VALUES ('".$_POST['erp_sys_hrm_users_natsnl_id']."','".$_POST['erp_sys_hrm_users_natsnl_issue_dt']."','".$_POST['erp_sys_hrm_users_natsnl_expry_dt']."','".$_POST['erp_sys_hrm_users_pp_num']."','".$_POST['erp_sys_hrm_users_pp_issue_dt']."','".$_POST['erp_sys_hrm_users_pp_expry_dt']."','".$_POST['erp_sys_hrm_users_visa_num']."','".$_POST['erp_sys_hrm_users_visa_type']."','".$_POST['erp_sys_hrm_users_visa_issue_dt']."','".$_POST['erp_sys_hrm_users_visa_expry_dt']."','".$_POST['erp_sys_hrm_users_cntrt_num']."','".$_POST['erp_sys_hrm_users_file_num']."','".$_POST['erp_sys_hrm_users_ofr_letr_num']."','".$_POST['erp_sys_hrm_users_jo_dt']."','".$_POST['erp_sys_hrm_users_bsc_salry']."','".$_POST['erp_sys_hrm_users_acmd_alwn']."','".$_POST['erp_sys_hrm_users_trnpt_alwn']."','".$_POST['erp_sys_hrm_users_kids_edu_alwn']."','".$_POST['erp_sys_hrm_users_othr_alwn']."','".$_POST['erp_sys_hrm_users_vactn_frq']."','".$_POST['erp_sys_hrm_users_airtkt']."','".$_POST['erp_sys_hrm_users_airtkt_self']."','".$_POST['erp_sys_hrm_users_airtkt_spouse']."','".$_POST['erp_sys_hrm_users_airtkt_kids']."','".$_POST['erp_sys_hrm_users_airtkt_kids_number']."','".$_POST['erp_sys_hrm_users_airtkt_frq']."','".$_POST['erp_sys_hrm_users_airtkt_limt']."','".$_POST['erp_sys_hrm_users_dl_num']."','".$_POST['erp_sys_hrm_users_dl_type']."','".$_POST['erp_sys_hrm_users_dl_issue_dt']."','".$_POST['erp_sys_hrm_users_dl_expry_dt']."','".$user_id."' ) ",'staff.php?state=list');
            }
        }
        if($_POST['action'] == "edit"){
            $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']."' ", " erp_sys_user_name_first = '".$_POST['erp_sys_user_name_first']."', erp_sys_user_name_middle='".$_POST['erp_sys_user_name_middle']."', erp_sys_user_name_last='".$_POST['erp_sys_user_name_last']."' , erp_sys_user_id='".$_POST['erp_sys_user_id']."' , erp_sys_user_email_personal='".$_POST['erp_sys_user_email_personal']."' , erp_sys_user_mobile1='".$_POST['erp_sys_user_mobile1']."', erp_sys_user_mobile2='".$_POST['erp_sys_user_mobile2']."', erp_sys_user_mobile_work='".$_POST['erp_sys_user_mobile_work']."' , erp_sys_org_name='".$_POST['erp_sys_org_name']."' , erp_sys_user_job_title='".$_POST['erp_sys_user_job_title']."', erp_sys_org_phone_work='".$_POST['erp_sys_org_phone_work']."', erp_sys_user_org_phone_work_ext='".$_POST['erp_sys_user_org_phone_work_ext']."', erp_sys_org_fax='".$_POST['erp_sys_org_fax']."', erp_sys_user_email_work='".$_POST['erp_sys_user_email_work']."', erp_sys_user_id_sm_linkedin='".$_POST['erp_sys_user_id_sm_linkedin']."', erp_sys_user_id_sm_twitter='".$_POST['erp_sys_user_id_sm_twitter']."', erp_sys_user_id_sm_facebook='".$_POST['erp_sys_user_id_sm_facebook']."', erp_sys_user_id_sm_instagram='".$_POST['erp_sys_user_id_sm_instagram']."', erp_sys_user_id_msngr_skype='".$_POST['erp_sys_user_id_msngr_skype']."', erp_sys_user_id_msngr_whatsapp='".$_POST['erp_sys_user_id_msngr_whatsapp']."', erp_sys_user_id_msngr_imo='".$_POST['erp_sys_user_id_msngr_imo']."', erp_sys_user_id_msngr_telegram='".$_POST['erp_sys_user_id_msngr_telegram']."', erp_sys_user_id_msngr_signal='".$_POST['erp_sys_user_id_msngr_signal']."', erp_sys_user_id_msngr_botim='".$_POST['erp_sys_user_id_msngr_botim']."', erp_sys_user_id_messanger_viber='".$_POST['erp_sys_user_id_messanger_viber']."', erp_sys_user_secutiry_permission='".$_POST['erp_sys_user_secutiry_permission']."', erp_sys_user_roleid='".$_POST['erp_sys_user_roleid']."', erp_sys_user_isActive='".$_POST['erp_sys_user_isActive']."'".$fileName.",erp_sys_user_address='".$_POST['erp_sys_user_address']."',erp_sys_user_city='".$_POST['erp_sys_user_city']."',erp_sys_user_country='".$_POST['erp_sys_user_country']."',erp_sys_user_state='".$_POST['erp_sys_user_state']."',erp_sys_user_zipcode='".$_POST['erp_sys_user_zipcode']."' ",'');
            $user_id = $_POST['user_id'];
            $countRow = $commonFunctions->getRowDataCount('erp_sys_hrm_users',' WHERE user_id = "'.$user_id.'"');
            if($countRow > 0){
                $commonFunctions->updateData('erp_sys_hrm_users'," WHERE user_id = '".$user_id."' ", " erp_sys_hrm_users_natsnl_id = '".$_POST['erp_sys_hrm_users_natsnl_id']."',erp_sys_hrm_users_natsnl_issue_dt='".$_POST['erp_sys_hrm_users_natsnl_issue_dt']."', erp_sys_hrm_users_natsnl_expry_dt='".$_POST['erp_sys_hrm_users_natsnl_expry_dt']."' , erp_sys_hrm_users_pp_num='".$_POST['erp_sys_hrm_users_pp_num']."' , erp_sys_hrm_users_pp_issue_dt='".$_POST['erp_sys_hrm_users_pp_issue_dt']."', erp_sys_hrm_users_pp_expry_dt='".$_POST['erp_sys_hrm_users_pp_expry_dt']."', erp_sys_hrm_users_visa_num='".$_POST['erp_sys_hrm_users_visa_num']."' , erp_sys_hrm_users_visa_type='".$_POST['erp_sys_hrm_users_visa_type']."' , erp_sys_hrm_users_visa_issue_dt='".$_POST['erp_sys_hrm_users_visa_issue_dt']."', erp_sys_hrm_users_visa_expry_dt='".$_POST['erp_sys_hrm_users_visa_expry_dt']."', erp_sys_hrm_users_cntrt_num='".$_POST['erp_sys_hrm_users_cntrt_num']."', erp_sys_hrm_users_file_num='".$_POST['erp_sys_hrm_users_file_num']."', erp_sys_hrm_users_ofr_letr_num='".$_POST['erp_sys_hrm_users_ofr_letr_num']."', erp_sys_hrm_users_jo_dt='".$_POST['erp_sys_hrm_users_jo_dt']."', erp_sys_hrm_users_bsc_salry='".$_POST['erp_sys_hrm_users_bsc_salry']."', erp_sys_hrm_users_acmd_alwn='".$_POST['erp_sys_hrm_users_acmd_alwn']."', erp_sys_hrm_users_trnpt_alwn='".$_POST['erp_sys_hrm_users_trnpt_alwn']."', erp_sys_hrm_users_kids_edu_alwn='".$_POST['erp_sys_hrm_users_kids_edu_alwn']."', erp_sys_hrm_users_othr_alwn='".$_POST['erp_sys_hrm_users_othr_alwn']."', erp_sys_hrm_users_vactn_frq='".$_POST['erp_sys_hrm_users_vactn_frq']."', erp_sys_hrm_users_airtkt='".$_POST['erp_sys_hrm_users_airtkt']."', erp_sys_hrm_users_airtkt_self='".$_POST['erp_sys_hrm_users_airtkt_self']."', erp_sys_hrm_users_airtkt_spouse='".$_POST['erp_sys_hrm_users_airtkt_spouse']."', erp_sys_hrm_users_airtkt_kids='".$_POST['erp_sys_hrm_users_airtkt_kids']."', erp_sys_hrm_users_airtkt_kids_number='".$_POST['erp_sys_hrm_users_airtkt_kids_number']."', erp_sys_hrm_users_airtkt_frq='".$_POST['erp_sys_hrm_users_airtkt_frq']."', erp_sys_hrm_users_airtkt_limt='".$_POST['erp_sys_hrm_users_airtkt_limt']."', erp_sys_hrm_users_dl_num='".$_POST['erp_sys_hrm_users_dl_num']."', erp_sys_hrm_users_dl_type='".$_POST['erp_sys_hrm_users_dl_type']."', erp_sys_hrm_users_dl_issue_dt='".$_POST['erp_sys_hrm_users_dl_issue_dt']."', erp_sys_hrm_users_dl_expry_dt='".$_POST['erp_sys_hrm_users_dl_expry_dt']."'",'staff.php?state=list');
            }else{
                $commonFunctions->addData('erp_sys_hrm_users'," (erp_sys_hrm_users_natsnl_id,erp_sys_hrm_users_natsnl_issue_dt,erp_sys_hrm_users_natsnl_expry_dt,erp_sys_hrm_users_pp_num,erp_sys_hrm_users_pp_issue_dt,erp_sys_hrm_users_pp_expry_dt,erp_sys_hrm_users_visa_num,erp_sys_hrm_users_visa_type,erp_sys_hrm_users_visa_issue_dt,erp_sys_hrm_users_visa_expry_dt,erp_sys_hrm_users_cntrt_num,erp_sys_hrm_users_file_num,erp_sys_hrm_users_ofr_letr_num,erp_sys_hrm_users_jo_dt,erp_sys_hrm_users_bsc_salry,erp_sys_hrm_users_acmd_alwn,erp_sys_hrm_users_trnpt_alwn,erp_sys_hrm_users_kids_edu_alwn,erp_sys_hrm_users_othr_alwn,erp_sys_hrm_users_vactn_frq,erp_sys_hrm_users_airtkt,erp_sys_hrm_users_airtkt_self,erp_sys_hrm_users_airtkt_spouse,erp_sys_hrm_users_airtkt_kids,erp_sys_hrm_users_airtkt_kids_number,erp_sys_hrm_users_airtkt_frq,erp_sys_hrm_users_airtkt_limt,erp_sys_hrm_users_dl_num,erp_sys_hrm_users_dl_type,erp_sys_hrm_users_dl_issue_dt,erp_sys_hrm_users_dl_expry_dt,user_id) VALUES ('".$_POST['erp_sys_hrm_users_natsnl_id']."','".$_POST['erp_sys_hrm_users_natsnl_issue_dt']."','".$_POST['erp_sys_hrm_users_natsnl_expry_dt']."','".$_POST['erp_sys_hrm_users_pp_num']."','".$_POST['erp_sys_hrm_users_pp_issue_dt']."','".$_POST['erp_sys_hrm_users_pp_expry_dt']."','".$_POST['erp_sys_hrm_users_visa_num']."','".$_POST['erp_sys_hrm_users_visa_type']."','".$_POST['erp_sys_hrm_users_visa_issue_dt']."','".$_POST['erp_sys_hrm_users_visa_expry_dt']."','".$_POST['erp_sys_hrm_users_cntrt_num']."','".$_POST['erp_sys_hrm_users_file_num']."','".$_POST['erp_sys_hrm_users_ofr_letr_num']."','".$_POST['erp_sys_hrm_users_jo_dt']."','".$_POST['erp_sys_hrm_users_bsc_salry']."','".$_POST['erp_sys_hrm_users_acmd_alwn']."','".$_POST['erp_sys_hrm_users_trnpt_alwn']."','".$_POST['erp_sys_hrm_users_kids_edu_alwn']."','".$_POST['erp_sys_hrm_users_othr_alwn']."','".$_POST['erp_sys_hrm_users_vactn_frq']."','".$_POST['erp_sys_hrm_users_airtkt']."','".$_POST['erp_sys_hrm_users_airtkt_self']."','".$_POST['erp_sys_hrm_users_airtkt_spouse']."','".$_POST['erp_sys_hrm_users_airtkt_kids']."','".$_POST['erp_sys_hrm_users_airtkt_kids_number']."','".$_POST['erp_sys_hrm_users_airtkt_frq']."','".$_POST['erp_sys_hrm_users_airtkt_limt']."','".$_POST['erp_sys_hrm_users_dl_num']."','".$_POST['erp_sys_hrm_users_dl_type']."','".$_POST['erp_sys_hrm_users_dl_issue_dt']."','".$_POST['erp_sys_hrm_users_dl_expry_dt']."','".$user_id."' ) ",'staff.php?state=list');
            }
        }
    }else{
        echo "<script>location.href='staff.php?state=form';</script>";
    }
}
?>    
<style type="text/css"> td.text-primary { cursor: pointer; } </style>
        
    <!-- Page-Title -->
    <div class="row">
        <div class="col-sm-12">
            <div class="page-title-box">
                <div class="row">
                    <div class="col">
                        <h4 class="page-title">HR Management</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>
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Staff<?php echo (!empty($_GET['state']) and $_GET['state'] == "form")?" Form ":" List "; ?></a></li>
                        </ol>
                    </div><!--end col-->
                    <?php if($_GET['state'] != "list"){ ?>
                        <a href="staff.php?state=list"><button type="button" class="btn btn-sm btn-outline-secondary clear_form">Back to Staff List</button></a> 
                    <?php } ?>
                </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-md-12">
            <?php if(empty($_GET['state']) OR (!empty($_GET['state']) and $_GET['state'] == "list")): ?>
                <div class="row justify-content-center">
                    <div class="col-md-6 col-lg-3">
                        <div class="card report-card">
                            <div class="card-body">
                                <div class="row d-flex justify-content-center">
                                    <div class="col">
                                        <p class="text-dark mb-0 font-weight-semibold">Total Staff</p>
                                        <h3 class="m-0"><?php echo $commonFunctions->getRowDataCount('sys_erp_adm_user',' WHERE erp_sys_user_roleid != 1 '); ?></h3>
                                    </div>
                                    <div class="col-auto align-self-center">
                                        <div class="report-main-icon bg-light-alt">
                                            <i data-feather="users" class="align-self-center text-muted icon-sm"></i>  
                                        </div>
                                    </div>
                                </div>
                            </div><!--end card-body--> 
                        </div><!--end card--> 
                    </div> <!--end col--> 
                    <div class="col-md-6 col-lg-3">
                        <div class="card report-card">
                            <div class="card-body">
                                <div class="row d-flex justify-content-center">                                                
                                    <div class="col">
                                        <p class="text-dark mb-0 font-weight-semibold">Active Staff</p>                
                                        <h3 class="m-0"><?php echo $commonFunctions->getRowDataCount('sys_erp_adm_user',' WHERE erp_sys_user_isActive = 0 AND erp_sys_user_roleid != 1 '); ?></h3>
                                    </div>
                                    <div class="col-auto align-self-center">
                                        <div class="report-main-icon bg-light-alt">
                                            <i data-feather="clock" class="align-self-center text-muted icon-sm"></i>  
                                        </div>
                                    </div> 
                                </div>
                            </div><!--end card-body--> 
                        </div><!--end card--> 
                    </div> <!--end col--> 
                    <div class="col-md-6 col-lg-3">
                        <div class="card report-card">
                            <div class="card-body">
                                <div class="row d-flex justify-content-center">                                                
                                    <div class="col">
                                        <p class="text-dark mb-0 font-weight-semibold">In-Active Staff</p>
                                        <h3 class="m-0"><?php echo $commonFunctions->getRowDataCount('sys_erp_adm_user',' WHERE erp_sys_user_isActive = 1  AND erp_sys_user_roleid != 1 '); ?></h3>
                                    </div>
                                    <div class="col-auto align-self-center">
                                        <div class="report-main-icon bg-light-alt">
                                            <i data-feather="clock" class="align-self-center text-muted icon-sm"></i>  
                                        </div>
                                    </div> 
                                </div>
                            </div><!--end card-body--> 
                        </div><!--end card--> 
                    </div> <!--end col--> 
                    <div class="col-md-6 col-lg-3">
                        <div class="card report-card">
                            <div class="card-body">
                                <div class="row d-flex justify-content-center">                                                
                                    <div class="col">
                                        <p class="text-dark mb-0 font-weight-semibold">Branches</p>
                                        <h3 class="m-0">0</h3>
                                        <!--p class="mb-0 text-truncate text-muted">Products Below Desired Stock</p-->
                                    </div>
                                    <div class="col-auto align-self-center">
                                        <div class="report-main-icon bg-light-alt">
                                            <i data-feather="clock" class="align-self-center text-muted icon-sm"></i>  
                                        </div>
                                    </div> 
                                </div>
                            </div><!--end card-body--> 
                        </div><!--end card--> 
                    </div> <!--end col-->                        
                </div><!--end row-->
            <?php endif; ?>
            <?php if(!empty($_GET['state']) and $_GET['state'] != "edit" ){ ?>
                <div class="card">
                    <div class="card-header">
                        <h4 class="card-title">
                            <div class="form-row">
                                <div class="form-group searchForm col-md-6">
                                    <a href="staff-form.php?state=form" style="float: left;"><button type="button" class="btn btn-outline-primary">Add Staff</button></a>
                                </div>    
                                <div class="form-group searchForm col-md-6">
                                <?php if(empty($_GET['state']) OR (!empty($_GET['state']) and $_GET['state'] == "list")): ?>    
                                    <form action="" id="searchForm" method="GET">
                                        <div class="form-row">
                                            <div class="form-group searchForm col-md-8">
                                                <input type="text" name="search" id="search" placeholder="Search" class="form-control" value="<?php echo @$_GET['search']; ?>">
                                                <input type="hidden" name="state" value="<?php echo @$_GET['state']; ?>">
                                                <input type="hidden" name="page" value="<?php echo @$_GET['page']; ?>">
                                            </div>
                                            <div class="form-group searchForm col-md-4">
                                                <button type="submit" id="searchbtn" class="btn btn-primary"> <i class="fa fa-search"></i> Search</button>
                                                <button type="button" id="clearbtn" class="btn btn-danger"> <i class="fa fa-trash"></i> Clear</button>
                                            </div>
                                        </div>
                                    </form>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </h4>
                        <?php echo !empty($msg)?$msg:''; ?>        
                        <?php echo !empty($msg1)?$msg1:''; ?>        
                    </div>
            
                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="main-card mb-3 ">
                                    <!-- <div class="card-body"> -->
                                        <?php if(!empty($_GET['state']) and $_GET['state'] != "list" ):
                                            if(!empty($_GET['user_id'])){
                                                $editData = $commonFunctions->getRowData('sys_erp_adm_user'," WHERE id = '".$_GET['user_id']."' ");
                                            }
                                            ?>
                                            <form enctype="multipart/form-data" action="staff.php?state=form&action=add" method="post" name="formsoc" autocomplete="off">      
                                                <div class="form-row">
                                                    <input type="hidden" name="action" value="<?php echo !empty($_GET['user_id'])?'edit':'add';?>">
                                                    <input type="hidden" name="user_id" value="<?php echo @$_GET['user_id'];?>">
                                                    <input type="hidden" name="erp_sys_user_isActive" value="1">
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_name_first" class="">First Name</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_name_first" id="erp_sys_user_name_first" value="<?php echo @$editData['erp_sys_user_name_first'];?>" autofocus="autofocus" class="form-control" placeholder="First Name">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_name_middle" class="">Middle Name</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_name_middle" id="erp_sys_user_name_middle" value="<?php echo @$editData['erp_sys_user_name_middle'];?>" autofocus="autofocus" class="form-control" placeholder="Middle Name">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_name_last" class="">Last Name</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_name_last" id="erp_sys_user_name_last" value="<?php echo @$editData['erp_sys_user_name_last'];?>" autofocus="autofocus" class="form-control" placeholder="Last Name">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_org_name" class="">Company Name</label>
                                                        <select class="form-control" name="erp_sys_org_name">
                                                            <option value="0">Select</option>
                                                        </select>
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_job_title" class="">Job Title</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_job_title" id="erp_sys_user_job_title" value="<?php echo @$editData['erp_sys_user_job_title'];?>" autofocus="autofocus" class="form-control" placeholder="Job Title">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_org_phone_work" class="">Work Phone</label>
                                                        <input type="text" maxlength="128" name="erp_sys_org_phone_work" id="erp_sys_org_phone_work" value="<?php echo @$editData['erp_sys_org_phone_work'];?>" autofocus="autofocus" class="form-control" placeholder="Work Phone">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_org_phone_work_ext" class="">Work Phone - Ext</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_org_phone_work_ext" id="erp_sys_user_org_phone_work_ext" value="<?php echo @$editData['erp_sys_user_org_phone_work_ext'];?>" autofocus="autofocus" class="form-control" placeholder="Work Phone - Ext">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_org_fax" class="">Work Fax</label>
                                                        <input type="text" maxlength="128" name="erp_sys_org_fax" id="erp_sys_org_fax" value="<?php echo @$editData['erp_sys_org_fax'];?>" autofocus="autofocus" class="form-control" placeholder="Work Fax">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_mobile1" class="">Mobile 1</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_mobile1" id="erp_sys_user_mobile1" value="<?php echo @$editData['erp_sys_user_mobile1'];?>" autofocus="autofocus" class="form-control" placeholder="Mobile">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_mobile2" class="">Mobile 2</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_mobile2" id="erp_sys_user_mobile2" value="<?php echo @$editData['erp_sys_user_mobile2'];?>" autofocus="autofocus" class="form-control" placeholder="Mobile">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_email_work" class="">Work eMail</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_email_work" id="erp_sys_user_email_work" value="<?php echo @$editData['erp_sys_user_email_work'];?>" autofocus="autofocus" class="form-control" placeholder="Work eMail">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_mobile_work" class="">Work Mobile</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_mobile_work" id="erp_sys_user_mobile_work" value="<?php echo @$editData['erp_sys_user_mobile_work'];?>" autofocus="autofocus" class="form-control" placeholder="Work Mobile">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_email_personal" class="">Personal eMail</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_email_personal" id="erp_sys_user_email_personal" value="<?php echo @$editData['erp_sys_user_email_personal'];?>" autofocus="autofocus" class="form-control" placeholder="Personal eMail">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_sm_linkedin" class="">LinkedIn</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_sm_linkedin" id="erp_sys_user_id_sm_linkedin" value="<?php echo @$editData['erp_sys_user_id_sm_linkedin'];?>" autofocus="autofocus" class="form-control" placeholder="LinkedIn">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_sm_twitter" class="">Twitter</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_sm_twitter" id="erp_sys_user_id_sm_twitter" value="<?php echo @$editData['erp_sys_user_id_sm_twitter'];?>" autofocus="autofocus" class="form-control" placeholder="Twitter">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_sm_facebook" class="">Facebook</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_sm_facebook" id="erp_sys_user_id_sm_facebook" value="<?php echo @$editData['erp_sys_user_id_sm_facebook'];?>" autofocus="autofocus" class="form-control" placeholder="Facebook">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_sm_instagram" class="">Instagram</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_sm_instagram" id="erp_sys_user_id_sm_instagram" value="<?php echo @$editData['erp_sys_user_id_sm_instagram'];?>" autofocus="autofocus" class="form-control" placeholder="Instagram">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_msngr_skype" class="">Skype</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_msngr_skype" id="erp_sys_user_id_msngr_skype" value="<?php echo @$editData['erp_sys_user_id_msngr_skype'];?>" autofocus="autofocus" class="form-control" placeholder="Skype">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_msngr_whatsapp" class="">Whatsapp Number</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_msngr_whatsapp" id="erp_sys_user_id_msngr_whatsapp" value="<?php echo @$editData['erp_sys_user_id_msngr_whatsapp'];?>" autofocus="autofocus" class="form-control" placeholder="Whatsapp Number">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_msngr_imo" class="">IMO Number </label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_msngr_imo" id="erp_sys_user_id_msngr_imo" value="<?php echo @$editData['erp_sys_user_id_msngr_imo'];?>" autofocus="autofocus" class="form-control" placeholder="IMO Number">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_msngr_telegram" class="">Telegram Number </label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_msngr_telegram" id="erp_sys_user_id_msngr_telegram" value="<?php echo @$editData['erp_sys_user_id_msngr_telegram'];?>" autofocus="autofocus" class="form-control" placeholder="Telegram Number">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_msngr_signal" class="">Signal Number </label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_msngr_signal" id="erp_sys_user_id_msngr_signal" value="<?php echo @$editData['erp_sys_user_id_msngr_signal'];?>" autofocus="autofocus" class="form-control" placeholder="Signal Number">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_msngr_botim" class="">Botim Number</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_msngr_botim" id="erp_sys_user_id_msngr_botim" value="<?php echo @$editData['erp_sys_user_id_msngr_botim'];?>" autofocus="autofocus" class="form-control" placeholder="Botim Number">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id_messanger_viber" class="">Viber Number</label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id_messanger_viber" id="erp_sys_user_id_messanger_viber" value="<?php echo @$editData['erp_sys_user_id_messanger_viber'];?>" autofocus="autofocus" class="form-control" placeholder="Viber Number">
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_secutiry_permission" class="">Permission</label>
                                                        <select name="erp_sys_user_secutiry_permission" class="form-control">
                                                            <option value="">Select</option>
                                                        </select>
                                                    </div>

                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_id" class="">UserName <span class="error">*</span></label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_id" id="erp_sys_user_id" value="<?php echo @$editData['erp_sys_user_id'];?>" autofocus="autofocus" class="form-control" placeholder="UserName" required="">
                                                    </div>
                                                    <!-- <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_secutiry_password" class="">Password <span class="error">*</span></label>
                                                        <input type="password" maxlength="128" name="erp_sys_user_secutiry_password" id="erp_sys_user_secutiry_password" value="" autofocus="autofocus" class="form-control" placeholder="Password" required="">
                                                    </div> -->
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_roleid">Select Staff Type <span class="error">*</span></label>
                                                        <?php $optionData = $commonFunctions->getData('sys_erp_adm_user_roles',' WHERE isActive = 0 '); ?>
                                                        <select class="form-control" name="erp_sys_user_roleid" id="erp_sys_user_roleid">
                                                          <?php foreach ($optionData as $key) { ?>
                                                            <option value="<?php echo $key['id'];?>" <?php echo (!empty(@$editData['erp_sys_user_roleid']) and $key['id'] == $editData['erp_sys_user_roleid'])?"selected":""; ?> ><?php echo $key['role'];?></option>
                                                          <?php } ?>
                                                        </select>
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_logo" class=""> Staff Photo (Avatar) </label>
                                                        <input type="file" name="erp_sys_user_logo" >
                                                    </div>

                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_address" class="">Address </label>
                                                        <textarea name="erp_sys_user_address" id="erp_sys_user_address" class="form-control"><?php echo @$editData['erp_sys_user_address'];?></textarea>
                                                    </div>
                                                    
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_country" class=""> Country </label>
                                                        <?php $countryData = $commonFunctions->getData('sys_erp_adm_countries',' WHERE active = 1 '); ?>
                                                        <select name="erp_sys_user_country" id="erp_sys_user_country" class="select2 form-control" >
                                                            <option value="0">Select Country</option>
                                                            <?php foreach ($countryData as $rw) { ?>
                                                                <option value="<?php echo $rw['rowid'];?>" ><?php echo $rw['label']."(".$rw['code'].")"; ?></option>     
                                                            <?php } ?>
                                                        </select>
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_state" class=""> State / Province </label>
                                                        <?php $stateData = $commonFunctions->getData('sys_erp_adm_countries_states',' WHERE active = 1 '); ?>
                                                        <select name="erp_sys_user_state" id="erp_sys_user_state" class="select2 form-control" >
                                                            <option value="0">Select State / Province</option>
                                                            <?php foreach ($stateData as $rw) { ?>
                                                                <option value="<?php echo $rw['rowid'];?>" ><?php echo $rw['label']."(".$rw['region_code'].")"; ?></option>     
                                                            <?php } ?>
                                                        </select>
                                                    </div>
                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_city" class="">City </label>
                                                        <input type="text" maxlength="128" name="erp_sys_user_city" id="erp_sys_user_city" value="<?php echo @$editData['erp_sys_user_city'];?>" autofocus="autofocus" class="form-control" placeholder="Enter City" >
                                                    </div>

                                                    <div class="position-relative form-group col-md-4">
                                                        <label for="erp_sys_user_zipcode" class="">Zipcode </label>
                                                        <input type="number" maxlength="128" name="erp_sys_user_zipcode" id="erp_sys_user_zipcode" value="<?php echo @$editData['erp_sys_user_zipcode'];?>" autofocus="autofocus" class="form-control" placeholder="Enter Zipcode" >
                                                    </div>

                                                    <div class="col-md-12 position-relative form-group">
                                                        <div class="accordion" id="accordionExample">
                                                            <div class="card border mb-1 shadow-none">
                                                                <a href="" id="expand" class="text-dark collapsed" data-toggle="collapse" data-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
                                                                    <div class="card-header rounded-0" id="headingOne">
                                                                        Advanced Features
                                                                        <span class="accordion-class" style="float: right;font-size: 20px;font-family: 'Roboto';">
                                                                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu align-self-center topbar-icon"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
                                                                        </span>
                                                                    </div>
                                                                </a>
                                                                <div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordionExample" style="">
                                                                    <div class="card-body form-row">
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_natsnl_id" class="">User National ID</label>
                                                                            <input type="text" name="erp_sys_hrm_users_natsnl_id" class="form-control" placeholder="User National ID">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_natsnl_issue_dt" class="">User National ID Date of Issue</label>
                                                                            <input type="text" name="erp_sys_hrm_users_natsnl_issue_dt" class="form-control date" placeholder="User National ID Date of Issue">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_natsnl_expry_dt" class="">User National ID Date of Expire</label>
                                                                            <input type="text" name="erp_sys_hrm_users_natsnl_expry_dt" class="form-control date" placeholder="User National ID Date of Expire">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_pp_num" class="">User Passport No</label>
                                                                            <input type="text" name="erp_sys_hrm_users_pp_num" class="form-control" placeholder="User Passport No">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_pp_issue_dt" class="">User Passport Date of Issue</label>
                                                                            <input type="text" name="erp_sys_hrm_users_pp_issue_dt" class="date form-control" placeholder="User Passport Date of Issue">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_pp_expry_dt" class="">User Passport Date of Expire</label>
                                                                            <input type="text" name="erp_sys_hrm_users_pp_expry_dt" class="date form-control" placeholder="User Passport Date of Expire">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_visa_num" class="">User Visa No</label>
                                                                            <input type="text" name="erp_sys_hrm_users_visa_num" class="form-control" placeholder="User Visa No">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_visa_type" class="">User Visa Type</label>
                                                                            <input type="text" name="erp_sys_hrm_users_visa_type" class="form-control" placeholder="User Visa Type">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_visa_issue_dt" class="">User Visa -  Date of Issue</label>
                                                                            <input type="text" name="erp_sys_hrm_users_visa_issue_dt" class="date form-control" placeholder="User Visa -  Date of Issue">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_visa_expry_dt" class="">User Visa -  Date of Expire</label>
                                                                            <input type="text" name="erp_sys_hrm_users_visa_expry_dt" class="date form-control" placeholder="User Visa -  Date of Issue">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_cntrt_num" class="">User Contract Number</label>
                                                                            <input type="text" name="erp_sys_hrm_users_cntrt_num" class="form-control" placeholder="User Contract Number">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_file_num" class="">User File Number</label>
                                                                            <input type="text" name="erp_sys_hrm_users_file_num" class="form-control" placeholder="User File Number">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_ofr_letr_num" class="">User Offer Letter Number</label>
                                                                            <input type="text" name="erp_sys_hrm_users_ofr_letr_num" class="form-control" placeholder="User Offer Letter Number">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_jo_dt" class="">User Joining / Hiring  Date</label>
                                                                            <input type="text" name="erp_sys_hrm_users_jo_dt" class="date form-control" placeholder="User Joining / Hiring  Date">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_bsc_salry" class="">User Basic Salary</label>
                                                                            <input type="text" name="erp_sys_hrm_users_bsc_salry" class="form-control" placeholder="User Basic Salary">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_acmd_alwn" class="">User Accommodation Allowance</label>
                                                                            <input type="text" name="erp_sys_hrm_users_acmd_alwn" class="form-control" placeholder="User Accommodation Allowance">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_trnpt_alwn" class="">User Transportation Allowance</label>
                                                                            <input type="text" name="erp_sys_hrm_users_trnpt_alwn" class="form-control" placeholder="User Transportation Allowance">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_kids_edu_alwn" class="">User Kids Education  Allowance</label>
                                                                            <input type="text" name="erp_sys_hrm_users_kids_edu_alwn" class="form-control" placeholder="User Kids Education  Allowance">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_othr_alwn" class="">User Other Allowance</label>
                                                                            <input type="text" name="erp_sys_hrm_users_othr_alwn" class="form-control" placeholder="User Other Allowance">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_vactn_frq" class="">User Vacation - Frequency</label>
                                                                            <select name="erp_sys_hrm_users_vactn_frq" class="form-control">
                                                                                <option value="0">Select</option>
                                                                                <option value="1">1 Year</option>
                                                                                <option value="2">2 Year</option>
                                                                            </select>
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_airtkt" class="">User Air Ticket - Eligibility</label>
                                                                            <select name="erp_sys_hrm_users_airtkt" class="form-control">
                                                                                <option value="0">Select</option>
                                                                                <option value="1">Yes</option>
                                                                                <option value="2">No</option>
                                                                            </select>
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_airtkt_self" class="">User Air Ticket - Self</label>
                                                                            <select name="erp_sys_hrm_users_airtkt_self" class="form-control">
                                                                                <option value="0">Select</option>
                                                                                <option value="1">Yes</option>
                                                                                <option value="2">No</option>
                                                                            </select>
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_airtkt_spouse" class="">User Air Ticket - Spouse</label>
                                                                            <select name="erp_sys_hrm_users_airtkt_spouse" class="form-control">
                                                                                <option value="0">Select</option>
                                                                                <option value="1">Yes</option>
                                                                                <option value="2">No</option>
                                                                            </select>
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_airtkt_kids" class="">User Air Ticket - Kids</label>
                                                                            <select name="erp_sys_hrm_users_airtkt_kids" class="form-control">
                                                                                <option value="0">Select</option>
                                                                                <option value="1">Yes</option>
                                                                                <option value="2">No</option>
                                                                            </select>
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_airtkt_kids_number" class="">User Air Ticket - Kids Number</label>
                                                                            <input type="number" name="erp_sys_hrm_users_airtkt_kids_number" class="form-control" placeholder="User Air Ticket - Kids Number">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_airtkt_frq" class="">User Air Ticket - Frequency</label>
                                                                            <select name="erp_sys_hrm_users_airtkt_frq" class="form-control">
                                                                                <option value="0">Select</option>
                                                                                <option value="1">1 Year</option>
                                                                                <option value="2">2 Year</option>
                                                                            </select>
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_airtkt_limt" class="">User Air Ticket - Limits</label>
                                                                            <input type="number" name="erp_sys_hrm_users_airtkt_limt" class="form-control" placeholder="User Air Ticket - Limits">
                                                                        </div>

                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_dl_num" class="">User Driving License No</label>
                                                                            <input type="text" name="erp_sys_hrm_users_dl_num" class="form-control" placeholder="User Driving License No">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_dl_type" class="">User Driving License Type</label>
                                                                            <input type="text" name="erp_sys_hrm_users_dl_type" class="form-control" placeholder="User Driving License Type">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_dl_issue_dt" class="">User Driving License Date of Issue</label>
                                                                            <input type="text" name="erp_sys_hrm_users_dl_issue_dt" class="date form-control" placeholder="User Driving License Date of Issue">
                                                                        </div>
                                                                        <div class="col-md-4 position-relative form-group">
                                                                            <label for="erp_sys_hrm_users_dl_expry_dt" class="">User Driving License Date of Expire</label>
                                                                            <input type="text" name="erp_sys_hrm_users_dl_expry_dt" class="form-control date" placeholder="User Driving License Date of Expire">
                                                                        </div>

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

                                                    <div class="position-relative form-group col-md-12">
                                                        <button type="submit" class="btn btn-success">Create</button>
                                                        <a href="staff.php?state=list"><button type="button" class="btn btn-danger">Back to Users List</button></a>
                                                    </div>
                                                </div>
                                            </form>
                                        <?php endif; ?>
                                        <?php if(empty($_GET['state']) OR (!empty($_GET['state']) and $_GET['state'] == "list")): 

                                            $targetpage = "staff.php?state=list";

                                            $limit = 50;
                                            $total_pages = $commonFunctions->getData('sys_erp_adm_user','');
                                            $total_pages = count($total_pages);
                                            $stages = 3;
                                            $page = @$_GET['page'];
                                            if($page){
                                                $start = ($page - 1) * $limit; 
                                            }else{
                                                $start = 0; 
                                            } 
                                            
                                            $search_con = "";
                                            if(!empty($_GET['search'])){
                                                $countryArr = $commonFunctions->getIDs('sys_erp_adm_countries','rowid'," WHERE label LIKE '%".$_GET['search']."%' ");
                                                $sys_erp_adm_countries_statesArr = $commonFunctions->getIDs('sys_erp_adm_countries_states','rowid'," WHERE label LIKE '%".$_GET['search']."%' ");
                                                $country_ids = @$countryArr["ids"];
                                                $state_ids = @$sys_erp_adm_countries_statesArr["ids"];
                                                $search_con = " AND erp_sys_user_name_first LIKE '%".$_GET['search']."%' OR erp_sys_user_name_middle LIKE '%".$_GET['search']."%' OR erp_sys_user_name_last LIKE '%".$_GET['search']."%' OR erp_sys_user_email_personal LIKE '%".$_GET['search']."%' OR erp_sys_user_mobile1 LIKE '%".$_GET['search']."%' OR erp_sys_org_phone_work LIKE '%".$_GET['search']."%' OR erp_sys_user_email_work LIKE '%".$_GET['search']."%' OR erp_sys_org_name LIKE '%".$_GET['search']."%' ";
                                            }
                                            $where = " WHERE id ".$search_con." AND erp_sys_user_roleid != 1 ORDER BY id DESC LIMIT $start, $limit ";
                                           
                                            // Initial page num setup
                                            if ($page == 0){ $page = 1; }
                                            $prev = $page - 1;  
                                            $next = $page + 1;  
                                            $lastpage = ceil($total_pages/$limit);  
                                            $LastPagem1 = $lastpage - 1;    
                                            $paginate = '';
                                            if($lastpage > 1)
                                            {       
                                                $paginate .= "<div class='paginate'>";
                                                // Previous

                                                if ($page > 1){
                                                    $paginate.= "<a href='$targetpage&page=$prev'>Previous</a>";
                                                }else{
                                                    $paginate.= "<span class='disabled'>Previous</span>";   }
                                                // Pages    
                                                if ($lastpage < 7 + ($stages * 2))  // Not enough pages to breaking it up
                                                {   
                                                    for ($counter = 1; $counter <= $lastpage; $counter++)
                                                    {
                                                        if ($counter == $page){
                                                            $paginate.= "<span class='current'>$counter</span>";
                                                        }else{
                                                            $paginate.= "<a href='$targetpage&page=$counter'>$counter</a>";}    
                                                    }
                                                }
                                                elseif($lastpage > 5 + ($stages * 2))   // Enough pages to hide a few?
                                                {
                                                    // Beginning only hide later pages
                                                    if($page < 1 + ($stages * 2))   
                                                    {
                                                        for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
                                                        {
                                                            if ($counter == $page){
                                                                $paginate.= "<span class='current'>$counter</span>";
                                                            }else{
                                                                $paginate.= "<a href='$targetpage&page=$counter'>$counter</a>";}    
                                                        }
                                                        $paginate.= "...";
                                                        $paginate.= "<a href='$targetpage&page=$LastPagem1'>$LastPagem1</a>";
                                                        $paginate.= "<a href='$targetpage&page=$lastpage'>$lastpage</a>";
                                                    }
                                                    // Middle hide some front and some back
                                                    elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
                                                    {
                                                        $paginate.= "<a href='$targetpage&page=1'>1</a>";
                                                        $paginate.= "<a href='$targetpage&page=2'>2</a>";
                                                        $paginate.= "...";
                                                        for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
                                                        {
                                                            if ($counter == $page){
                                                                $paginate.= "<span class='current'>$counter</span>";
                                                            }else{
                                                                $paginate.= "<a href='$targetpage&page=$counter'>$counter</a>";}    
                                                        }
                                                        $paginate.= "...";
                                                        $paginate.= "<a href='$targetpage&page=$LastPagem1'>$LastPagem1</a>";
                                                        $paginate.= "<a href='$targetpage&page=$lastpage'>$lastpage</a>";
                                                    }
                                                    // End only hide early pages
                                                    else
                                                    {
                                                        $paginate.= "<a href='$targetpage&page=1'>1</a>";
                                                        $paginate.= "<a href='$targetpage&page=2'>2</a>";
                                                        $paginate.= "...";
                                                        for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
                                                        {
                                                            if ($counter == $page){
                                                                $paginate.= "<span class='current'>$counter</span>";
                                                            }else{
                                                                $paginate.= "<a href='$targetpage&page=$counter'>$counter</a>";}
                                                        }
                                                    }       
                                                }       
                                                        // Next
                                                if ($page < $counter - 1){ 
                                                    $paginate.= "<a href='$targetpage&page=$next'>Next</a>";
                                                }else{
                                                    $paginate.= "<span class='disabled'>Next</span>";
                                                    }
                                                $paginate.= "</div>";   
                                            }
                                            $resultData = $commonFunctions->getData('sys_erp_adm_user',$where);
                                            ?>
                                            <div class="form-row1 table-rep-plugin">
                                                <div class="table-responsive1 mb-0" data-pattern="priority-columns">
                                                    <table style="width: 100% !important;" class="table datatable_t table-hover table-striped table-bordered">
                                                        <thead>
                                                            <tr>
                                                                <th  class="text-center">Name</th>
                                                                <th  class="text-center">Staff ID</th>
                                                                <th  class="text-center">Phone No</th>
                                                                <th  class="text-center">Mobile No</th>
                                                                <th  class="text-center">Email Address</th>
                                                                <th  class="text-center">Designation</th>
                                                                <th  class="text-center">Staff Role</th>
                                                                <th  class="text-center">Staff Status</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php $i = 1; foreach ($resultData as $rw) { ?>
                                                                <tr>
                                                                    <td class="text-primary" onclick="redirect_('staff-card.php?user_id=<?php echo $rw['id'];?>')"><?php echo $rw['erp_sys_user_name_first']." ".$rw['erp_sys_user_name_middle']." ".$rw['erp_sys_user_name_last'];?></td>
                                                                    <td class="text-primary" onclick="redirect_('staff-card.php?user_id=<?php echo $rw['id'];?>')"><?php echo $rw['erp_sys_user_id'];?></td>
                                                                    <td><?php echo $rw['erp_sys_org_phone_work'];?></td>
                                                                    <td><?php echo $rw['erp_sys_user_mobile1'];?></td>
                                                                    <td class="text-primary" onclick="redirect_('staff-card.php?user_id=<?php echo $rw['id'];?>')"><?php echo $rw['erp_sys_user_email_personal'];?></td>
                                                                    
                                                                    <!-- <td><span class="badge badge-lg badge-secondary text-white"><?php echo $users->formatDate($rw['last_logged_date']); ?></span></td> -->
                                                                    <td><?php echo $commonFunctions->getName($rw['erp_sys_user_roleid'],'sys_erp_adm_user_roles','role','id'); ?>
                                                                    </td>
                                                                    <td class="text-primary" onclick="redirect_('staff-card.php?user_id=<?php echo $rw['id'];?>')"><?php echo $commonFunctions->getName($rw['erp_sys_user_roleid'],'sys_erp_adm_user_roles','role','id'); ?>
                                                                    </td>

                                                                    <td>
                                                                        <?php if ($rw['erp_sys_user_isActive'] == '0') { ?>
                                                                            <span class="badge badge-lg badge-info text-white">Active</span>
                                                                        <?php }else{ ?>
                                                                            <span class="badge badge-lg badge-danger text-white">Deactive</span>
                                                                        <?php } ?>
                                                                    </td>
                                                                </tr>
                                                            <?php } ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                            <?php echo "<center>".$paginate."</center>";?>
                                        <?php endif; ?>
                                    <!-- </div> -->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            <?php }else{ 
                $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']."' ");
                ?>
                <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 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><!--end col-->
                                        
                                        <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><!--end col-->
                                                <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><!--end col-->
                                            </div><!--end row-->                                               
                                        </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">
                                        <form action="" class="personalInfoForm">
                                            <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 class="FormBtn" href="javascript:void(0);"><button type="button" class="text-right btn btn-sm btn-success waves-effect waves-light">Save</button></a>              
                                                        </div><!--end col-->                                                       
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">
                                                    <input type="hidden" name="user_id" value="<?php echo @$_GET['user_id'];?>">
                                                    <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">
                                                                <input type="text" name="erp_sys_user_name_first" value="<?php echo @$userData['erp_sys_user_name_first'];?>" class="form-control">
                                                            </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"> 
                                                                <input type="text" name="erp_sys_user_name_middle" value="<?php echo @$userData['erp_sys_user_name_middle'];?>" class="form-control">
                                                            </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">
                                                                <input type="text" name="erp_sys_user_name_last" value="<?php echo @$userData['erp_sys_user_name_last'];?>" class="form-control"> </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 $optionData = $commonFunctions->getData('sys_erp_adm_user_roles',' WHERE isActive = 0 '); ?>
                                                                <select class="form-control" name="erp_sys_user_roleid" id="erp_sys_user_roleid" required="">
                                                                  <?php foreach ($optionData as $key) { ?>
                                                                    <option value="<?php echo $key['id'];?>" <?php echo (!empty(@$userData['erp_sys_user_roleid']) and $key['id'] == $userData['erp_sys_user_roleid'])?"selected":""; ?> ><?php echo $key['role'];?></option>
                                                                  <?php } ?>
                                                                </select>

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

                                                </div>                                        
                                            </div>
                                        </form>
                                        <!-- Personal Information Card - End --->
                                        <!-- Contact Information Personal Card - End --->
                                        <form action="" class="contactInfoForm">    
                                            <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 class="FormBtn" href="javascript:void(0);"><button type="button" class="text-right btn btn-sm btn-success waves-effect waves-light">Save</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"> 
                                                                <input type="text" name="erp_sys_user_mobile2" value="<?php echo @$userData['erp_sys_user_mobile2'];?>" class="form-control"> </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"> 
                                                            <input type="text" name="erp_sys_user_id_msngr_whatsapp" value="<?php echo @$userData['erp_sys_user_id_msngr_whatsapp'];?>" class="form-control">
                                                             </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"> 
                                                                <input type="text" name="erp_sys_user_email_personal" value="<?php echo @$userData['erp_sys_user_email_personal'];?>" class="form-control">
                                                            </h5>
                                                        </div>
                                                    </div>                                                   
                                                </div><!--end card-body-->
                                            </div><!--end card-->
                                        </form>
                                        <form action="" class="socialInfoForm">  
                                            <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 class="FormBtn" href="javascript:void(0);"><button type="button" class="text-right btn btn-sm btn-success waves-effect waves-light">Save</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"> 
                                                                <input type="text" name="erp_sys_user_id_sm_linkedin" value="<?php echo @$userData['erp_sys_user_id_sm_linkedin'];?>" class="form-control"> </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"> 
                                                                <input type="text" name="erp_sys_user_id_sm_twitter" value="<?php echo @$userData['erp_sys_user_id_sm_twitter'];?>" class="form-control">
                                                            </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"> 
                                                                <input type="text" name="erp_sys_user_id_sm_facebook" value="<?php echo @$userData['erp_sys_user_id_sm_facebook'];?>" class="form-control">
                                                            </h5>
                                                        </div>
                                                    </div>                                                    
                                                </div><!--end card-body-->
                                            </div><!--end card-->
                                        </form>
                                    </div>
                                    <div class="col-lg-6 col-xl-6">
                                        <form action="" class="contactOfiInfoForm">
                                            <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 class="FormBtn" href="javascript:void(0);"><button type="button" class="text-right btn btn-sm btn-success waves-effect waves-light">Save</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"> 
                                                                <input type="text" name="erp_sys_user_mobile_work" value="<?php echo @$userData['erp_sys_user_mobile_work'];?>" class="form-control">
                                                            </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">
                                                                <input type="text" name="erp_sys_org_phone_work" value="<?php echo @$userData['erp_sys_org_phone_work'];?>" class="form-control">
                                                            </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"> <input type="text" name="erp_sys_org_fax" value="<?php echo @$userData['erp_sys_org_fax'];?>" class="form-control">
                                                            </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"> <input type="text" name="erp_sys_user_email_work" value="<?php echo @$userData['erp_sys_user_email_work'];?>" class="form-control">

                                                            </h5>
                                                        </div>
                                                    </div>
                                                    
                                                </div><!--end card-body-->
                                            </div><!--end card-->
                                        </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">Office Address </h4>                      
                                                        </div><!--end col-->
                                                        <!-- <div class="col-1">             
                                                            <a class="FormBtn" href="javascript:void(0);"><button type="button" class="text-right btn btn-sm btn-success waves-effect waves-light">Save</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"> 
                                                                <input type="text" name="erp_sys_user_address" value="<?php echo @$userData['erp_sys_user_address'];?>" class="form-control">
                                                            </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"> 
                                                                <input type="text" name="erp_sys_user_zipcode" value="<?php echo @$userData['erp_sys_user_zipcode'];?>" class="form-control">
                                                            </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 $countryData = $commonFunctions->getData('sys_erp_adm_countries',' WHERE active = 1 '); ?>
                                                                <select name="erp_sys_user_country" id="erp_sys_user_country" class="select2 form-control" >
                                                                    <option value="0">Select Country</option>
                                                                    <?php foreach ($countryData as $rw) { ?>
                                                                        <option value="<?php echo $rw['rowid'];?>" <?php echo ($userData['erp_sys_user_country'] == $rw['rowid'])?"selected":'';?> ><?php echo $rw['label']."(".$rw['code'].")"; ?></option>     
                                                                    <?php } ?>
                                                                </select>
                                                             </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 $stateData = $commonFunctions->getData('sys_erp_adm_countries_states',' WHERE active = 1 '); ?>
                                                                <select name="erp_sys_user_state" id="erp_sys_user_state" class="select2 form-control" >
                                                                    <option value="0">Select State / Province</option>
                                                                    <?php foreach ($stateData as $rw) { ?>
                                                                        <option value="<?php echo $rw['rowid'];?>" <?php echo ($userData['erp_sys_user_state'] == $rw['rowid'])?"selected":'';?> ><?php echo $rw['label']."(".$rw['region_code'].")"; ?></option>     
                                                                    <?php } ?>
                                                                </select>
                                                            </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"> 
                                                                <input type="text" name="erp_sys_user_city" id="erp_sys_user_city" value="<?php echo @$userData['erp_sys_user_city'];?>" class="form-control">
                                                            </h5>
                                                        </div>
                                                    </div>

                                                </div><!--end card-body-->
                                            </div><!--end card-->
                                        </form>
                                    </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 class="FormBtn" href="javascript:void(0);"><button type="button" class="text-right btn btn-sm btn-success waves-effect waves-light">Save</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">User National ID</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_natsnl_id" class="form-control" placeholder="User National ID" value="<?php echo @$userHRMData['erp_sys_hrm_users_natsnl_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">User National ID Date of Issue</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_natsnl_issue_dt" class="form-control" placeholder="User National ID Date of Issue" value="<?php echo @$userHRMData['erp_sys_hrm_users_natsnl_issue_dt'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User National ID Date of Expire</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_natsnl_expry_dt" class="form-control" placeholder="User National ID Date of Expire" value="<?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-3 col-lg-3 text-left mb-lg-0 align-self-center">User Passport No</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_pp_num" class="form-control" placeholder="User Passport No" value="<?php echo @$userHRMData['erp_sys_hrm_users_pp_num'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Passport Date of Issue</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_pp_issue_dt" class="form-control date" placeholder="User Passport Date of Issue" value="<?php echo @$userHRMData['erp_sys_hrm_users_pp_issue_dt'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Passport Date of Expire</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_pp_expry_dt" class="date form-control" placeholder="User Passport Date of Expire" value="<?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-3 col-lg-3 text-left mb-lg-0 align-self-center">User Driving License No</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_dl_num" class="form-control" placeholder="User Driving License No" value="<?php echo @$userHRMData['erp_sys_hrm_users_dl_num'];?>">
                                                            </h5>
                                                        </div> 
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Driving License Type</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_dl_type" class="form-control" placeholder="User Driving License Type" value="<?php echo @$userHRMData['erp_sys_hrm_users_dl_type'];?>">
                                                            </h5>
                                                        </div> 
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Driving License Date of Issue</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_dl_issue_dt" class="date form-control" placeholder="User Driving License Date of Issue" value="<?php echo @$userHRMData['erp_sys_hrm_users_dl_issue_dt'];?>">
                                                            </h5>
                                                        </div> 
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Driving License Date of Expire</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_dl_expry_dt" class="date form-control" placeholder="User Driving License Date of Expire" value="<?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-3 col-lg-3 text-left mb-lg-0 align-self-center">User Vacation - Frequency</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <select name="erp_sys_hrm_users_vactn_frq" class="form-control">
                                                                    <option value="0">Select</option>
                                                                    <option value="1" <?php echo (@$userHRMData['erp_sys_hrm_users_vactn_frq'] == 1 )?"selected":"";?> >1 Year</option>
                                                                    <option value="2" <?php echo (@$userHRMData['erp_sys_hrm_users_vactn_frq'] == 2 )?"selected":"";?> >2 Year</option>
                                                                </select>
                                                            </h5>
                                                        </div>
                                                    </div>

                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Air Ticket - Eligibility</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <select name="erp_sys_hrm_users_airtkt" class="form-control">
                                                                    <option value="0">Select</option>
                                                                    <option value="1" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt'] == 1 )?"selected":"";?> >Yes</option>
                                                                    <option value="2" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt'] == 2 )?"selected":"";?> >No</option>
                                                                </select>
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Air Ticket - Self</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <select name="erp_sys_hrm_users_airtkt_self" class="form-control">
                                                                    <option value="0">Select</option>
                                                                    <option value="1" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_self'] == 1 )?"selected":"";?> >Yes</option>
                                                                    <option value="2" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_self'] == 2 )?"selected":"";?> >No</option>
                                                                </select>
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Air Ticket - Spouse</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <select name="erp_sys_hrm_users_airtkt_spouse" class="form-control">
                                                                    <option value="0">Select</option>
                                                                    <option value="1" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_spouse'] == 1 )?"selected":"";?> >Yes</option>
                                                                    <option value="2" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_spouse'] == 2 )?"selected":"";?> >No</option>
                                                                </select>
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Air Ticket - Kids</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <select name="erp_sys_hrm_users_airtkt_kids" class="form-control">
                                                                    <option value="0">Select</option>
                                                                    <option value="1" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_kids'] == 1 )?"selected":"";?> >Yes</option>
                                                                    <option value="2" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_kids'] == 2 )?"selected":"";?> >No</option>
                                                                </select>
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Air Ticket - Kids Number</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="number" name="erp_sys_hrm_users_airtkt_kids_number" class="form-control" placeholder="User Air Ticket - Kids Number" value="<?php echo @$userHRMData['erp_sys_hrm_users_airtkt_kids_number'];?>">
                                                            </h5>
                                                        </div> 
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Air Ticket - Frequency</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <select name="erp_sys_hrm_users_airtkt_frq" class="form-control">
                                                                    <option value="0">Select</option>
                                                                    <option value="1" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_frq'] == 1 )?"selected":"";?> >1 Year</option>
                                                                    <option value="2" <?php echo (@$userHRMData['erp_sys_hrm_users_airtkt_frq'] == 2 )?"selected":"";?> >2 Year</option>
                                                                </select>
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Air Ticket - Limits</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="number" name="erp_sys_hrm_users_airtkt_limt" class="form-control" placeholder="User Air Ticket - Limits" value="<?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-3 col-lg-3 text-left mb-lg-0 align-self-center">User Visa No</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_visa_num" class="form-control" placeholder="User Visa No" value="<?php echo @$userHRMData['erp_sys_hrm_users_visa_num'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Visa Type</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_visa_type" class="form-control" placeholder="User Visa Type" value="<?php echo @$userHRMData['erp_sys_hrm_users_visa_type'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Visa -  Date of Issue</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_visa_issue_dt" class="date form-control" placeholder="User Visa -  Date of Issue" value="<?php echo @$userHRMData['erp_sys_hrm_users_visa_type'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Visa -  Date of Expire</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_visa_expry_dt" class="date form-control" placeholder="User Visa -  Date of Issue" value="<?php echo @$userHRMData['erp_sys_hrm_users_visa_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-body">

                                                </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 class="FormBtn" href="javascript:void(0);"><button type="button" class="text-right btn btn-sm btn-success waves-effect waves-light">Save</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">User Contract Number</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_cntrt_num" class="form-control" placeholder="User Contract Number" value="<?php echo @$userHRMData['erp_sys_hrm_users_cntrt_num'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User File Number</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_file_num" class="form-control" placeholder="User File Number" value="<?php echo @$userHRMData['erp_sys_hrm_users_file_num'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Offer Letter Number</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_ofr_letr_num" class="form-control" placeholder="User Offer Letter Number" value="<?php echo @$userHRMData['erp_sys_hrm_users_ofr_letr_num'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Joining / Hiring  Date</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_jo_dt" class="date form-control" placeholder="User Joining / Hiring  Date" value="<?php echo @$userHRMData['erp_sys_hrm_users_jo_dt'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Basic Salary</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_bsc_salry" class="form-control" placeholder="User Basic Salary" value="<?php echo @$userHRMData['erp_sys_hrm_users_bsc_salry'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Accommodation Allowance</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_acmd_alwn" class="form-control" placeholder="User Accommodation Allowance" value="<?php echo @$userHRMData['erp_sys_hrm_users_acmd_alwn'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Transportation Allowance</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_trnpt_alwn" class="form-control" placeholder="User Transportation Allowance" value="<?php echo @$userHRMData['erp_sys_hrm_users_trnpt_alwn'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Kids Education  Allowance</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_kids_edu_alwn" class="form-control" placeholder="User Kids Education  Allowance" value="<?php echo @$userHRMData['erp_sys_hrm_users_kids_edu_alwn'];?>">
                                                            </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Other Allowance</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title">
                                                                <input type="text" name="erp_sys_hrm_users_othr_alwn" class="form-control" placeholder="User Other Allowance" value="<?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 } ?>
        </div> <!-- end col -->
    </div> <!-- end row -->
    
<?php require "../inc/footer.php"; ?>
<script type="text/javascript">
$("#clearbtn").click(function(){
    $("#search").val('');
    $("#searchForm").submit();
});
function redirect_(uri){
    window.location.href = uri;
}
$(".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;
    }
});
$(".FormBtn").click(function(){
    $.ajax({
        type: 'POST',
        url: "",
        data: $('.personalInfoForm').serialize()+"&"+$('.contactInfoForm').serialize()+"&"+$('.socialInfoForm').serialize()+"&"+$('.contactOfiInfoForm').serialize()+"&"+$('.officeInfoForm').serialize()+"&action=ajax_call_1",
        success: function(response) { 
          window.location.href = response;
        }
    });
});

$("#erp_sys_user_country").change(function(){
    var country = $("#erp_sys_user_country option:selected").val();
    $.ajax({
        type: 'POST',
        url: "",
        data: {"country_id":country,"action":"ajax_call"},
        success: function(response) { 
            obj = JSON.parse(response);
            $("#erp_sys_user_state").html("<option value=''>Select State / Province</option>"+obj.option);
        }
    });
})
$(function() {
    $("#erp_sys_user_city").autocomplete({
        source: function(request, response) {
            $.getJSON("", { country_id: $('#erp_sys_user_country option:selected').val(),state_id: $('#erp_sys_user_state option:selected').val(),keyword: request.term,action:"ajax_call1" }, response);
        },
        minLength: 2,
    });
});
$(".date").datepicker();
</script>