<!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/charge";
		form.submit();
	}
	
	
	function goSearch(pageNo){
		var form = document.searchVO;
		form.page.value = 1;	
		form.action = "/cash/charge";
		form.submit();
	}
	</script>
</th:block>
<th:block layout:fragment="content">

            <div class="container-fluid">
              <div class="page-name">
                  <h1>에이전시 충전 내역</h1>
              </div>

              <div class="row">
                <div>
                  <div class="card">
                    <div class="card-body">
                      <div class="left">
                          <div class="">금일 나의 충전 금액</div>
                          <div class="" th:text="|₩${#numbers.formatInteger(sum.my, 0, 'COMMA')}|"> 0</div>
                      </div>
                      <div class="right"><img src="/img/icon_money.svg" /></div>
                    </div>
                  </div>
                </div>
                <div>
                  <div class="card">
                    <div class="card-body">
                      <div class="left">
                          <div class="">금일 하부에이젼시 충전 금액</div>
                          <div class=""  th:text="|₩${#numbers.formatInteger(sum.down, 0, 'COMMA')}|"> 0</div>
                      </div>
                      <div class="right"><img src="/img/icon_money.svg" /></div>
                    </div>
                  </div>
                </div>
                <div></div>
                <div></div>
              </div>
				
			  <ul class="tabletab">
                <li><a  th:class="${searchVO.updown == '' } ? active : ''" href="/cash/charge?updown=">전체 내역(<em class="num" th:text="${searchVO.tatal_list_count}">0</em>)</a></li>
                <li><a  th:class="${searchVO.updown == 'up' } ? active : ''" href="/cash/charge?updown=up">나의 내역</a></li>
                <li><a  th:class="${searchVO.updown == 'down' } ? active : ''" href="/cash/charge?updown=down">하부 에이전시의 내역</a></li>
              </ul>	
              <form class="searchWrap-form" name="searchVO">
                 <input type="hidden" id="page" name="page" th:value="${searchVO.page}"/>
                 <input type="hidden" id="updown" name="updown" th:value="${searchVO.updown}"/>
                 <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" placeholder="에이전시 아이디"  th:value="${searchVO.searchSiteId}" >
                           <i class="fa fa-search" aria-hidden="true"></i>
                         </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}"/>
                           <i class="fa fa-search" aria-hidden="true"></i>
                         </div>
                       </li>
                       <li>
                         <a class="btn" href ="javascript:goSearch()">
                           전체검색
                         </a>
                       </li>
                     </ul>

                   </div>
                 </div>
			  </form>
              <div class="table">
                <!--div class="head"><h6>에이전시 충전 내역 목록 (<em class="num" th:text="${searchVO.tatal_list_count}">0</em>)</h6></div-->
                <div class="body">                 
                  
                  <div class="table-responsive">
                    <table class="center">
                      <colgroup>
                        <col width="10%">
                        <col width="10%">
                      </colgroup>
                      <thead>
                        <tr>
                          <th>번호</th>
                          <th>주는 에이전시명</th>
                          <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.targetSiteId}">입금자명</td>
	                        <td th:text="${#numbers.formatInteger(list.creditAmt, 0, 'COMMA')}">충전 요청 크레딧</td>
	                        <td th:text="|${list.creditRate}%|">요율</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="${#temporals.format(list.regDate, 'yyyy-MM-dd HH:mm:ss')}">요청 시각</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>