<%@page import="com.eactive.eai.rms.onl.transaction.tracking.DbTrackingService" %>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="java.io.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/jsp/common/include/localemessage.jsp" %>
<%@ page import="com.eactive.eai.rms.common.login.SessionManager" %>
<%
    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="/onl/transaction/tracking/trackingMan.json" />';
        var url_view = '<c:url value="/onl/transaction/tracking/trackingMan.view" />';
        var url_excel = '<c:url value="/onl/transaction/tracking/trackingMan.excel" />';
        var GUID_LENGTH = <%=DbTrackingService.GUID_LENGTH%>;
        var isProdServer = <%=com.eactive.eai.common.util.SystemUtil.isProdServer()%>;
        var roleString = "<%=SessionManager.getRoleIdString(request)%>";
        let totalLogs = 0;
        let displayedLogs  = 0;

        function adminChk() {
            var arrRoleID = roleString.split(',');
            var flag = false;
            $(arrRoleID).each(function (i, role) {
                if (role == 'admin') {
                    flag = true;
                }
            });
            return flag;
        }

        function getTransactionCounts() {
            var searchData = getSearchForJqgrid("cmd", "COUNT");
            $.ajax({
                type: "POST",
                url: url,
                data: searchData,
                success: function(counts) {
                    if (!counts) {
                        totalLogs = 0;
                        displayedLogs = 0;
                        updateLogCountDisplay(0, 0, 0);
                        return;
                    }
                    totalLogs = counts.totalLogs;
                    displayedLogs = counts.displayedLogs;

                    var uniqueCount = calculateUniqueLogCount("#grid");
                    updateLogCountDisplay(uniqueCount, displayedLogs, totalLogs);

                },
                error: function(e) {
                    alert(e.responseText);
                }
            });
        }

        function updateLogCountDisplay(uniqueCount, displayedLogs, totalLogs) {
            const totalText = "총 건수: " + uniqueCount + " 건";
            $("#totalCount").text(totalText);
        }

        function calculateUniqueLogCount(gridId) {
            const uniqueLogs = new Set();

            $(gridId).jqGrid("getRowData").forEach(row => {
                const uniqueKey = row.EAISVCSERNO + row.SEQ;
                uniqueLogs.add(uniqueKey);
            });

            return uniqueLogs.size; 
        }

        function getStartTime() {
            var now = new Date();
            var tm = right("0" + now.getHours(), 2);
            tm += right("0" + now.getMinutes(), 2);

            tm = (Math.floor(tm.substr(0, 2)) * 60) + Math.floor(right(tm, 2)) - 5;
            tm = right("0" + parseInt(tm / 60), 2) + right("0" + tm % 60, 2);
            return tm + '00';
        }

        function getEndTime() {
            var now = new Date();
            var tm = right("0" + now.getHours(), 2);
            tm += right("0" + now.getMinutes(), 2);
            return tm + '59';
        }

        function init(callback) {
            $.ajax({
                type: "POST",
                url: url,
                dataType: "json",
                data: {cmd: 'LIST_COMBO'},
                success: function (json) {
                    new makeOptions("CODE", "NAME").setObj($("select[name=searchEaiBzwkDstcd]")).setNoValueInclude(true).setNoValue("", "전체").setData(json.eaiBizList).setFormat(codeName3OptionFormat).rendering();
                    new makeOptions("CODE", "NAME").setObj($("select[name=searchExtBizCd]")).setNoValueInclude(true).setNoValue("", "전체").setData(json.extBizList).setFormat(codeName3OptionFormat).rendering();
                    new makeOptions("CODE", "NAME").setObj($("select[name=searchLogPrcssSerno]")).setNoValueInclude(true).setNoValue("", "전체").setData(json.logPrcssSernoList).rendering();

                    setSearchable("searchEaiBzwkDstcd");	// 콤보에 searchable 설정
                    setSearchable("searchExtBizCd");

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

        }

        function toDateString(d) {
            var dateStr = d.replace(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, '$4:$5:$6 $2/$3/$1');
            return dateStr;
        }

        function diffMinute(date1, date2) {
            var diff = (date1.getTime() - date2.getTime()) / 1000;
            return Math.round(diff / 60);
        }

        function detail() {
            var start = $("input[name=searchStartYYYYMMDD]").val().replace(/-/gi, "");
            var end = $("input[name=searchEndYYYYMMDD]").val().replace(/-/gi, "");

            var startHm = $("input[name=searchStartHHMM]").val();
            var endHm = $("input[name=searchEndHHMM]").val();

            if (startHm != null) {
                if (startHm.length < 6) {
                    alert("<%=localeMessage.getString("tracking.alert1")%>"); //Please check the start time of the log inquiry.
                    $("input[name=searchStartHHMM]").focus();
                    return;
                }
            } else {
                alert("<%=localeMessage.getString("tracking.alert1")%>"); //Please check the start time of the log inquiry.
                $("input[name=searchStartHHMM]").focus();
                return;
            }

            if (endHm != null) {
                if (endHm.length < 6) {
                    alert("<%=localeMessage.getString("tracking.alert2")%>"); //Please check the end time of the log inquiry.
                    $("input[name=searchEndHHMM]").focus();
                    return;
                }
            } else {
                alert("<%=localeMessage.getString("tracking.alert2")%>");  //Please check the end time of the log inquiry.
                $("input[name=searchEndHHMM]").focus();
                return;
            }

            start = start + startHm;
            end = end + endHm;

            if (start > end) {
                alert("<%=localeMessage.getString("tracking.alert3")%>"); //Please input the inquiry time.
                return false;
            }

            // 운영인 경우에만 검색시간 체크
//            if (isProdServer) {
                //admin이 아닐경우 검색시간간격이 10분이상이면 안됨
//                if (!adminChk()) {
                    //검색시간 10분이상일경우 다시 확인
//                    var endDate = new Date(toDateString(end));
//                    var startDate = new Date(toDateString(start));
//                    if (diffMinute(endDate, startDate) > 10) {
//                        console.log("diffMinute:" + diffMinute(endDate, startDate));
//                        alert("<%=localeMessage.getString("tracking.alert4")%>"); //Sets the log interval to 10 minutes.
//                        setTime(start);
//                        end = $("input[name=searchEndYYYYMMDD]").val().replace(/-/gi, "");
//                        end = end + $("input[name=searchEndHHMM]").val();
//                    }
//                }
//            }


            $("#grid").clearGridData();		// 이전 데이터 삭제.

            $("input[name=searchStartTime]").val(start);
            $("input[name=searchEndTime]").val(end);

            // guid로 검색 할 때 자리수 체크.
            //if(!isValidGuid()) return;

            var postData = getSearchForJqgrid("cmd", "LIST"); //jqgrid에서는 object 로
            $("#grid").setGridParam({url: url, postData: postData, datatype: 'json'}).trigger("reloadGrid");
        }

        //10분후 시간셋팅
        function setTime(searchTime) {
            var endYYYYMMDD;
            var endHHMM;
            var yy = searchTime.substr(0, 4);
            var mm = searchTime.substr(4, 2);
            var dd = searchTime.substr(6, 2);
            var hh = searchTime.substr(8, 2);
            var MM = searchTime.substr(10, 2);
            var ms = Date.UTC(yy, mm - 1, dd, hh, MM, 00);
            var date = new Date(ms);
            date.setHours(date.getHours() - 9);

            //10분 후 셋팅
            date.setMinutes(date.getMinutes() + 9);

            endYYYYMMDD = date.getFullYear() + right("0" + (date.getMonth() + 1), 2) + right("0" + (date.getDate()), 2);
            endHHMM = right("0" + date.getHours(), 2) + right("0" + date.getMinutes(), 2) + "59";

            $("input[name=searchEndYYYYMMDD]").val(endYYYYMMDD);
            $("input[name=searchEndHHMM]").val(endHHMM);
        }

        function guidEvent() {
            var searchGuid = $("input[name=searchGuid]").val();
            if (searchGuid.trim() == '')
                return;

            var searchTm = searchGuid.trim();
            /*
            var yy = searchTm.substr(13,4);
            var mm = searchTm.substr(17,2);
            var dd = searchTm.substr(19,2);
            var hh = searchTm.substr(21,2);
            var MM = searchTm.substr(23,2);
            */
            var yy = searchTm.substr(3,4);
            var mm = searchTm.substr(7,2);
            var dd = searchTm.substr(9,2);
            var hh = searchTm.substr(11,2);
            var MM = searchTm.substr(13,2);

            var ms = Date.UTC(yy,mm-1,dd,hh,MM,00);
            var date = new Date(ms);
            var startYYYYMMDD;
            var startHHMM;
            var endYYYYMMDD;
            var endHHMM;
            //Local Time Setting
            date.setHours(date.getHours() - 9);
            //5분 간격
            date.setMinutes(date.getMinutes() - 5);

            startYYYYMMDD = date.getFullYear() + right("0" + (date.getMonth() + 1), 2) + right("0" + (date.getDate()), 2);
            startHHMM = right("0" + date.getHours(), 2) + right("0" + date.getMinutes(), 2) + "00";

            date.setMinutes(date.getMinutes() + 10);

            endYYYYMMDD = date.getFullYear() + right("0" + (date.getMonth() + 1), 2) + right("0" + (date.getDate()), 2);
            endHHMM = right("0" + date.getHours(), 2) + right("0" + date.getMinutes(), 2) + "00";

            //추가 코드 입력 2012.05.16 권세환 (일자가 바뀔경우 시간 간격을 +-5분 -> +-1분)
            if (startYYYYMMDD.substr(6, 2) != endYYYYMMDD.substr(6, 2)) {
                date.setMinutes(date.getMinutes() - 6);

                startYYYYMMDD = date.getFullYear() + right("0" + (date.getMonth() + 1), 2) + right("0" + (date.getDate()), 2);
                startHHMM = right("0" + date.getHours(), 2) + right("0" + date.getMinutes(), 2) + "00";

                date.setMinutes(date.getMinutes() + 2);

                endYYYYMMDD = date.getFullYear() + right("0" + (date.getMonth() + 1), 2) + right("0" + (date.getDate()), 2);
                endHHMM = right("0" + date.getHours(), 2) + right("0" + date.getMinutes(), 2) + "00";
            }
            $("input[name=searchStartYYYYMMDD]").val(startYYYYMMDD);
            $("input[name=searchEndYYYYMMDD]").val(endYYYYMMDD);
            $("input[name=searchStartHHMM]").val(startHHMM);
            $("input[name=searchEndHHMM]").val(endHHMM);

        }

        function timeStampFormat2(cellvalue, options, rowObject) {
            if (cellvalue == null || cellvalue.length < 17)
                return '';
            return cellvalue.substr(0, 4) + '-' +
                cellvalue.substr(4, 2) + '-' +
                cellvalue.substr(6, 2) + ' ' +
                cellvalue.substr(8, 2) + ':' +
                cellvalue.substr(10, 2) + ':' +
                cellvalue.substr(12, 2) + ' ' + cellvalue.substr(14, 3);

        }

        function orgNameFormatter(cellvalue, options, rowObject) {
            if (cellvalue == null) return "";

            if (cellvalue === "null" || cellvalue === "NULL") return "";

            if (String(cellvalue).trim() === "") return "";
            
            if (cellvalue === "미분류") return "";

			return cellvalue;
        }

        function trimFormatter(cellvalue, options, rowObject) {

        	return cellvalue ? String(cellvalue).trim() : '';

        }

        $(document).ready(function () {
            console.log(roleString);

            $("input[name=searchStartYYYYMMDD],input[name=searchEndYYYYMMDD]").inputmask("yyyy-mm-dd", {'autoUnmask': true});
            $("input[name=searchStartHHMM],input[name=searchEndHHMM]").inputmask("hh:mm:ss", {'autoUnmask': true});

            $("input[name=searchStartYYYYMMDD],input[name=searchEndYYYYMMDD]").each(function () {
                if ($(this).val() == undefined || $(this).val() == null || $(this).val() == "") {
                    $(this).val(getToday());
                }
            });
            $("input[name=searchStartHHMM]").each(function () {
                if ($(this).val() == undefined || $(this).val() == null || $(this).val() == "") {
                    $(this).val(getStartTime());
                }
            });
            $("input[name=searchEndHHMM]").each(function () {
                if ($(this).val() == undefined || $(this).val() == null || $(this).val() == "") {
                    $(this).val(getEndTime());
                }
            });

            init();

            const serviceType = sessionStorage.getItem('serviceType');
            // 서비스타입이 API에 해당되는지 확인하여 아래 GRID 구성
            // 다른 이름을 사용 할 경우 아래 비교 코드 수정
            const isApiGw = 'APIGW' === serviceType;

            $('#grid').jqGrid({
                datatype: "local",
                mtype: 'POST',
                colNames: ['<%=localeMessage.getString("tracking.eaisvcserno")%>',
                    '<%=localeMessage.getString("tracking.logprcssserno")%>',
                    '<%=localeMessage.getString("tracking.eaibzwkdstcd")%>',
                    '<%=localeMessage.getString("tracking.msgdpstyms")%>',
                    '<%=localeMessage.getString("tracking.erryn")%>',
                    '<%=localeMessage.getString("tracking.trackasiskey1ctnt")%>',
                    '<%=localeMessage.getString("tracking.trackasiskey2ctnt")%>',

                    '<%=localeMessage.getString("tracking.eaiSvcserNo")%>',
                    '<%=localeMessage.getString("tracking.keymgtmsgctnt")%>',
                    '<%=localeMessage.getString("tracking.logprcssserno_tmp")%>',
                    '<%=localeMessage.getString("tracking.telgmrecvtrancd")%>',
                    '<%= localeMessage.getString("eaiMessage.eaiSvcName")%>',
                    '<%= localeMessage.getString("eaiMessage.eaiSvcDesc")%>',
                    '<%=localeMessage.getString("tracking.eaibzwkdstcd")%>',
                    '<%=localeMessage.getString("tracking.extBizName")%>',
                    '<%=localeMessage.getString("tracking.ifDisKeyVal")%>',
                    'APP 명',
                    '법인명',
                    '<%=localeMessage.getString("tracking.msgrecvtm")%>',
                    '<%=localeMessage.getString("tracking.msgprcssyms")%>',
                    '<%=localeMessage.getString("tracking.companycode")%>',
                    '<%=localeMessage.getString("tracking.companyname")%>',
                    '<%=localeMessage.getString("tracking.osidinstinm")%>',
                    '<%=localeMessage.getString("tracking.companyitcontactname")%>',
                    '<%=localeMessage.getString("tracking.companyitcontacttelno")%>',
                    '<%=localeMessage.getString("tracking.itcontactpointperson1")%>',
                    '<%=localeMessage.getString("tracking.bzwkcontactperson")%>'
                ],
                colModel: [
                    {name: 'EAISVCSERNO', hidden: true},
                    {name: 'LOGPRCSSSERNO', hidden: true},
                    {name: 'EAIBZWKDSTCD', hidden: true},
                    {name: 'MSGDPSTYMS', hidden: true},
                    {name: 'ERRYN', hidden: true},
                    {name: 'TRACKASISKEY1CTNT', hidden: true},
                    {name: 'TRACKASISKEY2CTNT', hidden: true},

                    {name: 'EAISVCSERNO_TMP', align: 'left', width: '220', formatter: trimFormatter},
                    {name: 'KEYMGTMSGCTNT', align: 'left', width: '240'},
                    {name: 'LOGPRCSSSERNO_TMP', align: 'center', width: '40'},
                    {name: 'TELGMRECVTRANCD', align: 'left', width: '135', hidden: true},
                    {name: 'EAISVCNAME', align: 'left', width: '130'},
                    {name: 'EAISVCDESC', align: 'left', width: '280'},
                    {name: 'EAIBZWKDSTCD_TMP', align: 'center', width: '50'},
                    {name: 'EXTBIZCD', align: 'center', width: '50', hidden: isApiGw},
                    {name: 'REFKEY', align: 'left', width: '280', hidden: isApiGw},
                    {name: 'CLIENTNAME', align: 'left', width: '260', hidden: !isApiGw},
                    {name: 'ORGNAME', align: 'left', width: '100', hidden: !isApiGw, formatter: orgNameFormatter},
                    {name: 'MSGDPSTYMS_TMP', align: 'center', width: '150', formatter: timeStampFormat2},
                    {name: 'MSGPRCSSYMS', align: 'center', width: '150', formatter: timeStampFormat2},
                    {name: 'COMPANYCODE', align: 'center', width: '80', hidden: true},
                    {name: 'COMPANYNAME', align: 'center', width: '100', hidden: true},
                    {name: 'ADPTRINSTINAME', align: 'left', width: '160', hidden: true},
                    {name: 'COMPANYITCONTACTNAME', align: 'left', width: '110', hidden: true},
                    {name: 'COMPANYITCONTACTTELNO', align: 'left', width: '120', hidden: true},
                    {name: 'ITCONTACTPOINTPERSON1', align: 'left', width: '120', hidden: true},
                    {name: 'BZWKCONTACTPERSON', align: 'left', width: '120', hidden: true}
                ],
                jsonReader: {
                    repeatitems: false
                },
                rowNum: 10000,
                height: '520',
                viewrecords: true,
                gridview: true,
                autowidth: true,
                ondblClickRow: function (rowId) {
                    var rowData = $(this).getRowData(rowId);
                    var args = new Object();
                    args['eaiBzwkDstcd'] = rowData['EAIBZWKDSTCD'];
                    args['msgDpstYMS'] = rowData['MSGDPSTYMS'];
                    args['logPrcssSerno'] = rowData['LOGPRCSSSERNO'];
                    args['eaiSvcSerno'] = rowData['EAISVCSERNO'];

                    var url2 = '<c:url value="/onl/transaction/tracking/trackingMan.view"/>';
                    url2 = url2 + "?cmd=DETAIL";
                    showModal2(url2, args, 1000, 1218, undefined, "scroll:yes;status:no;resizable:yes;", false);

                    //url2 = url2 + "&eaiBzwkDstcd="  +rowData['EAIBZWKDSTCD'];
                    //url2 = url2 + "&msgDpstYMS="    +rowData['MSGDPSTYMS'];
                    //url2 = url2 + "&logPrcssSerno=" +rowData['LOGPRCSSSERNO'];
                    //url2 = url2 + "&eaiSvcSerno="   +rowData['EAISVCSERNO'];
                    //goNav(url2);
                },
                gridComplete: function (d) {
                    // 헤더 화살표 없애기
                    var colModel = $(this).getGridParam("colModel");
                    for (var i = 0; i < colModel.length; i++) {
                        $(this).setColProp(colModel[i].name, {sortable: false});
                    }

                },
                loadComplete: function (d) {
                    $("#grid").tuiTableRowSpan("7");

                    // 거래 건수 표시
                    var uniqueCount = calculateUniqueLogCount("#grid");
                    updateLogCountDisplay(uniqueCount, displayedLogs, totalLogs);

                    //에러 행 색상 표시
                    var rows = $(this).getDataIDs();
                    for (var i = 0; i < rows.length; i++) {
                        var val = $("#grid").getCell(rows[i], 'ERRYN');
                        if (val == "Y") {
                            $("#" + rows[i]).find("td").css("background-color", "#FFCC99");
                        }
                    }

                    //1000건이상 alert
                    if (d.records == 1000) {
                        setTimeout(() => {
                            alert("<%=localeMessage.getString("tracking.alert5")%>"); // 조회 결과 1,000건 초과
                        }, 0); // Alert는 비동기적으로 처리
                    }

                },
                loadError: function (jqXHR, textStatus, errorThrown) {
                    if (jqXHR.status == 401) {
                        alert('HTTP status code: ' + jqXHR.status + '\n' +
                            '<%=localeMessage.getString("tracking.alert6")%>');  //error: the session has closed.
                        parent.location.href = '<%=request.getContextPath()%>/';
                    } else if (jqXHR.status == 400) {
                        $("#grid").clearGridData();
                        alert(JSON.parse(jqXHR.responseText).errorMsg);
                    } else {
                        alert('HTTP status code: ' + jqXHR.status + '\n' +
                            'textStatus: ' + textStatus + '\n' +
                            'errorThrown: ' + errorThrown);
//	             alert('HTTP message body (jqXHR.responseText): ' + '\n' + jqXHR.responseText);
                    }

                }

            });

            resizeJqGridWidth('grid', 'content_middle', '1000');
            //$("#grid").jqGrid('setFrozenColumns');

            $("#btn_search").click(function () {
                $("input[name=searchGuid]").blur();
                detail();
                getTransactionCounts();
            });

            $("input[name^=search]").keydown(function (key) {
                if (key.keyCode == 13) {
                    $("#btn_search").click();
                }
            });

            $("input[name=searchStartYYYYMMDD]").change(function (e) {
                $("input[name=searchEndYYYYMMDD]").val($(this).val());
            })

            //검색조건 달력
            $("#startDatepicker").datepicker();

            //업체명 검색
            $("#btn_popup").click(function () {
                var key = "";
                var args = new Object();
                args['companyName'] = $('input[name=companyName1]').val();
                var url = '<c:url value="/onl/admin/service/companyMan.view" />';
                url = url + "?cmd=POPUP";
                var ret = showModal(url, args, 1020, 630, function (arg) {
                    var args = null;
                    if (arg == null || arg == undefined) {//chrome
                        args = this.dialogArguments;
                        args.returnValue = this.returnValue;
                    } else {//ie
                        args = arg;
                    }

                    if (!args || !args.returnValue) return;

                    var ret = args.returnValue;
                    console.log("ret", ret);
                    key = ret['key'];
                    $("input[name=companyName1]").val(key);
                    $("input[name=searchCompanyName]").val(key);

                });
            });

            //업체명 검색
            $("#btn_init").click(function () {
                $("input[name=companyName1]").val("");
                $("input[name=searchCompanyName]").val("");

            });

            $("#btn_excel").click(function (event) {
                event.stopPropagation(); // Do not propagate the event.
                // Create an object that will manage to download the file.
                var target = "excelDown"; // iframe의 name
                //(url,cmd,gridObj,formObject,fileName,merge)

                var start = $("input[name=searchStartYYYYMMDD]").val().replace(/-/gi, "");
                start = start + $("input[name=searchStartHHMM]").val();
                var end = $("input[name=searchEndYYYYMMDD]").val().replace(/-/gi, "");
                end = end + $("input[name=searchEndHHMM]").val();

                $("input[name=searchStartTime]").val(start);
                $("input[name=searchEndTime]").val(end);

                gridToExcelSubmit2(url_excel, "LIST_GRID_TO_EXCEL", $("#grid"), $("#ajaxForm"), '<%= localeMessage.getString("tracking.title")%>');
                return false;
            });

            //GUID
            $("input[name=searchGuid]").blur(function (event) {
                guidEvent();

            });

            buttonControl();

            var local = localStorage.getItem("guid");

            if (local != null) {
                if (local.length > GUID_LENGTH) local = local.substr(0, GUID_LENGTH);

                $("input[name=searchGuid]").val(local);
                localStorage.removeItem("guid");

                local = null;
            }

            $(window).on('resize.jqGrid', function () {
                jQuery("#grid").jqGrid('setGridWidth', $("#content_middle").width());
            });
            
            
            const checkbox = document.getElementById('schedulerToggle');
            const targetButton = document.getElementById('btn_search');
            let timerId = null; // 인터벌 ID를 저장할 변수

            // 체크박스 상태 변화 감지
            checkbox.addEventListener('change', function() {
                if (this.checked) {
                    console.log("스케줄러 시작: 1분 간격으로 클릭합니다.");
                    
                    // 1. 즉시 한 번 실행하고 싶다면 아래 주석 해제
                    // targetButton.click();

                    // 2. 1분(60,000ms)마다 반복 실행
                    timerId = setInterval(() => {
                        console.log("자동 클릭 실행 중...");
                        targetButton.click();
                    }, 60000); 

                } else {
                    console.log("스케줄러 중지");
                    
                    // 체크 해제 시 반복 멈춤
                    if (timerId) {
                        clearInterval(timerId);
                        timerId = null;
                    }
                }
            });

        });
        
        

    </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="content_middle">
        <div class="search_wrap">
        	<input type="checkbox" id="schedulerToggle">
            <button type="button" class="cssbtn" id="btn_excel" level="W"><i
                    class="material-icons">table_view</i> <%= localeMessage.getString("button.excel") %>
            </button>
            <button type="button" class="cssbtn" id="btn_search" level="R"><i
                    class="material-icons">search</i> <%= localeMessage.getString("button.search") %>
            </button>
            <%-- 					<img src="<c:url value="/img/btn_excel.png"/>" id="btn_excel" level="W"/>  --%>
            <%-- 					<img src="<c:url value="/img/btn_search.png"/>" alt="" id="btn_search" level="R" /> --%>
        </div>
        <div class="title"><%=localeMessage.getString("tracking.title")%>
        </div>

        <form id = "ajaxForm">
            <table class="search_condition" cellspacing=0;>
                <tbody>
                <tr>
                    <th style="width:12%; min-width:120px;"><%= localeMessage.getString("eaiMessage.eaiSvcName")%></th>
                    <td style="width:15%;"><input type="text" name="searchEaiSvcName" value="${param.searchEaiSvcName}"></td>
                    <th style="width:13%; min-width:140px;"><%=localeMessage.getString("tracking.bzwkdstcd")%></th>
                    <td style="width:15%; min-width:160px;">
                        <div style="position: relative; width: 100%;">
                            <select name="searchEaiBzwkDstcd" value="${param.searchEaiBzwkDstcd}"></select>
                        </div>
                    </td>
                    <th style="width:12%; min-width:120px;"><%=localeMessage.getString("tracking.msgrecvtm")%></th>
                    <td>
                        <input type="text" name="searchStartYYYYMMDD" id="startDatepicker" readonly="readonly" value="" size="10" style="width:70px; border:1px solid #ebebec;">
                        <input type="text" name="searchStartHHMM" value="" size="8" style="width:70px; border:1px solid #ebebec;">
                        ~
                        <input type="text" name="searchEndYYYYMMDD" value="" id="endDatepicker" size="10" readonly="readonly" style="width:70px; border:1px solid #ebebec;">
                        <input type="text" name="searchEndHHMM" value="" size="8" style="width:70px; border:1px solid #ebebec;">
                        <input type="hidden" name="searchStartTime" value="" style="width:0px;">
                        <input type="hidden" name="searchEndTime" value="" style="width:0px;">
                    </td>
                </tr>
                <tr>
                	<th><%= localeMessage.getString("eaiMessage.eaiSvcDesc")%></th>
                    <td><input type="text" name="searchEaiSvcDesc" value="${param.searchEaiSvcDesc}"></td>

                    <th><%=localeMessage.getString("tracking.logprcssserno")%></th>
                    <td>
                        <div >
                            <select name="searchLogPrcssSerno" value="${param.searchLogPrcssSerno}" style="width: 100%;">
                            </select>
                        </div>
                    </td>
                    <th ><%=localeMessage.getString("tracking.logtype")%></th>
                    <td>
                        <input type="radio" name="searchErrorYn" value="N" checked="checked" id="sub2_2_1_1"><label for="sub2_2_1_1"><%= localeMessage.getString("tracking.allLog") %></label>
                        <input type="radio" name="searchErrorYn" value="Y" id="sub2_2_1_2"><label for="sub2_2_1_2"><%= localeMessage.getString("tracking.errLog") %></label>
                    </td>

                    <!-- 로그조회키 -->
                    <%-- <th><%=localeMessage.getString("tracking.trackasiskeyctnt")%></th>
                    <td>
                        <input type="text" name="searchTrackAsisKey1Ctnt" value="${param.searchTrackAsisKey1Ctnt}" style="width: 40%;">
                        <input type="text" name="searchTrackAsisKey2Ctnt" value="${param.searchTrackAsisKey2Ctnt}" style="width: 40%;">
                    </td> --%>
                    <!-- 대외업무, 업무서비스키 -->
                    <%-- <th><%=localeMessage.getString("tracking.extBizCd")%></th>
                    <td>
                        <div style="position: relative; width: 100%;">
                            <select name="searchExtBizCd" value="${param.searchExtBizCd}" style="width: 100%;"></select>
                        </div>
                    </td>
                    <th><%=localeMessage.getString("tracking.ifDisKeyVal")%></th>
                    <td><input type="text" name="searchRefKey" value="${param.searchRefKey}"></td> --%>
                    <!-- <th><%=localeMessage.getString("tracking.companycode")%></th>
							<td><input type="text" name="searchCompanyCode" value="${param.searchCompanyCode}"></td>  -->
                    <!-- <th><%=localeMessage.getString("tracking.companyname")%></th>
							<td><input type="hidden" name="searchCompanyName" value="" style="width:0px;">
								<input type="text" name="companyName1" value="${param.searchCompanyName}" style="width:70%;" readonly>
								<img src="<c:url value="/img/icon_search.png"/>" alt="" id="btn_popup" style="margin: 5px;cursor:hand "/>
								<img src="<c:url value="/img/btn_pop_initialize.png"/>" alt="" id="btn_init" style="margin: 5px;cursor:hand "/>
							</td> -->
                </tr>
                <tr>
                    <th><%=localeMessage.getString("tracking.eaisvcserno_tmp")%></th>
                    <td colspan="3"><input type="text" name="searchEaiSvcSerno" value="${param.searchEaiSvcSerno}"></td>
                
                    <th><%=localeMessage.getString("tracking.keymgtmsgctnt")%></th>
                    <td colspan="2"><input type="text" name="searchKeyMgtMsgCtnt" value="${param.searchKeyMgtMsgCtnt}"></td>

                    <%-- <th><%=localeMessage.getString("tracking.orgGUID")%></th>
                    <td colspan="4"><input type="text" name="searchGuid" value="" maxlength="<%=DbTrackingService.GUID_LENGTH%>"></td> --%>
                </tr>
                </tbody>
            </table>
        </form>
        <div id="totalCount">총 건수: 0 건</div>
        <table id="grid" style="margin-top: 3px;"></table>
        <div id="pager"></div>

    </div><!-- end content_middle -->
</div><!-- end right_box -->
</body>
</html>