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

<!-- Page Body -->
<div class="content-pop" data-doctx="${pageName}">
    <div class="d-flex flex-row justify-content-evenly">
        <div class="w-px-1150">
            <!-- 입력 영역 -->
            <form name="frmCrdnPayer">
                <input type="hidden" name="crdnId" data-map="CRDN_ID" />
                <input type="hidden" name="rtpyrId" data-map="RTPYR_ID" />

                <!-- 단속 정보 -->
                <div class="card">
                    <!-- 업무 버튼 -->
                    <div class="container-page-btn">
                        <label class="col-form-label bg-label-danger pe-2 w-px-120 text-sm-center">단속 정보</label>
                    </div> <!-- <div class="container-page-btn"> -->

                    <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="crdnRegSeNm">등록 / 입력</label>
                            <input is="id-input" type="text" class="form-control" name="crdnRegSeNm" data-map="CRDN_REG_SE_NM" placeholder="등록구분" readonly />
                            <input is="id-input" type="text" class="form-control" name="crdnInptSeNm" data-map="CRDN_INPT_SE_NM" placeholder="입력구분" readonly />
                        </div>
<%--
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="crdnRegSeNm">등록구분</label>
                            <input is="id-input" type="text" class="form-control w-45" name="crdnRegSeNm" data-map="CRDN_REG_SE_NM" readonly />
                        </div>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="crdnInptSeNm">입력구분</label>
                            <input is="id-input" type="text" class="form-control w-45" name="crdnInptSeNm" data-map="CRDN_INPT_SE_NM" readonly />
                        </div>
                        <div class="col-md-4">
                            <span slot="edit">
                                <template class="pes pvs"> <!-- 밤샘주차 주정차 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="crdnBgngTm">단속시간</label>
                                        <input is="id-input" type="text" class="form-control w-25" name="crdnBgngTm" data-map="CRDN_BGNG_TM" readonly /> ~
                                        <input is="id-input" type="text" class="form-control w-25" name="crdnEndTm" data-map="CRDN_END_TM" readonly />
                                    </slot>
                                </template>
                            </span>
                        </div>
--%>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="crdnYmdTm">단속일시</label>
                            <input is="id-input" type="text" class="form-control w-45" name="crdnYmdTm" data-map="CRDN_YMD_TM" data-fmt-type="dt" readonly />
                        </div>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="vhrno">차량번호</label>
                            <input is="id-input" type="text" class="form-control w-45" name="vhrno" data-map="VHRNO" readonly />
                        </div>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="vltnArtcl">위반항목</label>
                            <input is="id-input" type="text" class="form-control w-45" name="vltnArtcl" data-map="VLTN_ARTCL" readonly />
                            <span slot="edit">
                                <template class="dpv"> <!-- 장애인 -->
                                    <slot>
                                        <label>
                                            <input type="checkbox" class="form-check-input" name="dstrbncYn" data-map="DSTRBNC_YN" disabled />1면방해
                                        </label>
                                    </slot>
                                </template>
                            </span>
                        </div>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="crdnStdgNm">법정동</label>
                            <input is="id-input" type="text" class="form-control w-45" name="crdnStdgNm" data-map="CRDN_STDG_NM" readonly />
                        </div>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="crdnPlc">단속장소</label>
                            <input is="id-input" type="text" class="form-control w-60" name="crdnPlc" data-map="CRDN_PLC" readonly />
                        </div>
                        <div class="col-md-4">
                            <span slot="edit">
                                <template class="dpv eca rvs pvs"> <!-- 장애인 전기차 주정차 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="crdnSn">단속일련번호</label>
                                        <input is="id-input" type="text" class="form-control w-45" name="crdnSn" maxlength="20" data-maxlengthb="20" data-map="CRDN_SN" readonly />
                                    </slot>
                                </template>
                                <template class="bpv"> <!-- 전용차로 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="dtlCrdnPlc">상세단속장소</label>
                                        <input is="id-input" type="text" class="form-control w-60" name="dtlCrdnPlc" data-map="DTL_CRDN_PLC" readonly />
                                    </slot>
                                </template>
                            </span>
                        </div>
<%--
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="cvlcptAplcntNm">민원신청인</label>
                            <input is="id-input" type="text" class="form-control w-45" name="cvlcptAplcntNm" data-map="CVLCPT_APLCNT_NM" readonly />
                        </div>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="cvlcptRcptYmd">민원접수일</label>
                            <input is="id-input" type="text" class="form-control w-45" name="cvlcptRcptYmd" data-map="CVLCPT_RCPT_YMD" data-fmt-type="day" readonly />
                        </div>
--%>
                        <div>
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="cvlcptPrcsPicNm">담당자</label>
                            <input is="id-input" type="text" class="form-control w-45" name="cvlcptPrcsPicNm" data-map="CVLCPT_PRCS_PIC_NM" 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="vin">차량</label>
                            <input is="id-input" type="text" class="form-control" name="vhclNm" data-map="VHCL_NM" placeholder="명칭" readonly />
                            <input is="id-input" type="text" class="form-control" name="vhclColr" data-map="VHCL_COLR" placeholder="색상" readonly />
                            <input is="id-input" type="text" class="form-control text-end" name="vhclCpct" data-map="VHCL_CPCT" placeholder="정원" readonly />
                            <input is="id-input" type="text" class="form-control" name="vin" data-map="VIN" placeholder="차대번호" readonly />
                        </div>
