<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorate="~{admin/layout/layout}" th:with="title='',active='home'">
<th:block layout:fragment="html_head">
	<script>
	function goPage(pageNo){
		var form = document.searchVO;
		form.page.value = pageNo;	
		form.action = "/cash/exchange";
		form.submit();
	}
	
	
	
	function goSearch(pageNo){
		var form = document.searchVO;
		form.page.value = 1;	
		form.action = "/cash/exchange";
		form.submit();
	}
	</script>
</th:block>
<th:block layout:fragment="content">


            <div class="container-fluid">
              <div class="page-name">
                  <h1>에이전시 지급 내역</h1>
              </div>
              <ul class="tabletab">
              	 <li class="active"><a>금월 총 지급/충전 금액: 0 C</a></li>               	        
              </ul>
              <form class="searchWrap-form" name="searchVO">
                 <input type="hidden" id="page" name="page" th:value="${searchVO.page}"/>
                 <div class="tableserachwrap">
                   <!--div>
                     <ul class="tableserach">
                       <li>
                         <div class="input-group">
                           <div>
                             <label class="input-group-text">표시</label>
                           </div>
                           <select name="count_per_list">
                             <option value="10"  th:selected="${searchVO.count_per_list == 10}">10</option>
                             <option value="50"  th:selected="${searchVO.count_per_list == 50}">50</option>
                             <option value="100"  th:selected="${searchVO.count_per_list == 100}">100</option>
                           </select>
                         </div>
                       </li>
                     </ul>
                   </div-->
                   <div>
                     <ul class="tableserach">
                       <li>
                         <div class="input-group">
                           <div>
                             <label class="input-group-text">에이전시 아이디</label>
                           </div>
                           <input type="text" name="searchSiteId" th:value="${searchVO.searchSiteId}" >
                         </div>
                       </li>
                       
                       <li>
                         <div class="input-group">
                           <div>
                             <label class="input-group-text">기간</label>
                           </div>
                           <input type="date" name="startDate" th:value="${searchVO.startDate}"/>
                           <input type="date" name="endDate" th:value="${searchVO.endDate}"/>
                         </div>
                       </li>
                       <li>
                         <a class="btn" href ="javascript:goSearch()">
                           전체검색
                         </a>
                       </li>
                     </ul>

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

              <div class="table">
                <!--div class="head"><h6>에이전시 지급 내역 목록</h6><span class="text">금월 총 지급/충전 금액: 0 C</span></div-->
                <div class="body">
                  <div class="table-responsive">
                    <table class="center">
                      <thead>
                        <tr>
                          <th>번호</th>
                          <th>주는 에이전시명</th>
                          <th>받는 에이전시명</th>
                          <th>타입</th>
                          <th>지급 금액</th>
                          <th>지급 전 잔액</th>
                          <th>지급 후 잔액</th>
                          <th>처리 시각</th>
                          <th>상태</th>
                          <th>관리</th>
                        </tr>
                      </thead>
                      <tbody>
						 
						<th:block th:each="list,seq : ${list}">
						<tr>
							<td th:text="${list.creditIdx}"></th>
	                        <td th:text="${list.siteId}">주는 에이전시명</td>
	                        <td th:text="${list.targetSiteId}">받는 에이전시명</td>
	                        <td th:text="${list.creditType}">입금자명</td>
	                        <td th:text="${#numbers.formatInteger(list.creditAmt, 0, 'COMMA')}">충전 요청 크레딧</td>
	                        <td th:text="${#numbers.formatInteger(list.preCreditAmt, 0, 'COMMA')}">지급 잔액</td>
	                  
	                        <td th:text="${#numbers.formatInteger(list.preCreditAmt - list.creditAmt, 0, 'COMMA')}">지급 후 잔액</td>	                    
	                        <td  th:text="${list.creditStatus eq '1' }?${#temporals.format(list.updDate, 'yyyy-MM-dd HH:mm:ss')}:'-'">처리 시각</td>
	                        <td>
	                        	<span th:if="${list.creditStatus eq '0' }" th:text="신청"></span>
	                        	<span th:if="${list.creditStatus eq '1' }" th:text="완료"></span>
	                        	<span th:if="${list.creditStatus eq '2' }" th:text="대기"></span>
	                        </td>
	                
	                        <td>-</td>
	                        </tr>
						</th:block>
                      
                      </tbody>
                    </table>
                      <th:block th:utext="${pageInfo}"></th:block>
                  </div>
                </div>
              </div>

            </div><!-- container-fluid -->

</th:block>
