<!DOCTYPE html>
<html lang="ko"
	  xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : SupplyCompanyLayerFormWeb.html
 * @desc    : 공급업체 리스트 page
 *============================================================================
 * STYLE24
 * Copyright(C) 2021 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2021.06.09   jsshin       최초 작성
 *******************************************************************************
 -->
<div class="modal-dialog" role="document">
	<div class="modal-content">
		<div class="modal-header">
			<h5 class="modal-title" id="psptnLabel">업체 리스트</h5>
		</div>
		<div class="modal-body">
			<div class="pop_cont">
				<!-- 컨텐츠 시작 -->
				<div class="ps ptn" >
					<table>
						<colgroup>
							<col width="*">
							<col width="30%">
						</colgroup>
						<thead>
							<tr>
								<th>업체명</th>
								<th>대표자</th>
							</tr>
						</thead>
						<tbody id="supplyCompanyList">
						</tbody>
					</table>
					<div class="pager">
						<ul class="pageNav" id="paging">
						</ul>
					</div>
				</div>
				<!-- 컨텐츠 종료 -->
			</div>
		</div>
	</div>
</div>
<a href="#close-modal" rel="modal:close" class="close-modal">Close</a>

<form id="supplyCompanyForm" name="supplyCompanyForm" th:action="@{/customer/supply/company/list}" th:method="post">
	<input type="hidden" name="pageNo" value="1" />
	<input type="hidden" name="pageSize" value="5" />
</form>
<script src="/ux/plugins/gaga/gaga.paging.js"></script>
<script th:inline="javascript">
/*<![CDATA[*/
	var fnGetSupplyCompanyList = function () {
		gagaPaging.init('supplyCompanyForm', fnSearchCallback, 'paging', 10);
		gagaPaging.load(1);
	}

	var fnSearchCallback = function (result) {
		$('#supplyCompanyList').html('');
		let html = '';
		if (!gagajf.isNull(result) && result.supplyCompanyList.length > 0) {
			$.each(result.supplyCompanyList, function (idx, item) {
				html += '<tr>\n';
				html += '    <td>\n';
				html += item.supplyCompNm;
				html += '    </td>\n';
				html += '    <td>\n';
				html += item.ownerNm;
				html += '    </td>\n';
				html += '</tr>\n';
			});
		}
		$('#supplyCompanyList').html(html);

		gagaPaging.createPagination(result.paging.pageable);
	}

	$(document).ready(function() {
		fnGetSupplyCompanyList();
	});

	//약관내부링크
	$(function(){
		$(".hook_list ul li a").on("click", function(){
			var hookHeader = $(".modal-header").outerHeight() + 3000;
			var hookHref = $(this).attr("href");
			var hookPot = $(hookHref == "#" || hookHref == "" ? "body" : hookHref);
			var hookPos = hookPot.offset().top - hookHeader;
			$("html, body").animate({ scrollTop: hookPos }, 3000);
		});
	});
/*]]>*/
</script>
</html>