<%@ 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-wrapper" data-doctx="${pageName}">
	<!-- Content -->
	<div class="container-xxl flex-grow-1 px-0">
		<div class="card wrapper-list">
			<!-- 상단 버튼 -->
			<div class="container-page-btn">
				<button type="button" class="btn btn-outline-dark w-px-120" name="btnReset" title="초기화">
					초기화
				</button>
				<span class="container-window-btn-right">
					<button type="button" class="btn btn-search w-px-120" name="btnSearch" title="검색">
						검색
					</button>
					<button type="button" class="btn btn-excel w-px-120" name="btnExcel" title="엑셀">
						엑셀
					</button>
				</span>
			</div>
			<!-- 상단 버튼 -->

			<!-- 검색 조건 영역 -->
			<form name="frmSearch">
				<!-- hidden -->
				<input type="hidden" name="sggCd" />

				<!-- 메인 조건 -->
				<div class="container-search">
					<div class="row g-1">
						<div class="col-12">
							<span class="form-label form-search-title w-px-120 text-end fw-bold">업무구분</span>
							<span class="form-search-linebox">
								<c:forEach items="${taskListForSgg}" var="item">
									<label>
										<input type="radio" class="form-check-input" name="taskSeCd" alt="업무구분"
											value="${item.code}" onchange="pageObject['${pageName}'].fnResetAndChangeBiz(this.value);">
										${item.value}
									</label>
								</c:forEach>
							</span>
						</div>
						<div class="col-6">
							<label class="form-label form-search-title w-px-120 text-end fw-bold">접수일자</label>
							<span class="form-search-linebox">
								<input type="text" class="form-control form-date" name="schRcptYmdFrom"
								    data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
								<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
								~
								<input type="text" class="form-control form-date" name="schRcptYmdTo"
								    data-fmt-type="day" autocomplete="off" title="종료 날짜 선택" />
								<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
							</span>
						</div>
						<div class="col-6">
							<label class="form-label form-search-title w-px-120 text-end fw-bold">답변일자</label>
							<span class="form-search-linebox">
								<input type="text" class="form-control form-date" name="schAnsYmdFrom"
								    data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
								<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
								~
								<input type="text" class="form-control form-date" name="schAnsYmdTo"
								    data-fmt-type="day" autocomplete="off" title="종료 날짜 선택" />
								<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
							</span>
						</div>
						<div class="col-6">
							<label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schOpnnSbmsnSttsCd">의견제출상태</label>
                            <select is="id-select" class="form-select w-px-120" name="schOpnnSbmsnSttsCd">
                            	<option value="">전체</option>
                            	<c:forEach items="${FIM031List}" var="item">
                            		<option value="${item.code}">${item.value}</option>
                            	</c:forEach>
                            </select>
						</div>
						<div class="col-6">
							<label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schOpnnSbmsnSeCd">의견제출구분</label>
                            <select is="id-select" class="form-select w-px-220" name="schOpnnSbmsnSeCd">
                            	<option value="">전체</option>
                            	<c:forEach items="${FIM033List}" var="item">
                            		<option value="${item.code}">${item.value}</option>
                            	</c:forEach>
                            </select>
						</div>
                        <div class="col-6">
                            <label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schNtfctnSeCd">통보구분</label>
                            <select is="id-select" class="form-select w-px-120" name="schNtfctnSeCd">
                                <option value="">전체</option>
                                <c:forEach items="${FIM030List}" var="item">
                                    <option value="${item.code}">${item.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <!-- 동적검색 -->
                        <div class="col-6">
                            <input type="hidden" name="by" />
                            <input type="text" class="form-control w-px-120 text-end fw-bold" name="byOutput" value="동적 검색" readonly />
                            <input type="hidden" name="mainOption" />
                            <input type="hidden" name="subOption" />
                            <input type="text" class="form-control w-px-400" name="term" autocomplete="off" />
                            <!-- 상세 검색조건 버튼 -->
                            <span class="flr">
                                <button type="button" class="btn btn-open-detail" data-bs-toggle="collapse" data-bs-target="[data-doctx='${pageName}'] [name='searchDetail']">
                                    <i class="bx bx-chevron-down"></i>
                                    상세검색
                                </button>
                            </span>
                        </div> <!-- 동적검색 -->
					</div>
				</div> <!-- 메인 조건 -->

				<!-- 상세 조건 -->
				<div name="searchDetail" class="container-search container-search-detail collapse">
					<div class="row g-1">
                        <div class="col-4">
                            <label class="form-label form-search-title w-px-120 text-end fw-bold">단속일자</label>
                            <span class="form-search-linebox">
                                <input type="text" class="form-control form-date" name="schCrdnYmdFrom"
                                    data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
                                <button type="button" class="bx bx-lg bx-calendar bg-white"></button>
                                ~
                                <input type="text" class="form-control form-date" name="schCrdnYmdTo"
                                    data-fmt-type="day" autocomplete="off" title="종료 날짜 선택" />
                                <button type="button" class="bx bx-lg bx-calendar bg-white"></button>
                            </span>
                        </div>
                        <div class="col-4">
                            <label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schVhrno">차량번호</label>
                            <input is="id-input" type="text" class="form-control w-px-160" name="schVhrno" autocomplete="off" />
                        </div>
                        <div class="col-4">
                            <label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schRtpyrNo">납부자번호</label>
                            <input is="id-input" type="text" class="form-control w-px-160" name="schRtpyrNo" autocomplete="off" />
                        </div>
                        <div class="col-4">
                            <label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schRtpyrNm">납부자명</label>
                            <input is="id-input" type="text" class="form-control w-px-160" name="schRtpyrNm" autocomplete="off" />
                        </div>
						<div class="col-4">
							<select class="form-select w-px-120 text-center" name="schRegDateOpt">
								<option value="regDt">등록일자</option>
								<option value="mdfcnDt">수정일자</option>
							</select>
							<span class="form-search-linebox">
								<input type="text" class="form-control form-date" name="schRegDateFrom"
                                	data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
								<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
                                ~
								<input type="text" class="form-control form-date" name="schRegDateTo"
                                	data-fmt-type="day" autocomplete="off" title="종료 날짜 선택">
								<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
							</span>
						</div>
						<div class="col-4">
							<select class="form-select w-px-120 text-center" name="schRgtrOpt">
								<option value="rgtr">등록자</option>
								<option value="mdfr">수정자</option>
							</select>
							<input type="hidden" name="schRgtrCd" />
							<input type="text" class="form-control w-px-160" name="schRgtrNm" />
							<button type="button" class="btn btn-sm btn-outline-dark" name="btnFindUser" title="사용자 검색">
								검색
							</button>
						</div>
					</div>
				</div> <!-- 상세 조건 -->
		    </form>
		    <!-- 검색 조건 영역 -->

			<!-- 업무 버튼 및 건수 표시 -->
			<div>
				<span class="container-page-btn" name="gridButtonArea">
	            	<!-- 건수, 페이지 표시 -->
					<div class="d-flex flex-row justify-content-between">
						<span is="paging-info" class="dataTables_info" name="dataPagingInfo" role="status" aria-live="polite"></span>
						<ul class="pagination pagination-primary" name="dataPaging">
						</ul>
					</div>
					<!-- 업무 버튼 -->
		            <span class="container-window-btn-right">
						<button type="button" class="btn btn-info w-px-120" name="btnDlbrMbr" title="심의위원 관리">
							심의위원 관리
						</button>
						<button type="button" class="btn btn-primary w-px-120" name="btnUpdate" title="의견제출 수정">
							의견제출 수정
						</button>
						<button type="button" class="btn btn-primary w-px-120" name="btnUpdateDlbr" title="의견제출 심의">
							의견제출 심의
						</button>
						<button type="button" class="btn btn-primary w-px-120" name="btnRemove" title="의견제출 삭제">
							의견제출 삭제
						</button>
						<button type="button" class="btn btn-primary w-px-120" name="btnPrintDlbrDecsn" title="심의의결서 출력">
							심의의결서 출력
						</button>
		            </span>
				</span>
			</div>
			<!-- 업무 버튼 및 건수 표시 -->

			<!-- DataTables(그리드) -->
            <div class="card-datatable text-nowrap">
                <div class="dataTables_wrapper dt-bootstrap5 no-footer">
                    <div class="table-responsive ox-scroll oy-scroll h-px-450" name="tableRspns">
                        <table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" aria-describedby="DataTables_Table_0_info">
                            <thead class="sticky-thead">
                                <tr name="theadTr" data-search-target="[data-doctx='${pageName}']">
                                </tr>
                            </thead>
                            <template name="tmpltCols">
                                <th class="cmn" style="width: 72px;">No.</th>
                                <th class="cmn" style="width: 56px;"><input type="checkbox" class="form-check-input" name="gridAllCheckbox" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></th>
                                <th class="cmn" style="width: 160px;">업무구분</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('RCPT_NO', this.innerText, 'match', 'part');">접수번호</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('RCPT_YMD', this.innerText, 'ymd', '');">접수일자</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('RCPT_SE_CD', this.innerText, 'codeValue', 'FIM029');">접수구분</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('NTFCTN_SE_CD', this.innerText, 'codeValue', 'FIM030');">통보구분</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('OWNR_REL_CD', this.innerText, 'codeValue', 'FIM032');">소유주관계</th>
                                <th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('STTR_NM', this.innerText, 'match', 'part');">진술자명</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('STTR_BRDT', this.innerText, 'ymd', '');">진술자생일</th>
                                <th class="cmn" style="width: 140px;" onclick="FimsSupport.searchFromGridTitle('STTR_ZIP', this.innerText, 'match', 'part');">진술자우편번호</th>
                                <th class="cmn" style="width: 280px;" onclick="FimsSupport.searchFromGridTitle('STTR_ADDR', this.innerText, 'match', 'part');">진술자주소</th>
                                <th class="cmn" style="width: 320px;" onclick="FimsSupport.searchFromGridTitle('STTR_DADDR', this.innerText, 'match', 'part');">진술자상세주소</th>
                                <th class="cmn" style="width: 140px;" onclick="FimsSupport.searchFromGridTitle('OPNN_SBMSN_STTS_CD', this.innerText, 'codeValue', 'FIM031');">의견제출상태</th>
                                <th class="cmn" style="width: 200px;" onclick="FimsSupport.searchFromGridTitle('OPNN_SBMSN_SE_CD', this.innerText, 'codeValue', 'FIM033');">의견제출분류</th>
                                <th class="cmn" style="width: 280px;" onclick="FimsSupport.searchFromGridTitle('OPNN_SBMSN_GIST', this.innerText, 'match', 'part');">의견제출요지</th>
                                <th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('DOC_NO', this.innerText, 'ymd', '');">문서번호</th>
                                <th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('ANS_YMD', this.innerText, 'ymd', '');">답변일시</th>
                                <th class="cmn" style="width: 280px;" onclick="FimsSupport.searchFromGridTitle('ANS_CN', this.innerText, 'match', 'part');">답변내용</th>
                                <th class="cmn" style="width: 180px;" onclick="FimsSupport.searchFromGridTitle('CRDN_YMD', this.innerText, 'ymd', '');">단속일시</th>
                                <th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('VHRNO', this.innerText, 'match', 'part');">차량번호</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('RTPYR_SE_CD', this.innerText, 'codeValue', 'FIM011');">납부자구분</th>
                                <th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('RTPYR_NO', this.innerText, 'ymd', '');">납부자번호</th>
                                <th class="cmn" style="width: 200px;" onclick="FimsSupport.searchFromGridTitle('RTPYR_NM', this.innerText, 'match', 'part');">납부자명</th>
                                <th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('VLTN_ARTCL', this.innerText, 'match', 'part');">위반항목</th>
                                <th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('CRDN_STDG_NM', this.innerText, 'match', 'part');">단속법정동</th>
                                <th class="cmn" style="width: 280px;" onclick="FimsSupport.searchFromGridTitle('CRDN_PLC', this.innerText, 'match', 'part');">단속장소</th>
                                <th class="bpv" style="width: 280px;" onclick="FimsSupport.searchFromGridTitle('DTL_CRDN_PLC', this.innerText, 'match', 'part');">상세단속장소</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('FFNLG_CRDN_AMT', this.innerText, 'match', 'part');">단속원금</th>
                                <th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('FFNLG_AMT', this.innerText, 'match', 'part');">과태료금액</th>
                                <th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('CRDN_STTS_CD', this.innerText, 'codeValue', 'FIM010');">처리상태</th>
                                <th class="rvs pvs" style="width: 140px;" onclick="FimsSupport.searchFromGridTitle('CRDN_SPAREA_CD', this.innerText, 'codeValue', 'FIM007');">단속특별구역</th>
                                <th class="eca" style="width: 140px;" onclick="FimsSupport.searchFromGridTitle('USE_FUEL_CD', this.innerText, 'codeValue', 'LVS005');">사용연료</th>
                                <th class="dpv" style="width: 140px;" onclick="FimsSupport.searchFromGridTitle('PRK_PSBLTY_RSLT_CD', this.innerText, 'codeValue', 'FIM034');">주차가능여부</th>
                                <th class="cmn" style="width: 100px;" onclick="FimsSupport.searchFromGridTitle('ZIP', this.innerText, 'match', 'part');">우편번호</th>
                                <th class="cmn" style="width: 280px;" onclick="FimsSupport.searchFromGridTitle('ADDR', this.innerText, 'match', 'part');">주소</th>
                                <th class="cmn" style="width: 320px;" onclick="FimsSupport.searchFromGridTitle('DTL_ADDR', this.innerText, 'match', 'part');">상세주소</th>
                                <th class="cmn" style="width: 180px;">등록일시</th>
                                <th class="cmn" style="width: 140px;">등록사용자</th>
                                <th class="cmn" style="width: 180px;">수정일시</th>
                                <th class="cmn" style="width: 140px;">수정사용자</th>
                                <th class="cmn dummy-th"></th>
                            </template>
                            <tbody name="tbodyList">
                            </tbody>
                            <template is="curly-brackets" name="tmpltRows">
                                <tr data-index="{data-index}">
                                    <td class="cmn text-center" onclick ondblclick>{ROW_NUM}</td>
                                    <td class="cmn text-center"><input type="checkbox" class="form-check-input" name="gridCheckbox" value="{data-index}" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></td>
                                    <td class="cmn text-center" onclick ondblclick>{TASK_SE_NM}</td>
                                    <td class="cmn text-center" onclick ondblclick>{RCPT_NO_MASK}</td>
                                    <td class="cmn text-center" onclick ondblclick>{RCPT_YMD}</td>
                                    <td class="cmn text-center" onclick ondblclick>{RCPT_SE_NM}</td>
                                    <td class="cmn text-center" onclick ondblclick>{NTFCTN_SE_NM}</td>
                                    <td class="cmn text-center" onclick ondblclick>{OWNR_REL_NM}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{STTR_NM}</td>
                                    <td class="cmn text-center" onclick ondblclick>{STTR_BRDT_MASK}</td>
                                    <td class="cmn text-center" onclick ondblclick>{STTR_ZIP}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{STTR_ADDR}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{STTR_DADDR}</td>
                                    <td class="cmn text-center" onclick ondblclick>{OPNN_SBMSN_STTS_NM}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{OPNN_SBMSN_SE_NM}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{OPNN_SBMSN_GIST}</td>
                                    <td class="cmn text-center" onclick ondblclick>{DOC_NO}</td>
                                    <td class="cmn text-center" onclick ondblclick>{ANS_YMD_TM}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{ANS_CN}</td>
                                    <td class="cmn text-center" onclick ondblclick>{CRDN_YMD_TM}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{VHRNO}</td>
                                    <td class="cmn text-center" onclick ondblclick>{RTPYR_SE_NM}</td>
                                    <td class="cmn text-center privacy-cell" onclick ondblclick>
                                        <span>{RTPYR_NO}</span>
                                        <span>*************</span>
                                    </td>
                                    <td class="cmn text-start"  onclick ondblclick>{RTPYR_NM}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{VLTN_ARTCL}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{CRDN_STDG_NM}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{CRDN_PLC}</td>
                                    <td class="bpv text-start"  onclick ondblclick>{DTL_CRDN_PLC}</td>
                                    <td class="cmn text-end"    onclick ondblclick>{FFNLG_CRDN_AMT}</td>
                                    <td class="cmn text-end"    onclick ondblclick>{FFNLG_AMT}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{CRDN_STTS_NM}</td>
                                    <td class="rvs pvs text-center" onclick ondblclick>{CRDN_SPAREA_NM}</td>
                                    <td class="eca text-center" onclick ondblclick>{USE_FUEL_NM}</td>
                                    <td class="dpv text-center" onclick ondblclick>{PRK_PSBLTY_RSLT_NM}</td>
                                    <td class="cmn text-center" onclick ondblclick>{ZIP}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{ADDR}</td>
                                    <td class="cmn text-start"  onclick ondblclick>{DTL_ADDR}</td>
                                    <td class="cmn text-center" onclick ondblclick>{REG_DT}</td>
                                    <td class="cmn text-center" onclick ondblclick>{RGTR_NM}</td>
                                    <td class="cmn text-center" onclick ondblclick>{MDFCN_DT}</td>
                                    <td class="cmn text-center" onclick ondblclick>{MDFR_NM}</td>
                                    <td class="cmn dummy-td"></td>
                                </tr>
							</template>
							<template name="tmpltNotFound">
								<tr class="bpv">
									<td valign="top" colspan="39" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
								</tr>
								<tr class="dpv">
									<td valign="top" colspan="39" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
								</tr>
                                <tr class="dvs">
                                    <td valign="top" colspan="39" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
                                </tr>
								<tr class="eca">
									<td valign="top" colspan="39" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
								</tr>
								<tr class="rvs pvs">
									<td valign="top" colspan="39" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
								</tr>
								<tr class="pes">
									<td valign="top" colspan="39" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
								</tr>
							</template>
						</table>
					</div>
				</div>
			</div>
			<!-- DataTables(그리드) -->
		</div> <!-- <div class="card wrapper-list"> -->
	</div> <!-- <div class="container-xxl flex-grow-1 px-0"> -->
	<!-- / Content -->

  	<div class="content-backdrop fade"></div>
</div>
<!-- / Inner page html -->

<script>
    LoadScript("excl02010Script", wctx.url("/resources/js/fims/excl/excl02010.js?ver=${ver}"));

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

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

        // URL
        $P.prefixUrl = "${prefixUrl}";
        // datasetControl
        $P.ctrl = newExcl02010Control("${pageName}", "[data-doctx=${pageName}]");

        /**************************************************************************
         * DataTables 이벤트
         **************************************************************************/
        // dataTable 체크박스 클릭 이벤트
        $P.dataTableCheckbox = (element, bool) => {
            GRID.checkbox.sync(element, bool);

            let atLeastOne = GRID.checkbox.countChecked(element) > 0;

            $P.$findn("btnRemove").prop("disabled", !atLeastOne);                // 의견제출 삭제
            $P.$findn("btnPrintDlbrDecsn").prop("disabled", !atLeastOne);        // 심의의결서 출력

            Apply.toDataset.selection($P.ctrl.dataset, element, bool);
        }

        // dataTable 클릭 이벤트
        $P.dataTableClick = (dataIndex) => {
        	if (!dataIndex) return;

            $P.$findn("tbodyList").setCurrentRow(dataIndex);

            Apply.toDataset.current($P.ctrl.dataset, dataIndex);
        }

        // dataTable 더블 클릭 이벤트 - 개별총정보 dialog
        $P.dataTableDblClick = (dataIndex) => {
            if (!dataIndex) return;

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

            let params = {
                  callPageName: "${pageName}"
                , callPurpose: "update"
                , sggCd: $P.ctrl.getValue("SGG_CD")
                , taskSeCd: $P.ctrl.getValue("TASK_SE_CD")
                , crdnId: $P.ctrl.getValue("CRDN_ID")
            }

            ajax.get({
                  url: wctx.url("/sprt/sprt02/010/main.do")
                , data: params || {}
                , success: (resp) => {
                    let dialogName = "totalInfoMainDialog";
                    let dialogId = dialogName + "-" + uuid();

                    dialog.open({
                          id: dialogId
                        , title: "개별총정보"
                        , size: "xxl"
                        , content: resp
                        , init: () => {
                            $("#" + dialogId).attr("name", dialogName);
                            $("#" + dialogId).attr("data-ref-doctx", "${pageName}");

                            AppSupport.setDialogZindex();
                        }
                        , onClose: () => { }
                    });
                }
            });
        }

        // DataTables에 스크롤이 맨 밑으로 이동했을 때 이벤트
        $P.scrollDataList = () => {
            $P.ctrl.load($P.ctrl.query.pageNum + 1);
        }

        /**************************************************************************
         * 사용자 함수(function)
         **************************************************************************/
        // 사용자검색 callback
        $P.callbackFindUser = (userId, userNm) => {
            $P.$findn("schRgtrCd").val(userId);                                 // 사용자 ID
            $P.$findn("schRgtrNm").val(userNm);                                 // 사용자 명
        }

        // 삭제사유 callback
        $P.callbackRsn = (obj) => {
            let selected = $P.ctrl.getDataset("selected");                      // 선택 자료

            // 서버에 전송할 data(파라미터) 생성
            let params = {
                  sggCd: $P.$findn("sggCd").val()                                           // 시군구 코드
                , taskSeCd: $P.$findn("frmSearch").find("[name='taskSeCd']:checked").val()  // 업무 구분 코드
                , opnnIds: selected.map(info => info.OPNN_ID).join(",")                     // 의견제출 IDs
                , btnTitle: obj.btnTitle                                                    // 버튼 title
                , delRsn: obj.reason                                                        // 삭제 사유
            };

            $P.ctrl.remove(params);
        }

        // 의견제출 심의
        $P.opnnSbmsnDlbr = (params) => {
            if (!params) return;

            ajax.get({
                  url: wctx.url($P.prefixUrl + "/030/info.do")
                , data: params || {}
                , success: (resp) => {
                    let dialogName = $P.ctrl.prefixed("DlbrDialog")
                    let dialogId = dialogName + "-" + uuid();

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

                            AppSupport.setDialogZindex();
                        }
                        , onClose: () => { $P.ctrl.reload({all : true}); }      // 자료 재조회
                    });
                }
            });
        }

        // 의견제출 심의위원 관리
        $P.opnnSbmsnDlbrMbr = (params) => {
            if (!params) return;

            ajax.get({
                  url: wctx.url($P.prefixUrl + "/040/info.do")
                , data: params || {}
                , success: (resp) => {
                    let dialogName = $P.ctrl.prefixed("DlbrMbrDialog");
                    let dialogId = dialogName + "-" + uuid();

                    dialog.open({
                          id: dialogId
                        , title: $P.ctrl.prefixName + " 심의위원 정보"
                        , size: "md"
                        , content: resp
                        , init: () => {
                            $("#" + dialogId).attr("name", dialogName);
                            $("#" + dialogId).attr("data-ref-doctx", "${pageName}");

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

        // 심의의결서 출력
        $P.makeHwpFileDlbrDecsn = (params) => {
            if (!params) return;

            let url = wctx.url($P.prefixUrl + "/010/makeHwp.do");
            let parameter = toQuery({
                  opnnIds: params.opnnIds
                , taskSeCd: params.taskSeCd
            });

            document.location.href = url + "?" + parameter;
        }

        /**************************************************************************
         * 버튼 clickEvent
         **************************************************************************/
        // 업무 구분 변경
        $P.fnResetAndChangeBiz = (taskSeCd) => {
            // 업무 구분 코드
            if (!taskSeCd) {
                taskSeCd = $("#layout-navbar input[name='taskSeCd']:checked").val();
            }

            // 초기화
            $P.fnReset(taskSeCd);

            // 업무 구분에 따른 URL 설정
            $P.ctrl.urls.load    = wctx.url($P.prefixUrl + "/010/list.do");    // 검색
            $P.ctrl.urls.remove  = wctx.url($P.prefixUrl + "/010/remove.do");  // 삭제
            $P.ctrl.urls.getInfo = wctx.url($P.prefixUrl + "/020/info.do");    // 상세 정보

            // 최고 관리자인지 권한을 확인하여 업무구분을 선택할 수 있도록 하자 -> 수정 필요
            $P.$findn("frmSearch").find("input[name='taskSeCd']").each(function(i) {
                $(this).prop("disabled", "true");
            });

            FimsSupport.renderForTask($P.findn("frmSearch"), taskSeCd.toLowerCase());       // 업무별 검색 조건
            FimsSupport.renderForTask($P.findn("gridbuttonArea"), taskSeCd.toLowerCase());  // 업무별 버튼

            // 업무별 그리드 th
            let colContent = $P.findn("tmpltCols").content;
            let cols = $(colContent).find("." + taskSeCd.toLowerCase() + ",.cmn");
            let colsOuterHTML = "";

            cols.each(function() {
                colsOuterHTML += this.outerHTML;
            });
            $P.findn("tableRspns").changeColumn(colsOuterHTML);
        }

        // 사용자검색 버튼 클릭 이벤트
        $P.fnGetFindUser = () => {
            let params = {
                callbackFuncName: "pageObject['${pageName}']['callbackFindUser']"
            }

            ajax.get({
                  url: wctx.url("/user/user02/010/main.do")
                , data: params || {}
                , success: (resp) => {
                    let dialogName = "userDialog";
                    let dialogId = dialogName + "-" + uuid();

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

                            AppSupport.setDialogZindex();
                        }
                        , onClose: () => { }
                    });
                }
            });
        }

        // 검색 버튼 클릭 이벤트
        $P.fnSearchList = () => {
            // validate 확인
            if (!AppSupport.customValidate($P.$findn("frmSearch").find("input,select,textarea"))) return;

            // 검색조건
            $P.ctrl.query = new FimsFormFields($P.selectorn("frmSearch")).get();    // 검색 조건
            $P.ctrl.query.fetchSize = DEFAULT_FETCH_SIZE;                           // 한번에 조회되는 자료 건수
            $P.ctrl.query.delYn = "N";                                              // 삭제 여부

            $P.ctrl.load(1);
        }

        // 엑셀 버튼 클릭 이벤트
        $P.fnExcel = () => {
            if ($P.ctrl.dataset.empty) {
                dialog.alert({
                      content: "검색된 " + $P.ctrl.prefixName + " 정보가 없습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });
                return;
            }

            // DataTables(그리드)
            $P.ctrl.query.cellDefs =
                  AppSupport.getCellDefs($P.$findn("theadTr").find("th").not(".dummy-th").not(":eq(0)")
                , $($P.findn("tmpltRows").content).find("td").not(".dummy-td").not(":eq(0)")
                , FimsSupport.getCellDefsForPrivacyCell);

            $P.ctrl.download();
        }

        // 심의위원 관리 버튼 클릭 이벤트
        $P.fnDlbrMbr = (btnTitle) => {
            //
        	let params = {
                  btnTitle: btnTitle                                                        // 버튼 title
                , callPurpose: "update"                                                     // 호출용도: 수정
                , sggCd: $P.$findn("sggCd").val()                                            // 시군구 코드
                , taskSeCd: $P.$findn("frmSearch").find("[name='taskSeCd']:checked").val()   // 업무 구분 코드
            };

            $P.opnnSbmsnDlbrMbr(params);
        }

        // 의견제출 수정 버튼 클릭 이벤트
        $P.fnUpdate = (btnTitle) => {
            // 의견제출 ID
            let opnnId = $P.ctrl.getValue("OPNN_ID");
            if (!opnnId) return;

            let params = {
                  btnTitle: btnTitle                                            // 버튼 title
                , callPurpose: "update"                                         // 호출용도: 수정
                , sggCd: $P.ctrl.getValue("SGG_CD")                             // 시군구 코드
                , taskSeCd: $P.ctrl.getValue("TASK_SE_CD")                      // 업무 구분 코드
                , opnnId: $P.ctrl.getValue("OPNN_ID")                           // 의견제출 ID
            };

            $P.ctrl.getInfo(params);
        }

        // 의견제출 심의 버튼 클릭 이벤트
        $P.fnUpdateDlbr = (btnTitle) => {
            // 의견제출 ID
            let opnnId = $P.ctrl.getValue("OPNN_ID");
            if (!opnnId) return;

            let params = {
                  btnTitle: btnTitle                                            // 버튼 title
                , callPurpose: "update"                                         // 호출용도: 수정
                , sggCd: $P.ctrl.getValue("SGG_CD")                             // 시군구 코드
                , taskSeCd: $P.ctrl.getValue("TASK_SE_CD")                      // 업무 구분 코드
                , opnnId: $P.ctrl.getValue("OPNN_ID")                           // 의견제출 ID
            };

            $P.opnnSbmsnDlbr(params);
        }

        // 의견제출 삭제 버튼 클릭 이벤트
        $P.fnRemove = (btnTitle) => {
            let selected = $P.ctrl.getDataset("selected");                      // 선택 자료

            if (selected.length < 1) {
                dialog.alert({
                      content: "선택하신 " + $P.ctrl.prefixName + " 정보가 없습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });
                return;
            }

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

        // 심의의결서 출력 버튼 클릭 이벤트
        $P.fnPrintDlbrDecsn = (btnTitle) => {
            let selected = $P.ctrl.getDataset("selected");                      // 선택 자료

            if (selected.length < 1) {
                dialog.alert({
                      content: "선택하신 " + $P.ctrl.prefixName + " 정보가 없습니다."
                    , init: () => { AppSupport.setDialogZindex(); }
                    , onOK: () => { }
                });
                return;
            }

            let params = {
                  callPurpose: "download"
                , title: btnTitle
                , sggCd: $P.ctrl.getValue("SGG_CD")                             // 시군구 코드
                , taskSeCd: $P.ctrl.getValue("TASK_SE_CD")                      // 업무 구분 코드
                , opnnIds: selected.map(info => info.OPNN_ID).join(",")         // 의견제출 IDs
            };

            $P.makeHwpFileDlbrDecsn(params);
        }

        /**************************************************************************
         * 초기 설정
         **************************************************************************/
        // 이벤트
        $P.setEvent = () => {
            // 기본 버튼 이벤트
            $P.$findn("btnReset").on("click", () => $P.fnResetAndChangeBiz());  // 초기화
            $P.$findn("btnSearch").on("click", () => $P.fnSearchList());        // 검색
            $P.$findn("btnExcel").on("click", () => $P.fnExcel());              // 엑셀
            $P.$findn("btnFindUser").on("click", () => $P.fnGetFindUser());     // 사용자 검색

            // 동적검색에서 엔터(Enter) 키를 누르면 검색한다.
            $P.$findn("term").onEnterPress($P.fnSearchList);

            // 업무 버튼 이벤트
            $P.$findn("btnDlbrMbr").on("click", function() {
                $P.fnDlbrMbr($(this).attr("title"));                            // 심의위원 관리
            });
            $P.$findn("btnUpdate").on("click", function() {
                $P.fnUpdate($(this).attr("title"));                             // 의견제출 수정
            });
            $P.$findn("btnUpdateDlbr").on("click", function() {
                $P.fnUpdateDlbr($(this).attr("title"));                         // 의견제출 심의
            });
            $P.$findn("btnRemove").on("click", function() {
                $P.fnRemove($(this).attr("title"));                             // 의견제출 삭제
            });
            $P.$findn("btnPrintDlbrDecsn").on("click", function() {
                $P.fnPrintDlbrDecsn($(this).attr("title"));                     // 심의의결서 출력
            });

            // DataTables width 변경 조정
            Componentization.fnMakeResizableTable($P.findn("tableRspns"));
            // DataTables 스크롤 이벤트 생성
            Componentization.fnMakeScrollableTable($P.findn("tableRspns"), $P.scrollDataList);
        }

        // 초기화 버튼 이벤트
        $P.fnReset = (taskSeCd) => {
            // 초기화
            $P.findn("frmSearch").reset();                                      // 화면 초기화
            AppSupport.initDatepicker($P.findn("frmSearch"));                   // 달력 초기화
            AppSupport.initDetailSearchButton($P.findn("frmSearch"));           // 상세검색 버튼 화살표

            // input, select 초기화
            let searchForm = $P.$findn("frmSearch");
            searchForm.find("input[type='radio']").not("[name='taskSeCd']").prop("checked", false);
            searchForm.find("input[type='checkbox']").prop("checked", false);
            searchForm.find("input[type='text']").val("");
            searchForm.find("input[type='hidden']").val("");
            searchForm.find("select").each(function(){ $(this).find("option:eq(0)").prop("selected", true); });

            // 기본 데이터 설정
            $P.$findn("sggCd").val("${sggCd}");                                  // 시군구 코드
            $P.$findn("frmSearch").find("input[name='taskSeCd'][value='" + taskSeCd + "']").prop("checked", true);
            $P.$findn("schRcptYmdFrom").datepicker('setDate', DateSupport.getAddDay(-7));    // 부과 제외 일자 시작
            $P.$findn("schRcptYmdTo").datepicker('setDate', TODAY());                        // 부과 제외 일자 종료
            $P.$findn("byOutput").val("동적 검색");                              // 동적 검색
            $P.$findn("schRgtrNm").prop("readonly", true);                       // 사용자 이름

            // dataset 초기화
            $P.ctrl.dataset.clear();
        }

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

        // 2. 초기 설정 및 업무 구분 변경
        $P.fnResetAndChangeBiz($("#layout-navbar input[name='taskSeCd']:checked").val());

        // 3. 보안모드
        fn_securityModeToggle($("#securityMode--top").is(":checked"));
    });

</script>
