<%@ 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"%>

<script src="<c:url value='/js/map/request.js' />"></script>
<script type="text/javascript">
  var start = "${b_start}";
  var end = "${b_end}";
  var now = "${current_page}";
</script>
<div class="section_title">
	<!-- <p>현장 지원 시스템</p> -->
</div>

<div class="section_content">
	<h1 class="h4 m-3">지도사용 요청</h1>

	<form:form commandName="useRequestSearchVO" id="searchForm" name="searchForm" method="get" >
		<div class="row justify-content-between bg-white mx-3 py-2">
			<input type="hidden" name="id" />
      <table class="table table-hover text-center">
        <thead>
          <tr>
            <th>번호</th>
            <th>작업명</th>
            <th>날짜</th>
            <th>상태</th>
          </tr>
        </thead>

        <tbody>
          <c:if test="${count >= 1}">
            <c:forEach var="item" items="${useRequestList}" varStatus="idx">
              <tr>
                <%--<a href="/map/request/<c:out value='${item.idx}' />">--%>
                <td>${idx.count}</td>
                <td class="title-td" data-idx="${item.idx}">${item.title}</td>
                <td class="td_date">${item.r_date}</td>
                <td>
                  <c:choose>
                    <c:when test="${item.status eq '99'}"><span class="card-warning"><c:out value='승인대기' /></span></c:when>
                    <c:when test="${item.status eq '0'}"><span class="card-success"><c:out value='승인' /></span></c:when>
                    <c:when test="${item.status eq '-1'}"><span class="card-default"><c:out value='반려' /></span></c:when>
                  </c:choose>
                </td>
              </tr>
            </c:forEach>
          </c:if>
          <c:if test="${count == 0}">
            <tr><td colspan="4">요청한 목록이 없습니다.</td></tr>
          </c:if>
        </tbody>
      </table>
		</div>
    <div class="row justify-content-between mx-3 py-2">
      <div class="col-auto"></div>
      <div class="col-auto">
        <form:hidden path="pageIndex" />
        <nav aria-label="Page navigation">
          <ul class="pagination justify-content-center">
            <ui:pagination paginationInfo="${paginationInfo}" type="image" jsFunction="fn_link_page" />
          </ul>
        </nav>
      </div>
      <div class="col-auto">
        <input class="btn btn-warning" id="mapRequestModalBtn" type="button" value="작성"/>
      </div>
    </div>
	</form:form>
</div>
<div class="section_btn">
	<!-- <p><input class="btn" type="button" value="관리" onclick="location.href='fieldDetail.html'" /></p> -->
</div>

<div class="modal fade" id="mapRequestModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="mapRequestModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="mapRequestModalLabel">지도 사용 요청</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body" id="mapRequestModalBody">

      </div>
    </div>
  </div>
</div>