<!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>
	

	$(document).ready(function(){

			var prev_val ;		
			$('#vl').focus(function(){		
			 prev_val = $(this).val();		
			}).change(function(){		
			 $(this).blur(); 		
			 if(confirm(" 변경하시겠습니까?")){		
			        // Todo		
			     
			    $.ajax({
		 			type : "post",
		 			url : "/agent/siteVenderUpdate",
		 			data : {
		 				
		 				vendorIdx:$(this).find("option:selected").data("vidx"),
		 				vendorCode: $(this).val()
		 				
		 			},
		 			async : true,
		 			dataType : "json",
		 			success : function(data) {
		 				if(data.RES=="SUCCESS"){
		 					alert("변경완료");		
		 			
		 				}else{
		 					alert(data.MSG);
		 				
		 				}
		 			}
		 		});
			          
			 }else{		
			        // 기존에 선택한 값으로 Undo		
			        $(this).val(prev_val);		
			      //  alert('unchanged');		
			        return false;
		
			 }
		
			});

	});
	
	
	
	</script>
</th:block>
<th:block layout:fragment="content">
    
    <div class="container-fluid">
      <div class="page-name">
          <h1>게임사 연결설정</h1>
      </div>

      <div class="table">
        <div class="head"><h6>에이전시 <span th:text="${loginSite.siteId}"></span>의 게임회사 연결설정</h6></div>
        <div class="body">
          <div class="table-responsive">
            <table>
              <colgroup>
                <col width="50%">
                <col width="50%%">
                
              </colgroup>
              <tbody>
              		<th:block th:each="list,seq : ${mylist}">
                    <tr>
                        <th th:text="${list.vendorName}">에볼루션</th>
                        <td>
                        	<select id="vl" class="wa">
                        		<th:block  th:each="vlist,vseq : ${vendorlist}">
                        				<option th:data-vidx="${list.vendorIdx}" th:value = "${vlist.vendorCode}" th:if="${list.vendorIdx == vlist.vendorIdx }" th:text="${vlist.vendorName2}" th:selected="${list.vendorCode == vlist.vendorCode}">에볼루션 1</option>
                        		</th:block>                        	                        	
                        	</select>
						</td>
					</tr>
                   </th:block>
                </tbody>
            </table>
          </div>
        </div>
      </div>

    </div>
</th:block>