<%@ 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="pageKorName" scope="request">단속 자료 조회</c:set>
<div class="content-wrapper" data-doctx="${pageName}">
	<div class="container-xxl flex-grow-1 px-0">
		<div class="card wrapper-list">

		    <div class="container-page-btn">
		        <button type="button" name="btnReset" class="btn btn-outline-dark w-px-120" title="초기화">
		        초기화
		        </button>
		        <span class="container-window-btn-right">
		            <button type="button" name="btnSearch" class="btn btn-search w-px-120" title="검색">
		            검색
		            </button>
		            <button type="button" name="btnExcel" class="btn btn-excel w-px-120" title="엑셀 저장">
		            엑셀
		            </button>
		            <button type="button" name="btnExcelForApproval" class="btn btn-excel w-px-120" title="엑셀 저장">
		            엑셀(사진 포함)
		            </button>
		        </span>
		    </div>

		    <form name="frmSearch">
		        <div class="container-search">
                    <div class="row g-1">
                    	<jsp:include page="/WEB-INF/jsp/include/sgg-tasklist.jsp" />
                        <div class="col-6">
							<span class="form-label fw-bold form-search-title w-px-120 text-end">단속일자</span>
                        	<span class="form-search-linebox">
                                <input type="text" name="schCrdnYmdFrom"
                                class="form-control form-date"
                                	data-fmt-type="day"   title="시작 날짜 선택" />
                                <button type="button" class="bx bx-lg bx-calendar bg-white"></button>
                                ~
                                <input type="text" name="schCrdnYmdTo"
                                class="form-control form-date"
                                	data-fmt-type="day" title="종료 날짜 선택">
                                <button type="button" class="bx bx-lg bx-calendar bg-white"></button>
                            </span>
                        </div>
                        <div class="col-6">
                            <label is="name-label" for="crdnInptSeCd" class="form-label fw-bold form-search-title w-px-120 text-end">자료출처</label>
                            <select is="id-select" name="crdnInptSeCd" class="form-select">
                            	<option value="">전체</option>
                            	<c:forEach items="${FIM003List}" var="item">
                            		<option value="${item.code}">${item.value}</option>
                            	</c:forEach>
                            </select>
                        </div>
                        <div class="col-6">
                            <label is="name-label" for="vhrno" class="form-label fw-bold form-search-title w-px-120 text-end">차량번호</label>
                            <input type="text" is="id-input" name="vhrno" class="form-control" />
                        </div>
						<div class="col-6">
                        	<input type="hidden" name="by" />
							<input type="text" class="form-control fw-bold w-px-120 text-end" 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">
						<div slot="search" class="col-6 if-empty-col0">
			        		<template class="pvs dpv eca">
					            <slot>
					                <span class="form-label fw-bold form-search-title w-px-120 text-end">견인여부</span>
					                <label class="form-label">
		                            	<input type="radio" name="towngYn" value="" class="form-check-input" checked />전체
		                            </label>
					                <label class="form-label">
		                            	<input type="radio" name="towngYn" value="Y" class="form-check-input" />예
		                            </label>
		                            <label class="form-label">
		                            	<input type="radio" name="towngYn" value="N" class="form-check-input" />아니오
		                            </label>
					            </slot>
						    </template>
			        	</div>
			            <div class="col-6">
			                <label is="name-label" for="crdnSttsCd" class="form-label fw-bold form-search-title w-px-120 text-end">자료상태</label>
                            <select is="id-select" name="crdnSttsCd" class="form-select">
                            	<option value="">전체</option>
                            	<c:forEach items="${FIM010List}" var="item">
                            		<option value="${item.code}">${item.value}</option>
                            	</c:forEach>
                            </select>
			            </div>
			            <div slot="search" name="searchForNxrp" class="col-6 if-empty-col0">
                            <template class="rvs pvs bpv">
                                <slot>
                                    <label is="name-label" for="nxrpSendStts"
                                    class="form-label fw-bold form-search-title w-px-120 text-end">세외수입 전송 상태</label>
                                    <select is="id-select" name="nxrpSendStts" class="form-select">
                                        <option value="">전체</option>
                                        <option value="01">전송가능</option>
                                        <option value="02">전송완료</option>
                                        <option value="03">전송불가(사진없음)</option>
                                    </select>
                                </slot>
                            </template>
                        </div>
			            <div class="col-12"></div>
						<!-- 등록일자, 수정일자 -->
						<div class="col-6">
							<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" 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" title="종료 날짜 선택">
								<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
							</span>
						</div>
						<!-- 등록자명, 수정자명 -->
						<div class="col-6">
							<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>
		        <div name="gridbuttonArea" class="container-page-btn">
		            <div class="d-flex flex-row justify-content-between">
						<span is="paging-info" name="crdnPagingInfo"  class="dataTables_info" ></span>
		                <ul name="crdnPaging" class="pagination pagination-primary"></ul>
						<span is="paging-info" name="crdnSummary" class="dataTables_info" style="margin-left: 1.5rem;"></span>
					</div>

					<span class="container-window-btn-right">
						<input name="vehicleUpload" type="file" hidden>
						<button name="btnVehicleReqs" type="button" class="btn btn-primary">차적조회파일생성</button>
						<button name="btnVehicleUpdate" type="button" class="btn btn-primary">차적조회파일등록</button>
						<span slot="button">
							<template class="pvs bpv">
								<slot>
									<button type="button" class="btn btn-primary w-px-120" name="btnSendCrdn" title="세외수입 전송">
										&#x2611; 세외수입 전송
									</button>
								</slot>
							</template>
						</span>
					</span>
		        </div>
		    </div>

		    <div class="card-datatable text-nowrap">
		        <div class="dataTables_wrapper dt-bootstrap5 no-footer">
					<div name="table-responsive"
					class="table-responsive ox-scroll oy-scroll h-px-500">
						<table name="crdnTable" class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
							<thead class="sticky-thead">
								<tr name="crdnThead" data-search-target="[data-doctx='${pageName}']">
								</tr>
							</thead>
		                    <tbody name="crdnTbody"></tbody>
		                    <template name="crdnCols">
								<th style="width: 80px;" class="cmn">No.</th>
								<th class="cmn" style="width: 56px;">
									<input type="checkbox" class="form-check-input" name="gridAllCheckbox"
									onchange="pageObject['${pageName}'].checkCrdnList(this, this.checked);" />
								</th>
								<th onclick="FimsSupport.searchFromGridTitle('CRDN_INPT_SE_CD',this.innerText,'codeValue','FIM003');"
								style="width: 160px;" class="rvs pvs bpv dpv eca">자료출처</th>
								<th onclick="FimsSupport.searchFromGridTitle('VHRNO',this.innerText,'match','part');"
								style="width: 130px;" class="cmn">차량번호</th>
								<th onclick="FimsSupport.searchFromGridTitle('CRDN_YMD','위반일자','ymd','');"
								style="width: 180px;" class="cmn">위반일시</th>
								<th onclick="FimsSupport.searchFromGridTitle('CRDN_PLC',this.innerText,'match','part');"
								style="width: 250px;" class="cmn">단속장소</th>
								<th onclick="FimsSupport.searchFromGridTitle('ATCH_FILE_CNT',this.innerText,'match','perfect');"
								style="width: 100px;" class="cmn">사진건수</th>
								<th data-sort="CRDN_STTS_CD" onclick="FimsSupport.searchFromGridTitle('CRDN_STTS_CD',this.innerText,'codeValue','FIM010');"
								style="width: 140px;" class="cmn">처리상태</th>
								<th onclick="FimsSupport.searchFromGridTitle('LEVY_EXCL_RSN_CD',this.innerText,'codeValue','FIM022');"
								style="width: 250px;" class="cmn">제외사유</th>
								<th onclick="FimsSupport.searchFromGridTitle('LEVY_EXCL_YMD',this.innerText,'ymd','');"
								style="width: 140px;" class="cmn">제외처리일자</th>
								<th onclick="FimsSupport.searchFromGridTitle('LEVY_EXCL_ETC_CN',this.innerText,'match','part');"
								style="width: 250px;" class="cmn">제외내역</th>
								<th class="cmn dummy-th"></th>
		                    </template>
							<template is="curly-brackets" name="crdnRow">
								<tr data-index="DATA-INDEX">
									<td onclick ondblclick class="text-end cmn">ROW_NUM</td>
									<td class="cmn text-center">
										<input type="checkbox" class="form-check-input" name="gridCheckbox" value="DATA-INDEX"
										onchange="pageObject['${pageName}'].checkCrdnList(this, this.checked);">
									</td>
									<td onclick ondblclick class="text-center cmn">CRDN_INPT_SE_NM</td>
		                    		<td onclick ondblclick class="text-center cmn">VHRNO</td>
		                    		<td onclick ondblclick class="text-center cmn">CRDN_YMD_TM</td>
		                    		<td onclick ondblclick class="text-start cmn">CRDN_PLC</td>
		                    		<td onclick ondblclick class="text-center cmn">ATCH_FILE_CNT</td>
		                    		<td onclick ondblclick class="text-center cmn">CRDN_STTS_NM</td>
		                    		<td onclick ondblclick class="text-center cmn">LEVY_EXCL_RSN_NM</td>
		                    		<td onclick ondblclick class="text-center cmn">LEVY_EXCL_YMD</td>
		                    		<td onclick ondblclick class="text-start cmn">LEVY_EXCL_ETC_CN</td>
		                    		<td class="dummy-td cmn"></td>
	                    		</tr>
							</template>
							<template name="crdnNotFound">
								<tr class="dpv">
									<td valign="top" colspan="14" class="dataTables_empty text-center">
									단속 정보를 찾지 못했습니다.
									</td>
								</tr>
								<tr class="eca">
									<td valign="top" colspan="13" class="dataTables_empty text-center">
									단속 정보를 찾지 못했습니다.
									</td>
								</tr>
								<tr class="rvs pvs">
									<td valign="top" colspan="12" class="dataTables_empty text-center">
									단속 정보를 찾지 못했습니다.
									</td>
								</tr>
								<tr class="bpv">
									<td valign="top" colspan="12" class="dataTables_empty text-center">
									단속 정보를 찾지 못했습니다.
									</td>
								</tr>
								<tr class="pes">
									<td valign="top" colspan="12" class="dataTables_empty text-center">
									단속 정보를 찾지 못했습니다.
									</td>
								</tr>
								<tr class="dvs">
									<td valign="top" colspan="12" class="dataTables_empty text-center">
									단속 정보를 찾지 못했습니다.
									</td>
								</tr>
							</template>
						</table>
					</div>
				</div>
		    </div>
		</div>
	</div>

	<div class="content-backdrop fade"></div>

