<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<div class="spinner-border spinner-border-lg text-primary wait" style="display:none;" role="status">
  <span class="visually-hidden">Loading...</span>
</div>

<!-- Core JS -->
<script src="<c:url value="/webjars/3rd-party/sneat/libs/jquery/jquery.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/libs/popper/popper.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/js/bootstrap.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/jquery-ui/1.13.2/jquery-ui.js"/>"></script>

<script src="<c:url value="/webjars/3rd-party/sneat/js/config.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/libs/perfect-scrollbar/perfect-scrollbar.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/js/helpers.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/js/menu.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/libs/jstree/jstree.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/jstree/jstree-support.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/libs/jquery-sticky/jquery-sticky.js" />"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/libs/bootstrap-datepicker/bootstrap-datepicker.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/libs/block-ui/block-ui.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/libs/dropzone/dropzone.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/js/dropdown-hover.js"/>"></script>

<!-- base -->
<script src="<c:url value="/webjars/js/base/base.js"/>"></script>
<script src="<c:url value="/webjars/js/base/dataset.js"/>"></script>
<script src="<c:url value="/webjars/js/base/dataset-support.js"/>"></script>
<script src="<c:url value="/webjars/js/base/upload-support.js?${ver}"/>"></script>
<script src="<c:url value="/webjars/js/base/code.js"/>"></script>
<script src="<c:url value="/webjars/js/base/code-support.js"/>"></script>
<script src="<c:url value="/webjars/js/base/menu.js"/>"></script>
<script src="<c:url value="/webjars/js/base/menu-support.js"/>"></script>
<script src="<c:url value="/webjars/js/base/actionGroup.js"/>"></script>
<script src="<c:url value="/webjars/js/base/user.js"/>"></script>
<script src="<c:url value="/webjars/js/base/sgg-dept.js"/>"></script>
<script src="<c:url value="/webjars/js/base/authority.js"/>"></script>
<!-- base:사전정의요소 클립보드 저장 -->
<script src="<c:url value="/webjars/js/support/toolPalette.js?${ver}"/>"></script>

<!-- 공통 유틸(applib) -->
<script src="<c:url value="/webjars/applib/js/app-base.js?${ver}"/>"></script>
<script src="<c:url value="/webjars/applib/js/string-support.js?${ver}"/>"></script>
<script src="<c:url value="/webjars/applib/js/date-support.js?${ver}"/>"></script>
<script src="<c:url value="/webjars/applib/js/app-support.js?${ver}"/>"></script>
<script src="<c:url value="/webjars/applib/js/componentization.js?${ver}"/>"></script>

<script src="<c:url value="/resources/js/fims/cmmn/fims-base.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/customElements.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/fims-support.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/fims-componentization.js?${ver}"/>"></script>

<!-- 개발 편의성 유틸 -->
<script src="<c:url value="/resources/js/fims/cmmn/detect.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/objectInspector.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/fims/cmmn/registByXml.js?${ver}"/>"></script>

<!-- endbuild -->
<c:set var="functions" scope="request">
wctx.path = "${pageContext.request.contextPath}";
wctx.version = "${ver}";
wctx.trace = ${!production};
wctx.csrf = {
	header:"${_csrf.headerName}",
	token:"${_csrf.token}"
};
dialog.title = "북촌 통행제한 관리 시스템";
dialog.timeout = 1500;

function currentTask() {
	let checked = document.querySelector("div#taskSeCd--Top input[type='radio']:checked");
	return checked ? checked.value : "";
}

<c:if test="${currentUser.authenticated}">
function logout() {
	dialog.alert({
		content:"로그아웃 하시겠습니까?",
		onOK:function(){
			var form = $("<form action=\"<c:url value='/logout.do'/>\", method=\"POST\">");
			$("<input name=\"${_csrf.parameterName}\" value=\"${_csrf.token}\" type=\"hidden\">").appendTo(form);
			form.appendTo("body").submit();
		}
	});
}</c:if>

<c:if test="${currentUser.hasAuthorities('ROLE_ADMIN')}">
async function selectURL(multiple) {
	return new Promise(function(resolve, reject) {
		ajax.get({
			url:wctx.url("/urls.do"),
			data:{multiple:multiple},
			success: resp => {
				dialog.open({
					title:"URL 선택",
					content:resp,
					getData:() => getSelectedURL(),
					onOK:selected => {
						resolve(selected);
					}
				});
			}
		});
	});
}
</c:if>

</c:set>
