<%@ 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">
			<form name="frmEdit">

				<div class="row g-1" name="forRootAdmin" hidden>
					<div class="col-md-6">
						<label is="name-label" for="sggID"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end required">
						시군구코드
						</label>
						<input type="text" is="id-input" name="sggID" data-map="SGG_CD"
						class="form-control w-px-200" required maxlength="7" readonly />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="instCode"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end required">
						기관코드
						</label>
						<input type="text" is="id-input" name="instCode" data-map="INST_CD"
						class="form-control w-px-200" required maxlength="7" readonly />
					</div>
				</div>



				<div class="row g-1">

					<div class="col-md-6">
						<label is="name-label" for="deptID"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end required">
						부서코드
						</label>

						<input type="text" is="id-input" name="deptID" data-map="DEPT_CD"
						class="form-control w-px-200" required maxlength="7" readonly />

					</div>

					<div class="col-md-6">
						<label is="name-label" for="name"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end required">
						부서명
						</label>

						<input type="text" is="id-input" name="name" data-map="DEPT_NM"
						class="form-control w-px-200" required readonly  />

					</div>

					<div class="col-md-12" hidden>
						<input type="text" is="id-input" name="telno" data-map="DEPT_TELNO"
						class="form-control w-px-200" />
						<input type="text" is="id-input" name="faxno" data-map="DEPT_FXNO"
						class="form-control w-px-200" />
					</div>

				</div>

				<div class="row g-1">
					<div class="col-md-6">
						<label is="name-label" for="cvlcptLinkSeCd"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						민원연계구분
						</label>
						<input type="text" is="id-input" name="cvlcptLinkSeCd" data-map="CVLCPT_LINK_SE_CD"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="vrbacntLinkSeCd"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						가상계좌연계구분
						</label>
						<input type="text" is="id-input" name="vrbacntLinkSeCd" data-map="VRBACNT_LINK_SE_CD"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="pstofcNm"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						우체국명
						</label>
						<input type="text" is="id-input" name="pstofcNm" data-map="PSTOFC_NM"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="rgNoHeader"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						등기번호 헤더
						</label>
						<input type="text" is="id-input" name="rgNoHeader" data-map="RG_NO_HEADER"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="sndngLinkSeCd"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						발송연계구분
						</label>
						<input type="text" is="id-input" name="sndngLinkSeCd" data-map="SNDNG_LINK_SE_CD"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="egpConOrg"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						E그린 외부기관구분
						</label>
						<input type="text" is="id-input" name="egpConOrg" data-map="EGP_CON_ORG"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="egpRceptId"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						E그린 접수수체국기호
						</label>
						<input type="text" is="id-input" name="egpRceptId" data-map="EGP_RCEPT_ID"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="egpApvlNb"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						E그린 후납계약승인번호
						</label>
						<input type="text" is="id-input" name="egpApvlNb" data-map="EGP_APVL_NB"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="egpEsbPath"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						E그린 ESB경로
						</label>
						<input type="text" is="id-input" name="egpEsbPath" data-map="EGP_ESB_PATH"
						class="form-control w-px-300"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="egpPostInstId"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						E그린 우정정보센터 기관ID
						</label>
						<input type="text" is="id-input" name="egpPostInstId" data-map="EGP_POST_INST_ID"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="egpCertCn"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						E그린 인증서CN
						</label>
						<input type="text" is="id-input" name="egpCertCn" data-map="EGP_CERT_CN"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="ensInterfaceId"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						세외수입인터페이스ID
						</label>
						<input type="text" is="id-input" name="ensInterfaceId" data-map="ENS_INTERFACE_ID"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="ensSourceCd"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						세외수입소스코드
						</label>
						<input type="text" is="id-input" name="ensSourceCd" data-map="ENS_SOURCE_CD"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="ensTargetCd"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						세외수입타겟코드
						</label>
						<input type="text" is="id-input" name="ensTargetCd" data-map="ENS_TARGET_CD"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="ensUrl"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						세외수입URL
						</label>
						<input type="text" is="id-input" name="ensUrl" data-map="ENS_URL"
						class="form-control w-px-300"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="nxrpLinkYn"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						세외수입 연계 여부
						</label>
						<input type="text" is="id-input" name="nxrpLinkYn" data-map="NXRP_LINK_YN"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="nxrpLinkSrvcUrl"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						세외수입연계서비스URL
						</label>
						<input type="text" is="id-input" name="nxrpLinkSrvcUrl" data-map="NXRP_LINK_SRVC_URL"
						class="form-control w-px-300"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="nxrpRgnSeCd"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						세외수입지역구분코드
						</label>
						<input type="text" is="id-input" name="nxrpRgnSeCd" data-map="NXRP_RGN_SE_CD"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="dtbnBankNm"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						교부은행명
						</label>
						<input type="text" is="id-input" name="dtbnBankNm" data-map="DTBN_BANK_NM"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="dtbnActno"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						교부계좌번호
						</label>
						<input type="text" is="id-input" name="dtbnActno" data-map="DTBN_ACTNO"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="docHeader"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						문서머릿말
						</label>
						<input type="text" is="id-input" name="docHeader" data-map="DOC_HEADER"
						class="form-control w-px-200"  />
					</div>
					<div class="col-md-6">
						<label is="name-label" for="srvrOs"
						class="w-px-160 bg-lighter pe-2 col-form-label text-sm-end">
						서버OS
						</label>
						<input type="text" is="id-input" name="srvrOs" data-map="SRVR_OS"
						class="form-control w-px-200"  />
					</div>
				</div>

				<div class="row m-3">
					<div class="col-md-12">
						<span class="float-end">
							<button type="button" name="btnSave" class="btn btn-primary">저장</button>
						</span>
					</div>
				</div>
			</form>


		</div>

	</div>
