<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>

	<link rel="stylesheet" type="text/css" href="/css/jquery-ui.css" >
	<script type="text/javascript" src="/js/jquery.min.js"></script>
	<script type="text/javascript" src="/js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="/js/beta.fix.js"></script>
	<script type="text/javascript" src="/js/datepicker.js"></script>

	<script type="text/javascript">
	
		function goSearch(obj){
			document.search.submit();
		}
		
		function linkPage(pageNo){
			document.search.pageIndex.value = pageNo ;
			document.search.action = '/com/srch/SearchCounsel.do';
			document.search.submit();
		}
	
		function doCollection(type){
			var url = '';
			
			if(type === 'ALL'){
				url = '/com/srch/Search.do';
			}else if(type === 'process'){
				url = '/com/srch/SearchProcess.do';
			}else if(type === 'conference'){
				url = '/com/srch/SearchConference.do';
			}else if(type === 'completed'){
				url = '/com/srch/SearchCompleted.do';
			}else if(type === 'board'){
				url = '/com/srch/SearchBoard.do';
			}else if(type === 'counsel'){
				url = '/com/srch/SearchCounsel.do';
			}else if(type === 'file'){
				url = '/com/srch/SearchFile.do';
			}
			document.search.searchType.value = type;
			document.search.action = url;
			document.search.submit();
		}
	</script>

	<style>
		.page-content{padding-left:0;padding-right:0;}
		.cs-search-wrapper {margin-top:40px;font-family:'Malgun Gothic';}
		.cs-search{position: relative;}
		.cs-search .blue_window{display:inline-block;width:561px;height:40px;border: 1px solid #676fb2;border-right:0;}
		.cs-search label{background:url(/img/search-fofair.png) no-repeat 15px 50%;width:147px;height:40px;margin-bottom:0;
			text-indent:-999em;}
		.cs-search .query{width:100%;height:100%;padding:4px 10px;border:0;font-size:15px;}
		.cs-search .query::-webkit-input-placeholder {font-family:'Malgun Gothic';color: #757575;font-size:15px;letter-spacing: -1px;}
		.cs-search .query::-moz-placeholder {font-family:'Malgun Gothic';color: #757575;font-size:15px;letter-spacing: -1px;}
		.cs-search .query:-ms-input-placeholder {font-family:'Malgun Gothic';color: #757575;font-size:15px;letter-spacing: -1px;}
		.cs-search .query:-moz-placeholder {font-family:'Malgun Gothic';color: #757575;font-size:15px;letter-spacing: -1px;}
		.cs-search .cs-search-btn{width:57px;height:40px;white-space: nowrap;background: #818ce3;color: #fff;-moz-box-shadow: inset 0 0 10px #5f6cd4;-webkit-box-shadow: inset 0 0 10px #5f6cd4;box-shadow:inset 0 0 10px #5f6cd4;}
		.cs-search-lnb{overflow:hidden;list-style:none;border-bottom:1px solid #e8e8e8}
		.cs-search-lnb li{float:left;}
		.cs-search-lnb li:first-child{margin-left:139px;}
		.cs-search-lnb li a{position:relative;display:block;height:54px;margin: 2px 8px 0;padding: 0 8px;line-height:54px;}
		.cs-search-lnb li a.on{color: #5f6cd4;font-weight:700}
		.cs-search-lnb li a.on:after{content:'';display:block;position:absolute;left:0;bottom:0;width:100%;height:3px;background:#5f6cd4}
		.cs-content-search{padding:16px 0 0 163px;}
		.cs-result-stats{font-size:13px;color:#808080;margin-bottom:38px;}
		.result-box{max-width:918px;padding:16px 0;border-top:1px solid #e8e8e8}
		.result-box h2{margin-bottom: 10px;font-size:15px;}
		.result-link{font-size:18px;color:#1a0dab;}
		.result-link.more{font-size:16px;}
		.result-link:hover{text-decoration:underline;}
		.result-list{position: relative;margin-bottom:23px;}
		.result-list:last-child{margin-bottom:0;}
		.result-date{color:#545454;line-height: 1.4;}
		.result-content{padding:4px 0;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;}
	
	</style>
	<div class="cs-search-wrapper">
		<div class="search-form-wrap">
			<form:form name="search" id="search" action="/com/srch/Search.do" class="search-form" method="post">
				<input type="hidden" id="pageIndex" name="pageIndex" value="1"/>
				<input type="hidden" id="searchType" name="searchType" value="counsel"/>
				
				<fieldset>
					<div class="cs-search">
						<label for="query">kofair</label>
						<span class="blue_window">
						<input name="searchKeyword" id="searchKeyword" type="text" value="${searchVO.searchKeyword}" class="query" title="검색어 입력" placeholder="한국공정거래조정원 통합검색" >
						</span>
						<a style="display: unset;"><input type="button" value="검색" class="cs-search-btn" onClick="javascript:goSearch(this);" />&nbsp;
						</a>
					</div>
				</fieldset>
			</form:form>
		</div>
		
		<c:if test="${not empty searchVO.searchKeyword}">
			<ul class="cs-search-lnb">
				<li><a href="#none" onClick="javascript:doCollection('ALL');">통합검색</a></li>
				<li>
					<a href="#none" onClick="doCollection('process');">
						사건처리 관리 [${empty process.totcnt ? "0":process.totcnt}]
					</a>
				</li>
				<li>
					<a href="#none" onClick="doCollection('conference');">  
						협의회 관리 [${empty conference.totcnt ? "0":conference.totcnt}]
					</a>
				</li>
				<li>
					<a href="#none" onClick="doCollection('completed');">  
						사건종료 관리 [${empty completed.totcnt ? "0":completed.totcnt}]
					</a>
				</li>
				<li>
					<a href="#none" onClick="doCollection('board');">
						게시판 [${empty board.totcnt ? "0":board.totcnt}]
					</a>
				</li>
				<li>
					<a href="#none" onClick="doCollection('counsel');" class="on">
						상담 관리 [${empty counsel.totcnt ? "0":counsel.totcnt}]
					</a>
				</li>
				<li>
					<a href="#none" onClick="doCollection('file');">
						사건파일 [${empty file.totcnt ? "0":file.totcnt}]
					</a>
				</li>
			</ul>
			<c:choose>
				<c:when test="${fn:length(counsel.list) > 0}">
					<div class="cs-content-search">
						<div class="cs-result-stats">검색어 '<c:out value="${searchVO.searchKeyword}"/>'에 대해 총 ${counsel.totcnt}건이 검색되었습니다.</div>
						
						<div class="result-box cass">
						    <h2>상담관리</h2>
						    <c:forEach var="list" items="${counsel.list}" varStatus="sts1">
						        <div class="result-list">
								        <a href="/gtm/case/onlineCounsel/view.do?type=L&fileFuncType=CIVIL_TYPE&counselSeq=${list.url}" class="result-link" target="_blank">${list.counselTitle}</a>
								        <div class="result-content">상담번호: ${list.counselSeq} </div>
								        <div class="result-content">신청인: ${list.applcntNm}, 조정유형: ${list.mediationTypeName} </div>
								        <div class="result-content">상담방식: ${list.civilType}, 상담경로: ${list.noticeType} </div>
								        <div class="result-content">진행상태: ${list.counselStateName}, 처리일자: ${list.noticeDate}, 담당자: ${list.managerNm} </div>
								        <span class="result-date">등록일: ${list.counselRegdate} </span>
								    </div>
						    </c:forEach>
						</div>
						
						<div class="page">
							<ul class="inline">
								<ui:pagination paginationInfo="${paginationInfo}" type="image" jsFunction="linkPage" />
							</ul>
						</div>
					</div>
				</c:when>
				<c:otherwise>
					<div class="result-box h2">
						<p>'<c:out value="${searchVO.searchKeyword}"/>'에 대한 검색결과가 없습니다.</p>
						<ul>
							<li>단어의 철자가 정확한지 확인해 보세요.</li>
							<li>한글을 영어로 혹은 영어를 한글로 입력했는지 확인해 보세요.</li>
							<li>검색어의 단어 수를 줄이거나, 보다 일반적인 검색어로 다시 검색해 보세요.</li>
							<li>두 단어 이상의 검색어인 경우, 띄어쓰기를 확인해 보세요.</li>
						</ul>
					</div>
				</c:otherwise>
			</c:choose>
		</c:if>
	</div>