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

<script src="../../../js/admin/requestView.js"></script>


	<form:form commandName="useRequestVO" name="frm" method="POST" action="/admin/updateReqConfirm" id="updateFrm">
		<input type="hidden" name="idx" value="<c:out value='${useRequestVO.idx}' />" />
		<input type="hidden" name="admin_id" value="<c:out value='${loginUserVO.userid}' />" />
		<div class="section_title">
			<!-- <p>현장 지원 시스템</p> -->
		</div>
		<div class="section_content">
			<input type="hidden" id="layers" name="layers"/>
			<input type="hidden" id="places" name="places"/>
			
			<table class="detail_table">
				<thead>
					<tr><th colspan="8">담당자</th></tr>
				</thead>
				<tbody>
					<tr>
						<th>소속</th>
						<td class="text-center"><c:out value='${userVO.company}' /></td>
						<th>담당자</th>
						<td class="text-center"><c:out value='${userVO.name}' /></td>
						<th>연락처</th>
						<td class="text-center"><c:out value='${userVO.phonenum}' /></td>
						<th>상태</th>
						<td class="text-center">
							<c:choose>
								<c:when test="${useRequestVO.status eq '99'}"><span class="label label-warning"><c:out value='승인대기' /></span></c:when>
								<c:when test="${useRequestVO.status eq '0'}"><span class="label label-success"><c:out value='승인' /></span></c:when>
								<c:when test="${useRequestVO.status eq '-1'}"><span class="label label-default"><c:out value='반려' /></span></c:when>
							</c:choose>
						</td>
					</tr>
				</tbody>
			</table>
			
			<table class="detail_table">
				<thead>
					<tr><th colspan="5">지도 사용 요청</th></tr>
				</thead>
				<tbody>
					<tr>
						<th colspan="2">작업명</th>
						<td><c:out value='${useRequestVO.title}' /></td>
					</tr>
					<tr>
						<th colspan="2">기간</th>
						<td><c:out value='${useRequestVO.s_date}' />  ~ <c:out value='${useRequestVO.e_date}' /></td>
					</tr>
					<tr>
						<th colspan="2">장소</th>
						<td id="area_select_td">
							<c:forEach var="item" items="${selectArea}" varStatus="status">
								<div id="addedBlock<c:out value='${status.index}' />">
									<c:out value='' />${item}
								</div>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<th style="width:7%;" rowspan="3">레이어</th>
						<th><label>지하시설물</label></th>
						<td>
				        	<div class="facility">
				        		<c:forEach var="item" items="${layersVO}" varStatus="status">
				        			<c:if test="${item.code eq  'facility'}">
				        				<c:set var="faciltySize" value="${faciltySize+1}" />
				        				<label class="layer-label">
				        					<input type="checkbox" name="${item.code}" id="${item.code}" disabled="disabled" value="${item.layer}"
				        						<c:forEach var="item2" items="${layers}" varStatus="status2">
			        							<c:if test="${item.layer eq item2}">
			        								<c:out value='checked' />
			        							</c:if>
			        							</c:forEach>
				        					/> <c:out value='${item.name}' />
				        				</label>
				        			</c:if>
								</c:forEach>
				        	</div>
						</td>
					</tr>
					<tr>
						<th><label>지하구조물</label></th>
						<td>
				        	<div class="structure">
					            <c:forEach var="item" items="${layersVO}" varStatus="status">
				        			<c:if test="${item.code eq  'structure'}">
				        				<label class="layer-label"><input type="checkbox" name="${item.code}" id="${item.code}" disabled="disabled" value="${item.layer}"
				        				<c:forEach var="item2" items="${layers}" varStatus="status2">
				        						<c:if test="${item.layer eq item2}">
				        							<c:out value='checked' />
				        						</c:if>
				        					</c:forEach>
				        					/> <c:out value='${item.name}' />
				        				</label>
				        			</c:if>
								</c:forEach>
				        	</div>
						</td>
					</tr>
					<tr>
						<th><label>지반</label></th>
						<td>
				        	<div class="ground">
					            <c:forEach var="item" items="${layersVO}" varStatus="status">
				        			<c:if test="${item.code eq  'ground'}">
				        				<label class="layer-label"><input type="checkbox" name="${item.code}" id="${item.code}" disabled="disabled" value="${item.layer}"
				        				<c:forEach var="item2" items="${layers}" varStatus="status2">
				        						<c:if test="${item.layer eq item2}">
				        							checked
				        						</c:if>
				        					</c:forEach>
				        					/> <c:out value='${item.name}' />
				        				</label>
				        			</c:if>
								</c:forEach>
				        	</div>
						</td>
					</tr>
					<tr>
						<th colspan="2">요청 내용</th>
						<td><c:out value='${useRequestVO.user_msg}' /></td>
					</tr>
				</tbody>
			</table>
			
			<c:choose>
				<c:when test="${useRequestVO.status eq '99'}">
					<table class="detail_table">
						<tbody>
							<tr>
								<th>전달 메세지</th>
								<td>
									<textarea class="form-control" rows="3" style="resize:none;" name="admin_msg"></textarea>
								</td>
							</tr>
						</tbody>
					</table>
					<input type="hidden" name="status" id="status" />
					<div class="section_btn">
						<p class="search_p1">
							<input class="btn btn-primary" type="button" value="목록" onclick="location.href='/admin/request'" />
						</p>
						<p class="search_p2">
					        <input class="btn btn-danger" type="button" value="거절" onclick="confirmReqBtn('-1'); return false;" />
							<input class="btn btn-success" type="button" value="승인" onclick="confirmReqBtn('0'); return false;" />
						</p>
					</div>
				</c:when>
				<c:otherwise>
					<table class="detail_table">
						<tbody>
							<tr>
								<th>전달 메세지</th>
								<td><c:out value='${useRequestVO.admin_msg}' /></td>
							</tr>
						</tbody>
					</table>
					<div class="section_btn">
						<p class="search_p1">
							<input class="btn btn-primary" type="button" value="목록" onclick="location.href='/admin/request'" />
						</p>
					</div>
				</c:otherwise>
			</c:choose>
		</div>
	</form:form>

	
