<!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 = "/user";
		form.submit();
	}
	
	
	function goSearch(pageNo){
		var form = document.searchVO;
		form.page.value = 1;	
		form.action = "/user";
		form.submit();
	}
	
	function changeUserParseSet(memberIdx, pStatus) {
		$.ajax({
			type : "get", 
			url : "/user/parseOnOff?memberIdx="+memberIdx+"&pStatus="+pStatus,	
			async : true, 
			dataType : "json", 
			success : function(data) {
				if(data.RES=="SUCCESS"){
 					alert("처리 완료");
				 				
 				} else {
 					alert("오류발생");
 				}
			}
		});
	}
	</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>유저 목록 (<em class="num" th:text="${searchVO.tatal_list_count}">3,150</em>)</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>
                        <input type="text" name="searchSiteId" th:value="${searchVO.searchSiteId}">
                      </div>
                    </li>
                    <li class="mr10">
                      <div class="input-group">
                        <div>
                          <label class="input-group-text">유저 아이디</label>  <!--아이디 검색 시 입력한 값을 포함한 아이디 모두 출력-->
                        </div>
                        <input type="text"  name="searchMemId" th:value="${searchVO.searchMemId}">
                      </div>
                    </li>
                    <li class="mr10">
                      <div class="input-group">
                        <div>
                          <label class="input-group-text">유저 변환아이디</label>
                        </div>
                        <input type="text" name="vendorUsername" th:value="${searchVO.vendorUsername}">
                      </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}">3,150</em></h6></div-->
                <div class="body"> 
                  <div class="table-responsive">
                    <table class="center" style="width: 100%">
                      <thead>
                        <tr>
                          <th>번호</th>
                          <th>소속 에이전시</th>
                          <th>유저ID</th>
                          <th>UUID</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.memberIdx}">516398</td>
                          <td>
                            <div class="tgBox">
                              <a class="selectBox bl"><em th:text="${list.siteId}">@no.1</em></a>
                            </div>
                          </td>
                          <td>
                            <div class="tgBox">
                              <a class="selectBox"><em th:text="${list.memberId}">@no.1</em></a>
                              <div class="tgBoxcon">
                                <ul class="b0">
                                  <li>유저</li>
                                  <li><a href="userRead.html">수정</a></li>
                                  <li><a href="transactionList.html">전체 트랜잭션 내역</a></li>
                                  <li><a href="betlist.html">통합 베팅 내역</a></li>
                                  <li><a class="modalBtn">머니 지급</a></li>
                                </ul>
                              </div>
                            </div>
                          </td>
                          <td><span class="copytxt" th:text="${list.uuid}">-</span><button class="copybtn"></button></td>
                          <td th:text="${list.get('memberNick')}">-</td>
                          <td th:text="${list.get('vendorUsername')}">-</td>
                          <td th:text="${list.regDate}">22-03-11 17:18</td>
                          <td th:text="${list.totalEvoBetAmt}">-</td>
                          <td th:text="${list.parseEvoYn}">-</td>
                          <td>
                            <a id="up_on_bt" class="btn upBtns" th:href="'javascript:changeUserParseSet(' + ${list.memberIdx} + ', \'Y\')'">허용</a>
                            <a id="up_off_bt" class="btn upBtns" th:href="'javascript:changeUserParseSet(' + ${list.memberIdx} + ', \'N\')'">불가</a>
                          </td>
                        </tr>
                        </th:block>
                      </tbody>
                    </table>
                     <th:block th:utext="${pageInfo}"></th:block>
                  </div>
                </div>
              </div>

              <div class="modal-content">
                <div class="modal-header"><h5>유저 머니 지급</h5><a>×</a></div>
                <div class="modal-body">
                  <ul>
                    <li>지급금액</li>
                    <li><input type="text"><em class="pot">C</em><span>마이너스(-)로 입력시 보유 금액을 차감합니다.<br />나의 보유 금액보다 큰 금액을 지급할 수 없습니다.<br />대상 유저의 보유 금액보다 큰 금액을 차감할 수 없습니다.</span></li>
                  </ul>
                </div>
                <div class="modal-footer">
                  <a>취소</a>
                  <a>지급</a>
                </div>
              </div>

            </div><!-- container-fluid -->
<script>
	const button = document.querySelector('.copybtn');
	const span = document.querySelector('.copytxt');
	
	button.addEventListener('click', () => {
	  const text = span.innerText;
	  navigator.clipboard.writeText(text)
	});
</script>
<style>
.table-responsive .btn{border:0; padding: 5px 10px; margin-left: 10px}
.copybtn { background:url(img/copy2.png) no-repeat; background-size: cover; width: 20px; height: 20px; border: 0; cursor:pointer;margin-left:10px;}
</style>
</th:block>
