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

<div class="d-flex flex-row justify-content-evenly">
	<div class="card" style="max-width:1100px;">
		<form id="frmEdit--${pageName}">
			<input type="hidden" id="crdnId-${pageName}" name="crdnId" data-map="CRDN_ID" />
			<input type="hidden" id="rtpyrId-${pageName}" name="rtpyrId" data-map="RTPYR_ID"/>
			<input type="hidden" id="sggCd--${pageName}" name="sggCd" value="${sggCd}" />
			<input type="hidden" id="taskSeCd--${pageName}" name="taskSeCd" value="${taskSeCd}" />
			<div class="row g-1">
				<div class="col-md-12" slot="edit">
					<template class="pvs bpv">
						<slot>
							<label for="crdnSeCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">단속구분</label>
							<select id="crdnSeCd--${pageName}" name="crdnSeCd" data-map="CRDN_SE_CD" class="form-select">
								<c:forEach items="${FIM002List}" var="item">
									<option value="${item.code}">${item.value}</option>
				                </c:forEach>
							</select>
						</slot>
					</template>
				</div>
				<div class="col-md-4">
					<label for="crdnYmd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end required">
						위반일자
					</label>
					<input type="text" id="crdnYmd--${pageName}" name="crdnYmd" data-map="CRDN_YMD"
						class="form-control form-date" data-fmt-type="day" maxlength="10" required />
		            <button type="button" class="bx bx-sm bx-calendar bg-white"></button>
				</div>
				<div class="col-md-4">
					<label for="crdnTm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end required">
						위반시간
					</label>
		            <input type="text" id="crdnTm--${pageName}" name="crdnTm" data-map="CRDN_TM"
		            	class="form-control form-time" data-fmt-type="time" maxlength="8" required 
		            	placeholder="시:분:초" />
				</div>
				<div class="col-md-4">
					<label for="vhrno--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end required">
						차량번호
					</label>
					<input type="text" id="vhrno--${pageName}" name="vhrno" data-map="VHRNO" class="form-control" 
						data-maxlengthb="30" required />
				</div>
				<div class="col-md-4">
					<label for="vltnCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">
						위반내용
					</label>
					<select id="vltnCd--${pageName}" name="vltnCd" class="form-select" data-map="VLTN_CD">
						<c:forEach items="${VLTNList}" var="item">
							<option value="${item.code}">${item.value}</option>
		                </c:forEach>
					</select>
				</div>
				<div class="col-md-4 select2-primary">
					<label for="crdnStdgNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">법정동</label>
					<input type="text" id="crdnStdgNm--${pageName}" name="crdnStdgNm" data-map="CRDN_STDG_NM" 
						class="form-control w-px-150"  list="stdgNmList--${pageName}" />
					<datalist id="stdgNmList--${pageName}">
						<c:forEach items="${stdgNmList}" var="item">
							<option value="${item}"></option>
						</c:forEach>
					</datalist>
				</div>
				<div class="col-md-4 select2-primary">
					<label for="crdnRoadNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">도로명</label>
					<input type="text" id="crdnRoadNm--${pageName}" name="crdnRoadNm" data-map="CRDN_ROAD_NM" 
						class="form-control" />
				</div>
				<div class="col-md-6">
					<label for="crdnPlc--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">위반장소</label>
					<input type="text" id="crdnPlc--${pageName}" name="crdnPlc" data-map="CRDN_PLC"
						class="form-control w-px-300" data-maxlengthb="200" />
				</div>
				<div class="col-md-6" slot="edit">
					<template class="bpv">
						<slot>
							<label for="dtlCrdnPlc--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">상세위반장소</label>
							<input type="text" id="dtlCrdnPlc--${pageName}" name="dtlCrdnPlc" data-map="DTL_CRDN_PLC" class="form-control" 
								data-maxlenghb="200" />
						</slot>
					</template>
					<template class="pvs">
						<slot>
							<label for="crdnSpareaCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">특별구역</label>
							<select id="crdnSpareaCd--${pageName}" name="crdnSpareaCd" data-map="CRDN_SPAREA_CD" class="form-select">
								<c:forEach items="${FIM007List}" var="item">
									<option value="${item.code}">${item.value}</option>
				                </c:forEach>
							</select>
						</slot>
					</template>
				</div>
				<div class="col-md-12">
					<label for="etcCn--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">특기사항</label>
					<input type="text" id="etcCn--${pageName}" name="etcCn" data-map="ETC_CN" class="form-control" 
						data-maxlengthb="1000" />
				</div>
				<div class="col-md-4">
					<label for="rtpyrNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">소유자</label>
					<input type="text" id="rtpyrNm--${pageName}" name="rtpyrNm" data-map="RTPYR_NM" class="form-control" 
						/>
				</div>
				<div class="col-md-4">
					<label for="rtpyrSeCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">주민번호구분</label>
					<select id="rtpyrSeCd--${pageName}" name="rtpyrSeCd" data-map="RTPYR_SE_CD" class="form-select">
						<c:forEach items="${FIM011List}" var="item">
							<option value="${item.code}">${item.value}</option>
		                </c:forEach>
					</select>
				</div>
				<div class="col-md-4">
					<label for="rtpyrNo--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">주민번호</label>
					<input type="text" id="rtpyrNo--${pageName}" name="rtpyrNo" data-map="RTPYR_NO" class="form-control privacy" />
					<input type="text" id="mask-rtpyrNo--${pageName}" class="form-control privacy-mask" disabled value="******"/>
				</div>
				<div class="col-md-12">
					<label for="addr--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">주소</label>
					<input type="text" id="addr--${pageName}" name="addr" data-map="ADDR" class="form-control w-px-700" 
						data-maxlengthb="320" />
				</div>
				<div class="col-md-12">
					<label for="dtlAddr--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">상세주소</label>
					<input type="text" id="dtlAddr--${pageName}" name="dtlAddr" data-map="DTL_ADDR" class="form-control w-px-700" 
						data-maxlengthb="200" />
				</div>
				<div class="col-md-6">
					<label for="zip--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">우편번호</label>
					<input type="text" id="zip--${pageName}" name="zip" data-map="ZIP" class="form-control w-px-100" 
						maxlength="7" pattern="(\d{3}-\d{3}|\d{6}|\d{5})" />
					<button type="button" class="btn btn-sm btn-outline-dark" onclick="">검색</button>
				</div>
				<div class="col-md-6">

				</div>
				<div class="col-md-4">
					<label for="vin--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">차대번호</label>
					<input type="text" id="vin--${pageName}" name="vin" data-map="VIN" class="form-control" readonly 
						placeholder="입력항목이 아닙니다." />
				</div>
				<div class="col-md-4">
					<label for="vhclNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">차량명칭</label>
					<input type="text" id="vhclNm--${pageName}" name="vhclNm" data-map="VHCL_NM" class="form-control" readonly 
						placeholder="입력항목이 아닙니다." />
				</div>
				<div class="col-md-4">
					<label for="vhclColor--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">차량색상</label>
					<input type="text" id="vhclColor--${pageName}" name="vhclColor" data-map="VHCL_COLOR" class="form-control" readonly 
						placeholder="입력항목이 아닙니다." />
				</div>
				<div class="col-md-12" slot="edit">
					<template class="pvs bpv">
						<slot>
							<label for="ffnlgCarmdlCd--${pageName}" 
							class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">차종</label>
							<select id="ffnlgCarmdlCd--${pageName}" name ="ffnlgCarmdlCd" data-map="FFNLG_CARMDL_CD" 
							class="form-select">
								<option value=""></option>
								<c:forEach items="${FIM009List}" var="item">
									<option value="${item.code}">${item.value}</option>
				                </c:forEach>
							</select>
						</slot>
					</template>
				</div>
				<div class="col-md-12" slot="edit">
					<template class="eca">
						<slot>
							<label for="useFuelCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">연료구분</label>
							<select id="useFuelCd--${pageName}" name="useFuelCd" data-map="USE_FUEL_CD" class="form-select" disabled>
								<option value=""></option>
								<c:forEach items="${LVS005List}" var="item">
									<option value="${item.code}">${item.value}</option>
				                </c:forEach>
							</select>
						</slot>
					</template>
				</div>
				<div class="col-md-4" slot="edit">
					<template class="dpv eca pvs">
						<slot>
							<label for="towngYn--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">견인지시</label>
							<select id="towngYn--${pageName}" name="towngYn" class="form-select" data-map="TOWNG_YN">
								<c:forEach items="${FIM053List}" var="item">
									<option value="${item.code}">${item.value}</option>
				                </c:forEach>
							</select>
						</slot>
					</template>
				</div>
				<div class="col-md-4" slot="edit">
					<template class="dpv eca pvs">
						<slot>
							<label for="crdnSn--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">스티커번호</label>
							<input type="text" id="crdnSn--${pageName}" name="crdnSn" data-map="CRDN_SN" class="form-control" 
								maxlength="20" data-maxlengthb="20" />
						</slot>
					</template>
				</div>
				<div class="col-md-4" slot="edit">
					<template class="dpv">
						<slot>
							<label for="parkngPsbltyRsltCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">장애차량확인</label>
							<select id="parkngPsbltyRsltCd--${pageName}" name="parkngPsbltyRsltCd" data-map="PARKNG_PSBLTY_RSLT_CD" class="form-select">
								<c:forEach items="${FIM034List}" var="item">
									<c:if test="${item.code == '0' or item.code == '1'}">
										<option value="${item.code}">${item.value}</option>
									</c:if>
				                </c:forEach>
							</select>
						</slot>
					</template>
				</div>
				<div class="col-md-12" slot="edit">
					<template class="pvs bpv">
						<slot>
							<label for="teamId--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">단속조</label>
							<select id="teamId--${pageName}" name="teamId" data-map="TEAM_ID" class="form-select">
								<option value=""></option>
								<c:forEach items="${TeamList}" var="item">
									<option value="${item.TEAM_ID}">${item.TEAM_NM}</option>
				                </c:forEach>
							</select>
						</slot>
					</template>
				</div>
				<div class="col-md-12" slot="edit">
					<template class="pvs bpv">
						<slot>
							<label class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">단속원</label>
							<input type="text" id="teamer1--${pageName}" name="teamer1" data-map="TEAMER_1" class="form-control" />
							<input type="text" id="teamer2--${pageName}" name="teamer2" data-map="TEAMER_2" class="form-control" />
							<input type="text" id="teamer3--${pageName}" name="teamer3" data-map="TEAMER_3" class="form-control" />
							<input type="text" id="teamer4--${pageName}" name="teamer4" data-map="TEAMER_4" class="form-control" />
						</slot>
					</template>
				</div>
				<div class="col-md-6">
					<label for="doWarning--${pageName}">
						<input type="checkbox" id="doWarning--${pageName}" name="doWarning" class="form-check-input" />계고처리
					</label>
				</div>
			</div>

			<div class="row mt-4 justify-content-end mb-3">
				<div class="col-md-6">
					<div class="row justify-content-end">
						<div class="col-sm-3">
							<button type="button" id="btnInst--${pageName}" class="btn btn-primary">등록</button>
						</div>
					</div>
				</div>
			</div>
			
		</form>
	</div>
	<div class="card" style="width:400px;">
		<form id="frmFile--${pageName}" method="post" enctype="multipart/form-data">
			<input type="file" id="newFileList--${pageName}" name="newFileList" multiple accept="image/*" hidden />
		</form>
		
		<form id="frmUploadSet--${pageName}" method="post" enctype="multipart/form-data">
			<input type="file" id="inputUploadSet--${pageName}" name="inputUploadSet" multiple accept="image/*" hidden />
		</form>
		<div class="col-md-12">
			<button type="button" id="btnAddFile--${pageName}" class="btn btn-primary">이미지 추가</button>
			<button type="button" id="btnOpenVideoCapture--${pageName}" class="btn btn-primary">동영상 캡쳐</button>
			<button type="button" id="btnCancelAddFile--${pageName}" class="btn btn-primary">선택 사진 삭제</button>
		</div>
		<div id="display--${pageName}" style="overflow-y: scroll;height: 600px;border-style: solid;">
			
		</div>
	</div>