<%--
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="vin">차대번호</label>
                            <input is="id-input" type="text" class="form-control w-45" name="vin" data-map="VIN" readonly />
                        </div>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="vhclNm">차량명</label>
                            <input is="id-input" type="text" class="form-control w-60" name="vhclNm" data-map="VHCL_NM" readonly />
                        </div>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="vhclColr">차량색상</label>
                            <input is="id-input" type="text" class="form-control w-45" name="vhclColr" data-map="VHCL_COLR" readonly />
                        </div>
--%>
                        <div class="col-md-4">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="advntceBgngYmd">사전통지일자</label>
                            <input is="id-input" type="text" class="form-control w-30" name="advntceBgngYmd" data-map="ADVNTCE_BGNG_YMD" data-fmt-type="day" readonly /> ~
                            <input is="id-input" type="text" class="form-control w-30" name="advntceDudtYmd" data-map="ADVNTCE_DUDT_YMD" data-fmt-type="day" readonly />
                        </div>
                        <div class="col-md-8">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end align-top" for="etcCn">기타내용</label>
                            <textarea is="id-textarea" type="text" class="form-control w-80" name="etcCn" data-map="ETC_CN" cols="100%" rows="3" readonly></textarea>
                        </div>
                        <div class="col-md-3">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="ffnlgCrdnAmt">과태료단속원금</label>
                            <input is="id-input" type="text" class="form-control w-40 text-sm-end" name="ffnlgCrdnAmt" data-map="FFNLG_CRDN_AMT" data-fmt-type="number" readonly />
                        </div>
                        <div class="col-md-3">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="ffnlgRdcrt">과태료감경율</label>
                            <input is="id-input" type="text" class="form-control w-20 text-sm-end" name="ffnlgRdcrt" data-map="FFNLG_RDCRT" readonly /> %
                        </div>
                        <div class="col-md-3">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="ffnlgAmt">과태료금액</label>
                            <input is="id-input" type="text" class="form-control w-40 text-sm-end" name="ffnlgAmt" data-map="FFNLG_AMT" data-fmt-type="number" readonly />
                        </div>
                        <div class="col-md-3">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="advntceAmt">사전감경금액</label>
                            <input is="id-input" type="text" class="form-control w-40 text-sm-end" name="advntceAmt" data-map="ADVNTCE_AMT" data-fmt-type="number" readonly />
                        </div>
                        <div class="col-md-3">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="levyAmt">부과금액</label>
                            <input is="id-input" type="text" class="form-control w-40 text-sm-end" name="levyAmt" data-map="LEVY_AMT" data-fmt-type="number" readonly />
                        </div>
                        <div class="col-md-3">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="reducAmt">감액금액</label>
                            <input is="id-input" type="text" class="form-control w-40 text-sm-end" name="reducAmt" data-map="REDUC_AMT" data-fmt-type="number" readonly />
                        </div>
                        <div class="col-md-3">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="rcvmtAmt">수납금액</label>
                            <input is="id-input" type="text" class="form-control w-40 text-sm-end" name="rcvmtAmt" data-map="RCVMT_AMT" data-fmt-type="number" readonly />
                        </div>
                        <div class="col-md-3">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="lastAmt">최종금액</label>
                            <input is="id-input" type="text" class="form-control w-40 text-sm-end fw-bold text-red" name="lastAmt" data-map="LAST_AMT" data-fmt-type="number" readonly />
                        </div>
                        <div class="col-md-3">
                            <span slot="edit">
                                <template class="bpv pvs"> <!-- 전용차로 주정차 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="ffnlgCarmdlNm">과태료차종</label>
                                        <input is="id-input" type="text" class="form-control w-50" name="ffnlgCarmdlNm" data-map="FFNLG_CARMDL_NM" readonly />
                                    </slot>
                                </template>
                                <template class="dpv"> <!-- 장애인 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="prkPsbltyRsltNm">주차가능결과</label>
                                        <input is="id-input" type="text" class="form-control w-50" name="prkPsbltyRsltNm" data-map="PRK_PSBLTY_RSLT_NM" readonly />
                                    </slot>
                                </template>
                                <template class="eca"> <!-- 전기차 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="useFuelNm">연료구분</label>
                                        <input is="id-input" type="text" class="form-control w-50" name="useFuelNm" data-map="USE_FUEL_NM" readonly />
                                    </slot>
                                </template>
                            </span>
                        </div>
                        <div class="col-md-3">
                            <span slot="edit">
                                <template class="pvs"> <!-- 주정차 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="crdnSpareaNm">단속특별구역</label>
                                        <input is="id-input" type="text" class="form-control w-50" name="crdnSpareaNm" data-map="CRDN_SPAREA_NM" readonly />
                                    </slot>
                                </template>
                            </span>
                        </div>
                        <div class="col-md-3">
                            <span slot="edit">
                                <template class="pvs"> <!-- 주정차 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="ovtmNm">2시간초과</label>
                                        <input is="id-input" type="text" class="form-control w-50" name="ovtmNm" data-map="OVTM_NM" readonly />
                                    </slot>
                                </template>
                            </span>
                        </div>
                        <div class="col-md-3">
                            <span slot="edit">
                                <template class="pvs"> <!-- 주정차 -->
                                    <slot>
                                        <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="towngNm">견인지시</label>
                                        <input is="id-input" type="text" class="form-control w-50" name="towngNm" data-map="TOWNG_NM" readonly />
                                    </slot>
                                </template>
                            </span>
                        </div>
                    </div>
                </div> <!-- <div class="card"> -->
                <!-- 단속 정보 -->

                <!-- 납부자 정보 -->
                <div class="card">
                    <!-- 업무 버튼 -->
                    <div class="container-page-btn">
                        <label class="col-form-label bg-label-danger pe-2 w-px-120 text-sm-center">납부자 정보</label>
                        <!-- 버튼 우측 정렬 -->
                        <span class="container-window-btn-right">
                            <button type="button" class="btn btn-primary w-px-120" name="btnDeleteCrdnPayer" title="납부자 초기화" disabled>
                                납부자 초기화
                            </button>
                            <button type="button" class="btn btn-primary w-px-120" name="btnUpdatePayer" title="납부자 수정" disabled>
                                납부자 수정
                            </button>
                        </span>
                    </div> <!-- <div class="container-page-btn"> -->

                    <div class="row g-1">
                    	<div class="row">
                    		<div class="row col-6">
	                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="rtpyrNm">납부자</label>
	                            
	                            <input is="id-input" type="text" class="form-control w-25" style="margin-left: .3rem;" name="rtpyrNm" data-map="RTPYR_NM" placeholder="이름" readonly />
	                            <input is="id-input" type="text" class="form-control w-10" style="margin-left: .3rem;" name="rtpyrSeNm" data-map="RTPYR_SE_NM" placeholder="구분" readonly />
	                            <input is="id-input" type="text" class="form-control w-25" style="margin-left: .3rem;" name="rtpyrNo" data-map="RTPYR_NO" placeholder="번호" readonly />
                    		</div>
                    		<div class="row col-6">
	                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="rtpyrNm">연락처</label>
	                            
	                            <input is="id-input" type="text" class="form-control w-25" style="margin-left: .3rem;" name="rtpyrMblTelno" data-map="RTPYR_MBL_TELNO" placeholder="휴대전화번호" readonly />
	                            <input is="id-input" type="text" class="form-control w-20" style="margin-left: .3rem;" name="rtpyrTelno" data-map="RTPYR_TELNO" placeholder="전화번호" readonly />
	                            <input is="id-input" type="text" class="form-control w-25" style="margin-left: .3rem;" name="rtpyrEml" data-map="RTPYR_EML" placeholder="이메일" readonly />
                    		</div>
                    	</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="wholAddr">주소</label>
                            <input is="id-input" type="text" class="form-control w-80" name="wholAddr" data-map="WHOL_ADDR" readonly />
                            <input is="id-input" type="text" class="form-control w-px-75" name="zip" data-map="ZIP" readonly />
                        </div>
                        <div class="col-md-6">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="rtpyrInptSeNm">입력구분</label>
                            <input is="id-input" type="text" class="form-control w-50" name="rtpyrInptSeNm" data-map="RTPYR_INPT_SE_NM" readonly />
                        </div>
                        <div class="col-md-6">
                            <label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="pMdfcnDt">수정일시 / 수정자</label>

                            <input is="id-input" type="text" class="form-control w-30" name="pMdfcnDt" data-map="P_MDFCN_DT" data-fmt-type="dt" readonly />
                            <input is="id-input" type="text" class="form-control w-30" name="pMdfrNm" data-map="P_MDFR_NM" readonly />
                        </div>
                    </div>
                </div> <!-- <div class="card"> -->
                <!-- 납부자 정보 -->
            </form>
            <!-- 입력 영역 -->
            <div class="container-page-btn">
                <span name="excludeBtns" class="container-window-btn-left">
                    <button type="button" class="btn btn-primary w-px-120" name="btnCreateWrng" title="계도 등록">계도 등록</button>
                    <button type="button" class="btn btn-primary w-px-120" name="btnCreateLevyExcl" title="부과제외 등록">부과제외 등록</button>
                </span>
                <span class="container-window-btn-right">
                    <button type="button" class="btn btn-primary" name="btnPrintNhtPdf01" title="고지서 출력(PDF-A4)" disabled>고지서출력(A4)</button>
                    <button type="button" class="btn btn-primary" name="btnUpdateCrdn" title="단속정보 수정" disabled>단속정보 수정</button>
                    <button type="button" class="btn btn-primary" name="btnRemoveCrdn" title="단속정보 삭제" disabled>단속정보 삭제</button>
                    <button type="button" class="btn btn-primary" name="btnUpdateCrdnSttsCd" title="단속상태 변경" disabled>단속상태 변경</button>
                    <button type="button" class="btn btn-primary" name="btnCreateCrdnReReg" title="단속 재등록" disabled>단속 재등록</button>
                </span>
            </div>
        </div>

        <!-- 단속 이미지 -->
        <jsp:include page="/WEB-INF/jsp/fims/photo-main.jsp" />
    </div> <!-- <div class="d-flex flex-row justify-content-evenly"> -->
