<?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'].'" ','');
    echo 'users-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 ,'users-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> User profile picture not saved!</div>');
        echo "<script>location.href='users-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']).'" ','users-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='users-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 user id !</div>');
    }else{
        $id = !empty($_POST['user_id'])?$_POST['user_id']:0;
        $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> User id already exists !</div>');
        }
    }

    if(empty($_POST['erp_sys_user_email_personal'])){
        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 user email id !</div>');
    }else{
        $id = !empty($_POST['user_id'])?$_POST['user_id']:0;
        $cntA = $commonFunctions->getRowData('sys_erp_adm_user',' WHERE id NOT IN('.$id.') AND erp_sys_user_email_personal = "'.$_POST['erp_sys_user_email_personal'].'" ');
        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> User email id 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']."' ) ",'');

            $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']."' ) ",'users-form.php?state=form');
        }
        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('global_contacts'," WHERE id = '".$_POST['user_id']."' ", " global_user_name_first = '".$_POST['erp_sys_user_name_first']."', global_user_name_middle='".$_POST['erp_sys_user_name_middle']."', global_user_name_last='".$_POST['erp_sys_user_name_last']."' , global_user_email_personal='".$_POST['erp_sys_user_email_personal']."' , global_user_mobile1='".$_POST['erp_sys_user_mobile1']."', global_user_mobile2='".$_POST['erp_sys_user_mobile2']."', global_user_mobile_work='".$_POST['erp_sys_user_mobile_work']."' , global_org_name='".$_POST['erp_sys_org_name']."' , global_user_job_title='".$_POST['erp_sys_user_job_title']."', global_org_phone_work='".$_POST['erp_sys_org_phone_work']."', global_user_org_phone_work_ext='".$_POST['erp_sys_user_org_phone_work_ext']."', global_org_fax='".$_POST['erp_sys_org_fax']."', global_user_email_work='".$_POST['erp_sys_user_email_work']."', global_user_id_sm_linkedin='".$_POST['erp_sys_user_id_sm_linkedin']."', global_user_id_sm_twitter='".$_POST['erp_sys_user_id_sm_twitter']."', global_user_id_sm_facebook='".$_POST['erp_sys_user_id_sm_facebook']."', global_user_id_sm_instagram='".$_POST['erp_sys_user_id_sm_instagram']."', global_user_id_msngr_skype='".$_POST['erp_sys_user_id_msngr_skype']."', global_user_id_msngr_whatsapp='".$_POST['erp_sys_user_id_msngr_whatsapp']."', global_user_id_msngr_imo='".$_POST['erp_sys_user_id_msngr_imo']."', global_user_id_msngr_telegram='".$_POST['erp_sys_user_id_msngr_telegram']."', global_user_id_msngr_signal='".$_POST['erp_sys_user_id_msngr_signal']."', global_user_id_msngr_botim='".$_POST['erp_sys_user_id_msngr_botim']."', global_user_id_messanger_viber='".$_POST['erp_sys_user_id_messanger_viber']."'",'');

            $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']."' ",'users.php?state=list');
        }
    }else{
        echo "<script>location.href='users-form.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">Users</h4>
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Settings</a></li>
                            <li class="breadcrumb-item"><a href="javascript:void(0);">User Management</a></li>
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Users<?php echo (!empty($_GET['state']) and $_GET['state'] == "form")?" Form ":" List "; ?></a></li>
                        </ol>
                    </div><!--end col-->
                    <?php if($_GET['state'] != "list"){ ?>
                        <a href="users.php?state=list"><button type="button" class="btn btn-sm btn-outline-secondary clear_form">Back to Users 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 echo !empty($msg)?$msg:''; ?>        
            <?php echo !empty($msg1)?$msg1:''; ?>
            
            <?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 Users</p>
                                        <h3 class="m-0"><?php echo $commonFunctions->getRowDataCount('sys_erp_adm_user',''); ?></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 Users</p>                
                                        <h3 class="m-0"><?php echo $commonFunctions->getRowDataCount('sys_erp_adm_user',' WHERE erp_sys_user_isActive = 0 '); ?></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 Users</p>
                                        <h3 class="m-0"><?php echo $commonFunctions->getRowDataCount('sys_erp_adm_user',' WHERE erp_sys_user_isActive = 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" ){ ?>
                <form enctype="multipart/form-data" action="users-form.php?state=form&action=add" method="post" name="formsoc" autocomplete="off">      
                    <div class="tab-content" id="pills-tabContent">
                        <!-- User Profile - Start --->
                        <div class="tab-pane fade show active">
                            <div class="row">
                                <div class="col-lg-6 col-xl-6">
                                    <div class="card">
                                        <div class="card-header">
                                            <div class="row align-items-center">
                                                <div class="col-11">                      
                                                    <h4 class="card-title text-left">Staff Details ( Personal )</h4>                      
                                                </div><!--end col-->                                                     
                                            </div>  <!--end row-->                                  
                                        </div><!--end card-header-->
                                        <div class="card-body">                              
                                            <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="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">First Name <span class="error">*</span></label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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" required>
                                                </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">
                                                    <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>
                                            <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">
                                                    <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>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Mobile Number (1)<span class="error">*</span></label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <div class="input-group">
                                                        <div class="input-group-prepend"><span class="input-group-text"><i class="las la-phone"></i></span></div>
                                                        <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 Number (1)" required>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Mobile Number (2)</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <div class="input-group">
                                                        <div class="input-group-prepend"><span class="input-group-text"><i class="las la-phone"></i></span></div>
                                                        <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 Number (2)">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Email ( Personal ) <span class="error">*</span></label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <div class="input-group">
                                                        <div class="input-group-prepend"><span class="input-group-text"><i class="las la-at"></i></span></div>
                                                        <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" required>
                                                    </div>
                                                </div>
                                            </div>
                                            <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">
                                                    <textarea name="erp_sys_user_address" id="erp_sys_user_address" class="form-control"><?php echo @$editData['erp_sys_user_address'];?></textarea>
                                                </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">
                                                    <?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>
                                            <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">
                                                    <?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>
                                            <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">
                                                    <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>                                                    

                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Zipcode</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                            
                                        </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">Passport #</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input type="text" name="erp_sys_hrm_users_pp_num" class="form-control" placeholder="User Passport No">
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Date of Issue</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input type="text" name="erp_sys_hrm_users_pp_issue_dt" class="date form-control" placeholder="User Passport Date of Issue">
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Date of Expire</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input type="text" name="erp_sys_hrm_users_pp_expry_dt" class="date form-control" placeholder="User Passport Date of Expire">
                                                </div>
                                            </div>
                                            <!-- <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Place of Issue</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input class="form-control" type="text" placeholder="MH India">
                                                </div>
                                            </div> -->
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Passport Copy ( Front )</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input type="file" name="erp_sys_hrm_users_pass_cpy_frt" class="custom-file-input" id="customFile">
                                                    <label class="custom-file-label" for="customFile">Choose file</label>
                                                </div>
                                            </div>  
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Passport Copy( Back )</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input type="file" name="erp_sys_hrm_users_pass_cpy_bck" class="custom-file-input" id="customFile">
                                                    <label class="custom-file-label" for="customFile">Choose file</label>
                                                </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">Social Media 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">Linkedin ID</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Twitter ID</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Facebook ID</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Instagram ID</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                                                                                                                               
                                        </div>                                            
                                    </div>
                                </div>  

                                <div class="col-lg-6 col-xl-6">
                                    <div class="card">
                                        <div class="card-header">
                                            <div class="row align-items-center">
                                                <div class="col-11">                      
                                                    <h4 class="card-title text-left">Staff Details ( Official/Work )</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">Staff ID</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input class="form-control" type="password" placeholder="Staff ID">
                                                </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">
                                                    <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>
                                            <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">
                                                    <div class="input-group">
                                                        <div class="input-group-prepend"><span class="input-group-text"><i class="las la-phone"></i></span></div>
                                                        <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>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Work Phone Ext</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <div class="input-group">
                                                        <div class="input-group-prepend"><span class="input-group-text"><i class="las la-phone"></i></span></div>
                                                        <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>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Email ( Work )</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <div class="input-group">
                                                        <div class="input-group-prepend"><span class="input-group-text"><i class="las la-at"></i></span></div>
                                                        <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>
                                            </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">
                                                    <div class="input-group">
                                                        <div class="input-group-prepend"><span class="input-group-text"><i class="las la-fax"></i></span></div>
                                                        <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>
                                            </div> 
                                            <!-- <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">
                                                    <input class="form-control" type="password" placeholder="Address">
                                                </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">
                                                    <select class="form-control">
                                                        <option>India</option>
                                                        <option>USA</option>
                                                        <option>UK</option>
                                                    </select>
                                                </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">
                                                    <select class="form-control">
                                                        <option>Maharashtra</option>
                                                        <option>Gujrat</option>
                                                        <option>Rajasthan</option>
                                                    </select>
                                                </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">
                                                    <select class="form-control">
                                                        <option>Doha</option>
                                                        <option>Mumbai</option>
                                                        <option>Navi Mumbai</option>
                                                        <option>Pune</option>
                                                    </select>
                                                </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">Messanger's</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">Skype ID</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                                                                                                               
                                            <!-- <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Google Duo #</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input class="form-control" type="password" placeholder="Google Duo #">
                                                </div>
                                            </div>   
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Google Hangout ID</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input class="form-control" type="password" placeholder="Google Hangout ID">
                                                </div>
                                            </div> -->                                                                        
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">WhatsApp #</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                                                          
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">IMO #</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                                                            
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Telegram #</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                                                              
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Signal #</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                                                                                                                
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Botim #</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                                                              
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Viber #</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>                                                                                                                                      
                                        </div>                                            
                                    </div>

                                    <div class="card">
                                        <div class="card-header">
                                            <h4 class="card-title">User Credentials</h4>
                                        </div> 
                                        <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 ID <span class="error">*</span></label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <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>  
                                            <!-- <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">New Password</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input type="password" maxlength="128" name="password" id="password" value="" autofocus="autofocus" class="form-control" placeholder="Password">
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Confirm Password</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input type="text" maxlength="128" name="cnf_password" id="cnf_password" value="" autofocus="autofocus" class="form-control" placeholder="Confirm Password">
                                                </div>
                                            </div>  -->
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Staff Type</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <?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>
                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Status</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <select class="form-control" name="erp_sys_user_isActive">
                                                        <option value="1">Active</option>
                                                        <option value="2">Inactive</option>
                                                    </select>
                                                </div>
                                            </div>

                                            <div class="form-group row">
                                                <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">User Photo (Avatar)</label>
                                                <div class="col-lg-9 col-xl-8">
                                                    <input type="file" name="erp_sys_user_logo" >
                                                </div>
                                            </div>  

                                        </div> 
                                    </div>
                                </div> <!-- end col -->                                                                              
                            </div><!--end row-->
                        </div>
                        <!-- User Profile - End --->
                    </div>
                    <div class="page-title-box">
                        <div class="row">
                            <div class="col-auto align-self-center">
                                <button type="submit" class="btn btn-sm btn-success waves-effect waves-light"><i class="fas fa-times-circle align-self-center icon-xs"></i> Save</button>
                                <a href="users.php?state=list" class="btn btn-sm btn-danger waves-effect waves-light">
                                    <i class="fas fa-times-circle align-self-center icon-xs"></i> Cancel
                                </a>
                            </div><!--end col-->  
                        </div><!--end row-->                                                              
                    </div><!--end page-title-box-->                      
                </form>
            <?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,
    });
});
</script>