</div>

<script>
/**************************************************************************
 * Global Variable
 **************************************************************************/

pageObject["${pageName}"] = {};

$(document).ready(function(){

	var $P = pageObject["${pageName}"];
	
	$P.captureFileArr = [];
	$P.localUploadArr = [];
	
	/**************************************************************************
	 * DatasetControl, Dataset, FormFields
	 **************************************************************************/
	$P.formFields = new FimsFormFields("#frmEdit--${pageName}");

	$P.uploadSet = uploadSupport("#inputUploadSet--${pageName}");

	$P.crdnControl = new DatasetControl({
	    urls : { load : "", create : wctx.url("/${taskSeCd}/crdn/crdn05/030/create.do") },
	    keymapper : info => info ? info.CRDN_ID : "",
	    dataGetter : obj => obj["List"], appendData : true,
	    formats: {

		}
	});

	
	$P.crdnControl.save = (info) => {
		if (!info) return;
		var item = $P.crdnControl.getCurrent("item"),
			create = "added" == item.state;

		var formData = new FormData(document.getElementById("frmFile--${pageName}"));
		for(var key in info) {
		    var value = info[key];
		    formData.append(key,value);
		}
		
		formData.delete("newFileList");

		if($P.localUploadArr.length > 0){
			$P.localUploadArr.forEach(item => formData.append("newFileList",item));
		}
		
		if($P.captureFileArr.length > 0){
			$P.captureFileArr.forEach(item => formData.append("newFileList",item));
		}
		
		ajax.post({
			url:!create ? $P.crdnControl.urls.update : $P.crdnControl.urls.create,
			data: formData, contentType : false, processData : false,
			success:resp => $P.crdnControl.onSave(resp)
		});
	};

	/**************************************************************************
	 * DatasetControl.on, Dataset.on
	 **************************************************************************/
	$P.uploadSet.onDatasetChange  = () => { 
		var files = $P.uploadSet.getDataset();
		files.forEach(item => $P.localUploadArr.push(item));

		$P.fnDisplay(); 
	};
	$P.uploadSet.onRemove = () => { };

	$P.crdnControl.onSave = (resp) => {
		if (resp.saved) {
			dialog.alert("저장됐습니다.");
			dialog.close("manualdialog");
		}
	};
	/**************************************************************************
	 * pageObject.function
	 **************************************************************************/
	$P.fnMakeImgForNewFile = (fileArr) => {
		var tagsText = "";
		
		for(var index = 0; index < fileArr.length; index++){
			var item = fileArr[index];
			
			tagsText += "<label class='mx-2'>";
			tagsText += "<input type='checkbox' name='newPhoto' class='form-check-input' value='"+item.id +"' ";
			tagsText += " />";
			tagsText += "<img src='"+ item.url +"' width='200' height='200' />";
			tagsText += "</label>";
				
			if(index % 2 == 1){
				tagsText += "<br />";
			}
		}

		return tagsText;
	}
	 
	$P.fnDisplay = () => {
		var displayArea = document.querySelector("#display--${pageName}");

		var concatArr = $P.localUploadArr.concat($P.captureFileArr);
		var tagsText = $P.fnMakeImgForNewFile(concatArr);
		displayArea.innerHTML = tagsText;
	};

	$P.fnSave = () => {

		if(!customValidate($("#frmEdit--${pageName} input"))) return;

		if($("#doWarning--${pageName}").is(":checked")){

			var rtpyrNm = document.getElementById("rtpyrNm--${pageName}");
			if(rtpyrNm.value == ""){
				dialog.alert({
					content:"계고 처리를 하기 위해선 소유주정보가 입력되어야 합니다.",
					onClose:function(){rtpyrNm.focus();}
				});
				return;
			}
			
		}
		
		if(confirm("현재 단속 정보를 저장하시겠습니까?")){
			$P.crdnControl.save($P.formFields.get());
		}
		
	};

	$P.videoCallback = (snapshots) => {
		snapshots.forEach(function(canvas, index, array){
			canvas.toBlob(function(blob){
				var identify = new Date().getTime()+ "-" + index;
				var file = new File([blob], "capture-"+identify+".png", {type: "image/png"});
				file.id = "file-" + identify;
				file.url = (window.URL || window.webkitURL).createObjectURL(file);
				$P.captureFileArr.push(file);
				if(index === array.length - 1){ 
					$P.fnDisplay();
				}
			});
		});
		
	}
	
	/**************************************************************************
	 * 초기화(업무별 입력항목)
	 **************************************************************************/
	var clsForTask = $("#taskSeCd--${pageName}").val().toLowerCase();
	//업무별 입력 항목
	renderForTask('frmEdit--${pageName}', clsForTask);
	
	/**************************************************************************
	 * element.on
	 **************************************************************************/
	 
	$("#btnInst--${pageName}").on('click', () => $P.fnSave());
	
	$("#btnAddFile--${pageName}").on('click', () => { $("#inputUploadSet--${pageName}").trigger("click"); });
	
	$("#btnOpenVideoCapture--${pageName}").on('click', () => {
		window.open(wctx.url("/sprt/sprt03/010/main.do?openerPageName=${pageName}")
				,"newVideoCapture"
				,"width=1800,height=950"
		);
	});
	
	$("#btnCancelAddFile--${pageName}").on('click', () => {
		var checked = $("#display--${pageName}").find("[name='newPhoto']:checked");
		if(checked.length < 1){
			alert("선택된 사진이 없습니다.");
			return;
		}
		
		var checkedArr = [];
		for(var i=0; i < checked.length; i++){
			checkedArr.push(checked[i].value);
		}
		
		$P.captureFileArr = $P.captureFileArr.filter(item => checkedArr.indexOf(item.id) == -1);
		$P.localUploadArr = $P.localUploadArr.filter(item => checkedArr.indexOf(item.id) == -1);

		$P.fnDisplay();
	});
	
	$("#vhrno--${pageName}").on("keyup",function(e){
		if(e.key == "Enter"){
			var crdnYmd = $("#crdnYmd--${pageName}").val().replaceAll("-", "");
			var vhrno = this.value;
			if(crdnYmd == ""){
				dialog.alert({
					content:"단속일자를 입력하세요.",
					onClose:function(){ $("#crdnYmd--${pageName}").focus(); }
				});
				return;
			}
			if(vhrno == ""){
				dialog.alert({
					content:"차량번호를 입력하세요.",
					onClose:function(){ $(this).focus(); }
				});
				return;
			}
			
			json.post({
				url: wctx.url("/payer/vehicle.do"),
				data: {
					sggCd : $("#sggCd--${pageName}").val(),
					vhrno : vhrno,
					levy_stdde : crdnYmd
				},
				success:resp => {
					if(!resp.found){
						dialog.alert("차량 정보가 없습니다.");
						$("#rtpyrId--${pageName}").val("");
						$("#rtpyrNm--${pageName}").val("");
						$("#rtpyrSeCd--${pageName}").val("");
						$("#rtpyrNo--${pageName}").val("");
						$("#vin--${pageName}").val("");
						$("#vhclNm--${pageName}").val("");
						$("#vhclColor--${pageName}").val("");
						$("#useFuelCd--${pageName}").val("");
						$("#ffnlgCarmdlCd--${pageName}").val("");
						$("#zip--${pageName}").val("");
						$("#addr--${pageName}").val("");
						$("#dtlAddr--${pageName}").val("");
						return;
					}
					
					$("#rtpyrId--${pageName}").val(resp.rtpyrId);
					
					var vehicle = resp.vehicle;
					
					$("#rtpyrNm--${pageName}").val(vehicle.mber_nm);
					
					var pyrSeCd = "";
					switch(vehicle.mber_se_code){
						case "11" : pyrSeCd = "01"; break;
						case "12" : pyrSeCd = "02"; break;
						case "13" : pyrSeCd = "03"; break;
						case "14" : pyrSeCd = "04"; break;
						case "15" : pyrSeCd = "05"; break;
					}
					$("#rtpyrSeCd--${pageName}").val(pyrSeCd);

					$("#rtpyrNo--${pageName}").val(vehicle.mber_se_no);
					
					$("#vin--${pageName}").val(vehicle.vin);
					$("#vhclNm--${pageName}").val(vehicle.cnm);
					$("#vhclColor--${pageName}").val(vehicle.color_nm);
					$("#useFuelCd--${pageName}").val(vehicle.use_fuel_code);
					
					if(vehicle.vhcty_asort_code == "1"){ //승용
						$("#ffnlgCarmdlCd--${pageName}").val("11");
					} else if(vehicle.vhcty_asort_code == "2"){ //승합
						$("#ffnlgCarmdlCd--${pageName}").val("12");
					} else if(vehicle.vhcty_asort_code == "3"){ //화물
						if(vehicle.vhcle_tot_wt <= 4000){
							$("#ffnlgCarmdlCd--${pageName}").val("13");
						} else {
							$("#ffnlgCarmdlCd--${pageName}").val("14");
						}
					} else if(vehicle.vhcty_asort_code == "4"){ //특수
						$("#ffnlgCarmdlCd--${pageName}").val("15");
					} else {
						$("#ffnlgCarmdlCd--${pageName}").val("");
					}
					
					$("#zip--${pageName}").val(vehicle.zip_code); //우편번호
					$("#addr--${pageName}").val(vehicle.road_nm_adres); //주소
					$("#dtlAddr--${pageName}").val(vehicle.use_strnghld_adres_nm); //상세주소
				}
			});
		}
		
	});
	
	$("#teamId--${pageName}").on("change",function(){
		$("#teamer1--${pageName}").val("");
		$("#teamer2--${pageName}").val("");
		$("#teamer3--${pageName}").val("");
		$("#teamer4--${pageName}").val("");
		
		if(this.value != ""){
			ajax.get({
				url: wctx.url("/${taskSeCd}/crdn/crdn07/010/info.do"),
				data: { "teamId" : this.value},
				success:resp => {
					if(resp.teamInfo != null){
						var teamInfo = resp.teamInfo;
						$("#teamer1--${pageName}").val(teamInfo.TEAMER_1);
						$("#teamer2--${pageName}").val(teamInfo.TEAMER_2);
						$("#teamer3--${pageName}").val(teamInfo.TEAMER_3);
						$("#teamer4--${pageName}").val(teamInfo.TEAMER_4);
					}
				}
			});
		}
	});
	
	/**************************************************************************
	 * 초기화
	 **************************************************************************/
	initDatepicker("frmEdit--${pageName}"); //달력 초기화

	$("#frmEdit--${pageName}").find(".form-date").each(function(){
		$(this).on("input",function(){
			var value = this.value.replaceAll("-","");
			
			if(value.length > 7){
				this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6);
			} else if(value.length > 5){
				this.value = value.substring(0,4)+"-"+value.substring(4);
			}
			
		});
	});
	$("#frmEdit--${pageName}").find(".form-time").each(function(){
		$(this).on("input",function(){
			var value = this.value.replaceAll(":","");
			
			if(value.length > 5){
				this.value = value.substring(0,2)+":"+value.substring(2,4)+":"+value.substring(4);
			} else if(value.length > 3){
				this.value = value.substring(0,2)+":"+value.substring(2);
			}
			
		});
	});
	
	//보안모드
    fn_securityModeToggle($("#securityMode--top").is(":checked"));

    $P.crdnControl.dataset.append({});

});
</script>