<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ page import="java.io.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setHeader("Expires", "0");
%>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="/jsp/common/include/css.jsp" />
<jsp:include page="/jsp/common/include/script.jsp" />

<script language="javascript">
var url = '<c:url value="/bap/transaction/procWorkMan.json" />';
var isDetail = false;

function init(key, key2, callback) {
	$.ajax({
		type: "POST",
		url: url,
		dataType: "json",
		data: { cmd: 'LIST_INIT_COMBO' },
		success: function(json) {
			new makeOptions("CODE","NAME").setObj($("select[name=bjobBzwkDstcd]")).setNoValueInclude(true).setNoValue('','전체').setData(json.bjobBzwkDstcd).rendering();
			new makeOptions("CODE","NAME").setObj($("select[name=osidInstiDstcd]")).setNoValueInclude(true).setNoValue('','전체').setData(json.osidInstiDstcd).rendering();

			if (typeof callback === 'function') {
				callback(key, key2);
			}
		},
		error: function(e) {
			alert(e.responseText);
		}
	});
}

function detail(key, key2) {

	if (!isDetail) return;
	
	$.ajax({
		type: "POST",
		url: url,
		dataType: "json",
		data: {
			cmd : 'DETAIL',
			bjobMsgScheID : key,
			bjobDmndSubMsgID : key2
		},
		success: function(json) {
			var detail = json.detail;
			
			$("input,select").each(function() {
				var name = $(this).attr('name').toUpperCase();
				$(this).val(detail[name]);
			});

			$("select[name=bjobBzwkDstcd] option").not(":selected").remove();
			$("select[name=osidInstiDstcd] option").not(":selected").remove();
		},
		error : function(e) {
			alert("detail error : " + e.responseText);
		}
	});
}

