<%@ 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 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="advntceDayCnt" data-map="ADVNTCE_DAY_CNT" />

				<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" for="tnocs">총 건수/금액</label>
						<input is="id-input" type="text" class="form-control w-px-60 text-end" name="tnocs" data-map="TNOCS" data-fmt-type="number" readonly />
						<input is="id-input" type="text" class="form-control w-px-120 text-end" name="gramtFfnlgAmt" data-map="GRAMT_FFNLG_AMT" data-fmt-type="number" readonly />
					</div>
					<div class="col-md-12">
						<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="advntceRdcrt">감경율</label>
						<input is="id-input" type="text" class="form-control w-px-60 fw-bold text-end" name="advntceRdcrt" data-map="ADVNTCE_RDCRT" readonly /> %
					</div>
					<div class="col-md-12">
						<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="gramtAdvntceAmt">감경부과금액</label>
						<input is="id-input" type="text" class="form-control w-px-120 fw-bold text-red text-end" name="gramtAdvntceAmt" data-map="GRAMT_ADVNTCE_AMT" data-fmt-type="number" readonly />
					</div>
					<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="fyr">회계연도</label>
						<input is="id-input" type="text" class="form-control w-px-60" name="fyr" data-map="FYR" autocomplete="off" required />
					</div>
					<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="levyYmd">부과일자</label>
						<input is="id-input" type="text" class="form-control form-date" name="levyYmd" data-map="LEVY_YMD"
							data-fmt-type="day" autocomplete="off" title="날짜 선택" maxlength="10" required />
						<button type="button" class="bx bx-lg bx-calendar bg-white" name="btnLevyYmd"></button>
					</div>
					<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="dudtYmd">납기일자</label>
						<input is="id-input" type="text" class="form-control form-date" name="dudtYmd" data-map="DUDT_YMD"
							data-fmt-type="day" autocomplete="off" title="날짜 선택" maxlength="10" required />
						<button type="button" class="bx bx-lg bx-calendar bg-white" name="btnDudtYmd"></button>
					</div>
				</div>
			</form>
			<!-- 입력 영역 -->

			<!-- 업무 버튼 및 건수 표시 -->
            <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="card"> -->
	</div> <!-- <div class="container flex-grow-1 px-0"> -->
	<!-- Content -->
</div>
<!-- / inner page html <div class="content-pop"> -->

<script>
    LoadScript("levy01020Script", wctx.url("/resources/js/fims/levy/levy01020.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}";
        // main 의 검색 조건을 그대로 유지
        $P.mainQuery = ${mainQuery};
        // datasetControl
        $P.ctrl = newLevy01020Control("${pageName}", "[data-doctx=${pageName}]");

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


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

            // formFields
            let frmEdit = new FimsFormFields($P.selectorn("frmEdit")).get();
            let params = $.extend({}, $P.mainQuery, frmEdit);

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

        /**************************************************************************
         * 초기 설정
         **************************************************************************/
        // 이벤트 설정
        $P.setEvent = () => {
            // 부과 일자 변경 이벤트 -> 납기 일자 변경
            $P.$findn("levyYmd").on("change", function() {
                let levyYmd = $(this).val();                                    // 부과일자
                let dayCnt = Number($P.$findn("advntceDayCnt").val());          // 사전통지 일 수

                $P.$findn("dudtYmd").datepicker("setDate", DateSupport.getAddDay(levyYmd, dayCnt));
            });

            // 버튼 이벤트
            $P.$findn("btnSave").on("click", () => $P.fnSave());                // 저장
        }

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

            // 기본 데이터 설정
            $P.$findn("levyYmd").datepicker("setDate", TODAY());                // 부과 일자
            $P.$findn("dudtYmd").datepicker("setDate", TODAY());                // 납기 일자

            // 화면 호출(callPurpose)이 view라면 버튼 비활성화 disabled = true
            if ($P.callPurpose == "view") {
                // input 요소들을 disabled
                $P.$findn("frmEdit").find("input,textarea,select").prop("disabled", true);

                // button 요소들을 disabled
                $P.$findn("btnLevyYmd").prop("disabled", true);                 // 부과 일자 달력 버튼
                $P.$findn("btnDudtYmd").prop("disabled", true);                 // 납기 일자 달력 버튼
                $P.$findn("btnSave").prop("disabled", true);                    // 저장 버튼
            }
        }

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

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

        // 3. dataset 설정
        $P.ctrl.setData([${Info}]);
    });
//# sourceURL=levy01020-info.jsp
</script>