<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>

<c:set var="prefixName" scope="request">단속 상태 정보</c:set>

<!-- inner page html -->
<div class="content-pop" data-doctx="${pageName}">
	<!-- Content -->
	<div class="container-xxl flex-grow-1 px-0">
		<div class="card">
			<!-- 입력 영역 -->
			<form name="frmEdit">
				<!-- hidden -->
				<input type="hidden" name="sggCd" data-map="SGG_CD" />
				<input type="hidden" name="taskSeCd" data-map="TASK_SE_CD" />
				<input type="hidden" name="crdnId" data-map="CRDN_ID" />

				<div class="row g-1">
					<div class="col-md-12">
						<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="crdnSttsCd" >처리상태</label>
						<select is="id-select" class="form-select" name="crdnSttsCd" data-map="CRDN_STTS_CD" required>
							<option value="">선택하세요</option>
							<c:forEach items="${FIM010List}" var="item">
								<option value="${item.code}">${item.value}</option>
							</c:forEach>
						</select>
					</div>
					<!-- DB에 등록할 때 문구가 추가로 붙기 때문에 data-maxlengthb="900" 으로 지정 -->
					<div class="col-md-12">
						<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="etcCn">기타내용</label>
						<input is="id-input" type="text" class="form-control w-85" name="etcCn"	data-maxlengthb="900" />
					</div>
				</div>
			</form>
			<!-- 입력 영역 -->
        </div> <!-- <div class="card"> -->

		<!-- 업무 버튼 및 건수 표시 -->
		<div>
			<span class="container-page-btn">
				<!-- 업무 버튼 -->
				<span class="container-window-btn-right">
					<button type="button" class="btn btn-primary w-px-120" name="btnSave" title="저장">
						저장
					</button>
				</span>
			</span>
		</div>
		<!-- 업무 버튼 및 건수 표시 -->
	</div> <!-- <div class="container flex-grow-1 px-0"> -->
	<!-- Content -->
</div>
<!-- / inner page html <div class="content-pop"> -->

<script>
    LoadScript("crdn06030Script",wctx.url("/resources/js/fims/crdn/crdn06030.js?ver=${ver}"));

    /**************************************************************************
     * Global Variable
     **************************************************************************/
    pageObject["${pageName}"] = newDoctxFinder("${pageName}");

    /**************************************************************************
     * script 진입
     **************************************************************************/
    $(document).ready(function() {
        // pageObject
        let $P = pageObject["${pageName}"];

        // URL
        $P.prefixUrl = "${prefixUrl}"
        // infoDialog 호출 용도(view 조회(편집불가), create 등록, update 수정)
        $P.callPurpose = "${callPurpose}";
        // datasetControl
        $P.ctrl = newCrdn06030Control("${pageName}", "[data-doctx=${pageName}]");

        /**************************************************************************
         * 사용자 함수(function)
         **************************************************************************/


        /**************************************************************************
         * 버튼 clickEvent
         **************************************************************************/
        // 저장 버튼 클릭 이벤트
        $P.fnSave = () => {
            // validate 확인
            if (!AppSupport.customValidate($P.$findn("frmEdit").find("input, select, textarea"))) return;

            dialog.alert({
                  content: "현재 " + $P.ctrl.prefixName + " 정보를 저장하시겠습니까?"
                , init: () => {
                    AppSupport.setDialogZindex();
                    AppSupport.focusOK();
                }
                , onOK: () => {
                    let params = new FimsFormFields($P.selectorn("frmEdit")).get(); // formFields

                	$P.ctrl.save(params);
                }
            });
        }

        /**************************************************************************
         * 초기 셋팅
         **************************************************************************/
        // 이벤트 설정
        $P.setEvent = () => {
            // 버튼 이벤트
            $P.$findn("btnSave").on("click", () => $P.fnSave());                // 저장
        }

        // 초기 화면 설정
        $P.fnReset = () => {
            // 초기화
            $P.findn("frmEdit").reset();                                        // 화면 초기화
        }

        /**************************************************************************
        * 최초 실행 함수
        **************************************************************************/
        // 1. 이벤트 설정
        $P.setEvent();

        // 2. 초기 화면 설정
        $P.fnReset();

        // 3. Dataset 설정
        $P.ctrl.setData([${Info}]);
	});

</script>
