<!DOCTYPE html>
<html lang="ko"
	  xmlns:th="http://www.thymeleaf.org"
	  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
	  layout:decorator="web/common/layout/MypageLayoutWeb">
<!--
 *******************************************************************************
 * @source  : MypageCustConfirmFormWeb.html
 * @desc    : 마이페이지 > 회원정보 확인 Page
 *============================================================================
 * STYLE24
 * Copyright(C) 2021 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.03.15   jsshin      최초 작성
 *******************************************************************************
 -->

<body>
<th:block layout:fragment="content">
	<div class="content myManageEntry"> <!-- 페이지특정 클래스 = myManageEntry -->
		<div class="cont_body">
			<!-- CONT-BODY -->
			<div class="lnb">
				<div class="lnb_tit">
					<h2>마이페이지</h2>
				</div>
				<div class="lnb_list">
					<ul id="mypageLnbList"></ul>
				</div>
			</div>
			<div class="cont">
				<div class="sec_head">
					<h3 class="subH1">내 정보 관리</h3>
					<p class="text">정보를 안전하게 보호하기 위하여 비밀번호를 다시 확인 합니다.</p>
				</div>
				<form id="confirmForm" class="form_wrap" role="form" action="/mypage/customer/modify/form" method="post">
					<div class="sec_body">
						<div class="tbl type1">
							<table>
								<colgroup>
									<col width="210">
									<col width="*">
								</colgroup>
								<tbody>
									<tr>
										<th>아이디</th>
										<td>
											<div class="form_field">
												<div class="input_wrap">
													<th:block th:if="${snsType == ''}">
														<input type="text" id="custId" name="custId" class="form_control" th:value="${custId}" readonly="readonly"/>
													</th:block>
													<th:block th:unless="${snsType == ''}">
														<th:block th:if="${snsType == 'NV'}">
															<span>네이버 간편가입회원</span>
														</th:block>
														<th:block th:if="${snsType == 'KK'}">
															<span>카카오 간편가입회원</span>
														</th:block>
														<th:block th:if="${snsType == 'YS'}">
															<span>YES24 간편가입회원</span>
														</th:block>
													</th:block>
												</div>
											</div>
										</td>
									</tr>
									<tr>
										<th>비밀번호</th>
										<td>
											<div class="form_field">
												<div class="input_wrap">
												<input type="password" id="passwd" name="passwd" class="form_control" placeholder="비밀번호를 입력해주세요."/>
												</div>
											</div>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<div class="btn_footer_area">
						<button type="button" class="btn btn_default btn_md" onclick="cfnGoToPage(_PAGE_MAIN);">
							<span>취소</span>
						</button>
						<button type="button" id="btnConfirm" class="btn btn_dark btn_md">
							<span>확인</span>
						</button>
					</div>
				</form>
			</div>
		</div>
	</div>
<script th:inline="javascript">
	/*<![CDATA[*/
	$(document).ready(function() {
		// 마이페이지 LNB 설정
		fnSetMypageLnbList(10);

		// 마이페이지 location 설정
		fnSetMypageLocation('내정보 관리');

	});

	//엔터키 확인
	$('#confirmForm input[name=passwd]').keypress(function (event) {
		if (event.which === 13) {
			event.preventDefault();
			fnValidConfirm();
		}
	});

	// 확인버튼
	$('#btnConfirm').on('click', function () {
		fnValidConfirm();
	});

	// 확인
	var fnValidConfirm = function () {
		var $passwd = $('#confirmForm input[name=passwd]');
		if (gagajf.isNull($passwd.val())) {
			$passwd.blur();
			mcxDialog.alertC("비밀번호를 입력해 주세요.", {
				sureBtnText: "확인",
				sureBtnClick: function () {
					$passwd.focus();
				}
			});
			return;
		}
		gagajf.ajaxFormSubmit("/mypage/customer/password/confirm", '#confirmForm', fnConfirmCallback);
	};

	var fnConfirmCallback = function (result) {
		let $passwd = $('#confirmForm input[name=passwd]');
		let $custId = $('#confirmForm input[name=custId]');
		if (result.isMatch) {
			$('#confirmForm').submit();
		} else {
			$passwd.val('');
			$custId.focus();
			mcxDialog.alertC('비밀번호가 일치하지 않습니다.', {
				sureBtnText: '확인',
				sureBtnClick: function() {
					$passwd.focus();
				}
			});
			return;
		}
	};
	/*]]>*/
</script>

</th:block>

</body>
</html>


