<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
<script>
$( function(){
    $( "#newForm" ).validate({
        rules: {
            phoneNumber : {
                phoneValid : true
            },
            passwordConfirm : {
                 equalTo: "#passwordNew"
            },
            passwordNew :{
                passwordValid : true
            }
        },
        messages : {
        	passwordConfirm : {
                equalTo: "신규 비밀번호가 일치하지 않습니다."
            }
        },
        onkeyup: function( element, event ) {
            $( element ).valid();
        },
        onfocusout: function (element) {
            $( element ).val( $.trim( $( element ).val() ) );
            $( element ).valid();
        },
        submitHandler: function(form) {
            $("#mainAddr").removeAttr("disabled");
            form.submit();
        }
    });
})
</script>
</head>
<body>
    <div class="wrapper">
        <jsp:include page="${data._INCLUDE}/sidebar.jsp"></jsp:include>
        
        <div class="main">
            <jsp:include page="${data._INCLUDE}/top.jsp"></jsp:include>

            <main class="content">
                <div class="container-fluid p-0">
                    <!-- 환자관리 : 신규환자 등록 START -->
                    <div class="row">
                        <div class="col-12 col-lg-6">
                            <h1 class="h3 mb-3">내정보 변경</h1>
                        </div>
                        <div class="col-12 col-lg-6  text-right">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="javscript:;">Home</a></li>
                                    <li class="breadcrumb-item active">의료진 관리</li>
                                    <li class="breadcrumb-item active">내정보 변경</li>
                                </ol>
                            </nav>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12">
                            <div class="card">
                                <form action="./myinfo/update" id="newForm">
                                <input type="hidden" value="${returnUrl}" name="returnUrl">
                                    <div class="card-body">
                                        <table class="table mobile-table">
                                            <colgroup>
                                                <col style="width:15%">
                                                <col style="width:35%">
                                                <col style="width:15%">
                                                <col style="width:35%">
                                            </colgroup>
                                            <tr>
                                                <th>아이디</th>
                                                <td>
                                                    <c:out value="${info.id}" />
                                                    <input type="hidden" name="id" value="${info.id}">
                                                </td>
                                                <th>이름</th>
                                                <td>
                                                    <c:out value="${info.name}" />
                                                    <input type="hidden" name="name" value="${info.name}">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th><span class="fix">*</span>현재 비밀번호</th>
                                                <td colspan="3">
                                                    <input type="password" class="form-control" id="password" name="password" placeholder="정보수정을 위해 비밀번호를 입력해주세요." required>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>신규 비밀번호</th>
                                                <td colspan="3">
                                                    <input type="password" class="form-control" id="passwordNew" name="passwordNew" placeholder="비밀번호 변경시에만 입력해주세요.(영문, 숫자, 특수문자를 혼합하여 8 ~ 15자 이내)">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>신규 비밀번호 확인</th>
                                                <td colspan="3">
                                                    <input type="password" class="form-control" id="passwordConfirm" name="passwordConfirm" placeholder="신규 비밀번호 확인을 위해 비밀번호를 한번 더 입력하세요.">
                                                </td>
                                            </tr>
                                            <tr>
                                                <th><span class="fix">*</span>휴대폰번호</th>
                                                <td>
                                                    <input type="text" class="form-control" value="${info.phoneNumber}" name="phoneNumber" placeholder="010-1234-1234" required onkeypress="onlyNumber();">
                                                </td>
                                                <th>치료센터</th>
                                                <td>
                                                    <c:out value="${info.centerName}" />
                                                </td>
                                            </tr>
                                        </table>
                                        <div class="row mt-3">
                                            <div class="col-12">
                                                <div class="text-right">
                                                    <button type="button" class="btn btn-outline-primary w100">취소</button>
                                                    <button type="submit" class="btn btn-primary w100">수정</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!-- 환자관리 : 신규환자 등록 END -->
                </div>
            </main>

            <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
        </div>
    </div>
</body>
</html>