|
|
@@ -22,7 +22,14 @@
|
|
|
</div>
|
|
|
|
|
|
<form id="freeGoodsPromotionForm" name="freeGoodsPromotionForm" th:method="post" >
|
|
|
- <input type="hidden" name="gbn" th:value="${param.gbn}" />
|
|
|
+ <input type="hidden" name="gbn" th:value="${param.gbn}" /> <!-- 신규/수정 구분 -->
|
|
|
+ <input type="hidden" id="supplyCompCds" name="supplyCompCds"/> <!-- 공급업체 리스트 -->
|
|
|
+ <input type="hidden" id="brandCds" name="brandCds"/> <!-- 브랜드 리스트 -->
|
|
|
+ <input type="hidden" id="applyGoodsCds" name="applyGoodsCds"/> <!-- 적용상품 리스트 -->
|
|
|
+ <input type="hidden" id="exceptGoodsCds" name="exceptGoodsCds"/> <!-- 제외상품 리스트 -->
|
|
|
+ <input type="hidden" id="freeGoods1Cds" name="freeGoods1Cds"/> <!-- 적용 사은품1 리스트 -->
|
|
|
+ <input type="hidden" id="freeGoods2Cds" name="freeGoods2Cds"/> <!-- 적용 사은품2 리스트 -->
|
|
|
+
|
|
|
<div class="panelContent">
|
|
|
<ul class="notice">
|
|
|
<li>구성상품 등록시 기본값
|
|
|
@@ -117,23 +124,7 @@
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteCompany">선택삭제</button>
|
|
|
<span>선택 : 00개</span>
|
|
|
<br/>
|
|
|
- <div id="gridCompanyList" style="width:100%; height:300px;" class="ag-theme-balgam lh60"></div>
|
|
|
- <table class="frmStyle aC">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th style="width:5%;"><label class="chkBox"><input type="checkbox" id="companyAll"/></label></th>
|
|
|
- <th style="width:30%;">공급처ID</th>
|
|
|
- <th style="width:55%;">공급업체명</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td><label class="chkBox"><input type="checkbox" class="brand_idx" value="company_idx"/></label></td>
|
|
|
- <td>1211</td>
|
|
|
- <td>업체이름</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ <div id="gridFGPromotionCompanyList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="padding10 wid45">
|
|
|
@@ -143,22 +134,8 @@
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteBrand">선택삭제</button>
|
|
|
<span>선택 : 00개</span>
|
|
|
<br/>
|
|
|
- <table class="frmStyle aC">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th style="width:5%;"><label class="chkBox"><input type="checkbox" id="brandAll"/></label></th>
|
|
|
- <th style="width:30%;">브랜드ID</th>
|
|
|
- <th style="width:55%;">브랜드명</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td><label class="chkBox"><input type="checkbox" class="brand_idx" value="brand_idx"/></label></td>
|
|
|
- <td>1211</td>
|
|
|
- <td>브랜드이름</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ <!-- 브랜드 선택 팝업(단수 선택 팝업... 복수를 새로 만들어야하는지 ? 아니면 변수처리해야하는지 ? -->
|
|
|
+ <div id="gridFGBrandList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</td>
|
|
|
@@ -167,36 +144,11 @@
|
|
|
<th>적용상품</th>
|
|
|
<td>
|
|
|
<div class="padding10">
|
|
|
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnAddGoods">상품 추가</button>
|
|
|
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteGoods">선택삭제</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnAddApplyGoods">상품 추가</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteApplyGoods">선택삭제</button>
|
|
|
<span>선택 : 00개</span>
|
|
|
<br/>
|
|
|
- <div class="padding10 inner-tb-solid">
|
|
|
- <table class="frmStyle aC">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th style="width:5%;"><label class="chkBox"><input type="checkbox" id="goodsAll"/></label></th>
|
|
|
- <th style="width:15%;">Product ID</th>
|
|
|
- <th style="width:15%;">브랜드명</th>
|
|
|
- <th style="width:35%;">상품명</th>
|
|
|
- <th style="width:10%;">판매상태</th>
|
|
|
- <th class="cRed" style="width:10%;">정상가</th>
|
|
|
- <th class="cRed" style="width:10%;">판매가</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td><label class="chkBox"><input type="checkbox" class="brand_idx" value="brand_idx"/></label></td>
|
|
|
- <td>1211</td>
|
|
|
- <td>브랜드이름</td>
|
|
|
- <td>덕다운패딩</td>
|
|
|
- <td>판매중</td>
|
|
|
- <td>202,000</td>
|
|
|
- <td>199,000</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
+ <div id="gridFGApplyGoodsList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
@@ -225,36 +177,11 @@
|
|
|
<th>제외 대상</th>
|
|
|
<td>
|
|
|
<div class="padding10">
|
|
|
- <button type="button" class="btn btnRight btn-success btn-lg" id="btnAddExtGoods">상품 추가</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnAddExceptGoods">상품 추가</button>
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteExtGoods">선택삭제</button>
|
|
|
<span>선택 : 00개</span>
|
|
|
<br/>
|
|
|
- <div class="padding10 inner-tb-solid">
|
|
|
- <table class="frmStyle aC">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th style="width:5%;"><label class="chkBox"><input type="checkbox" id="ExtGoodsAll"/></label></th>
|
|
|
- <th style="width:15%;">Product ID</th>
|
|
|
- <th style="width:15%;">브랜드명</th>
|
|
|
- <th style="width:35%;">상품명</th>
|
|
|
- <th style="width:10%;">판매상태</th>
|
|
|
- <th class="cRed" style="width:10%;">정상가</th>
|
|
|
- <th class="cRed" style="width:10%;">판매가</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td><label class="chkBox"><input type="checkbox" class="brand_idx" value="brand_idx"/></label></td>
|
|
|
- <td>1211</td>
|
|
|
- <td>브랜드이름</td>
|
|
|
- <td>덕다운패딩</td>
|
|
|
- <td>판매중</td>
|
|
|
- <td>202,000</td>
|
|
|
- <td>199,000</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
+ <div id="gridFGExceptGoodsList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
@@ -302,35 +229,12 @@
|
|
|
<input type="button" value="+ 사은품 선택" id="goodsList" /> <!-- 선택 시 팝업 노출 -->
|
|
|
<input type="button" value="선택삭제" id="deleteGoodsList" />
|
|
|
<br/>
|
|
|
- <table class="frmStyle aC">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th style="width:5%;"><label class="chkBox"><input type="checkbox" id="freeGoodsAll1"/></label></th>
|
|
|
- <th style="width:15%;">사은품 코드</th>
|
|
|
- <th style="width:40%;">사은품명</th>
|
|
|
- <th style="width:10%;">포인트액</th>
|
|
|
- <th style="width:10%;">지급수량</th>
|
|
|
- <th style="width:10%;">한정수량</th>
|
|
|
- <th style="width:10%;">잔여수량</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td><label class="chkBox"><input type="checkbox" class="brand_idx" value="brand_idx"/></label></td>
|
|
|
- <td>1211</td>
|
|
|
- <td>사은품목도리</td>
|
|
|
- <td><input type="text" class="w100" placeholder="0" /></td>
|
|
|
- <td><input type="text" class="w100" placeholder="1" /></td>
|
|
|
- <td><input type="text" class="w100" placeholder="0" /></td>
|
|
|
- <td>88</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ <div id="gridFreeGoods1List" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <th>사은품 조건2<em class="required" title="필수"></em><br/>(최대 2개)</th>
|
|
|
+ <th>사은품 조건2<br/>(최대 2개)</th>
|
|
|
<td>
|
|
|
<div>
|
|
|
<label for="saleAmt2">구매금액</label><input type="text" class="w300" id="saleAmt2" /> <br/>
|
|
|
@@ -338,30 +242,7 @@
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnAddFreeGoods2">+ 사은품 선택</button>
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteFreeGoods2">선택삭제</button>
|
|
|
<br/>
|
|
|
- <table class="frmStyle aC">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th style="width:5%;"><label class="chkBox"><input type="checkbox" id="freeGoodsAll2"/></label></th>
|
|
|
- <th style="width:15%;">사은품 코드</th>
|
|
|
- <th style="width:40%;">사은품명</th>
|
|
|
- <th style="width:10%;">포인트액</th>
|
|
|
- <th style="width:10%;">지급수량</th>
|
|
|
- <th style="width:10%;">한정수량</th>
|
|
|
- <th style="width:10%;">잔여수량</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <tr>
|
|
|
- <td><label class="chkBox"><input type="checkbox" class="brand_idx" value="brand_idx"/></label></td>
|
|
|
- <td>1211</td>
|
|
|
- <td>사은품목도리</td>
|
|
|
- <td><input type="text" class="w100" placeholder="0" /></td>
|
|
|
- <td><input type="text" class="w100" placeholder="1" /></td>
|
|
|
- <td><input type="text" class="w100" placeholder="0" /></td>
|
|
|
- <td>88</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table>
|
|
|
+ <div id="gridFreeGoods2List" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
@@ -412,27 +293,395 @@
|
|
|
</div>
|
|
|
|
|
|
<script th:inline="javascript">
|
|
|
- let columnCompanyList = [
|
|
|
+ var FGAddGoodsStatList = gagajf.convertToArray([[${goodsStatList}]]); // 상품 상태 리스트
|
|
|
+ // 공급업체 리스트 설정
|
|
|
+ let columnFGCompanyList = [
|
|
|
{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
{headerName: "공급처ID", field: "supplyCompCd", width: 120, cellClass: 'text-center'},
|
|
|
{headerName: "공급업체명", field: "supplyCompNm", width: 150, cellClass: 'text-center'}
|
|
|
];
|
|
|
- let gridOptionsCompanyList = gagaAgGrid.getGridOptions(columnCompanyList);
|
|
|
- gridOptionsCompanyList.rowSelection = "multiple";
|
|
|
+ // 브랜드 리스트 설정
|
|
|
+ let columnBrandList = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ {headerName: "브랜드ID", field: "brandCd", width: 120, cellClass: 'text-center'},
|
|
|
+ {headerName: "공급업체명", field: "brandEnm", width: 150, cellClass: 'text-center'}
|
|
|
+ ];
|
|
|
+ // 적용상품 리스트 설정
|
|
|
+ let columnApplyGoodsList = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ {headerName: "Product ID", field: "goodsCd", width: 120, cellClass: 'text-center'},
|
|
|
+ {headerName: "브랜드명", field: "brandEnm", width: 150, cellClass: 'text-center'},
|
|
|
+ {headerName: "상품명", field: "goodsNm", width: 120, cellClass: 'text-center'},
|
|
|
+ {headerName: "판매상태", field: "goodsStat" , width: 120, cellClass: 'text-center',
|
|
|
+ cellEditorParams: { values: gagaAgGrid.extractValues(FGAddGoodsStatList) },
|
|
|
+ valueFormatter: function (params) { return gagaAgGrid.lookupValue(FGAddGoodsStatList, params.value); },
|
|
|
+ valueParser: function (params) { return gagaAgGrid.lookupKey(FGAddGoodsStatList, params.newValue); }
|
|
|
+ },
|
|
|
+ {headerName: "정상가", field: "listPrice", width: 120, cellClass: 'text-center', valueFormatter: function(params) {return params.value.addComma();}},
|
|
|
+ {headerName: "판매가", field: "currPrice", width: 120, cellClass: 'text-center', valueFormatter: function(params) {return params.value.addComma();}}
|
|
|
+ ];
|
|
|
+ // 제외상품 리스트 설정
|
|
|
+ let columnExceptGoodsList = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ {headerName: "Product ID", field: "goodsCd", width: 120, cellClass: 'text-center'},
|
|
|
+ {headerName: "브랜드명", field: "brandEnm", width: 150, cellClass: 'text-center'},
|
|
|
+ {headerName: "상품명", field: "goodsNm", width: 120, cellClass: 'text-center'},
|
|
|
+ {headerName: "판매상태", field: "goodsStat" , width: 120, cellClass: 'text-center',
|
|
|
+ cellEditorParams: { values: gagaAgGrid.extractValues(FGAddGoodsStatList) },
|
|
|
+ valueFormatter: function (params) { return gagaAgGrid.lookupValue(FGAddGoodsStatList, params.value); },
|
|
|
+ valueParser: function (params) { return gagaAgGrid.lookupKey(FGAddGoodsStatList, params.newValue); }
|
|
|
+ },
|
|
|
+ {headerName: "정상가", field: "listPrice", width: 120, cellClass: 'text-center',valueFormatter: function(params) {return params.value.addComma();}},
|
|
|
+ {headerName: "판매가", field: "currPrice", width: 120, cellClass: 'text-center',valueFormatter: function(params) {return params.value.addComma();}}
|
|
|
+ ];
|
|
|
+ // 사은품 조건1 리스트 설정 (사은품 상품 만들어지면 만들어야함)
|
|
|
+ let columnFreeGoods1List = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ {headerName: "사은품 코드", field: "goodsCd", width: 120, cellClass: 'text-center'},
|
|
|
+ {headerName: "사은품명", field: "goodsNm", width: 150, cellClass: 'text-center'},
|
|
|
+ {headerName: "포인트액", field: "pointAmt" , width: 100, cellClass: 'text-center'
|
|
|
+ ,valueFormatter: function(params) {
|
|
|
+ if(params.value && params.value > 0) {
|
|
|
+ return params.value.addComma();
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cellEditor: 'textCellEditor',
|
|
|
+ cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
+ },
|
|
|
+ {headerName: "지급수량", field: "sendQty" , width: 100, cellClass: 'text-center'
|
|
|
+ ,valueFormatter: function(params) {
|
|
|
+ if(params.value && params.value > 0) {
|
|
|
+ return params.value.addComma();
|
|
|
+ } else {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cellEditor: 'textCellEditor',
|
|
|
+ cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
+ },
|
|
|
+ {headerName: "한정수량", field: "limitQty" , width: 100, cellClass: 'text-center'
|
|
|
+ ,valueFormatter: function(params) {
|
|
|
+ if(params.value && params.value > 0) {
|
|
|
+ return params.value.addComma();
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cellEditor: 'textCellEditor',
|
|
|
+ cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
+ },
|
|
|
+ {headerName: "잔여수량", field: "leftQty", width: 120, cellClass: 'text-center'
|
|
|
+ ,valueFormatter: function(params) {
|
|
|
+ if(params.value && params.value > 0) {
|
|
|
+ return params.value.addComma();
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ // 사은품 조건2 리스트 설정 (사은품 상품 만들어지면 만들어야함)
|
|
|
+ let columnFreeGoods2List = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ {headerName: "사은품 코드", field: "goodsCd", width: 120, cellClass: 'text-center'},
|
|
|
+ {headerName: "사은품명", field: "goodsNm", width: 150, cellClass: 'text-center'},
|
|
|
+ {headerName: "포인트액", field: "pointAmt" , width: 100, cellClass: 'text-center'
|
|
|
+ ,valueFormatter: function(params) {
|
|
|
+ if(params.value && params.value > 0) {
|
|
|
+ return params.value.addComma();
|
|
|
+ } else {
|
|
|
+ return '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cellEditor: 'textCellEditor',
|
|
|
+ cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
+ },
|
|
|
+ {headerName: "지급수량", field: "sendQty" , width: 100, cellClass: 'text-center'
|
|
|
+ ,valueFormatter: function(params) {
|
|
|
+ if(params.value && params.value > 0) {
|
|
|
+ return params.value.addComma();
|
|
|
+ } else {
|
|
|
+ return '1';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cellEditor: 'textCellEditor',
|
|
|
+ cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
+ },
|
|
|
+ {headerName: "한정수량", field: "limitQty" , width: 100, cellClass: 'text-center'
|
|
|
+ ,valueFormatter: function(params) {
|
|
|
+ if(params.value && params.value > 0) {
|
|
|
+ return params.value.addComma();
|
|
|
+ } else {
|
|
|
+ return '0';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cellEditor: 'textCellEditor',
|
|
|
+ cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
+ },
|
|
|
+ {headerName: "잔여수량", field: "leftQty", width: 120, cellClass: 'text-center'
|
|
|
+ ,valueFormatter: function(params) {
|
|
|
+ if(params.value && params.value > 0) {
|
|
|
+ return params.value.addComma();
|
|
|
+ } else {
|
|
|
+ return '0';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ // 공급업체 리스트 설정
|
|
|
+ var gridOptionsFGCompanyList = gagaAgGrid.getGridOptions(columnFGCompanyList);
|
|
|
+ gridOptionsFGCompanyList.rowSelection = "multiple";
|
|
|
+ // 브랜드 리스트 설정
|
|
|
+ var gridOptionsFGBrandList = gagaAgGrid.getGridOptions(columnBrandList);
|
|
|
+ gridOptionsFGBrandList.rowSelection = "multiple";
|
|
|
+ // 적용상품 리스트 설정
|
|
|
+ var gridOptionsFGApplyGoodsList = gagaAgGrid.getGridOptions(columnApplyGoodsList);
|
|
|
+ gridOptionsFGApplyGoodsList.rowSelection = "multiple";
|
|
|
+ // 제외상품 리스트 설정
|
|
|
+ var gridOptionsFGExceptGoodsList = gagaAgGrid.getGridOptions(columnExceptGoodsList);
|
|
|
+ gridOptionsFGExceptGoodsList.rowSelection = "multiple";
|
|
|
+ // 사은품 조건1 리스트 설정
|
|
|
+ var gridOptionsFreeGoods1List = gagaAgGrid.getGridOptions(columnFreeGoods1List);
|
|
|
+ gridOptionsFreeGoods1List.rowSelection = "multiple";
|
|
|
+ // 사은품 조건2 리스트 설정
|
|
|
+ var gridOptionsFreeGoods2List = gagaAgGrid.getGridOptions(columnFreeGoods2List);
|
|
|
+ gridOptionsFreeGoods2List.rowSelection = "multiple";
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
- gagaAgGrid.createGrid("gridCompanyList", gridOptionsCompanyList);
|
|
|
+ gagaAgGrid.createGrid("gridFGPromotionCompanyList", gridOptionsFGCompanyList);
|
|
|
+ gagaAgGrid.createGrid("gridFGBrandList", gridOptionsFGBrandList);
|
|
|
+ gagaAgGrid.createGrid("gridFGApplyGoodsList", gridOptionsFGApplyGoodsList);
|
|
|
+ gagaAgGrid.createGrid("gridFGExceptGoodsList", gridOptionsFGExceptGoodsList);
|
|
|
+ gagaAgGrid.createGrid("gridFreeGoods1List", gridOptionsFreeGoods1List);
|
|
|
+ gagaAgGrid.createGrid("gridFreeGoods2List", gridOptionsFreeGoods2List);
|
|
|
+
|
|
|
cfnCreateCalendar('#promotionTerms', 'freegoodsStdt', 'freegoodsEddt', true, '행사기간', 'X');
|
|
|
});
|
|
|
|
|
|
+ // 저장 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnFreegoodsPromotionSave').on('click', function() {
|
|
|
+ // 각 ag-grid list 수량
|
|
|
+ let supplyCompCnt = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList).length;
|
|
|
+ let brandCnt = gagaAgGrid.getAllRowData(gridOptionsFGBrandList).length;
|
|
|
+ let applyGoodsCnt = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList).length;
|
|
|
+ // let supplyCompCnt = gagaAgGrid.getAllRowData(gridOptionsFGExceptGoodsList).length;
|
|
|
+ let freeGoods1Cnt = gagaAgGrid.getAllRowData(gridOptionsFreeGoods1List).length;
|
|
|
+ let freeGoods2Cnt = gagaAgGrid.getAllRowData(gridOptionsFreeGoods2List).length;
|
|
|
+
|
|
|
+ // 프로모션명 확인
|
|
|
+ if(gagajf.isEmpty($("#freeGoodsPromotionForm #freegiftNm").val())) {
|
|
|
+ mcxDialog.alert("프로모션명을 입력해주세요");
|
|
|
+ $("#freeGoodsPromotionForm #freegiftNm").focus();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 행사기간 확인
|
|
|
+ var fromDate = $('#freeGoodsPromotionForm input[name=freegiftStdt]').val();
|
|
|
+ var toDate = $('#freeGoodsPromotionForm input[name=freegiftEddt]').val();
|
|
|
+
|
|
|
+ if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
|
|
|
+ mcxDialog.alert("행사 기간 시작일자와 종료일자를 입력하세요.");
|
|
|
+ $('#freeGoodsPromotionForm input[name=freegiftStdt]').focus();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fromDate > toDate) {
|
|
|
+ mcxDialog.alert("시작일자는 종료일자 보다 클 수 없습니다.");
|
|
|
+ $('#freeGoodsPromotionForm input[name=freegiftStdt]').focus();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 공급업체, 브랜드, 적용상품 중 1개 필수 체크
|
|
|
+ if(supplyCompCnt < 1 && brandCnt < 1 && applyGoodsCnt < 1) {
|
|
|
+ mcxDialog.alert("공급업체, 브랜드, 적용 상품 중 한가지 이상 등록해주세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 사은품조건1 필수 체크
|
|
|
+ if(freeGoods1Cnt < 1) {
|
|
|
+ mcxDialog.alert("사은품 조건1의 사은품을 등록해주세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 사은품조건1 의 수량 체크
|
|
|
+ if(freeGoods1Cnt > 2) {
|
|
|
+ mcxDialog.alert("사은품 조건1의 사은품은 최대 2개까지 등록가능합니다.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 사은품조건2의 수량 체크
|
|
|
+ if(freeGoods2Cnt > 2) {
|
|
|
+ mcxDialog.alert("사은품 조건2의 사은품은 최대 2개까지 등록가능합니다.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ // 공급업체 설정 / 업체 추가 콜백함수
|
|
|
+ var fnSetPopupComapnyInfo = function(result) {
|
|
|
+ // 기존 리스트 데이터 for
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true;
|
|
|
+ let gridListValue = gagaAgGrid.getAllRowData(gridOptionsFGCompanyList); // 받아온 모든 데이터
|
|
|
+
|
|
|
+ // 받아온 data for
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ // 동일한 data는 추가하지 않음
|
|
|
+ if(gridListValue[j].supplyCompCd == result[i].supplyCompCd) {
|
|
|
+ addChk = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 동일한 data 리스트에 추가
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(gridOptionsFGCompanyList, result[i], "supplyCompCd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 브랜드 설정 / 브랜드 추가 콜백함수 (단수로 가져오므로 복수일 경우에 수정 확인 필요)
|
|
|
var fnSetPopupBrandInfo = function(result) {
|
|
|
- // $("#goodsPopupForm input[name=brandCd]").val(result[0].brandCd);
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true;
|
|
|
+ let gridListValue = gagaAgGrid.getAllRowData(gridOptionsFGBrandList);
|
|
|
|
|
|
- }
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ if(gridListValue[j].brandCd == result[i].brandCd) {
|
|
|
+ addChk = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(gridOptionsFGBrandList, result[i], "brandCd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 적용 상품 리스트 콜백함수
|
|
|
+ var fnSetPopupApplyGoodsInfo = function(result) {
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true;
|
|
|
+ let gridListValue = gagaAgGrid.getAllRowData(gridOptionsFGApplyGoodsList);
|
|
|
+
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ if(gridListValue[j].goodsCd == result[i].goodsCd) {
|
|
|
+ addChk = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(gridOptionsFGApplyGoodsList, result[i], "goodsCd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 제외 상품 리스트 콜백함수
|
|
|
+ var fnSetPopupExceptGoodsInfo = function(result) {
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true;
|
|
|
+ let gridListValue = gagaAgGrid.getAllRowData(gridOptionsFGExceptGoodsList);
|
|
|
+
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ if(gridListValue[j].goodsCd == result[i].goodsCd) {
|
|
|
+ addChk = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(gridOptionsFGExceptGoodsList, result[i], "goodsCd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 사은품 조건1 상품 리스트 콜백함수
|
|
|
+ var fnSetPopupFreeGoods1Info = function(result) {
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true;
|
|
|
+ let gridListValue = gagaAgGrid.getAllRowData(gridOptionsFreeGoods1List);
|
|
|
+
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ if(gridListValue[j].goodsCd == result[i].goodsCd) {
|
|
|
+ addChk = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(gridOptionsFreeGoods1List, result[i], "goodsCd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 사은품 조건1 상품 리스트 콜백함수
|
|
|
+ var fnSetPopupFreeGoods2Info = function(result) {
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true;
|
|
|
+ let gridListValue = gagaAgGrid.getAllRowData(gridOptionsFreeGoods2List);
|
|
|
+
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ if(gridListValue[j].goodsCd == result[i].goodsCd) {
|
|
|
+ addChk = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(gridOptionsFreeGoods2List, result[i], "goodsCd");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
// 공급업체 설정 업체 추가 버튼 클릭시
|
|
|
- $('#btnAddCompany').on('click', function() {
|
|
|
- cfnOpenCompanyListPopup('fnSetPopupBrandInfo');
|
|
|
+ $('#freeGoodsPromotionForm #btnAddCompany').on('click', function() {
|
|
|
+ cfnOpenCompanyListPopup("fnSetPopupComapnyInfo");
|
|
|
+ });
|
|
|
+
|
|
|
+ // 브랜드 추가 버튼 클릭시 (복수 브랜드때 수정 필요)
|
|
|
+ $('#freeGoodsPromotionForm #btnAddBrand').on('click', function() {
|
|
|
+ cfnOpenBrandListPopup("fnSetPopupBrandInfo");
|
|
|
+ });
|
|
|
+
|
|
|
+ // 적용 상품 추가 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnAddApplyGoods').on('click', function() {
|
|
|
+ cfnOpenGoodsPopup("fnSetPopupApplyGoodsInfo");
|
|
|
+ });
|
|
|
+ // 제외 상품 추가 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnAddExceptGoods').on('click', function() {
|
|
|
+ cfnOpenGoodsPopup("fnSetPopupExceptGoodsInfo");
|
|
|
+ });
|
|
|
+ // 사은품 조건1 상품 추가 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnAddFreeGoods1').on('click', function() {
|
|
|
+ cfnOpenGoodsPopup("fnSetPopupFreeGoods1Info");
|
|
|
+ });
|
|
|
+ // 사은품 조건2 상품 추가 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnAddFreeGoods2').on('click', function() {
|
|
|
+ cfnOpenGoodsPopup("fnSetPopupFreeGoods2Info");
|
|
|
+ });
|
|
|
+
|
|
|
+ // 공급업체 설정 선택삭제 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnDeleteCompany').on('click', function() {
|
|
|
+ gridOptionsFGCompanyList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGCompanyList)});
|
|
|
+ });
|
|
|
+ // 브랜드 설정 선택삭제 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnDeleteBrand').on('click', function() {
|
|
|
+ gridOptionsFGBrandList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGBrandList)});
|
|
|
+ });
|
|
|
+ // 적용상품 선택삭제 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnDeleteApplyGoods').on('click', function() {
|
|
|
+ gridOptionsFGApplyGoodsList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGApplyGoodsList)});
|
|
|
+ });
|
|
|
+ // 제외상품 선택삭제 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnDeleteExtGoods').on('click', function() {
|
|
|
+ gridOptionsFGExceptGoodsList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGExceptGoodsList)});
|
|
|
+ });
|
|
|
+ // 사은품조건1 선택삭제 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnDeleteFreeGoods1').on('click', function() {
|
|
|
+ gridOptionsFreeGoods1List.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFreeGoods1List)});
|
|
|
+ });
|
|
|
+ // 사은품조건2 선택삭제 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnDeleteFreeGoods2').on('click', function() {
|
|
|
+ gridOptionsFreeGoods2List.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFreeGoods2List)});
|
|
|
});
|
|
|
|
|
|
//패널영역 줄이기
|
|
|
@@ -450,5 +699,6 @@
|
|
|
var fnFreeGoodsPromotionFormClose = function(){
|
|
|
uifnPopupClose('popupFreeGoodsPromotionRegi');
|
|
|
}
|
|
|
+
|
|
|
</script>
|
|
|
</html>
|