|
|
@@ -29,27 +29,9 @@
|
|
|
<input type="hidden" id="exceptGoodsCds" name="exceptGoodsCds"/> <!-- 제외상품 리스트 -->
|
|
|
<input type="hidden" id="freeGoods1Cds" name="freeGoods1Cds"/> <!-- 적용 사은품1 리스트 -->
|
|
|
<input type="hidden" id="freeGoods2Cds" name="freeGoods2Cds"/> <!-- 적용 사은품2 리스트 -->
|
|
|
+ <input type="hidden" id="extmallIds" name="extmallIds" value=""/> <!-- 적용 사은품2 리스트 -->
|
|
|
|
|
|
<div class="panelContent">
|
|
|
- <ul class="notice">
|
|
|
- <li>구성상품 등록시 기본값
|
|
|
- <!-- 아이콘 툴팁 -->
|
|
|
- <div class="iconTooltip">
|
|
|
- <i class="fa fa-info" aria-hidden="true"></i>
|
|
|
- <span class="left" style="width:400px; text-align:left;">
|
|
|
- <!-- class="left" 또는 class="right" -->
|
|
|
- - 상품상태 : 정보부족<br/>
|
|
|
- - 정상가 : 구성상품의 정상가 합<br/>
|
|
|
- - 판매가 : 구성상품 판매가 입력값의 합<br/>
|
|
|
- - 브랜드코드 : 구성상품의 기준여부 'Y'상품의 브랜드코드<br/>
|
|
|
- - 품목코드 : 구성상품의 기준여부 'Y'상품의 품목코드<br/>
|
|
|
- - 포인트 : 구성상품의 기준여부 'Y'상품의 브랜드 포인트<br/>
|
|
|
- - 배송비정책 : 구성상품의 기준여부 'Y'상품의 브랜드 배송비정책<br/>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <!-- //아이콘 툴팁 -->
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
<table class="frmStyle">
|
|
|
<colgroup>
|
|
|
<col width="10%"/>
|
|
|
@@ -61,7 +43,7 @@
|
|
|
<th>프로모션명<em class="required" title="필수"></em></th>
|
|
|
<td>
|
|
|
<!-- 수정시 프로모션명 입력 : before -->
|
|
|
- <input class="w50p" type="text" id="freegiftNm" name="freegiftNm" maxlength="30"/>
|
|
|
+ <input class="w50p" type="text" id="freegiftNm" name="freegiftNm" minlength="2" maxlength="30" required="required" data-valid-name="프로모션명"/>
|
|
|
</td>
|
|
|
<th>프로모션ID</th>
|
|
|
<td>
|
|
|
@@ -86,8 +68,9 @@
|
|
|
<tr>
|
|
|
<th>적용 몰 구분<em class="required" title="필수"></em></th>
|
|
|
<td colspan="3">
|
|
|
- <!-- 적용 몰 구분 입력(공통 가져와야할듯?) : before -->
|
|
|
- <input type="checkbox" id="jasa"/><label for="jasa">자사몰</label>
|
|
|
+ <label class="chkBox"><input type="checkbox" name="mallCds" value="G011_10"/>자사몰</label>
|
|
|
+ <label class="chkBox" id="G011_20"><input type="checkbox" name="mallCds" value="G011_20"/>제휴몰</label>
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnExtmallPopup">선택</button><span id="extmallCntArea"> 선택 : <span id="extmallCnt">00</span>개</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
@@ -122,7 +105,7 @@
|
|
|
<div class="padding10 inner-tb-solid">
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnAddCompany">업체 추가</button>
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteCompany">선택삭제</button>
|
|
|
- <span>선택 : 00개</span>
|
|
|
+ <span>선택 : <span id="companyCnt">00</span>개</span>
|
|
|
<br/>
|
|
|
<div id="gridFGPromotionCompanyList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
@@ -132,7 +115,7 @@
|
|
|
<div class="padding10 inner-tb-solid">
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnAddBrand">브랜드 추가</button>
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteBrand">선택삭제</button>
|
|
|
- <span>선택 : 00개</span>
|
|
|
+ <span>선택 : <span id="brandCnt">00</span>개</span>
|
|
|
<br/>
|
|
|
<!-- 브랜드 선택 팝업(단수 선택 팝업... 복수를 새로 만들어야하는지 ? 아니면 변수처리해야하는지 ? -->
|
|
|
<div id="gridFGBrandList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
@@ -146,7 +129,7 @@
|
|
|
<div class="padding10">
|
|
|
<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>
|
|
|
+ <span>선택 : <span id="applyGoodsCnt">00</span>개</span>
|
|
|
<br/>
|
|
|
<div id="gridFGApplyGoodsList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
@@ -179,7 +162,7 @@
|
|
|
<div class="padding10">
|
|
|
<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>
|
|
|
+ <span>선택 : <span id="exceptGoodsCnt">00</span>개</span>
|
|
|
<br/>
|
|
|
<div id="gridFGExceptGoodsList" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
@@ -210,8 +193,8 @@
|
|
|
<th>지급 방법<em class="required" title="필수"></em></th>
|
|
|
<td>
|
|
|
<div>
|
|
|
- <span><label class="rdoBtn"><input type="radio" name="sendBox"/>모두 지급 (설정한 사은품을 모두 지급합니다)</label></span>
|
|
|
- <span><label class="rdoBtn"><input type="radio" name="sendBox"/>선택 사은품 (목록 중 1개를 선택하게 합니다)</label></span>
|
|
|
+ <span><label class="rdoBtn"><input type="radio" name="allYn" value="Y" checked/>모두 지급 (설정한 사은품을 모두 지급합니다)</label></span>
|
|
|
+ <span><label class="rdoBtn"><input type="radio" name="allYn" value="N"/>선택 사은품 (목록 중 1개를 선택하게 합니다)</label></span>
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
@@ -226,8 +209,6 @@
|
|
|
<span>사은품 목록</span>
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnAddFreeGoods1">+ 사은품 선택</button>
|
|
|
<button type="button" class="btn btnRight btn-success btn-lg" id="btnDeleteFreeGoods1">선택삭제</button>
|
|
|
- <input type="button" value="+ 사은품 선택" id="goodsList" /> <!-- 선택 시 팝업 노출 -->
|
|
|
- <input type="button" value="선택삭제" id="deleteGoodsList" />
|
|
|
<br/>
|
|
|
<div id="gridFreeGoods1List" style="width:100%; height:200px;" class="ag-theme-balham"></div>
|
|
|
</div>
|
|
|
@@ -250,8 +231,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <div class="panelStyle" style="margin:unset;">
|
|
|
+ <div class="panelStyle" th:if="${#strings.toString(param.gbn) == 'U'}" style="margin:unset;">
|
|
|
<!-- //TITLE -->
|
|
|
<div class="inner-panelContent">
|
|
|
<div class="panelContent">
|
|
|
@@ -362,15 +342,8 @@
|
|
|
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'}
|
|
|
+ ,cellEditor: 'textCellEditor'
|
|
|
+ ,cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
},
|
|
|
{headerName: "잔여수량", field: "leftQty", width: 120, cellClass: 'text-center'
|
|
|
,valueFormatter: function(params) {
|
|
|
@@ -460,20 +433,55 @@
|
|
|
cfnCreateCalendar('#promotionTerms', 'freegoodsStdt', 'freegoodsEddt', true, '행사기간', 'X');
|
|
|
});
|
|
|
|
|
|
+ // 제휴몰 체크 상태 확인
|
|
|
+ $("#G011_20").on("click", function() {
|
|
|
+ // 체크여부 확인 (선택되면 자동 checked 추가되는데, 추가되기 전 동작해서 반대로 지정)
|
|
|
+ if($("#G011_20").hasClass("checked")) {
|
|
|
+ $("#btnExtmallPopup").hide();
|
|
|
+ $("#extmallCntArea").hide();
|
|
|
+ $("#extmallCnt").text(0);
|
|
|
+ $("#extmallIds").val("");
|
|
|
+ } else {
|
|
|
+ $("#btnExtmallPopup").show();
|
|
|
+ $("#extmallCntArea").show();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#freeGoodsPromotionForm input[name=freegiftNm]').on('focusout', function() {
|
|
|
+ if($('#freeGoodsPromotionForm input[name=freegiftNm]').val().length < 2) {
|
|
|
+ mcxDialog.alert("2자~30자 이상 프로모션명을 입력하세요.");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // list 데이터 세팅
|
|
|
+ function setSendGridListVal(gridListOption, key, inputId) {
|
|
|
+ let list = gagaAgGrid.getAllRowData(gridListOption);
|
|
|
+ let cds = [];
|
|
|
+ for(let k = 0 ; k < list.length ; k++) {
|
|
|
+ cds.push(eval("list[k]." + key));
|
|
|
+ }
|
|
|
+
|
|
|
+ var jsonData = JSON.stringify(cds);
|
|
|
+ $("#" + inputId).val(jsonData);
|
|
|
+ }
|
|
|
+
|
|
|
// 저장 버튼 클릭시
|
|
|
- $('#freeGoodsPromotionForm #btnFreegoodsPromotionSave').on('click', function() {
|
|
|
+ $('#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 exceptGoodsCnt = 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();
|
|
|
+ if (!gagajf.validation('#freeGoodsPromotionForm')) {
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+
|
|
|
+ if($('#freeGoodsPromotionForm input[name=freegiftNm]').val().length < 2) {
|
|
|
+ mcxDialog.alert("2자~30자 이상 프로모션명을 입력하세요.");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
@@ -481,14 +489,8 @@
|
|
|
let fromDate = $('#freeGoodsPromotionForm input[name=freegiftStdt]').val();
|
|
|
let 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("시작일자는 종료일자 보다 클 수 없습니다.");
|
|
|
+ mcxDialog.alert("시작일자는 종료일자 보다 늦을 수 없습니다.");
|
|
|
$('#freeGoodsPromotionForm input[name=freegiftStdt]').focus();
|
|
|
return false;
|
|
|
}
|
|
|
@@ -517,7 +519,12 @@
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ // 각 리스트 데이터 세팅
|
|
|
+ if(supplyCompCnt > 0) { setSendGridListVal(gridOptionsFGCompanyList, "supplyCompCd", "supplyCompCds"); } // 공급업체 설정 데이터
|
|
|
+ if(brandCnt > 0) { setSendGridListVal(gridOptionsFGBrandList, "brandCd", "brandCds"); } // 브랜드 설정 데이터
|
|
|
+ if(applyGoodsCnt > 0) { setSendGridListVal(gridOptionsFGApplyGoodsList, "goodsCd", "applyGoodsCds"); } // 적용 상품 설정 데이터
|
|
|
+ if(exceptGoodsCnt > 0) { setSendGridListVal(gridOptionsFGExceptGoodsList, "goodsCd", "exceptGoodsCds"); } // 제외 상품 설정 데이터
|
|
|
+ if(freeGoods1Cnt > 0) { setSendGridListVal(gridOptionsFreeGoods1List, "goodsCd", "freeGoods1Cds"); } // 사은품 조건 1
|
|
|
});
|
|
|
|
|
|
// 공급업체 설정 / 업체 추가 콜백함수
|
|
|
@@ -535,6 +542,8 @@
|
|
|
// 중복되지 않은 데이터 리스트에 추가
|
|
|
if(addChk) { gagaAgGrid.addRowData(gridOptionsFGCompanyList, result[i], "supplyCompCd"); }
|
|
|
}
|
|
|
+
|
|
|
+ $("#companyCnt").text(gridOptionsFGCompanyList.api.getDisplayedRowCount());
|
|
|
};
|
|
|
|
|
|
// 브랜드 설정 / 브랜드 추가 콜백함수 (단수로 가져오므로 복수일 경우에 수정 확인 필요)
|
|
|
@@ -550,16 +559,20 @@
|
|
|
// 중복되지 않은 데이터 리스트에 추가
|
|
|
if(addChk) { gagaAgGrid.addRowData(gridOptionsFGBrandList, result[i], "brandCd"); }
|
|
|
}
|
|
|
+
|
|
|
+ $("#brandCnt").text(gridOptionsFGBrandList.api.getDisplayedRowCount());
|
|
|
};
|
|
|
|
|
|
// 적용 상품 리스트 콜백함수
|
|
|
var fnSetPopupApplyGoodsInfo = function(result) {
|
|
|
gridAddGoodsList(gridOptionsFGApplyGoodsList, result);
|
|
|
+ $("#applyGoodsCnt").text(gridOptionsFGApplyGoodsList.api.getDisplayedRowCount());
|
|
|
};
|
|
|
|
|
|
// 제외 상품 리스트 콜백함수
|
|
|
var fnSetPopupExceptGoodsInfo = function(result) {
|
|
|
gridAddGoodsList(gridOptionsFGExceptGoodsList, result);
|
|
|
+ $("#exceptGoodsCnt").text(gridOptionsFGExceptGoodsList.api.getDisplayedRowCount());
|
|
|
};
|
|
|
|
|
|
// 사은품 조건1 상품 리스트 콜백함수
|
|
|
@@ -567,7 +580,7 @@
|
|
|
gridAddGoodsList(gridOptionsFreeGoods1List, result);
|
|
|
};
|
|
|
|
|
|
- // 사은품 조건1 상품 리스트 콜백함수
|
|
|
+ // 사은품 조건2 상품 리스트 콜백함수
|
|
|
var fnSetPopupFreeGoods2Info = function(result) {
|
|
|
gridAddGoodsList(gridOptionsFreeGoods2List, result);
|
|
|
};
|
|
|
@@ -587,16 +600,39 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 제휴몰 list 콜백함수
|
|
|
+ function fnSetPopupExtmallInfo(result) {
|
|
|
+ let extmallIds = [];
|
|
|
+ if($("#extmallIds").val() != null && $("#extmallIds").val() != "") {
|
|
|
+ extmallIds = JSON.parse($("#extmallIds").val());
|
|
|
+ }
|
|
|
+
|
|
|
+ for(let i = 0 ; i < result.length ; i++) {
|
|
|
+ let addChk = true;
|
|
|
+ for(let j = 0 ; j < extmallIds.length ; j++) {
|
|
|
+ if(result[i].extmallId == extmallIds[j]) { addChk = false; }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(addChk) { extmallIds.push(result[i].extmallId) };
|
|
|
+ }
|
|
|
+
|
|
|
+ var jsonData = JSON.stringify(extmallIds);
|
|
|
+ $("#extmallIds").val(jsonData);
|
|
|
+ $("#extmallCnt").text(extmallIds.length);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 제휴몰 선택 버튼 클릭시
|
|
|
+ $('#freeGoodsPromotionForm #btnExtmallPopup').on('click', function() {
|
|
|
+ cfnOpenExtmallListPopup("fnSetPopupExtmallInfo");
|
|
|
+ });
|
|
|
// 공급업체 설정 업체 추가 버튼 클릭시
|
|
|
$('#freeGoodsPromotionForm #btnAddCompany').on('click', function() {
|
|
|
cfnOpenCompanyListPopup("fnSetPopupComapnyInfo");
|
|
|
});
|
|
|
-
|
|
|
// 브랜드 추가 버튼 클릭시 (복수 브랜드때 수정 필요)
|
|
|
$('#freeGoodsPromotionForm #btnAddBrand').on('click', function() {
|
|
|
cfnOpenBrandListPopup("fnSetPopupBrandInfo", "M");
|
|
|
});
|
|
|
-
|
|
|
// 적용 상품 추가 버튼 클릭시
|
|
|
$('#freeGoodsPromotionForm #btnAddApplyGoods').on('click', function() {
|
|
|
cfnOpenGoodsPopup("fnSetPopupApplyGoodsInfo");
|
|
|
@@ -617,18 +653,22 @@
|
|
|
// 공급업체 설정 선택삭제 버튼 클릭시
|
|
|
$('#freeGoodsPromotionForm #btnDeleteCompany').on('click', function() {
|
|
|
gridOptionsFGCompanyList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGCompanyList)});
|
|
|
+ $("#companyCnt").text(gridOptionsFGCompanyList.api.getDisplayedRowCount());
|
|
|
});
|
|
|
// 브랜드 설정 선택삭제 버튼 클릭시
|
|
|
$('#freeGoodsPromotionForm #btnDeleteBrand').on('click', function() {
|
|
|
gridOptionsFGBrandList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGBrandList)});
|
|
|
+ $("#brandCnt").text(gridOptionsFGBrandList.api.getDisplayedRowCount());
|
|
|
});
|
|
|
// 적용상품 선택삭제 버튼 클릭시
|
|
|
$('#freeGoodsPromotionForm #btnDeleteApplyGoods').on('click', function() {
|
|
|
gridOptionsFGApplyGoodsList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGApplyGoodsList)});
|
|
|
+ $("#applyGoodsCnt").text(gridOptionsFGApplyGoodsList.api.getDisplayedRowCount());
|
|
|
});
|
|
|
// 제외상품 선택삭제 버튼 클릭시
|
|
|
$('#freeGoodsPromotionForm #btnDeleteExtGoods').on('click', function() {
|
|
|
gridOptionsFGExceptGoodsList.api.updateRowData({remove:gagaAgGrid.selectedRowData(gridOptionsFGExceptGoodsList)});
|
|
|
+ $("#exceptGoodsCnt").text(gridOptionsFGExceptGoodsList.api.getDisplayedRowCount());
|
|
|
});
|
|
|
// 사은품조건1 선택삭제 버튼 클릭시
|
|
|
$('#freeGoodsPromotionForm #btnDeleteFreeGoods1').on('click', function() {
|