</div>

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

/**************************************************************************
 * Global Variable
 **************************************************************************/
var FIM002 = new CommonCodes(${FIM002});
var FIM003 = new CommonCodes(${FIM003});
var FIM010 = new CommonCodes(${FIM010});
var FIM022 = new CommonCodes(${FIM022});
var FIM026 = new CommonCodes(${FIM026});
var FIM034 = new CommonCodes(${FIM034});
pageObject["${pageName}"] = newDoctxFinder("${pageName}");

$(document).ready(function(){
	var $P = pageObject["${pageName}"];

	/**************************************************************************
	* DatasetControl, DatasetSupport, FormFields
	**************************************************************************/
	var ctrl = newCrdn06010Control($P);

	ctrl.defaultFetchSize = FETCH_XS;
	ctrl.query = { pageNum : 1, fetchSize : ctrl.defaultFetchSize };

	ctrl.dataset.onDatasetChange = (obj, option) => {
		var t = $P.getGridTemplate();
		var trs = Apply.fromDataset.getTbody(ctrl.dataset, t.found, t.notFound, t.replacer);
		$P.renderCrdnList(obj["Paging"]?.totalSize, ctrl.dataset.length, trs, option);

		$P.pagingSupport.setPagingInfo(obj);
		
		let crdns = ctrl.dataset.getDataset(),
			byStatus = crdns.reduce((acc, crdn) => {
				let status = crdn.CRDN_STTS_CD;
				if (["01", "81"].includes(status))
					acc[status] = (acc[status] || 0) + 1;
				return acc;
			}, {}),
			initial = byStatus["01"] || 0,
			excluded = byStatus["81"] || 0;
		
		$('button[name^="btnVehicle"]').prop("disabled", initial < 1);
		$('span[name="crdnSummary"]').html(crdns.length > 0 ? "초기상태: " + initial + ", 부과제외: " + excluded : "");
	};
	
	ctrl.dataset.onSort = sorter => {
		var t = $P.getGridTemplate();
		var trs = Apply.fromDataset.getTbody(ctrl.dataset, t.found, t.notFound, t.replacer);
		$P.renderCrdnList(obj["Paging"]?.totalSize, ctrl.dataset.length, trs, option);
	};

	ctrl.dataset.onCurrentChange = (dataItem) => {
		Apply.fromDataset.currentRow(ctrl.dataset, dataItem, $P.findn("crdnTbody"));
	}

	ctrl.dataset.onSelectionChange = (selectedArr) => {
		Apply.fromDataset.gridCheckbox(ctrl.dataset, $P.findn("crdnTbody"), 1, selectedArr);
		Apply.fromDataset.gridButton(ctrl.dataset, $P.findn("btnSendCrdn"), selectedArr);
	};

	$P.pagingSupport = new FimsPagingSupport({
		doq: $P,
        linkContainer: "[name='crdnPaging']"
	});

	/**************************************************************************
	* pageObject.function
	**************************************************************************/
	$P.fnReset = () => {
		var 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("byOutput").val("동적 검색");
		$P.$findn("schRgtrNm").prop("readonly", true);				// 사용자 이름
		$P.$findn("schCrdnYmdFrom").datepicker('setDate', DateSupport.getAddDay(-365));
		$P.$findn("schCrdnYmdTo").datepicker('setDate', TODAY());
		ctrl.dataset.setData([]);
	}

	$P.fnResetAndChangeBiz = (taskSeCd) => {
		$P.fnReset();
		ctrl.urls.load = wctx.url("/crdn/crdn06/010/list.do");
		ctrl.urls.getInfo = wctx.url("/sprt/sprt02/010/main.do");

		var clsForTask = taskSeCd.toLowerCase();

		//업무별 조회조건
		FimsSupport.renderForTask($P.findn("frmSearch"), clsForTask);
		//업무별 버튼
		FimsSupport.renderForTask($P.findn("gridbuttonArea"), clsForTask);
		//버튼 이벤트 재매핑
		$P.$findn("btnSendCrdn").off("click");
		$P.$findn("btnSendCrdn").on("click", () => $P.fnSendCrdn());

		//업무별 그리드
		var colsContent = $P.findn("crdnCols").content;
		var cols = $(colsContent).find("."+clsForTask+",.cmn");
		var colsStr = "";
		cols.each(function(){
			colsStr += this.outerHTML;
		});
		$P.findn("table-responsive").changeColumn(colsStr);

		if(SYS_LINK_INFO = null || SYS_LINK_INFO.NXRP_LINK_YN != 'Y'){
			$P.$findn("btnSendCrdn").attr("hidden","hidden");
			$P.$findn("searchForNxrp").attr("hidden","hidden");
		} else {
			$P.$findn("btnSendCrdn").prop("disabled", true);
		}
	}

	$P.getParams = () => {
		var formFields = new FimsFormFields($P.selectorn("frmSearch"));
		var data = formFields.get();
		data.fetchSize = ctrl.defaultFetchSize;

		return data;
	}

	$P.searchCrdnList = () => {
		ctrl.query = $P.getParams();
		ctrl.query.orderBy = "CRDN_YMD DESC, CRDN_TM DESC, VHRNO"
	    ctrl.load(1);
	}

	$P.scrollCrdnList = () => {
		ctrl.load(ctrl.query.pageNum + 1);
	}

	$P.refreshCrdnList = () => {
        ctrl.reload({all : true});
    }

	$P.fnExcelDown = (forApproval) => {
		if(ctrl.dataset.empty)
    		return alert("조회된 자료가 없습니다.");

    	var cellDefs = AppSupport.getCellDefs(
    		$P.$findn("crdnThead").find("th").not(".dummy-th").not(":eq(0)").not(":eq(0)"),
    		$($P.findn("crdnRow").content).find("td").not(".dummy-td").not(":eq(0)").not(":eq(0)")
    	);
		ctrl.query.cellDefs = cellDefs;
		ctrl.query.includePhoto = forApproval ? "Y" : "N";

    	ctrl.download();
    	ctrl.query.includePhoto = null;
	};
	$P.fnVehicleReqs = () => {
		let dataset = ctrl.dataset.getDataset("selected");
		if (dataset.length < 1)
			dataset = ctrl.dataset.getDataset();
		let crdnIds = dataset
			.filter(info => "01" == info.CRDN_STTS_CD)
			.map(info => info.CRDN_ID);
		if (crdnIds.length < 1)
			return dialog.alert("차적조회파일 생성의 대상 단속정보가 없습니다.");

		download.get({
			url: wctx.url("/crdn/crdn06/010/vehicleReqs.do"),
			data: {crdnIds: crdnIds.join(",")}
		});
	}
	$P.fnVehicleUpdate = () => {
		fileInput().select(item => {
			if (!item) return;

			let dataset = ctrl.dataset.getDataset("selected");
			if (dataset.length < 1)
				dataset = ctrl.dataset.getDataset();
			
			let crdnIds = dataset
				.filter(info => "01" == info.CRDN_STTS_CD)
				.map(info => info.CRDN_ID);
			if (crdnIds.length < 1)
				return dialog.alert("차적조회파일 등록의 대상 단속정보가 없습니다.");
			
			upload({
				url : wctx.url("/crdn/crdn06/010/uploadVehicles.do"),
				data : {
					crdnIds: crdnIds.join(","),
					upload: item
				},
				success : (resp) => {
					if (resp.saved) {
			        	if(resp.rtnMsg)
			        		dialog.alert(resp.rtnMsg);
		        		$P.refreshCrdnList();
					} else {
						dialog.alert(resp.rtnMsg);
					}
				}
			});
		});
	}

	$P.checkCrdnList = (element, bool) => {
		GRID.checkbox.sync(element, bool);

		var atLeastOne = GRID.checkbox.countChecked(element) > 0;
		$P.$findn("btnSendCrdn").prop("disabled", !atLeastOne);

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

	$P.getGridTemplate = () => {
		var clsForTask = $P.$findn("frmSearch").find("[name='taskSeCd']:checked").val().toLowerCase();
		var notFound = [$P.findn("crdnNotFound").content.querySelector("."+clsForTask+",.cmn").outerHTML];
		var foundContent = $P.findn("crdnRow").content;
		var foundTr = $(foundContent).find("tr")[0].cloneNode(false);
		var foundTds = $(foundContent).find("."+clsForTask+",.cmn");
		foundTds.each(function(){
			foundTr.appendChild(this.cloneNode(true));
		});
		var found = foundTr.outerHTML;

		var replacer = (str, dataItem) => str
			.replace(/{onclick}/gi, "pageObject['${pageName}'].clickCrdnList('{DATA-INDEX}');")
			.replace(/{ondblclick}/gi, "pageObject['${pageName}'].dblclickCrdnList('{CRDN_ID}');");

		return {
			found : found,
			notFound : notFound,
			replacer : replacer
		};
	}

	$P.renderCrdnList = (total, listLength, trs, option) => {
		let noMore = (listLength >= total);
		var initScroll = (ctrl.query.pageNum < 2);
		if(option != null && option.reloaded){
			initScroll = false;
		}

		$P.findn("table-responsive").changeContent(trs, initScroll, noMore);

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

	}

	$P.clickCrdnList = (dataIndex) => {
		if(!dataIndex)
			return;

		$P.$findn("crdnTbody").setCurrentRow(dataIndex);
		Apply.toDataset.current(ctrl.dataset, dataIndex);
	}

	$P.dblclickCrdnList = (dataKey) => crdnTotalInfo(
		{
			callPageName : "${pageName}",
			crdnId : dataKey
		},
		() => $P.refreshCrdnList()
	);

	$P.fnSendCrdn = () => {
		var datas = ctrl.dataset.getDataset("selected");
    	var taskSeCd = datas[0].TASK_SE_CD;

    	var keys = datas.map(item => item.CRDN_ID);

		var url = "";
    	if("RVS,PVS".includes(taskSeCd)){
    		url = "/nxrp/nxrp01/010/createIndivB01.do";
    	} else if(taskSeCd == "BPV"){
    		url = "/nxrp/nxrp01/010/createIndivC01.do";
    	} else {
    		return;
    	}

    	ajax.post({
			url : wctx.url(url),
			data : { "crdnIds" : keys.join(",") },
			success : (resp) => {
				if(resp.saved){
					dialog.alert({
						content : "처리되었습니다.",
						init : function() {
							AppSupport.setDialogZindex();
							AppSupport.focusClose();
						},
						onClose : function(){
							$P.refreshCrdnList();
						}
					});
				} else {
					alert(resp.rtnMsg);
				}
			}
		});
	}

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

	// 사용자검색 버튼 클릭 이벤트
	$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: "사용자 검색"
					, content: resp
					, size: "lg"
					, init: () => {
						$("#"+dialogId).attr("name", dialogName);
						$("#"+dialogId).attr("data-ref-doctx","${pageName}");

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

	/**************************************************************************
	* element.on
	**************************************************************************/
	$P.$findn("btnReset").on('click', () => $P.fnReset());
	$P.$findn("btnSearch").on('click', () => $P.searchCrdnList());
	$P.$findn("btnExcel").on('click', () => $P.fnExcelDown(false));
	$P.$findn("btnExcelForApproval").on('click', () => $P.fnExcelDown(true));
	$P.$findn("btnVehicleReqs").on('click', () => $P.fnVehicleReqs());
	$P.$findn("btnVehicleUpdate").on('click', () => $P.fnVehicleUpdate());
	
	$P.$findn("btnFindUser").on("click", () => $P.fnGetFindUser());		// 사용자 검색
	// 동적검색에서 엔터(Enter) 키를 누르면 검색한다.
	$P.$findn("term").onEnterPress($P.searchCrdnList);

    Componentization.fnMakeResizableTable($P.findn("table-responsive"));
    Componentization.fnMakeScrollableTable($P.findn("table-responsive"), $P.scrollCrdnList);

	/**************************************************************************
	* 초기화
	**************************************************************************/
    AppSupport.initDatepicker($P.findn("frmSearch")); //달력 초기화
    AppSupport.initDetailSearchButton($P.findn("frmSearch"));

    var defaultBizValue = $("#layout-navbar input[name='taskSeCd']:checked").val();
	if("${taskSeCd}" == ""){
		$P.$findn("frmSearch").find("input[name='taskSeCd'][value='" + defaultBizValue + "']").prop("checked",true);
	    $P.fnResetAndChangeBiz(defaultBizValue);
	} else {
		$P.$findn("frmSearch").find("input[name='taskSeCd'][value='" + "${taskSeCd}" + "']").prop("checked",true);
	    $P.fnResetAndChangeBiz("${taskSeCd}");
	}

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

    $P.$findn("frmSearch").find("input[name='taskSeCd']").each(function(i) {
		$(this).prop("disabled", "true");
	});
});
//# sourceURL=crdn06010-main.jsp
</script>