  <footer id="footer" class="footer">

    <div class="container">
      <div class="copyright">
        Copyright &copy; <?=date('Y')?> Green Oil Inc. All Rights Reserved.
      </div>
      
    </div>


  </footer><!-- End Footer -->
  <!-- End Footer -->

<? if ($view != "map") { ?>
  <a href="#" class="scroll-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>

  <div id="preloader"></div>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js"></script>

<? } ?>
 
<?

 if ($_SESSION["ss_UID"] != "") {
		// Get Information
		$qry_m = "SELECT * FROM tbl_member WHERE m_uid = '".$_SESSION['ss_UID']."' ";
		$rt_m=$jdb->fQuery($qry_m, "fetch query error");
		//	echo"$query";

		for($i=0; $i<sizeof($rt_m); $i++)
		{
			//list($key, $value) = each($result);
			foreach ( (Array) $list as $key => $value )
			$$key = $value;
		}

		$m_firstnameSTR = str_replace("\\", "", $m_firstname);
		$m_lastnameSTR = str_replace("\\", "", $m_lastname);
		$m_cellSTR = str_replace("\\", "", $m_cell);
		$m_initialSTR = str_replace("\\", "", $m_initial);
		$m_commentSTR = str_replace("\\", "", $m_comment);
}

?>

<script>
$(document).ready(function(){

		// 숫자만 입력가능 xxx-xxx-xxxx 형식으로 자동 - 삽입
		$('#m_cell').on('input', function() {
		    var number = $(this).val().replace(/[^\d]/g, '')
		    if (number.length == 7) {
		      number = number.replace(/(\d{3})(\d{4})/, "$1-$2");
		    } else if (number.length == 10) {
		      number = number.replace(/(\d{3})(\d{3})(\d{4})/, "$1-$2-$3");
		    }
		    $(this).val(number);
		});
			
	//$("#email").val("");
	//$('#userinfo')[0].reset();
  $("#personinfo").validate({
    // Specify validation rules
    ignore: ".ignore",
    rules: {
      m_userid: {
        required: true,
        email: true
      },      
      m_pwd: {
        required: true,
        minlength: 6,
      },
      m_pwd_chk: {
        required: true,
        minlength: 6,
        equalTo : '[name="m_pwd"]'
      },      
      m_firstname: {
        required: true,
      },
      m_lastname: {
        required: true,
      },  

    /*        hiddenRecaptcha: {
                required: function () {
                    if (grecaptcha.getResponse(1) == '') {
                        return true;
                    } else {
                        return false;
                    }
                }
            }
		*/
    },
    messages: {
    
				m_userid: {
						required: "Please input email address",
						email: "Please input a valid email address.",
				},
				m_pwd: {
						required: "Please input password (Minimum of 6 characters)",
						minlength: "Minimum of 6 characters.",
				},
				m_pwd_chk: {
						required: "Password and confirm password don't match",
						minlength: "Minimum of 6 characters.",
						equalTo : "Password and confirm password don't match",
				},  
				m_firstname: {
						required: "Please input First name",
				},				
				m_lastname: {
						required: "Please input Last name",
				},			
			
				//hiddenRecaptcha: {
				//		required: "Please check the checkbox.",
				//},   				
    },
    errorElement : 'div',
    /*submitHandler: function(form) {
    		if (grecaptcha.getResponse(1) == '') alert("Error");
    		else form.submit();
  	}*/
  });
});
</script>

<style>
.error{
	color: red;
	font-weight: 400;
	padding:1em;
	font-size: 14px;
}		
</style>

<? include getenv("DOCUMENT_ROOT")."/include/message_js.php"; ?>

<!-- Start of Modal -->
                <div id="member-detail-modal" class="modal fade customer-info">
                  <div class="modal-dialog" role="document">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h4 class="modal-title">USER INFORMATION</h4>
                        <button type="button" class="btn" data-dismiss="modal" aria-label="Close" style="color:#fff;"><i class="bi bi-x"></i></button>
                      </div>
                      <div class="modal-body">
<?

	$qry_m = "SELECT * FROM tbl_member WHERE m_uid = '".$_SESSION['ss_UID']."'";
	$rt_m = $jdb->fQuery($qry_m, "query error");
	
	// No data
	if ($rt_m[0] =="") {
		$msg = "Invaild data. Please try again.";
		$func -> modalMsg ($msg, "/index_intranet.php?view=customer_list&$goStr");
		exit();
	}
	
	$p_firstnameSTR = str_replace("\\", "", $rt_m['m_firstname']);
	$p_lastnameSTR = str_replace("\\", "", $rt_m['m_lastname']);
	$p_cellSTR = str_replace("\\", "", $rt_m['m_cell']);