</div> <!-- <div class="content-pop"> -->

<script>
    LoadScript("sprt02020Script", wctx.url("/resources/js/fims/sprt/sprt02020.js?ver=${ver}"));
    LoadScript("sprt02050Script", wctx.url("/resources/js/fims/sprt/sprt02050.js?ver=${ver}"));

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

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

        // datasetControl
        $P.ctrlCrdn = newSprt02020Control("${pageName}", "[data-doctx=${pageName}]", "${pageNameMain}");
        $P.ctrlLevyExcl = newSprt02050ControlLE("${pageName}", "[data-doctx=${pageName}]", "${pageNameMain}");

        // 단속 사진
        $P.existFileArr = [];
        $P.localUploadArr = [];
        $P.uploadSet = uploadSupport($P.selectorn("inputUploadSet"));

        $P.$findn("photoMainWrapper").addClass("w-px-380 min-w-px-380");

        /**************************************************************************
         * 사용자 함수(function)
         **************************************************************************/
        // 민원 원본 보기
        $P.viewCvlcptOrgnl = (params) => {
            if (!params) return;

            ajax.get({
                  url: wctx.url("/cvlc/cvlc01/050/info.do")
                , data: params || {}
                , success: (resp) => {
                    let dialogName = "cvlcptOrgnlDialog";
                    let dialogId = dialogName + "-" + uuid();

                    dialog.open({
                          id: dialogId
                        , title: params.btnTitle
                        , size: "xl"
                        , content: resp
                        , init: () => {
                            $("#" + dialogId).attr("name", dialogName);
                            $("#" + dialogId).attr("data-ref-doctx", "${pageName}");

                            AppSupport.setDialogZindex();
                        }
                    });
                }
            });
        }

        // 민원 답변 보기
        $P.viewAnswerPreview = (params) => {
            if (!params) return;

            ajax.get({
                  url: wctx.url("/cvlc/cvlc02/060/info.do")
                , data: params || {}
                , success: (resp) => {
                    let dialogName = "answerPreviewDialog";
                    let dialogId = dialogName + "-" + uuid();

                    dialog.open({
                          id: dialogId
                        , title: params.btnTitle
                        , size: "xl"
                        , content: resp
                        , init: () => {
                            $("#" + dialogId).attr("name", dialogName);
                            $("#" + dialogId).attr("data-ref-doctx", "${pageName}");

                            AppSupport.setDialogZindex();
                        }
                    });
                }
            });
        }

        // 삭제 사유 callback
        $P.callbackRsn = (obj) => {
            // 서버에 전송할 data(파라미터) 생성
            let params = {
                  callPurpose: "remove"
                , btnTitle: obj.btnTitle                                        // 버튼 title
                , sggCd: $P.ctrlCrdn.getValue("SGG_CD")                         // 시군구 코드
                , taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")                  // 업무 구분 코드
                , crdnId: $P.ctrlCrdn.getValue("CRDN_ID")                       // 단속 ID
                , delRsn: obj.reason                                            // 삭제 사유
            };

            $P.ctrlCrdn.remove(params);
        }

        // 단속 재등록
        $P.createCrdnReReg = (params) => {
            if (!params) return;

            ajax.post({
                  url: wctx.url("/excl/excl03/010/create.do")
                , data: params || {}
                , success: (resp) => {
                    if (resp.saved) {
                        dialog.alert({
                              content: "단속 재등록 작업이 처리되었습니다."
                            , init: () => { AppSupport.setDialogZindex(); }
                            , onOK: resp.saved ? undefined : () => { }
                        });
                    }
                }
            });
        }

        // 단속 상태 변경
        $P.getInfoCrdnSttsCd = (params) => {
            if (!params) return;

            ajax.get({
                  url: wctx.url("/crdn/crdn06/030/info.do")
                , data: params || {}
                , success: (resp) => {
                    let dialogName = "crdnSttsCdDialog";
                    let dialogId = dialogName + "-" + uuid();

                    dialog.open({
                          id: dialogId
                        , title: params.btnTitle
                        , size: "lg"
                        , content: resp
                        , init: () => {
                            $("#" + dialogId).attr("name", dialogName);
                            $("#" + dialogId).attr("data-ref-doctx", "${pageName}");

                            AppSupport.setDialogZindex();
                        }
                        , onClose: () => { $P.fnRefresh(); }                    // 정보 새로고침
                    });
                }
            });
        }

        // 납부자 초기화
        $P.deleteCrdnPayer = (params) => {
            if (!params) return;

            ajax.post({
                  url: wctx.url("/crdn/crdn06/010/removeCrdnPayer.do")
                , data: params || {}
                , success: (resp) => {
                    let showMessage = resp.rtnMsg.replace(/[S]|[F]/g, params.btnTitle);

                    dialog.alert({
                          content: showMessage
                        , init: () => { AppSupport.setDialogZindex(); }
                        , onOK: resp.saved ? undefined : () => { }
                        , onClose: () => {
                            if (resp.saved) { $P.fnRefresh(); }                 // 정보 새로고침
                        }
                    });
                }
            });
        }

        // 납부자 정보 수정
        $P.updatePayer = (params) => {
            if (!params) return;

            dialogTitle = !params.rtpyrId ? "납부자 정보 등록" : "납부자 정보 수정";
            params.callPurpose = !params.rtpyrId ? "create" : "update";

            ajax.get({
                  url: wctx.url("/payer/crdnPayerInfo.do")
                , data: params || {}
                , success: (resp) => {
                    let dialogName = "payerDialog";
                    let dialogId = dialogName + "-" + uuid();

                    dialog.open({
                          id: dialogId
                        , title: dialogTitle
                        , size: "lg"
                        , content: resp
                        , init: () => {
                            $("#" + dialogId).attr("name", dialogName);
                            $("#" + dialogId).attr("data-ref-doctx", "${pageName}");

//                            AppSupport.setDialogZindex();
                        }
                        , onClose: () => { $P.fnRefresh(); }                    // 정보 새로고침
                    });
                }
            });
        }
        // 계도 등록 버튼 이벤트
        $P.fnCreateWrng = (btnTitle) => {
            // 부과 제외 ID가 있다면.. return
            let levyExclId = $P.ctrlLevyExcl.getValue("LEVY_EXCL_ID");          // 부과 제외 ID
            if (levyExclId)
                return dialog.alert({
                      content: "이미 등록된 부과제외 대장 정보가 있습니다."
                            + "<br><br>" + "[" + btnTitle + "]" + " 실행이 취소되었습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });

            // 단속 ID 가 없다면.. return
            let ctrlMain = pageObject["${pageNameMain}"].ctrlMain;              // sprt02010 control
            let crdnId = ctrlMain.getValue("CRDN_ID");                          // 단속 ID
            if (!crdnId) return;

            let params = {
                  callPurpose: "create"
                , btnTitle: btnTitle
                , sggCd: ctrlMain.getValue("SGG_CD")                            // 시군구 코드
                , taskSeCd: ctrlMain.getValue("TASK_SE_CD")                     // 업무 구분 코드
                , crdnId: ctrlMain.getValue("CRDN_ID")                          // 단속 ID
                , levyExclSeCd: "2"                                             // 부과 제외 구분 코드
                , delYn: "N"
            };

            $P.ctrlLevyExcl.getInfo(params);
        }

        // 부과제외 등록 버튼 이벤트
        $P.fnCreateLevyExcl = (btnTitle) => {
            // 부과 제외 ID가 있다면.. return
            let levyExclId = $P.ctrlLevyExcl.getValue("LEVY_EXCL_ID");          // 부과 제외 ID
            if (levyExclId)
                return dialog.alert({
                      content: "이미 등록된 부과제외 대장 정보가 있습니다."
                            + "<br><br>" + "[" + btnTitle + "]" + " 실행이 취소되었습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });

            // 단속 ID 가 없다면.. return
            let ctrlMain = pageObject["${pageNameMain}"].ctrlMain;              // sprt02010 control
            let crdnId = ctrlMain.getValue("CRDN_ID");                          // 단속 ID
            if (!crdnId) return;

            let params = {
                  callPurpose: "create"
                , btnTitle: btnTitle
                , sggCd: ctrlMain.getValue("SGG_CD")                            // 시군구 코드
                , taskSeCd: ctrlMain.getValue("TASK_SE_CD")                     // 업무 구분 코드
                , crdnId: ctrlMain.getValue("CRDN_ID")                          // 단속 ID
                , levyExclSeCd: "1"                                             // 부과 제외 구분 코드
                , delYn: "N"
            };

            $P.ctrlLevyExcl.getInfo(params);
        }

        // 정보 새로고침
        $P.fnRefresh = () => {
            let ctrlMain = pageObject["${pageNameMain}"].ctrlMain;

            let crdnId = ctrlMain.getValue("CRDN_ID");                          // 단속 ID
            if (!crdnId) return;

            let params = {
                  callPurpose: "refresh"
                , sggCd: ctrlMain.getValue("SGG_CD")
                , taskSeCd: ctrlMain.getValue("TASK_SE_CD")
                , crdnId: ctrlMain.getValue("CRDN_ID")
                , delYn: "N"
            };

            ajax.get({
                  url: wctx.url("/sprt/sprt02/020/info.do")
                , headers: { Accept: "application/json; charset=utf-8" }        // json
                , data: params || {}
                , success: (resp) => {
                    // 초기화
                    $P.findn("frmCrdnPayer").reset();                           // 단속 화면
                    $P.ctrlCrdn.dataset.clear();                                // 단속, 납부자 Dataset

                    // sprt02010-main 단속 정보
                    ctrlMain.setData([resp.totalInfo]);

                    // 단속, 납부자 정보
                    if (resp.crdnPayerInfo) { $P.ctrlCrdn.setData([resp.crdnPayerInfo]); }

                    let hide = pageObject["${pageNameMain}"].ctrlMain.dataset.getDataset()[0].CRDN_STTS_CD != "21"; 
                    $P.$findn("excludeBtns").prop("hidden", hide);
                }
            });
        }

        /**************************************************************************
         * 버튼 clickEvent
         **************************************************************************/
        // 민원원본 보기
        $P.fnViewCvlcptOrgnl = (btnTitle) => {
            let crdnId = $P.ctrlCrdn.getValue("CRDN_ID");                       // 단속 ID
            if (!crdnId) return;

            let cvlcptLinkId = $P.ctrlCrdn.getValue("CVLCPT_LINK_ID");          // 민원 연계 ID
            if (!cvlcptLinkId)
                return dialog.alert({
                      content: "조회된 민원 대장 정보가 없습니다."
                            + "<br><br>" + "[" + btnTitle + "]" + " 실행이 취소되었습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });

            let params = {
                  callPurpose: "view"
                , btnTitle: btnTitle
                , sggCd: $P.ctrlCrdn.getValue("SGG_CD")                         // 시군구 코드
                , taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")                  // 업무 구분 코드
                , crdnId: $P.ctrlCrdn.getValue("CRDN_ID")                       // 단속 ID
            };

            $P.viewCvlcptOrgnl(params);
        }

        // 민원답변 보기
        $P.fnViewAnswerPreview = (btnTitle) => {
            let crdnId = $P.ctrlCrdn.getValue("CRDN_ID");                       // 단속 ID
            if (!crdnId) return;

            let cvlcptLinkId = $P.ctrlCrdn.getValue("CVLCPT_LINK_ID");          // 민원 연계 ID
            if (!cvlcptLinkId)
                return dialog.alert({
                      content: "조회된 민원 대장 정보가 없습니다."
                            + "<br><br>" + "[" + btnTitle + "]" + " 실행이 취소되었습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });

            let params = {
                  callPurpose: "view"
                , btnTitle: btnTitle
                , sggCd: $P.ctrlCrdn.getValue("SGG_CD")                         // 시군구 코드
                , taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")                  // 업무 구분 코드
                , crdnId: $P.ctrlCrdn.getValue("CRDN_ID")                       // 단속 ID
            };

            $P.viewAnswerPreview(params);
        }

        // 단속정보 수정
        $P.fnUpdateCrdn = (btnTitle) => {
            let crdnId = $P.ctrlCrdn.getValue("CRDN_ID");                       // 단속 ID
            if (!crdnId) return;

            let params = {
                  callPurpose: "update"
                , btnTitle: btnTitle
                , sggCd: $P.ctrlCrdn.getValue("SGG_CD")                         // 시군구 코드
                , taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")                  // 업무 구분 코드
                , crdnId: $P.ctrlCrdn.getValue("CRDN_ID")                       // 단속 ID
            };

            $P.ctrlCrdn.getInfo(params);
        }

        // 단속정보 삭제
        $P.fnRemoveCrdn = (btnTitle) => {
            let crdnId = $P.ctrlCrdn.getValue("CRDN_ID");                       // 단속 ID
            if (!crdnId) return;

            // 단속 상태 코드
            let crdnSttsCd = $P.ctrlCrdn.getValue("CRDN_STTS_CD");
            let crdnSttsNm = $P.ctrlCrdn.getValue("CRDN_STTS_NM");

            // 단속 상태 코드 확인
            if (Number(crdnSttsCd) > 51)
                return dialog.alert({
                      content: "[" + btnTitle + "]" + " 작업은 단속상태가 '부과 이전' 자료만 처리 가능합니다."
                            + "<br>" + "단속상태 : " + crdnSttsNm
                            + "<br><br>" + "[" + btnTitle + "]" + " 실행이 취소되었습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });

            // 삭제 메세지 확인
            dialog.alert({
                  content: "선택하신 " + $P.ctrlCrdn.prefixName + " 정보를 삭제하시겠습니까?"
                , onOK: () => {
                    // 삭제 사유 입력
                    fetch(wctx.url("/resources/html/inputRsnDialog.html"))
                        .then(function(resp) { return resp.text(); })
                        .then(function(template) {
                            dialog.open({
                                  id: "inputDelRsnDialog"
                                , title: btnTitle
                                , size: "lg"
                                , content: template
                                , init: () => { AppSupport.setDialogZindex(); }
                                , onOK: () => {
                                    $P.callbackRsn({
                                          btnTitle: btnTitle                    // 버튼 title
                                        , reason: $("#reason").val()            // 삭제 사유
                                    });
                                }
                            });
                        });
                }
            });
        }

        // 단속 재등록
        $P.fnCreateCrdnReReg = (btnTitle) => {
            let bfrCrdnId = $P.ctrlCrdn.getValue("CRDN_ID");                    // 단속 ID
            if (!bfrCrdnId) return;

            // 단속 상태 코드
            let crdnSttsCd = $P.ctrlCrdn.getValue("CRDN_STTS_CD");
            let crdnSttsNm = $P.ctrlCrdn.getValue("CRDN_STTS_NM");

            // 단속 상태 코드 확인
            if (Number(crdnSttsCd) < 80 || Number(crdnSttsCd) > 88)
                return dialog.alert({
                      content: "[" + btnTitle + "]" + " 작업은 단속상태가 '비부과', '계도', '부과취소' 자료만 처리 가능합니다."
                            + "<br>" + "단속상태 : " + crdnSttsNm
                            + "<br><br>" + "[" + btnTitle + "]" + " 실행이 취소되었습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });

            dialog.alert({
                  content: "현재 단속 정보를 재등록 하겠습니까?"
                , init: () => { AppSupport.setDialogZindex(); }
                , onOK: () => {
                    let params = {
                          callPurpose: "create"
                        , btnTitle: btnTitle
                        , sggCd: $P.ctrlCrdn.getValue("SGG_CD")                 // 시군구 코드
                        , taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")          // 업무 구분 코드
                        , bfrCrdnId: $P.ctrlCrdn.getValue("CRDN_ID")            // 단속 ID
                    };

                    $P.createCrdnReReg(params);
                }
            });
        }

        // 고지서출력
        $P.fnMakeFileNht = (title, fileType, paper) => {
            let url = "";
            let fileTypeName = "";

            if (fileType == "pdf") {
                url = wctx.url("/sprt/sprt01/150/makeNhtPdf.do");
                url = wctx.url("/preview/notice.do");
                fileTypeName = "PDF 파일";
            } else if (fileType == "outsourcing") {
                url = wctx.url("/sprt/sprt01/150/makeNhtOutsourcing.do");
                fileTypeName = "외주 요청 파일";
            }

            let params = {
                  taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")                  // 업무 구분
                , crdnIds: $P.ctrlCrdn.getValue("CRDN_ID")                      // 단속 ID
            };

            let inBrowser = false;

            if (fileType == "pdf") {
                params.paperSeCd = paper;
                inBrowser = true;
            }

            if (inBrowser) {
                let parameter = toQuery(params);
                let filenameInHeader = "";

                fetch(url + "?" + parameter)
                    .then((response) => {
                        let header = response.headers.get("Content-Disposition");
                        if (!header) {
                            response.json().then((responseJson) => {
                                dialog.alert({
                                      content: fileTypeName + " 생성 중 오류가 발생하였습니다."
                                        + " <br/>" + responseJson.description
                                    , init: () => { AppSupport.setDialogZindex(); }
                                });
                            });

                            new Error("");
                        }

                        let parts = header.split(";");
                        filenameInHeader = decodeURIComponent(parts[1].split("=")[1]);

                        return response.blob();
                    })
                    .then((blob) => {
                    	AppSupport.openPDF(blob, filenameInHeader);
                    })
                .catch(() => { });
            } else {
                let parameter = toQuery(params);
                document.location.href = url + "?" + parameter;
            }
        }

        // 단속 상태 변경
        $P.fnUpdateCrdnSttsCd = (btnTitle) => {
            let crdnId = $P.ctrlCrdn.getValue("CRDN_ID");                       // 단속 ID
            if (!crdnId) return;

            let params = {
                  callPurpose: "update"
                , btnTitle: btnTitle
                , sggCd: $P.ctrlCrdn.getValue("SGG_CD")                         // 시군구 코드
                , taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")                  // 업무 구분 코드
                , crdnId: $P.ctrlCrdn.getValue("CRDN_ID")                       // 단속 ID
            };

            $P.getInfoCrdnSttsCd(params);
        }

        // 납부자 초기화
        $P.fnDeleteCrdnPayer = (btnTitle) => {
            let crdnId = $P.ctrlCrdn.getValue("CRDN_ID");                       // 단속 ID
            if (!crdnId) return;

            let rtpyrId = $P.ctrlCrdn.getValue("RTPYR_ID");                     // 납부자 ID
            if (!rtpyrId)
                return dialog.alert({
                      content: "조회된 납부자 대장 정보가 없습니다."
                            + "<br><br>" + "[" + btnTitle + "]" + " 실행이 취소되었습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });

            dialog.alert({
                  content: "선택한 자료의 납부자 정보를 초기화 하시겠습니까?"
                , init: () => { AppSupport.setDialogZindex(); }
                , onOK: () => {
                    let params = {
                          callPurpose: "initialize"
                        , btnTitle: btnTitle
                        , sggCd: $P.ctrlCrdn.getValue("SGG_CD")                 // 시군구 코드
                        , taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")          // 업무 구분 코드
                        , crdnId: $P.ctrlCrdn.getValue("CRDN_ID")               // 단속 ID
                        , rtpyrId: $P.ctrlCrdn.getValue("RTPYR_ID")             // 납부자 ID
                        , etcCn: "[개별총정보-납부자초기화]"                    // 기타 내용
                        , delYn: "N"
                    };

                    $P.deleteCrdnPayer(params);
                }
            });
        }

        // 납부자 수정
        $P.fnUpdatePayer = (btnTitle) => {
            let crdnId = $P.ctrlCrdn.getValue("CRDN_ID");                       // 단속 ID
            if (!crdnId) return;

            let params = {
                  callPurpose: "update"
                , btnTitle: btnTitle
                , sggCd: $P.ctrlCrdn.getValue("SGG_CD")                         // 시군구 코드
                , taskSeCd: $P.ctrlCrdn.getValue("TASK_SE_CD")                  // 업무 구분 코드
                , crdnId: $P.ctrlCrdn.getValue("CRDN_ID")                       // 단속 ID
                , rtpyrId: $P.ctrlCrdn.getValue("RTPYR_ID")                     // 납부자 ID
                , vhrno: $P.ctrlCrdn.getValue("VHRNO")                          // 차량번호
                , rtpyrInptSeCd: "01"                                           // 납부자 입력 구분 코드
            };

            $P.updatePayer(params);
        }

        // 확인 필요
        // 차적조회(단속내역,민원상담내역,차적기본조회,장애인표지조회)
        $P.getVehicleTotalInfo = async function(vhrnoEl) {
            //
        };

        /**************************************************************************
         * 초기 셋팅
         **************************************************************************/
        // 이벤트 설정
        $P.setEvent = () => {
            // 업무 버튼 이벤트
            $P.$findn("btnViewCvlcptOrgnl").on("click", () => {
                $P.fnViewCvlcptOrgnl($P.$findn("btnViewCvlcptOrgnl").attr("title"));        // 민원 원본 보기
            });
            $P.$findn("btnViewAnswerPreview").on("click", () => {
                $P.fnViewAnswerPreview($P.$findn("btnViewAnswerPreview").attr("title"));    // 민원 답변 보기
            });
            $P.$findn("btnPrintNhtPdf01").on("click", () => {
                $P.fnMakeFileNht($P.$findn("btnPrintNhtPdf01").attr("title"), "pdf", "01"); // 고지서 출력
            });
            $P.$findn("btnPrintNhtPdf02").on("click", () => {
                $P.fnMakeFileNht($P.$findn("btnPrintNhtPdf02").attr("title"), "pdf", "02"); // 고지서 출력
            });
            $P.$findn("btnUpdateCrdn").on("click", () => {
                $P.fnUpdateCrdn($P.$findn("btnUpdateCrdn").attr("title"));                  // 단속 정보 수정
            });
            $P.$findn("btnRemoveCrdn").on("click", () => {
                $P.fnRemoveCrdn($P.$findn("btnRemoveCrdn").attr("title"));                  // 단속 정보 삭제
            });
            $P.$findn("btnUpdateCrdnSttsCd").on("click", () => {
                $P.fnUpdateCrdnSttsCd($P.$findn("btnUpdateCrdnSttsCd").attr("title"));      // 단속 상태 변경
            });
            $P.$findn("btnCreateCrdnReReg").on("click", () => {
                $P.fnCreateCrdnReReg($P.$findn("btnCreateCrdnReReg").attr("title"));        // 단속 재등록
            });
            $P.$findn("btnDeleteCrdnPayer").on("click", () => {
                $P.fnDeleteCrdnPayer($P.$findn("btnDeleteCrdnPayer").attr("title"));        // 납부자 초기화
            });
            $P.$findn("btnUpdatePayer").on("click", () => {
                $P.fnUpdatePayer($P.$findn("btnUpdatePayer").attr("title"));                // 납부자 수정
            });
            $P.$findn("btnCreateWrng").on("click", () => {
            	$P.fnCreateWrng("계도 등록");                               // 계도 등록
            });
            $P.$findn("btnCreateLevyExcl").on("click", () => {
            	$P.fnCreateLevyExcl("부과제외 등록");                         // 부과제외 등록
            });
        }

        // 초기 화면 설정
        $P.fnReset = () => {
            // 초기화
            $P.findn("frmCrdnPayer").reset();                                   // 단속 화면 초기화
            $P.ctrlCrdn.dataset.clear();                                        // 단속 Dataset 초기화

            // 화면 호출(callPurpose)이 view가 아니라면 버튼 활성화 disabled = false
            if (pageObject["${pageNameMain}"].callPurpose != "view") {
            	[
            		"btnViewCvlcptOrgnl", "btnViewAnswerPreview", "btnPrintNhtPdf01", "btnPrintNhtPdf02", "btnUpdateCrdn", "btnRemoveCrdn", "btnUpdateCrdnSttsCd",
            		"btnCreateCrdnReReg", "btnDeleteCrdnPayer", "btnUpdatePayer", <%--"btnOpenVideoCapture",--%> "btnAddFile", "btnEditPhoto", "btnDeleteExistPhoto"
            	].forEach(name => $P.$findn(name).prop("disabled", false));
            }

            let taskSeCd = pageObject["${pageNameMain}"].ctrlMain.getValue("TASK_SE_CD");

            // 업무 구분에 따른 화면 설정
            FimsSupport.renderForTask($P.findn("frmCrdnPayer"), taskSeCd.toLowerCase());

            let hide = pageObject["${pageNameMain}"].ctrlMain.dataset.getDataset()[0].CRDN_STTS_CD != "21"; 
            $P.$findn("excludeBtns").prop("hidden", hide);
        }

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

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

        // 3. Dataset 설정 = 단속, 납부자 정보 조회
        $P.ctrlCrdn.setData([${crdnPayerInfo}]);

        // 4. 사진영역 설정
        settingPhotoMain("${pageName}", $P.findn("crdnId")
            , function() {
                return {
                      vhrno: $P.$findn("vhrno").val()
                    , vhclNm: $P.$findn("vhclNm").val()
                    , vhclColr: $P.$findn("vhclColr").val()
                };
            }
            , async function(vhrnoEl) {
                return await $P.getVehicleTotalInfo(vhrnoEl);                   // 차적조회는 "단속정보 수정" 에서 해라...
            }
        );

        // 5. 사진영역 초기화
        let crdnPayerInfo = $P.ctrlCrdn.getCurrent();
        let existVideo = crdnPayerInfo.VIDEO_EXIST_YN == "Y"; // 동영상 캡쳐
        let showBtn = pageObject["${pageNameMain}"].callPurpose != "view"; // 사진 버튼 visible

        initPhotoMain("${pageName}", crdnPayerInfo.fileList, existVideo, showBtn);
    });
//# sourceURL= sprt02020-info.jsp
</script>