$(document).ready(function() {

	//$("input[name=sndrcvStartYMD],input[name=sndrcvEndYMD],input[name=bjobDmndMsgCretnYMD],input[name=msgQueeTracTdmndYMD]").inputmask({ alias: "datetime",autoUnmask: true, inputFormat : "yyyy-mm-dd",outputFormat : "yyyymmdd" });
	//$("input[name=sndrcvStartHMS],input[name=sndrcvEndHMS],input[name=bjobDmndMsgCretnHMS],input[name=msgQueeTracTdmndHMS]").inputmask({ alias: "datetime",autoUnmask: true, inputFormat : "HH:MM:ss",outputFormat : "HHMMss"  });
	$("input[name=sndrcvStartYMD],input[name=sndrcvEndYMD],input[name=bjobDmndMsgCretnYMD],input[name=msgQueeTracTdmndYMD]").inputmask("yyyy-mm-dd",{'autoUnmask':true});
	$("input[name=sndrcvStartHMS],input[name=sndrcvEndHMS],input[name=bjobDmndMsgCretnHMS],input[name=msgQueeTracTdmndHMS]").inputmask("hh:mm:ss",{'autoUnmask':true});
	$("input[name=msgPrcssPrity]").inputmask("9999",{'autoUnmask':true});
	
	var returnUrl = getReturnUrlForReturn();
	var key = "${param.bjobMsgScheID}";
	var key2 = "${param.bjobDmndSubMsgID}";

	if (key != "" && key != "null") {
		isDetail = true;
	}

	init(key, key2, detail);

	$("#btn_delete").click(function() {
		var postData = $('#ajaxForm').serializeArray();
		postData.push({
			name : "cmd",
			value : "DELETE"
		});

		$.ajax({
			type: "POST",
			url: url,
			data: postData,
			success: function(args) {
				alert("삭제 되었습니다.");
				goNav(returnUrl);//LIST로 이동
			},
			error: function(e) {
				alert(e.responseText);
			}
		});
	});

	$("#btn_previous").click(function() {
		goNav(returnUrl);//LIST로 이동
	});
	
	$(".focusOut").click(function(){
		document.body.focus();
	});

	buttonControl(key);
	// titleControl(key);
});
</script>
</head>
<body>
	<div class="right_box">
		<div class="content_top">
			<ul class="path">
				<li><a href="#">${rmsMenuPath}</a></li>
			</ul>
		</div><!-- end content_top -->
		<div class="content_middle" id="title">
			<div class="search_wrap">
				<img src="<c:url value="/img/btn_delete.png"/>" alt="" id="btn_delete" level="W" status="DETAIL" />
				<img src="<c:url value="/img/btn_previous.png"/>" alt="" id="btn_previous" level="R" status="DETAIL,NEW" />
			</div>
			<div class="title">진행작업 상세보기</div>
			<form id="ajaxForm">
			<input type="hidden" name="bjobDmndMsgID" />
			<input type="hidden" name="bjobDmndSubMsgID" "/>
			<table class="table_row" width="100%" cellspacing="0">
				<tr>
					<th style="width:180px;" class="focusIn">업무구분</th>
					<td>
						<div class="select-style" style="display:inline-block; width:calc(400px);">
						<select name="bjobBzwkDstcd" value="${param.bjobBzwkDstcd}" style="width:100%; background-color:#e5e5e5" disabled></select>
						</div> 
					</td>
				</tr>
				<tr>
					<th style="width:180px;">대외기관구분</th>
					<td>
						<div class="select-style" style="display:inline-block; width:calc(400px);">
						<select name="osidInstiDstcd" value="${param.osidInstiDstcd}" style="width:100%; background-color:#e5e5e5" disabled></select>
						</div> 
					</td>
				</tr>
				<tr>
					<th>작업유형구분</th>
					<td>
						<input type="text" name="bjobPtrnDstcd" value="${param.bjobPtrnDstcd}" readonly="readonly" class="focusOut" style="width:120px;"> 
					</td>
				</tr>
				<tr>
					<th>시스템연결구분코드</th>
					<td>
						<input type="text" name="sysLnkgDstcd" value="${param.sysLnkgDstcd}" readonly="readonly" class="focusOut" style="width:120px;"> 
					</td>
				</tr>
				<tr>
					<th>전문재시도수</th>
					<td>
						<input type="text" name="telgmReTralCnt" value="${param.telgmReTralCnt}" readonly="readonly" class="focusOut" style="width:60px;"> 
					</td>
				</tr>
				<tr>
					<th>작업메시지 일정ID</th>
					<td>
						<input type="text" name="bjobMsgScheID" value="${param.bjobMsgScheID}" readonly="readonly" class="focusOut" style="width:245px;">
					</td>
				</tr>
				<tr>
					<th>송수신 시작시각</th>
					<td>
						<input type="text" name="sndrcvStartYMD" maxlength=10 value="${param.sndrcvStartYMD}" size="10" readonly="readonly" style="width:120px;">
						<input type="text" name="sndrcvStartHMS" maxlength=9 value="${param.sndrcvStartHMS}" size="8" readonly="readonly" style="width:120px;">
						<input type="hidden" name="sndrcvStart" >
					</td>
				</tr>
				<tr>
					<th>송수신 종료시각</th>
					<td>
						<input type="text" name="sndrcvEndYMD" maxlength=10 value="${param.sndrcvEndYMD}" size="10" readonly="readonly" style="width:120px;">
						<input type="text" name="sndrcvEndHMS" maxlength=9 value="${param.sndrcvEndHMS}" size="8" readonly="readonly" style="width:120px;">
						<input type="hidden" name="sndrcvEnd" >
					</td>
				</tr>
				<tr>
					<th>송수신 파일 디렉토리명</th>
					<td>
						<input type="text" name="sndrcvFileDirName" value="${param.sndrcvFileDirName}" readonly="readonly" class="focusOut" style="width:400px;">
					</td>
				</tr>
				<tr>
					<th>송수신 파일명</th>
					<td>
						<input type="text" name="sndrcvFileName" value="${param.sndrcvFileName}" readonly="readonly" class="focusOut" style="width:400px;">
					</td>
				</tr>
				<tr>
					<th>백업 송수신 파일명</th>
					<td>
						<input type="text" name="bkupSndrcvFileName" value="${param.bkupSndrcvFileName}" readonly="readonly" class="focusOut" style="width:400px;">
					</td>
				</tr>
				<tr>
					<th>메시지처리 우선순위</th>
					<td>
						<input type="text" name="msgPrcssPrity" maxlength=3 value="${param.msgPrcssPrity}" size="3" readonly="readonly" style="width:60px;">
					</td>
				</tr>
				<tr>
					<th>작업요청메시지 생성시각</th>
					<td>
						<input type="text" name="bjobDmndMsgCretnYMD" maxlength=10 value="${param.bjobDmndMsgCretnYMD}" size="10" readonly="readonly" class="focusOut" style="width:120px;">
						<input type="text" name="bjobDmndMsgCretnHMS" maxlength=8 value="${param.bjobDmndMsgCretnHMS}" size="8" readonly="readonly" class="focusOut" style="width:120px;">
					</td>
				</tr>
				<tr>
					<th>메시지큐추출요청시각</th>
					<td>
						<input type="text" name="msgQueeTracTdmndYMD" maxlength=10 value="${param.msgQueeTracTdmndYMD}" size="10" readonly="readonly" class="focusOut" style="width:120px;">
						<input type="text" name="msgQueeTracTdmndHMS" maxlength=8 value="${param.msgQueeTracTdmndHMS}" size="8" readonly="readonly" class="focusOut" style="width:120px;">
					</td>
				</tr>
				<tr>
					<th>메시지처리상태코드</th>
					<td>
						<input type="text" name="msgPrcssStuscd" value="${param.msgPrcssStuscd}" readonly="readonly" class="focusOut" style="width:60px;">
					</td>
				</tr>
			</table>
			</form>
		</div><!-- end content_middle -->
	</div><!-- end right_box -->
</body>
</html>