<%@ 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/admin/history.js"/>"></script>

<div class="section_title">
    <!-- <p>지도사용 이력</p> -->
</div>

<div class="section_content">
    <h1 class="h4 m-3">지도사용 이력</h1>
    <form:form commandName="UseHistorySearchVO" name="searchForm" action="/admin/history" method="get">

    <div class="row justify-content-end bg-white mx-3 py-2">
        <div class="col-auto row">
            <div class="col-auto">
                <select class="form-select" name="searchCondition">
                    <option value="all" ${UseHistorySearchVO.searchCondition eq 'all'?'selected':''}>통합검색</option>
                    <option value="name" ${UseHistorySearchVO.searchCondition eq 'name'?'selected':''}>이름</option>
                    <option value="company" ${UseHistorySearchVO.searchCondition eq 'company'?'selected':''}>소속</option>
                    <option value="req_area" ${UseHistorySearchVO.searchCondition eq 'req_area'?'selected':''}>위치</option>
                </select>
            </div>
            <div class="col-auto">
                <input type="text" class="form-control" name="searchKeyword" value="${UseHistorySearchVO.searchKeyword}"/>
            </div>
            <div class="col-auto">
                <input class="btn btn-outline-secondary" type="submit" value="검색"/>
            </div>
        </div>
    </div>


    <div class="row m-3 p-2 bg-white">
        <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="${useHistoryList}">
                    <tr>
                        <td><c:out value="${item.reqArea}"/></td>
                        <td><c:out value="${item.company}"/></td>
                        <td><c:out value="${item.name}"/></td>
                        <td class="td_date"><c:out value="${item.logDate}"/></td>
                    </tr>
                </c:forEach>
            </c:if>
            <c:if test="${count == 0}">
                <tr>
                    <td colspan="5">요청한 목록이 없습니다.</td>
                </tr>
            </c:if>
            </tbody>
        </table>
    </div>
    <div class="text-page">
        <form:hidden path="pageIndex"/></form:form>
        <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>
