<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<!DOCTYPE html>
<html
		lang="kr"
		class="light-style layout-navbar-fixed layout-menu-fixed "
		dir="ltr"
		data-theme="theme-default"
		data-assets-path="<c:url value="/resources/"/>"
		data-template="vertical-menu-template-starter">
<head>
	<meta charset="UTF-8">
	<title>과태료통합관리시스템</title>

	<!-- Favicon -->
	<link rel="icon" type="image/x-icon" href="<c:url value="/resources/image/favicon.ico"/>" />

	<!-- Fonts -->
	<link rel="stylesheet" href="<c:url value="/resources/font/publicsans/fontface.css"/>" />

	<!-- Icons. Uncomment required icon fonts -->
	<link rel="stylesheet" href="<c:url value="/resources/3rd-party/sneat/fonts/boxicons.css"/>" />
	<link rel="stylesheet" href="<c:url value="/resources/3rd-party/sneat/fonts/fontawesome.css"/>" />
	<link rel="stylesheet" href="<c:url value="/resources/3rd-party/sneat/fonts/flag-icons.css"/>" />
	<link rel="stylesheet" href="<c:url value="/resources/css/fims/framework/common/xit-icon.css"/>" />
	<!-- Core CSS -->
	<link rel="stylesheet" href="<c:url value="/resources/css/fims/framework/common/xit-core.css"/>" />
	<link rel="stylesheet" href="<c:url value="/resources/3rd-party/sneat/css/theme-default.css"/>" />
	<link rel="stylesheet" href="<c:url value="/resources/3rd-party/sneat/css/docs.css"/>" />
	<link rel="stylesheet" href="<c:url value="/resources/css/fims/framework/common/xit-core-extend.css"/>" />

	<!-- Vendors CSS -->
	<link rel="stylesheet" href="<c:url value="/resources/3rd-party/sneat/libs/perfect-scrollbar/perfect-scrollbar.css"/>" />
	<link rel="stylesheet" href="<c:url value="/resources/css/styles.css"/>" />

	<link rel="stylesheet" href="<c:url value="/resources/css/fims/framework/common/common.css"/>"/>
	<link rel="stylesheet" href="<c:url value="/resources/lib/fims/framework/jquery-ui/1.13.2/themes/redmond/jquery-ui.css"/>" />
	<link rel="stylesheet" href="<c:url value="/resources/lib/fims/framework/datepicker/datepicker.css"/>" />
	

	<link href="<c:url value='/'/>resources/css/fims/framework/oldcommon.css" rel="stylesheet" type="text/css" >
	<link href="<c:url value='/'/>resources/css/fims/framework/login.css" rel="stylesheet" type="text/css" >
	
</head>
<body>
<div class="login_bg">
	<div class="header_wrap">
		<h1 class="logo"><img src="<c:url value='/'/>resources/image/fims/framework/login/mainLogo_02.png" alt="Logo Image"></img></h1>
	</div>
	<div class="login_text">
		<p class="main_img"><img src="<c:url value='/'/>resources/image/fims/framework/login/loginDeco_02.png" alt=""></img></p>
		<form id="formAuthentication" method="post">
			<div class="input_wrap">
				<div class="input-group">
					<select id="institute" name="institute" class="form-select mb-2" 
					style="height:45px;width:100%;max-width:560px;">
						<option value="4060000">파주시</option>
						<option value="default">기본</option>
					</select>
				</div>
				<div class="input-group">
					<input type="text" id="userId" value="${cookie['userAccount'].getValue()}"
						required title="계정 입력" class="typeText required form-control inp-long" placeholder="계정" autofocus/>
				</div>
				<div class="input-group input-group-merge mt-2">
					<input type="password" id="password"
						required title="비밀번호 입력" class="typePassword required form-control inp-long" placeholder="비밀번호" />
					<span class="input-group-text cursor-pointer"><i class="bx bxs-lock"></i></span>
				</div>
				<div class="input_wrap2">
					<a href="#" onclick="javascript:fn_FindId(); return false;">아이디 찾기</a>
					<a href="#" onclick="javascript:fn_FindPw(); return false;" class="line">비밀번호 찾기</a>
					<a href="#" onclick="javascript:fnReg(); return false;" class="line">회원가입</a>
				</div>
			</div>
			<input type="hidden" name="message" value="${message}" />
			<input type="hidden" name="userSe"  value="USR"/>
			<input name="j_username" type="hidden"/>
		</form>
		<div class="btn_wrap">
			<input type="button" onclick="login()" class="typeButton" title="로그인" value="로그인" />
		</div>
	</div>
</div>

<jsp:include page="/WEB-INF/jsp/include/tail.jsp" />

<script type="text/javascript">

${functions}

function login() {
	if (!$("#formAuthentication input").validInputs()) return;
	
	
	
	var params = {
			account:$("#userId").val(),
			password:$("#password").val(),
			institute:$("#institute").val()
			<%--, rememberCredentials:true--%>
		};
	json.post({
		url:wctx.url("/login.do"),
		data:params,
		success:function(resp) {
			if (resp.authenticated) {
				if (resp.message)
					dialog.alert(resp.message);
				
				wctx.home();
			} else {
				dialog.alert({
					content:resp.reason,
					onClose:() => $("#userId").focus()
				});
			}
		}
	});
}

$(function(){
	$("#formAuthentication input").onEnterPress(login);
	if ($("#userId").val())
		$("#password").focus();
});




	/**
	 * 회원가입 팝업
	 */
	function fnReg(){
		CmmPopup.open("<c:url value='/framework/biz/mng/usr/addUserPopup.do'/>", {}, {width: 1100, height:570}, '사용자 등록');
	}

	/**
	 * 아이디 찾기 팝업
	 */
	function fn_FindId(){
		CmmPopup.open("<c:url value='/login/findIdPopup/input.do'/>", {}, {width: 500, height:300}, '아이디 찾기');
	}

	/**
	 * 비밀번호 찾기 팝업
	 */
	function fn_FindPw(){
		CmmPopup.open("<c:url value='/login/findPwdPopup/input.do'/>", {}, {width: 500, height:330}, '비밀번호 찾기');
	}


</script>
</body>
</html>
