<?php
	include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';

?>
<?php include("../include/inc_top.php") ?>

<main class="normal--wrap pb123">
	<section class="idpw--form--wrap">
		<h2 class="">ID/PW 찾기</h2>
		<p>회원님의 아이디와 패스워드를 찾아드립니다.</p>
		<div class="idpw--form--contents">
			<div class="tab">
				<div class="tab--items">
					<a href="find_id.php">아이디 찾기</a>
					<a href="javascript:;" class="actv">비밀번호 찾기</a>
				</div>
				<div class="inner--contents">
					<h2>등록된 아이디와 휴대폰 번호로 찾기</h2>
					<p>회원가입에 등록한 휴대번호를 인증하여 회원님의 비밀번호를 찾을 수 있습니다!</p>
					<div class="items--box">
						<div>
							<label>아이디</label>
							<input type="text" class="form-control" id="cd_userid" name="cd_userid" />
						</div>
						<div>
							<label>휴대폰 번호</label>
							<div class="d-flex align-items-center">
								<select id="nm_hp1" class="form-select" style="max-width:90px;"></select>
								<label for="nm_hp2" class="ml10 mr10">-</label>
								<input type="text" class="form-control" id="nm_hp2" name="nm_hp2" style="max-width:117px;" maxlength="4">
								<label for="nm_hp3" class="ml10 mr10">-</label>
								<input type="text" class="form-control" id="nm_hp3" name="nm_hp3" maxlength="4">
							</div>
						</div>

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


			<div class="col-12 d-flex justify-content-center join--btn--wrap mt70">
				<button type="button" class="btn btn-secondary cancel--btn" style="width:180px; height:55px;" id='btn_cancel'>취소</button>
				<button type="button" class="btn btn-primary ml15" style="width:180px; height:55px;" id='btn_proc'>확인</button>
			</div>
		</div>
	</section>





	<!-- 임시 패스워드 전송 -->
	<div class="modal fade type2" id="findPwdModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog  modal-dialog-centered" style="max-width:400px;">
			<div class="modal-content">
				<div class="icon--wrap">
					<div class="thumb pp--ic"></div>
				</div>
				<div class="modal-body modal--body">
					<h2>임시 패스워드를 전송</h2>
					<p>휴대번호로 임시 패스워드를 전송했습니다.</p>
				</div>
				<div class="modal-footer d-flex justify-content-center ty2">
					<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">취소</button>
					<button type="button" class="ml20 btn btn-primary" id='btn_proc_confirm'>확인</button>
				</div>
			</div>
		</div>
	</div>

</main>

<script>
$(function() {
	setCodeSelect("listPhone","nm_hp1","","","","선택","");

	$("#btn_cancel").on("click", function() {
		link("login.php");
	});

	$("#btn_proc_confirm").on("click", function() {
		$(".idpw--form--contents input, .idpw--form--contents select").each(function() {
			$(this).val("");
		});
		$("#findPwdModal").modal("hide");
	});

	$("#btn_proc").on("click", function() {
		var custom_opts = {
			title : '',
			btn_close_show : false,
		}

		var fieldlist = [["cd_userid","아이디"],["nm_hp1","휴대폰 번호"], ["nm_hp2", "휴대폰 번호"], ["nm_hp3", "휴대폰 번호"]];

		if (!fnCheckForm(fieldlist)){
			return false;
		}

		var nm_hp = $("#nm_hp1").val()+"-"+$("#nm_hp2").val()+"-"+$("#nm_hp3").val();
		$.post("join_proc.php", { mode:"PwdSearch", cd_userid: $("#cd_userid").val(), nm_hp: nm_hp},function(res) {
			if(res.CODE != "0000") {
				// custom_opts.title = res.MSG;
				custom_opts.title = '입력하신 정보가 정확하지 않습니다.';

				custom_modal_alert(custom_opts);
				return false;
			}

			$("#findPwdModal").modal("show");
		}, "json");
	});
});
</script>

<?php include("../include/inc_bottom.php") ?>
<?
mysql_close($connect);
?>