</div>

<script>
LoadScript("ogdp02020Script",wctx.url("/resources/js/fims/ogdp/ogdp02020.js?ver=${ver}"));

pageObject["${pageName}"] = newDoctxFinder("${pageName}");
pageObject["${pageName}"].provided = {};

pageObject.childReq = [];
pageObject.childReq.push({
	refreshList : function(){ },
});

$(document).ready(function(){

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

	if(pageObject.parentRes.length > 0){
		$P.provided = pageObject.parentRes.pop();
	} else {
		$P.provided = pageObject.childReq.pop();
	}

	/**************************************************************************
	* DatasetControl, Dataset, FormFields
	**************************************************************************/
	$P.formFields = new FimsFormFields($P.selectorn("frmEdit"));

	var ctrl = newOgdp02010Control($P);

	ctrl.dataset.onCurrentChange = (dataItem) => {
		if(!dataItem){
			return;
		}
		$P.formFields.set(ctrl,dataItem);
	}

	/**************************************************************************
	* pageObject.function
	**************************************************************************/
	$P.fnSave = () => {

		if(!AppSupport.customValidate($P.$findn("frmEdit").find("input"))) return;

		var info = $P.formFields.get();
		if(info.deptID.length != 7){
			alert("부서코드는 7자리 숫자이여야 합니다.");
			return;
		}

		var create = ctrl.dataset.empty;

		ajax.post({
			url : create ? ctrl.urls.create : ctrl.urls.update,
			data : info,
			success : (resp) => {
				if(resp.saved){
					dialog.close($P.selfDlgId());
					dialog.alert({
						content:"저장되었습니다.",
						onOK : () => $P.provided.refreshList()
					});
				}
			}
		});
	}

	/**************************************************************************
	* element.on
	**************************************************************************/
	$P.$findn("btnSave").on('click', () => $P.fnSave());


	/**************************************************************************
	* 초기화
	**************************************************************************/

	if(MY_INFO.institute == 'ADMIN00') {
		$P.$findn("forRootAdmin").removeAttr("hidden");
	}

	var deptInfo = ${deptInfo};
	$P.$findn("deptID").attr("disabled","disabled");
	$P.$findn("name").attr("disabled","disabled");
	ctrl.dataset.setData([deptInfo]);
	if(deptInfo.USE_YN == "N"){
		$P.$findn("btnSave").attr("disabled","disabled");
	}

});

</script>