|
|
@@ -1,6 +1,6 @@
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="ko"
|
|
|
- xmlns:th="http://www.thymeleaf.org">
|
|
|
+ xmlns:th="http://www.thymeleaf.org">
|
|
|
<!--
|
|
|
*******************************************************************************
|
|
|
* @source : CouponCreatePopupForm.html
|
|
|
@@ -13,15 +13,22 @@
|
|
|
* === =========== ========== =============================================
|
|
|
* 1.0 2020.12.23 xyzp1539 최초 작성
|
|
|
*******************************************************************************
|
|
|
- -->
|
|
|
- <div class="modalPopup" data-width="1250" data-height="850">
|
|
|
- <div class="panelStyle" >
|
|
|
- <div class="panelTitle">
|
|
|
- <h2>쿠폰등록</h2>
|
|
|
- <button type="button" class="close" onclick="uifnPopupClose('CouponCreatePopup')"><i class="fa fa-times"></i></button>
|
|
|
- </div>
|
|
|
- <div class="panelContent">
|
|
|
- <form id="couponCreateForm" name="couponCreateForm">
|
|
|
+ -->
|
|
|
+<div class="modalPopup" data-width="1200">
|
|
|
+ <div class="panelStyle" >
|
|
|
+ <div class="panelTitle">
|
|
|
+ <h2>쿠폰등록</h2>
|
|
|
+ <button type="button" class="close" onclick="uifnPopupClose('CouponCreatePopup')"><i class="fa fa-times"></i></button>
|
|
|
+ </div>
|
|
|
+ <div class="panelContent">
|
|
|
+ <form id="couponCreateForm" name="couponCreateForm" th:action="@{'/marketing/coupon/save'}" >
|
|
|
+ <input type="hidden" name="supplyCompList" id="supplyCompList">
|
|
|
+ <input type="hidden" name="brandList" id="brandList">
|
|
|
+ <input type="hidden" name="applyGoodsList" id="applyGoodsList">
|
|
|
+ <input type="hidden" name="exceptGoodsList" id="excepGoodsList">
|
|
|
+ <input type="hidden" name="burdenList" id="burdenList">
|
|
|
+ <input type="hidden" name="cateList" id="cateList">
|
|
|
+
|
|
|
<div class="tabs">
|
|
|
<div class="tabsNav">
|
|
|
<ul>
|
|
|
@@ -45,9 +52,9 @@
|
|
|
<td colspan="5">
|
|
|
<input type="hidden" name="copyCpnId" maxlength="50" value="">
|
|
|
<input type="hidden" name="mode" maxlength="50" value="">
|
|
|
- <input type="text" name="cpnId" maxlength="50" value="" style="width:70%;" disabled="true" placeholder="자동생성" required="required" data-valid-name="쿠폰번호">
|
|
|
+ <input type="text" name="cpnId" maxlength="50" value="" style="width:70%;" disabled="true" placeholder="자동생성" data-valid-name="쿠폰번호">
|
|
|
<label class="chkBox checked" onclick="clickCreateChk(this);" id="cpnCreateLab">
|
|
|
- <input type="checkbox" name="cpnCreateType" value="true" class="type-check" checked />쿠폰번호 자동생성
|
|
|
+ <input type="checkbox" name="cpnCreateType" id="cpnCreateType" value="true" class="type-check" checked />쿠폰번호 자동생성
|
|
|
</label>
|
|
|
</td>
|
|
|
</tr>
|
|
|
@@ -81,8 +88,8 @@
|
|
|
<tr>
|
|
|
<th>사용고객등급구분<em class="required" title="필수"></em></th>
|
|
|
<td>
|
|
|
- <select name="usableCustGradeList" id="usableCustGradeList" required="required" data-valid-name="사용고객등급구분">
|
|
|
- <option value="">[전체]</option>
|
|
|
+ <select name="usableCustGrade" id="usableCustGrade" required="required" data-valid-name="사용고객등급구분">
|
|
|
+ <option value="ALL">[전체]</option>
|
|
|
<option th:if="${usableCustGradeList}" th:each="oneData , status : ${usableCustGradeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
|
|
|
</select>
|
|
|
</td>
|
|
|
@@ -96,10 +103,14 @@
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th>할인방식<em class="required" title="필수"></em></th>
|
|
|
- <td colspan="5">
|
|
|
+ <td>
|
|
|
<input type="hidden" name="dcWay" id="dcWay" required="required" data-valid-name="할인방식">
|
|
|
<label class="rdoBtn" th:if="${dcWayList}" th:each="oneData, status : ${dcWayList}"> <input type="radio" name="rdoDcWay" th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
|
|
|
</td>
|
|
|
+ <th>구매제한금액<em class="required" title="필수"></em></th>
|
|
|
+ <td>
|
|
|
+ <input type="text" id="buyLimitAmt" name="buyLimitAmt" class="w200" required="required" value="0" style="text-align: right;" data-valid-name="구매제한금액">원
|
|
|
+ </td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th>할인값(PC)<em class="required" title="필수"></em></th>
|
|
|
@@ -125,7 +136,7 @@
|
|
|
<th>다운로드시작일시<em class="required" title="필수"></em></th>
|
|
|
<td>
|
|
|
<input type="hidden" name="downStdt" id="downStdt" required="required" data-valid-name="다운로드시작일시">
|
|
|
- <input type="text" class="schDate w100" name="" id="downStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
|
|
|
+ <input type="text" class="schDate w100" name="downStDay" id="downStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
|
|
|
<select name="downStHH" id="downStHH">
|
|
|
<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
|
|
|
</select>
|
|
|
@@ -190,17 +201,24 @@
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th>첫구매여부<em class="required" title="필수"></em></th>
|
|
|
- <td colspan="5">
|
|
|
+ <td>
|
|
|
<select name="firstYn" id="firstYn" onchange="firstYnChange(this)" required="required" data-valid-name="첫구매여부">
|
|
|
<option value="Y">Y</option>
|
|
|
<option value="N" selected="selected">N</option>
|
|
|
</select>
|
|
|
</td>
|
|
|
+ <th>다운로드가능여부<em class="required" title="필수"></em></th>
|
|
|
+ <td>
|
|
|
+ <select name="downYn" id="downYn" required="required" data-valid-name="다운로드가능여부">
|
|
|
+ <option value="Y">Y</option>
|
|
|
+ <option value="Y" selected="selected">N</option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th class="buyDateTr">첫구매기간시작일시<em class="required" title="필수"></em></th>
|
|
|
<td class="buyDateTr">
|
|
|
- <input type="hidden" name="buyStdt" id="buyStdt" data-valid-name="유효기간시작일시">
|
|
|
+ <input type="hidden" id="buyEddt" name="buyEddt" data-valid-name="첫구매기간종료일시">
|
|
|
<input type="text" class="schDate w100" name="buyStDay" id="buyStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
|
|
|
<select name="buyStHH" id="buyStHH">
|
|
|
<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
|
|
|
@@ -210,7 +228,7 @@
|
|
|
</select>
|
|
|
<th class="buyDateTr">첫구매기간종료일시<em class="required" title="필수"></em></th>
|
|
|
<td class="buyDateTr">
|
|
|
- <input type="hidden" id="buyEddt" name="buyEddt" data-valid-name="유효기간종료일시">
|
|
|
+ <input type="hidden" name="buyStdt" id="buyStdt" data-valid-name="첫구매기간시작일시">
|
|
|
<input type="text" class="schDate w100" name="buyEdDay" id="buyEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
|
|
|
<select name="buyEdHH" id="buyEdHH">
|
|
|
<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
|
|
|
@@ -223,7 +241,7 @@
|
|
|
<tr>
|
|
|
<th>신규회원여부<em class="required" title="필수"></em></th>
|
|
|
<td colspan="5">
|
|
|
- <select name="custJoinYN" id="custJoinYn" onchange="custJoinYnChange(this)" required="required" data-valid-name="신규회원여부">
|
|
|
+ <select name="custJoinYn" id="custJoinYn" onchange="custJoinYnChange(this)" required="required" data-valid-name="신규회원여부">
|
|
|
<option value="Y">Y</option>
|
|
|
<option value="N" selected="selected">N</option>
|
|
|
</select>
|
|
|
@@ -300,44 +318,267 @@
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
+ <div class="mdPopBtnB aR">
|
|
|
+ <button type="button" class="btn btn-info btn-lg" onclick="fnCouponCreate();">등록</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ <!-- 쿠폰적용대상-->
|
|
|
+ <li class="tab" id="coupontab2" >
|
|
|
+ <div class="panelStyle">
|
|
|
+ <div class="panelTitle">
|
|
|
+ <h2 style="position: relative">적용 대상 상품 등록</h2>
|
|
|
+ </div>
|
|
|
+ <div class="inner-panelContent">
|
|
|
+ <div class="panelContent">
|
|
|
+ <table class="frmStyle">
|
|
|
+ <colgroup>
|
|
|
+ <col style="width:15%;">
|
|
|
+ <col style="width:85%;">
|
|
|
+ </colgroup>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <th>공급처</th>
|
|
|
+ <td>
|
|
|
+ <div class="padding10 inner-tb-solid">
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyAdd">공급처 추가</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnSupplyDel">선택삭제</button>
|
|
|
+ <br/>
|
|
|
+ <div id="supplyGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>브랜드</th>
|
|
|
+ <td>
|
|
|
+ <div class="padding10 inner-tb-solid">
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandAdd">브랜드 추가</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnBrandDel">선택삭제</button>
|
|
|
+ <br/>
|
|
|
+ <div id="brandGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>카테고리</th>
|
|
|
+ <td>
|
|
|
+ <div class="padding10 inner-tb-solid">
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnCateAdd">카테고리 추가</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnCateDel">선택삭제</button>
|
|
|
+ <br/>
|
|
|
+ <div id="cateGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>적용상품</th>
|
|
|
+ <td>
|
|
|
+ <div class="padding10 inner-tb-solid">
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsAdd">상품 추가</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsDel">선택삭제</button>
|
|
|
+ <br/>
|
|
|
+ <div id="goodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="panelTitle">
|
|
|
+ <h2 style="position: relative">적용 제외 대상 상품 등록</h2>
|
|
|
+ </div>
|
|
|
+ <div class="inner-panelContent">
|
|
|
+ <div class="panelContent">
|
|
|
+ <table class="frmStyle">
|
|
|
+ <colgroup>
|
|
|
+ <col style="width:15%;">
|
|
|
+ <col style="width:85%;">
|
|
|
+ </colgroup>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <th>제외상품</th>
|
|
|
+ <td>
|
|
|
+ <div class="padding10 inner-tb-solid">
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsAdd">제외상품 추가</button>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnExcepGoodsDel">선택삭제</button>
|
|
|
+ <br/>
|
|
|
+ <div id="excepGoodsGridList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ <!-- 쿠폰적용대상끝-->
|
|
|
+ <!-- 입점업체분담율-->
|
|
|
+ <li class="tab" id="coupontab3">
|
|
|
+ <div class="panelStyle">
|
|
|
+ <ul class="panelBar">
|
|
|
+ <li class="left">
|
|
|
+ <button type="button" class="btn btn-warning btn-lg" id="btnAddRow">행추가</button>
|
|
|
+ <button type="button" class="btn btn-danger btn-lg" id="btnDeleteRow">행삭제</button>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+
|
|
|
+ <div id="inComGridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
|
|
|
+
|
|
|
</div>
|
|
|
</li>
|
|
|
+ <!-- 입점업체분담끝-->
|
|
|
</ul>
|
|
|
</div>
|
|
|
</form>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+</div>
|
|
|
<script th:inline="javascript">
|
|
|
-/*<![CDATA[*/
|
|
|
+ /*<![CDATA[*/
|
|
|
+ var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
|
|
|
+ var delYnList = { "Y":"Yes", "N":"No" };
|
|
|
|
|
|
- $(function(){
|
|
|
- // 초기화시 데이터 세팅
|
|
|
- $('input[name=rdoCpnType]').eq(0).attr("checked" , true);
|
|
|
- $('input[name=rdoDcWay]').eq(0).attr("checked" , true);
|
|
|
- $('input[name=rdoApplyScope]').eq(0).attr("checked" , true)
|
|
|
- $('#availEdHH option:last').attr("selected" , "selected");
|
|
|
- $('#availEdMM option:last').attr("selected" , "selected");
|
|
|
- $('#downEdHH option:last').attr("selected" , "selected");
|
|
|
- $('#downEdMM option:last').attr("selected" , "selected");
|
|
|
- $('#custJoinEdHH option:last').attr("selected" , "selected");
|
|
|
- $('#custJoinEdMM option:last').attr("selected" , "selected");
|
|
|
- $('#buyEdHH option:last').attr("selected" , "selected");
|
|
|
- $('#buyEdMM option:last').attr("selected" , "selected");
|
|
|
- pdGbChange();
|
|
|
- firstYnChange();
|
|
|
- custJoinYnChange();
|
|
|
- })
|
|
|
+ // ag-grid 입점업체분담율 컬럼
|
|
|
+ var columnDefs = [
|
|
|
+ { headerName: "입점업체" , field:"supplyCompCd" , width:150, cellClass:"text-center" ,
|
|
|
+ cellEditor: 'agRichSelectCellEditor',
|
|
|
+ cellEditorParams: { values: gagaAgGrid.extractValues(ibSupplyComList) },
|
|
|
+ valueFormatter: function (params) { return gagaAgGrid.lookupValue(ibSupplyComList, params.value); },
|
|
|
+ valueParser: function (params) { return gagaAgGrid.lookupKey(ibSupplyComList, params.newValue);}
|
|
|
+ } ,
|
|
|
+ { headerName: "쿠폰분담율(%)", field:"burdenRate" , width:150, cellClass: "text-center" ,
|
|
|
+ cellEditorParams: { maxlength: 10, required: true }
|
|
|
+ } ,
|
|
|
+ { headerName: "삭제여부" , field: "delYn" , width:150, cellClass: "text-center" ,
|
|
|
+ cellEditor: 'agRichSelectCellEditor',
|
|
|
+ cellEditorParams: { values: gagaAgGrid.extractValues(delYnList) },
|
|
|
+ valueFormatter: function (params) { return gagaAgGrid.lookupValue(delYnList, params.value); },
|
|
|
+ valueParser: function (params) { return gagaAgGrid.lookupKey(delYnList, params.newValue); }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ // ag-grid 공급처 컬럼
|
|
|
+ var supplyColumnDefs = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ { headerName : "공급업체코드" , field: "supplyCompCd" , width:150, cellClass: 'text-center'} ,
|
|
|
+ { headerName: "공급업체명" , field: "supplyCompNm" , width:150, cellClass: 'text-center'}
|
|
|
+ ];
|
|
|
+
|
|
|
+ // ag-grid 브랜드 컬럼
|
|
|
+ var brandSelColumnDefs = [
|
|
|
+ {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: 120, cellClass: 'text-center'} ,
|
|
|
+ { headerName : "공급업체명", field: "supplyCompNm" , width: 150, cellClass: 'text-center' } ,
|
|
|
+ //{ headerName: "적용대상" , field: "targetGb" , width: 150, cellClass: 'text-center'}
|
|
|
+ ];
|
|
|
+
|
|
|
+ // ag-grid 적용상품 컬럼
|
|
|
+ var goodsSelColumnDefs = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ { headerName: "상품구분" , field: "goodsGb" , width: 100, cellClass: 'text-center'} ,
|
|
|
+ { headerName: "Product ID" , field: "goodsCd" , width: 120, cellClass: 'text-center'},
|
|
|
+ { headerName: "상품명" , field: "goodsNm" , width: 120 , cellClass: 'text-center'} ,
|
|
|
+ //{ headerName: "적용대상" , field: "targetGB" , width: 150, cellClass: 'text-center'}
|
|
|
+ ];
|
|
|
+
|
|
|
+ // ag-grid 카테고리 컬럼
|
|
|
+ var cateSelColumnDefs = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ { headerName: "카테고리코드" , field: "cateNo" , width: 100 , cellClass: 'text-center'} ,
|
|
|
+ { headerName: "카테고리명" , field: "cateNm" , width: 120 , cellClass: 'text-center'},
|
|
|
+ //{ headerName: "적용대사"}
|
|
|
+ ];
|
|
|
+
|
|
|
+ // ag-grid 제외상품 컬럼
|
|
|
+ var excepGoodsColumnDefs = [
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ { headerName: "상품구분" , field: "goodsGb" , width: 100, cellClass: 'text-center'} ,
|
|
|
+ { headerName: "Product ID" , field: "goodsCd" , width: 120, cellClass: 'text-center'},
|
|
|
+ { headerName: "상품명" , field: "goodsNm" , width: 120 , cellClass: 'text-center'} ,
|
|
|
+ ];
|
|
|
+
|
|
|
+ var inComGridOptions = gagaAgGrid.getGridOptions(columnDefs);
|
|
|
+ var cateGridOptions = gagaAgGrid.getGridOptions(cateSelColumnDefs);
|
|
|
+ var goodsGridOptions = gagaAgGrid.getGridOptions(goodsSelColumnDefs);
|
|
|
+ var brandGridOptions = gagaAgGrid.getGridOptions(brandSelColumnDefs);
|
|
|
+ var supplyGridOptions = gagaAgGrid.getGridOptions(supplyColumnDefs);
|
|
|
+ var excepGoodsGridOptions = gagaAgGrid.getGridOptions(excepGoodsColumnDefs);
|
|
|
+
|
|
|
+ inComGridOptions.defaultColDef.editable = true;
|
|
|
+ inComGridOptions.rowSelection = "multiple";
|
|
|
+ goodsGridOptions.rowSelection = "multiple";
|
|
|
+ supplyGridOptions.rowSelection = "multiple";
|
|
|
+ excepGoodsGridOptions.rowSelection = "multiple";
|
|
|
+ cateGridOptions.rowSelection = "multiple";
|
|
|
+ brandGridOptions.rowSelection = "multiple";
|
|
|
+ inComGridOptions.stopEditingWhenGridLosesFocus = true;
|
|
|
|
|
|
// 쿠폰 등록 버튼 클릭시
|
|
|
function fnCouponCreate(){
|
|
|
// 필수값들 셋팅
|
|
|
setReqValue();
|
|
|
|
|
|
+ // 필수값 validation 체크
|
|
|
if (!gagajf.validation('#couponCreateForm')) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ //신규가입 지급한다면 validation 체크
|
|
|
+ if( $('#custJoinYn option:selected').val() == "Y" ){
|
|
|
+ var fromDate = $('#couponCreateForm input[name=custJoinStdt]').val();
|
|
|
+ var toDate = $('#couponCreateForm input[name=custJoinEddt]').val();
|
|
|
+
|
|
|
+ if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
|
|
|
+ mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $('#couponCreateForm input[name=custJoinStdt]').focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fromDate > toDate) {
|
|
|
+ mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $('#couponCreateForm input[name=custJoinEddt]').focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 첫구매 지급하면 validation 체크
|
|
|
+ if( $('#firstYn option:selected').val() == "Y" ){
|
|
|
+ var fromDate = $('#couponCreateForm input[name=buyStdt]').val();
|
|
|
+ var toDate = $('#couponCreateForm input[name=buyEddt]').val();
|
|
|
+
|
|
|
+ if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
|
|
|
+ mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $('#couponCreateForm input[name=buyStdt]').focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (fromDate > toDate) {
|
|
|
+ mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $('#couponCreateForm input[name=buyEddt]').focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 할인율 validation 체크 (100을 넘길수없음)
|
|
|
if($('#dcWay').val() == 'G240_11') {
|
|
|
if($('#dcPval').val() > 100) {
|
|
|
mcxDialog.alert('PC할인율은 100을 초과할수없습니다.');
|
|
|
@@ -353,6 +594,17 @@
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ mcxDialog.confirm('저장하시겠습니까?' , {
|
|
|
+ cancelBtnText:"취소",
|
|
|
+ sureBtnText:"확인",
|
|
|
+ sureBtnClick: function () {
|
|
|
+ gagajf.ajaxFormSubmit($('#couponCreateForm').prop('action'), '#couponCreateForm', function() {
|
|
|
+ uifnPopupClose('CouponCreatePopup');
|
|
|
+ $('#btnSearch').trigger('click');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// 할인방식 변경
|
|
|
@@ -384,13 +636,147 @@
|
|
|
// 주문서 쿠폰 선택시 결제수단 노출
|
|
|
if(radioValue == 'G230_20') {
|
|
|
$('.payTypeTr').css('display' , '');
|
|
|
- $('#payType').attr('required' , true);
|
|
|
+ $('#couponCreateForm #payType').attr('required' , true);
|
|
|
} else {
|
|
|
$('.payTypeTr').css('display' , 'none');
|
|
|
- $('#payType').attr('required' , false );
|
|
|
+ $('#couponCreateForm #payType').attr('required' , false );
|
|
|
}
|
|
|
+
|
|
|
+ $('#couponCreateForm #cpnType').val(radioValue);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 적용대상 - 브랜드 추가 버튼시
|
|
|
+ $('#btnBrandAdd').on('click' , function(){
|
|
|
+ cfnOpenBrandListPopup("fnSetPopupBrandInfo", "M");
|
|
|
});
|
|
|
|
|
|
+ // 브랜드 설정 / 브랜드 추가 콜백함수 (단수로 가져오므로 복수일 경우에 수정 확인 필요)
|
|
|
+ var fnSetPopupBrandInfo = function(result) {
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true, gridListValue = gagaAgGrid.getAllRowData(brandGridOptions); // 받아온 모든 데이터
|
|
|
+
|
|
|
+ // 받아온 data for
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ if(gridListValue[j].brandCd == result[i].brandCd) { addChk = false; } // 중복체크
|
|
|
+ }
|
|
|
+
|
|
|
+ // 중복되지 않은 데이터 리스트에 추가
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(brandGridOptions, {"brandCd" : result[i].brandCd, "brandEnm" : result[i].brandEnm, "supplyCompNm" : result[i].supplyCompNm, "targetGb" : "G260_12"});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 적용대상 - 브랜드 삭제 버튼시
|
|
|
+ $('#btnBrandDel').on('click' , function(){
|
|
|
+ brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
|
|
|
+ });
|
|
|
+
|
|
|
+ // 적용대상 - 공급처 추가 버튼시
|
|
|
+ $('#btnSupplyAdd').on('click' , function (){
|
|
|
+ cfnOpenCompanyListPopup("fnSetPopupComapnyInfo");
|
|
|
+ });
|
|
|
+
|
|
|
+ // 공급업체 설정 / 업체 추가 콜백함수
|
|
|
+ var fnSetPopupComapnyInfo = function(result) {
|
|
|
+ // 기존 리스트 데이터 for
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true, gridListValue = gagaAgGrid.getAllRowData(supplyGridOptions); // 받아온 모든 데이터
|
|
|
+
|
|
|
+ // 받아온 data for
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ // 동일한 data는 추가하지 않음
|
|
|
+ if(gridListValue[j].supplyCompCd == result[i].supplyCompCd) { addChk = false; } // 중복체크
|
|
|
+ }
|
|
|
+
|
|
|
+ // 중복되지 않은 데이터 리스트에 추가
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(supplyGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm, "targetGb" : "G260_13"});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 적용대상 - 공급처 삭제시시
|
|
|
+ $('#btnSupplyDel').on('click' , function () {
|
|
|
+ supplyGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(supplyGridOptions)});
|
|
|
+ });
|
|
|
+
|
|
|
+ // 적용대상 - 카테고리 추가시
|
|
|
+ $('#btnCateAdd').on('click' , function () {
|
|
|
+ cfnOpenCategoryPopup("fnSetPopupCategoryInfo");
|
|
|
+ });
|
|
|
+
|
|
|
+ // 카테고리 추가 콜백 함수
|
|
|
+ var fnSetPopupCategoryInfo = function (result) {
|
|
|
+ // 기존 리스트 데이터 for
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true, gridListValue = gagaAgGrid.getAllRowData(cateGridOptions); // 받아온 모든 데이터
|
|
|
+
|
|
|
+ // 받아온 data for
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ // 동일한 data는 추가하지 않음
|
|
|
+ if(gridListValue[j].supplyCompCd == result[i].supplyCompCd) { addChk = false; } // 중복체크
|
|
|
+ }
|
|
|
+
|
|
|
+ // 중복되지 않은 데이터 리스트에 추가
|
|
|
+ if(addChk) {
|
|
|
+ gagaAgGrid.addRowData(cateGridOptions, {"supplyCompCd" : result[i].supplyCompCd, "supplyCompNm" : result[i].supplyCompNm, "targetGb" : "G260_13"});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 적용대상 - 카테고리 삭제시
|
|
|
+ $('#btnCateDel').on('click' , function () {
|
|
|
+ cateGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(cateGridOptions)});
|
|
|
+ });
|
|
|
+
|
|
|
+ // 적용대상 - 상품 추가시
|
|
|
+ $('#btnGoodsAdd').on('click' , function () {
|
|
|
+ cfnOpenGoodsPopup("fnSetPopupApplyGoodsInfo");
|
|
|
+ });
|
|
|
+
|
|
|
+ // 적용 상품 리스트 콜백함수
|
|
|
+ var fnSetPopupApplyGoodsInfo = function(result) {
|
|
|
+ gridAddGoodsList(goodsGridOptions, result , "apply");
|
|
|
+ };
|
|
|
+
|
|
|
+ // 적용대상 - 상품 삭제 시
|
|
|
+ $('#btnGoodsDel').on('click' , function () {
|
|
|
+ goodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(goodsGridOptions)});
|
|
|
+ });
|
|
|
+
|
|
|
+ // 적용대상 - 제외상품 추가시
|
|
|
+ $('#btnExcepGoodsAdd').on('click' , function(){
|
|
|
+ gridAddGoodsList(excepGoodsGridOptions, result , "except");
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#btnExcepGoodsDel').on('click' , function () {
|
|
|
+ excepGoodsGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(excepGoodsGridOptions)});
|
|
|
+ });
|
|
|
+
|
|
|
+ // ag-grid 상품관련 list 콜백함수
|
|
|
+ function gridAddGoodsList(OriginGridListOption, result, gubun) {
|
|
|
+ var goodsGbVal = "G800_10";
|
|
|
+ if(gubun == 'except'){
|
|
|
+ goodsGbVal = "G800_30";
|
|
|
+ }
|
|
|
+
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true, gridListValue = gagaAgGrid.getAllRowData(OriginGridListOption); // 받아온 모든 데이터
|
|
|
+
|
|
|
+ // 받아온 data for
|
|
|
+ for(let j = 0 ; j < gridListValue.length ; j++) {
|
|
|
+ if(gridListValue[j].goodsCd == result[i].goodsCd) { addChk = false; } // 중복체크
|
|
|
+ }
|
|
|
+
|
|
|
+ // 중복되지 않은 데이터 리스트에 추가
|
|
|
+ if(addChk) {
|
|
|
+ //gagaAgGrid.addRowData(OriginGridListOption, result[i], "goodsCd");
|
|
|
+ gagaAgGrid.addRowData(OriginGridListOption, {"goodsGb": goodsGbVal, "goodsCd" : result[i].goodsCd, "goodsNm" : result[i].goodsNm, "targetGb" : "G260_10"});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 기간 일수 변경시
|
|
|
function pdGbChange(pThis){
|
|
|
var selectVal = $(pThis).val();
|
|
|
@@ -402,13 +788,19 @@
|
|
|
if(selectVal == "P") {
|
|
|
$('.availDateTr').css('display' , '');
|
|
|
$('.availDayTr').css('display' , 'none');
|
|
|
- $('#availDays').attr('required' , false);
|
|
|
- $('#availStDay').attr('required' , true);
|
|
|
+ $('#couponCreateForm #availDays').attr('required' , false);
|
|
|
+ $('#couponCreateForm #availStDay').attr('required' , true);
|
|
|
+ $('#couponCreateForm #availEdDay').attr('required' , true);
|
|
|
+ $('#couponCreateForm #availStdt').attr('required' , true);
|
|
|
+ $('#couponCreateForm #availEddt').attr('required' , true);
|
|
|
} else {
|
|
|
$('.availDateTr').css('display' , 'none');
|
|
|
$('.availDayTr').css('display' , '');
|
|
|
- $('#availDays').attr('required' , true);
|
|
|
- $('#availStDay').attr('required' , false);
|
|
|
+ $('#couponCreateForm #availDays').attr('required' , true);
|
|
|
+ $('#couponCreateForm #availStDay').attr('required' , false);
|
|
|
+ $('#couponCreateForm #availEdDay').attr('required' , false);
|
|
|
+ $('#couponCreateForm #availStdt').attr('required' , false);
|
|
|
+ $('#couponCreateForm #availEddt').attr('required' , false);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -450,15 +842,24 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 행추가시
|
|
|
+ $('#btnAddRow').on('click' , function(){
|
|
|
+ var data = { supplyCompCd: null , burdenRate : null , delYn : null};
|
|
|
+ gagaAgGrid.addRowData(inComGridOptions , data , "supplyCompCd" );
|
|
|
+ });
|
|
|
+
|
|
|
// 쿠폰번호 자동생성 클릭시
|
|
|
function clickCreateChk(){
|
|
|
var flag = $('#couponCreateForm input[name=cpnCreateType]').prop("checked");
|
|
|
+
|
|
|
if(!flag) {
|
|
|
$("#couponCreateForm input[name=cpnId]").prop("disabled", true);
|
|
|
+ $("#couponCreateForm input[name=cpnId]").attr("required", false);
|
|
|
$("#couponCreateForm input[name=cpnId]").attr("placeholder", "자동생성");
|
|
|
$('#couponCreateForm input[name=cpnCreateType]').prop("checked" , false);
|
|
|
} else{
|
|
|
$("#couponCreateForm input[name=cpnId]").prop("disabled", false);
|
|
|
+ $("#couponCreateForm input[name=cpnId]").attr("required", true);
|
|
|
$("#couponCreateForm input[name=cpnId]").attr("placeholder", "");
|
|
|
$('#couponCreateForm input[name=cpnCreateType]').prop("checked" , true);
|
|
|
}
|
|
|
@@ -467,24 +868,73 @@
|
|
|
// 전송시 값 세팅
|
|
|
function setReqValue(){
|
|
|
// 쿠폰유형값 세팅
|
|
|
- $('#cpnType').val($('input [name=cpnTypeList]:checked').val());
|
|
|
+ $('#couponCreateForm #cpnType').val($('#couponCreateForm input:radio[name="rdoCpnType"]:checked').val());
|
|
|
// 할인방식값 세팅
|
|
|
- $('#dcWay').val($('input [name=dcWayList]:checked').val());
|
|
|
+ $('#couponCreateForm #dcWay').val($('#couponCreateForm input:radio[name="rdoDcWay"]:checked').val());
|
|
|
// 적용범위값 세팅
|
|
|
- $('#applyScope').val($('input [name=rdoApplyScope]:checked').val());
|
|
|
+ $('#couponCreateForm #applyScope').val($('#couponCreateForm input:radio[name="rdoApplyScope"]:checked').val());
|
|
|
// 다운로드기간 세팅
|
|
|
- $('#downStdt').val($('#downStDay').val() + " " + $('#downStHH').val() + ":" + $('#downStMM').val() + "00");
|
|
|
- $('#downEddt').val($('#downEdDay').val() + " " + $('#downEdHH').val() + ":" + $('#downEdMM').val() + "59");
|
|
|
+ $('#couponCreateForm #downStdt').val($('#couponCreateForm #downStDay').val() + " " + $('#couponCreateForm #downStHH').val() + ":" + $('#couponCreateForm #downStMM').val() + ":00");
|
|
|
+ $('#couponCreateForm #downEddt').val($('#couponCreateForm #downEdDay').val() + " " + $('#couponCreateForm #downEdHH').val() + ":" + $('#couponCreateForm #downEdMM').val() + ":59");
|
|
|
// 유효기간 세팅
|
|
|
- $('#availStdt').val($('#availStDay').val() + " " + $('#availStHH').val() + ":" + $('#availStMM').val() + "00");
|
|
|
- $('#availEddt').val($('#availEdDay').val() + " " + $('#availEdHH').val() + ":" + $('#availEdMM').val() + "59");
|
|
|
+ $('#couponCreateForm #availStdt').val($('#couponCreateForm #availStDay').val() + " " + $('#couponCreateForm #availStHH').val() + ":" + $('#couponCreateForm #availStMM').val() + ":00");
|
|
|
+ $('#couponCreateForm #availEddt').val($('#couponCreateForm #availEdDay').val() + " " + $('#couponCreateForm #availEdHH').val() + ":" + $('#couponCreateForm #availEdMM').val() + ":59");
|
|
|
// 첫구매기간세팅
|
|
|
- $('#buyStdt').val($('#buyStDay').val() + " " + $('#buyStHH').val() + ":" + $('#buyStMM').val() + "00");
|
|
|
- $('#buyEddt').val($('#buyEdDay').val() + " " + $('#buyEdHH').val() + ":" + $('#buyEdMM').val() + "59");
|
|
|
+ $('#couponCreateForm #buyStdt').val($('#couponCreateForm #buyStDay').val() + " " + $('#couponCreateForm #buyStHH').val() + ":" + $('#couponCreateForm #buyStMM').val() + ":00");
|
|
|
+ $('#couponCreateForm #buyEddt').val($('#couponCreateForm #buyEdDay').val() + " " + $('#couponCreateForm #buyEdHH').val() + ":" + $('#couponCreateForm #buyEdMM').val() + ":59");
|
|
|
// 신규회원기간 세팅
|
|
|
- $('#custJoinStdt').val($('#custJoinStDay').val() + " " + $('#custJoinStHH').val() + ":" + $('#custJoinStMM').val() + "00");
|
|
|
- $('#custJoinEddt').val($('#custJoinEdDay').val() + " " + $('#custJoinEdHH').val() + ":" + $('#custJoinEdMM').val() + "59");
|
|
|
+ $('#couponCreateForm #custJoinStdt').val($('#couponCreateForm #custJoinStDay').val() + " " + $('#couponCreateForm #custJoinStHH').val() + ":" + $('#couponCreateForm #custJoinStMM').val() + ":00");
|
|
|
+ $('#couponCreateForm #custJoinEddt').val($('#couponCreateForm #custJoinEdDay').val() + " " + $('#couponCreateForm #custJoinEdHH').val() + ":" + $('#couponCreateForm #custJoinEdMM').val() + ":59");
|
|
|
+ // 적용대상 - 공급처 그리드 전체값 세팅
|
|
|
+ var supplyAllData = gagaAgGrid.getAllRowData(supplyGridOptions);
|
|
|
+ var jsonSupplyCompData = JSON.stringify(supplyAllData);
|
|
|
+ $('#couponCreateForm #supplyCompList').val(jsonSupplyCompData);
|
|
|
+ // 적용대상 - 브랜드 그리드 전체값 세팅
|
|
|
+ var brandAllData = gagaAgGrid.getAllRowData(brandGridOptions);
|
|
|
+ var jsonBrandData = JSON.stringify(brandAllData);
|
|
|
+ $('#couponCreateForm #brandlist').val(jsonBrandData);
|
|
|
+ // // 적용대상 - 카테고리 그리드 전체값 세팅
|
|
|
+ var cateAllData = gagaAgGrid.getAllRowData(cateGridOptions);
|
|
|
+ var jsonCateData = JSON.stringify(cateAllData);
|
|
|
+ $('#couponCreateForm #cateList').val(jsonCateData);
|
|
|
+ // 적용대상 - 적용상품 그리드 전체값 세팅
|
|
|
+ var goodsAllData = gagaAgGrid.getAllRowData(goodsGridOptions);
|
|
|
+ var jsonGoodsData = JSON.stringify(goodsAllData);
|
|
|
+ $('#couponCreateForm #applyGoodsList').val(jsonGoodsData);
|
|
|
+ // 적용대상 - 제외상품 그리드 전체값 세팅
|
|
|
+ var exceptGoodsAllData = gagaAgGrid.getAllRowData(excepGoodsGridOptions);
|
|
|
+ var jsonExceptGoodsData = JSON.stringify(exceptGoodsAllData);
|
|
|
+ $('#couponCreateForm #excepGoodsList').val(jsonExceptGoodsData);
|
|
|
+
|
|
|
}
|
|
|
-/*]]>*/
|
|
|
+
|
|
|
+ $(document).ready(function() {
|
|
|
+ // 초기화시 데이터 세팅
|
|
|
+ $('input[name=rdoCpnType]').eq(0).attr("checked" , true);
|
|
|
+ $('input[name=rdoDcWay]').eq(0).attr("checked" , true);
|
|
|
+ $('input[name=rdoApplyScope]').eq(0).attr("checked" , true)
|
|
|
+ $('#couponCreateForm #availEdHH option:last').attr("selected" , "selected");
|
|
|
+ $('#couponCreateForm #availEdMM option:last').attr("selected" , "selected");
|
|
|
+ $('#downEdHH option:last').attr("selected" , "selected");
|
|
|
+ $('#downEdMM option:last').attr("selected" , "selected");
|
|
|
+ $('#custJoinEdHH option:last').attr("selected" , "selected");
|
|
|
+ $('#custJoinEdMM option:last').attr("selected" , "selected");
|
|
|
+ $('#buyEdHH option:last').attr("selected" , "selected");
|
|
|
+ $('#buyEdMM option:last').attr("selected" , "selected");
|
|
|
+
|
|
|
+ pdGbChange();
|
|
|
+ firstYnChange();
|
|
|
+ custJoinYnChange();
|
|
|
+
|
|
|
+ gagaAgGrid.createGrid('inComGridList', inComGridOptions);
|
|
|
+ gagaAgGrid.createGrid('brandGridList' , brandGridOptions);
|
|
|
+ gagaAgGrid.createGrid('cateGridList' , cateGridOptions);
|
|
|
+ gagaAgGrid.createGrid('supplyGridList' , supplyGridOptions);
|
|
|
+ gagaAgGrid.createGrid('goodsGridList' , goodsGridOptions);
|
|
|
+ gagaAgGrid.createGrid('excepGoodsGridList' , excepGoodsGridOptions);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ /*]]>*/
|
|
|
</script>
|
|
|
</html>
|