?>

        <FORM NAME=personinfo ID=personinfo METHOD=POST ACTION=/lib/user_process.php>
						<input type=hidden name=mode value="update">
						<input type=hidden name=m_uid value="<?=$_SESSION['ss_UID']?>">
						<input type=hidden name=actionStr value="PERSONINFO">
						<input type=hidden name=emailValidate id='emailValidateid' value="">
						<input type=hidden name=goStr id='goStr' value="<?=$goStr?>">
						<input type=hidden name=view value=<?=$view?>>
				
						<input type=hidden name=switched value="<?=$switched?>">
						<input type=hidden name=page value="<?=$page?>">
						<input type=hidden name=key_word value="<?=$key_word?>">
						<input type=hidden name=column value="<?=$column?>">
						<input type=hidden name=sorting_type value="<?=$sorting_type?>">
						<input type=hidden name=switch value="<?=$switch?>">
				
                          <table class="tb-info-box">

                            <tr>
                              <td class="td-title-info">User ID</td>
                              <td class="td-text-info">
                                <input type="email" name="m_userid" id="m_userid" placeholder="company@company.com" required='required' value='<?=$_SESSION['ss_ID']?>' option='email' <?=$admTag?> onBlur="checkEmail();" DISABLED>

                              </td>
                            </tr>

                            <tr>
                              <td class="td-title-info">Password</td>
                              <td class="td-text-info">
                                <input TYPE='password' NAME='m_pwd' id="m_pwd" required='required' VALUE='' minlength="6" maxlength=15>

                              </td>
                            </tr>

                            <tr>
                              <td class="td-title-info">Re-Password</td>
                              <td class="td-text-info">
                                <input type="password" NAME='m_pwd_chk' id="m_pwd_chk" required='required' VALUE='' minlength="6" maxlength=15>

                              </td>
                            </tr>

                            <tr>
                              <td class="td-title-info">Frist Name</td>
                              <td class="td-text-info">
                                <input type="text" NAME='m_firstname' id='m_firstname' placeholder="James" required='required'  VALUE='<?=htmlspecialchars($p_firstnameSTR, ENT_QUOTES)?>' maxlength=50>

                              </td>
                            </tr>

                            <tr>
                              <td class="td-title-info">Last Name</td>
                              <td class="td-text-info">
                                <input TYPE='text' NAME='m_lastname' id='m_lastname' placeholder="Lee" required='required'  VALUE='<?=htmlspecialchars($p_lastnameSTR, ENT_QUOTES)?>' maxlength=50>

                              </td>
                            </tr>

                            <tr>
                              <td class="td-title-info">Cell</td>
                              <td class="td-text-info">
                                <input type="text" name='m_cell' id='m_cell' placeholder="416-777-8888" value="<?=htmlspecialchars($p_cellSTR, ENT_QUOTES)?>" maxlength="12">
                              </td>
                            </tr>

<!--
                            <tr>
                              <td class="td-title-info">Last Login Date</td>
                              <td class="td-text-info">
                                <input type="date" id="lastlogindate" name="lastlogindate">
                              </td>
                            </tr>     
                            
                            <tr>
                              <td class="td-title-info">Signup Date</td>
                              <td class="td-text-info">
                                <input type="date" id="signupdate" name="signupdate">
                              </td>
                            </tr>     
                                                        
                            <tr>
                              <td class="td-title-info">Login No</td>
                              <td class="td-text-info">
                                <input type="number" id="loginnum" name="loginnum" placeholder="1234545">
                              </td>
                            </tr>

                            <tr>
                              <td class="td-title-info">Status</td>
                              <td class="td-text-info">
                                <select id="status" name="status" class="custom-select">
                                  <option value="allow">Allow</option>
                                  <option value="deny">Deny</option>
                                </select>
                              </td>
                            </tr>
                            
                            <tr>
                              <td class="td-title-info">Level</td>
                              <td class="td-text-info">
                                <select id="level" name="level" class="custom-select">
                                  <option value="admin">Admin</option>
                                  <option value="staff">Staff</option>
                                  <option value="manager">Manager</option>
                                  <option value="driver">Driver</option>
                                </select>
                              </td>
                            </tr>


                                                        
                            <tr>
                              <td class="td-title-info">Access</td>
                              <td class="td-text-info">
                                <select id="access" name="access" class="custom-select">
                                  <option value="local">Local</option>
                                  <option value="internet">Internet</option>
                                </select>
                              </td>
                            </tr>

                            <tr>
                              <td class="td-title-info">Memo</td>
                              <td class="td-text-info">
                                <textarea id="memo" class="textarea" name="memo" rows="4" cols="20"></textarea>
                              </td>
                            </tr>
-->                            
                          </table>
                          <br>
                          <div class="text-center grid-layout-col-2">
                            <button type="submit" class="btn-sub">SAVE</button>
                            <button type="button" class="btn-gray" data-dismiss="modal">CLOSE</button>
                          </div>
</FORM>
                      </div>
                    </div><!-- modal-content ends -->
                  </div><!-- modal-dialog ends -->
                </div>
                
<!-- End of Modal -->


</body>

</html>
