<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<!--
 *******************************************************************************
 * @source  : OrderDetailPointHst.html
 * @desc    : 주문상품 상세 상품권 이력 화면
 *============================================================================
 * Pastelmall
 * Copyright(C) 2019 TSIT, All rights reserved.
 *============================================================================
 * VER  DATE         AUTHOR      DESCRIPTION
 * ===  ===========  ==========  =============================================
 * 1.0  2020.12.16   jsh77b       최초 작성
 *******************************************************************************
 -->
<div class="modalPopup" data-width="900">
	<div class="panelStyle">
		<div class="giftcardTitle">
			<h2>상품권 사용 내역</h2>
			<button type="button" class="close" onclick="uifnPopupClose('popupOrderDetailGiftcardHstForm');"><i class="fa fa-times"></i></button>
		</div>
			
		<div class="panelContent" style="overflow-y:auto;">
			<form id="pointHstFrm">
				<div id="gridOrderGiftcardInfo" style="width:100%; height:260px;" class="ag-theme-balham"></div>
			</form>
		</div>
	</div>
</div>

<!-- data -->
<script th:inline="javascript">
/*<![CDATA[*/
var orderGiftcardHstList = [[${orderGiftcardHstList}]];

// specify the columns
var columnDefsOrderGiftcardInfo = [
		{headerName: "상품권명", 		field: "gfcdNm", 		width: 180, cellClass: 'text-center'},
		{headerName: "상품권코드", 		field: "gfcdNo", 		width: 180, cellClass: 'text-center'},
		{
			headerName			: "상품권승인금액"
			, field				: "chgGfcdAmt"
			, width				: 130
			, cellClass			: 'text-center'
			, valueFormatter	: function(params) {
				return params.value.addComma();
			}	
		},
		{
			headerName			: "상품권사용금액"
			, field				: "usGfcdAmt"
			, width				: 130
			, cellClass			: 'text-center'
			, valueFormatter	: function(params) {
				return params.value.addComma();
			}	
		},
		{
			headerName			: "상품권남은금액"
			, field				: "rmGfcdAmt"
			, width				: 130
			, cellClass			: 'text-center'
			, valueFormatter	: function(params) {
				return params.value.addComma();
			}	
		},
		{headerName: "주문상세", 		field: "ordDtlNo", 		width: 100, cellClass: 'text-center'},
		{headerName: "상품코드", 		field: "goodsCd", 		width: 100, cellClass: 'text-center'},
		{
			headerName			: "상품권사용금액"
			, field				: "gfcdAmt"
			, width				: 130
			, cellClass			: 'text-center'
			, valueFormatter	: function(params) {
				return params.value.addComma();
			}	
		},
		{headerName: "사유", 			field: "occurDtlDesc", 	width: 180, cellClass: 'text-center'},
		{
			headerName			: "등록일시"	
			, field				: "regDt"
			, width				: 130
			, cellClass			: 'text-center' 
			, cellRenderer: function(params) {
				return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmm").format("YYYY-MM-DD HH:mm") : '';
			}
		}
];

var gridOptionsOrderGiftcardInfo = orderAgGrid.getGridOptions(columnDefsOrderGiftcardInfo);

$(document).ready(function() {	
	// Create a agGrid
	gagaAgGrid.createGrid('gridOrderGiftcardInfo', gridOptionsOrderGiftcardInfo);
	gridOptionsOrderGiftcardInfo.api.setRowData(orderGiftcardHstList);
});
/*]]>*/

</script>

<!-- AgGrid 컬럼 세팅 -->
<script>
// 공통1. 주문상세 그리드 옵션 정보 적용
var orderAgGrid = {
	getGridOptions : function(colDefs) {
		return {
			columnDefs					: colDefs
			, detailCellRendererParams	: {
				detailGridOptions	: {
					columnDefs				: []
					, defaultColDef			: {
						resizable: true
					}
					, suppressLoadingOverlay: false
					, onGridReady			: function (params) {
						params.api.setDomLayout('autoHeight');
					}
					, onFirstDataRendered	: function (params) {
						params.api.sizeColumnsToFit();
					}
				}
				, getDetailRowData: function (params) {
					params.successCallback(params.data.orderDetailList);
				}
			}
			, defaultColDef: {
				resizable: true
			}
			, isRowMaster: function (dataItem) {
				return dataItem ? dataItem.orderDetailList.length > 1 : false;
			}
			, suppressRowTransform: true
			, enableRangeSelection: true
		};
	}
}
</script>
</html>





