|
|
@@ -0,0 +1,514 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="ko"
|
|
|
+ xmlns:th="http://www.thymeleaf.org">
|
|
|
+<!--
|
|
|
+ *******************************************************************************
|
|
|
+ * @source : GoodsSetForm.html
|
|
|
+ * @desc : 세트상품 구성 관리
|
|
|
+ *============================================================================
|
|
|
+ * SISUN
|
|
|
+ * Copyright(C) 2019 TSIT, All rights reserved.
|
|
|
+ *============================================================================
|
|
|
+ * VER DATE AUTHOR DESCRIPTION
|
|
|
+ * === =========== ========== =============================================
|
|
|
+ * 1.0 2020.05.26 eskim 최초 작성
|
|
|
+ *******************************************************************************
|
|
|
+ -->
|
|
|
+ <ul class="popup modal" data-width="1100" >
|
|
|
+ <li class="mdPopTitle">
|
|
|
+ <strong>세트 상품 구성</strong>
|
|
|
+ <button type="button" class="close" onclick="fnGoodsSetFormClose()"><i class="fa fa-times"></i></button>
|
|
|
+ </li>
|
|
|
+ <li class="mdPopContent" style="height:610px; overflow-y: auto;">
|
|
|
+ <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/>
|
|
|
+ - TAG가 : 구성상품의 TAG가 합<br/>
|
|
|
+ - 정상가 : 구성상품의 정상가 합<br/>
|
|
|
+ - 판매가 : 구성상품 판매가 입력값의 합<br/>
|
|
|
+ - 브랜드코드 : 구성상품의 기준여부 'Y'상품의 브랜드코드<br/>
|
|
|
+ - 품목코드 : 구성상품의 기준여부 'Y'상품의 품목코드<br/>
|
|
|
+ - 포인트 : 구성상품의 기준여부 'Y'상품의 브랜드 포인트<br/>
|
|
|
+ - 기본배송비 : 구성상품의 기준여부 'Y'상품의 브랜드 기본배송비<br/>
|
|
|
+ - 무료배송비기준 : 구성상품의 기준여부 'Y'상품의 브랜드 무료배송비기준<br/>
|
|
|
+ - 외부몰 판매가 : 구성상품 판매가 입력값의 합<br/>
|
|
|
+ - 상품이미지 : 상품상세에서 이미지 경로 등록 처리
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <!-- //아이콘 툴팁 -->
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <form id="goodsSetForm" name="goodsSetForm" th:method="post">
|
|
|
+ <input type="hidden" id="extendGoodsList" name="extendGoodsList" />
|
|
|
+ <table class="frmStyle">
|
|
|
+ <colgroup>
|
|
|
+ <col width="10%"/>
|
|
|
+ <col/>
|
|
|
+ <col width="10%"/>
|
|
|
+ <col width="23%"/>
|
|
|
+ <col width="10%"/>
|
|
|
+ <col width="23%"/>
|
|
|
+ </colgroup>
|
|
|
+ <tr>
|
|
|
+ <th>상품명<i class="star"></i></th>
|
|
|
+ <td><input type="text" id="goodsNm" name="goodsNm" maxlength="60"/></td>
|
|
|
+ <th>자사노출여부<i class="star"></i></th>
|
|
|
+ <td><label><input type="radio" name="selfMallYn" id="selfMallYnY" value="Y" checked/>Y</label>
|
|
|
+ <label><input type="radio" name="selfMallYn" id="selfMallYnN" value="N"/>N</label>
|
|
|
+ </td>
|
|
|
+ <th>성별<i class="star"></i></th>
|
|
|
+ <td><select name="sexGb" id="sexGb">
|
|
|
+ <option value="">[전체]</option>
|
|
|
+ <option th:if="${sexGbList}" th:each="oneData, status : ${sexGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>년도/시즌<i class="star"></i></th>
|
|
|
+ <td colspan="3">
|
|
|
+ <select name="styleYear" id="styleYear">
|
|
|
+ <option value="">[전체]</option>
|
|
|
+ <option th:if="${styleYearList}" th:each="oneData, status : ${styleYearList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
|
|
|
+ </select>
|
|
|
+ <select name="seasonCd" id="seasonCd">
|
|
|
+ <option value="">[전체]</option>
|
|
|
+ <option th:if="${seasonList}" th:each="oneData, status : ${seasonList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <th>원산지<i class="star"></i></th>
|
|
|
+ <td><input type="text" class="w100" id="makeNm" name="makeNm" maxlength="20" /></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <th>색상<i class="star"></i></th>
|
|
|
+ <td colspan="3">
|
|
|
+ <select name="colorCd" id="colorCd">
|
|
|
+ </select>
|
|
|
+ </td>
|
|
|
+ <th>제조년월일<i class="star"></i></th>
|
|
|
+ <td><input type="text" class="w100" id="makeYmd" name="makeYmd" maxlength="8" data-valid-type="date"/></td>
|
|
|
+ <!-- <th>매입유형<i class="star"></i></th>
|
|
|
+ <td colspan="3">
|
|
|
+ <select name="buyingType" id="buyingType">
|
|
|
+ <option value="">[선택]</option>
|
|
|
+ <option th:if="${buyingTypeList}" th:each="oneData, status : ${buyingTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
|
|
|
+ </select>
|
|
|
+ </td> -->
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ <div class="padT15 padB15">
|
|
|
+ <button type="button" class="btn btn-danger btn-lg" onclick="fnGoodsSetDeleteRow();">행삭제</button>
|
|
|
+ <button type="button" class="btn btnRight btn-base btn-lg" onclick="fnOpenGoodsSetPopup();">구상상품추가</button>
|
|
|
+ </div>
|
|
|
+ <div id="gridGoodsSetList" style="height: 390px;" class="ag-theme-balham lh60"></div>
|
|
|
+ </form>
|
|
|
+ </li>
|
|
|
+ <li class="mdPopBtnB padT15">
|
|
|
+ <th:block th:if="${sessionInfo.roleCd == '0000' OR sessionInfo.roleCd == 'A000' OR sessionInfo.roleCd == 'A101' OR sessionInfo.roleCd == 'A100' OR sessionInfo.roleCd == 'A001'}">
|
|
|
+ <button type="button" class="btn btnRight btn-success btn-lg" id="btnGoodsSetSave">저장</button>
|
|
|
+ </th:block>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+<script th:inline="javascript">
|
|
|
+/*<![CDATA[*/
|
|
|
+ var useYnList = cfnConvertToArray([[${useYnList}]]);
|
|
|
+ var goodsStatList = cfnConvertToArray([[${goodsStatList}]]);
|
|
|
+ // specify the columns
|
|
|
+ var columnGoodsSetDefs = [
|
|
|
+ {headerName: "정렬", field: "dispOrd", width: 70 ,hide: false, cellClass: 'text-center', rowDrag: true },
|
|
|
+ {width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
|
|
|
+ //{headerName: 'No', width: 60, cellClass: 'text-center', valueGetter: function(params) { return params.node.rowIndex + 1 }},
|
|
|
+ {headerName: "이미지", field: "imgPath1", width: 100, height: 60, cellClass: 'text-center'
|
|
|
+ ,cellRenderer: function(params) {
|
|
|
+ if (params.data.imgType == "A"){
|
|
|
+ if(!gagajf.isNull(params.data.imgPath6)){
|
|
|
+ return '<img width="60" src="'+ uploadGoodsUrl+params.data.imgPath6.replace("/1000/","/100/") + '" alt="" onerror="this.src=\'/image/no.gif\';"/>';
|
|
|
+ }else{
|
|
|
+ return '<img width="60" src="'+ uploadGoodsUrl+params.value.replace("/1000/","/100/") + '" alt="" onerror="this.src=\'/image/no.gif\';"/>';
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(!gagajf.isNull(params.data.imgPath6)){
|
|
|
+ return '<img width="60" src="'+ params.data.imgPath1 + '" alt="" onerror="this.src=\'/image/no.gif\';"/>';
|
|
|
+ }else{
|
|
|
+ return '<img width="60" src="'+ params.value + '" alt="" onerror="this.src=\'/image/no.gif\';"/>';
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {headerName: "구성상품코드", field: "extendGoodsCd" , width: 130, cellClass: 'text-center'},
|
|
|
+ {headerName: "구성상품명", field: "goodsNm" , width: 130, cellClass: 'text-left'},
|
|
|
+ //{headerName: "순서", field: "dispOrd" , width: 100, cellClass: 'text-center',editable: true, required: true},
|
|
|
+ {headerName: "수량", field: "qty" , width: 80, cellClass: 'text-right',editable: true, required: true},
|
|
|
+ {headerName: "상품판매가", field: "extendCurrPrice" , width: 120, cellClass: 'text-right',editable: true, required: true,
|
|
|
+ cellEditor: 'textCellEditor',
|
|
|
+ cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
+ },
|
|
|
+ /* {headerName: "임직원판매가", field: "extendStaffCurrPrice" , width: 120, cellClass: 'text-right',editable: true, required: true,
|
|
|
+ cellEditor: 'textCellEditor',
|
|
|
+ cellEditorParams: { maxlength: 14, validType: 'numeric'}
|
|
|
+ }, */
|
|
|
+ {headerName: "기준여부(품목/전시카테)", field: "baseYn" , width: 160, cellClass: 'text-center',editable: true, required: true,
|
|
|
+ cellEditor: 'agRichSelectCellEditor',
|
|
|
+ cellEditorParams: { values: gagaAgGrid.extractValues(useYnList) },
|
|
|
+ valueFormatter: function (params) { return gagaAgGrid.lookupValue(useYnList, params.value); },
|
|
|
+ valueParser: function (params) { return gagaAgGrid.lookupKey(useYnList, params.newValue); }
|
|
|
+ },
|
|
|
+ {headerName: "상품상태", field: "goodsStat" , width: 100, cellClass: 'text-center',
|
|
|
+ cellEditorParams: { values: gagaAgGrid.extractValues(goodsStatList) },
|
|
|
+ valueFormatter: function (params) { return gagaAgGrid.lookupValue(goodsStatList, params.value); },
|
|
|
+ valueParser: function (params) { return gagaAgGrid.lookupKey(goodsStatList, params.newValue); }
|
|
|
+ },
|
|
|
+ {headerName: "자사/입점구분", field: "selfGoodsYn" , width: 100, cellClass: 'text-center'}
|
|
|
+ /* {headerName: "등록일자", field: "regDt", width: 150, cellClass: 'text-center' ,
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmm").format("YYYY-MM-DD HH:mm") : '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {headerName: "등록자", field: "regId", width: 100, cellClass: 'text-center'},
|
|
|
+ {headerName: "수정일자", field: "regDt", width: 150, cellClass: 'text-center' ,
|
|
|
+ cellRenderer: function(params) {
|
|
|
+ return !gagajf.isNull(params.value) ? params.value.toDate("YYYYMMDDHHmm").format("YYYY-MM-DD HH:mm") : '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {headerName: "수정자", field: "regId", width: 100, cellClass: 'text-center'} */
|
|
|
+ ];
|
|
|
+
|
|
|
+ // Get GridOptions
|
|
|
+ var gridGoodsSetOptions = gagaAgGrid.getGridOptions(columnGoodsSetDefs);
|
|
|
+ gridGoodsSetOptions.rowSelection = 'multiple';
|
|
|
+ gridGoodsSetOptions.suppressRowClickSelection = true;
|
|
|
+
|
|
|
+ // 드래그
|
|
|
+ gridGoodsSetOptions.rowDragManaged = true;
|
|
|
+ gridGoodsSetOptions.rowHeight = 60; //이미지가 있을경우 높이 지정해야함.
|
|
|
+
|
|
|
+ //기준여부 표시
|
|
|
+ gridGoodsSetOptions.getRowStyle = function(params) {
|
|
|
+ if ("Y" == params.data.baseYn) {
|
|
|
+ return { background: '#1ab394' };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Row
|
|
|
+ gridGoodsSetOptions.onCellValueChanged = function(event) {
|
|
|
+ var rowIdx = null;
|
|
|
+ var isChangColor = true;
|
|
|
+ if (event.colDef.field == "baseYn"){
|
|
|
+ if (event.data.baseYn == "Y"){
|
|
|
+ rowIdx = event.rowIndex;
|
|
|
+
|
|
|
+ //다른 기준여부 'Y'가 존재하는지 확인
|
|
|
+ gridGoodsSetOptions.api.forEachNode(function(rowNode, index) {
|
|
|
+ if (rowNode.data.baseYn == "Y" && index != rowIdx){
|
|
|
+ event.data.baseYn = event.oldValue;
|
|
|
+ gridGoodsSetOptions.api.updateRowData({update: [event.data]});
|
|
|
+ isChangColor = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!isChangColor){
|
|
|
+ mcxDialog.alert('다른 구성상품에 기준여부가 선택되어 있습니다.');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //기준상품의 색상 정보 읽어오기
|
|
|
+ var goodsCd = event.data.extendGoodsCd;
|
|
|
+ $("#goodsSetForm select[name=colorCd] option:gt(0)").remove();
|
|
|
+ cfnCreateCombo("/renderer/goods/brand/color/list/" + goodsCd, $('#goodsSetForm select[name=colorCd]'), "[선택]");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //창종료
|
|
|
+ var fnGoodsSetFormClose = function(){
|
|
|
+ uifnPopupClose('popupGoodsSet');
|
|
|
+ }
|
|
|
+
|
|
|
+ $(document).ready(function() {
|
|
|
+ gagaAgGrid.createGrid('gridGoodsSetList', gridGoodsSetOptions);
|
|
|
+ });
|
|
|
+
|
|
|
+ //상품조회 팝업
|
|
|
+ var fnOpenGoodsSetPopup = function() {
|
|
|
+ cfnOpenGoodsPopup('fnCreateGoodsSet');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 상품추가
|
|
|
+ var fnCreateGoodsSet = function(goodsData) {
|
|
|
+ if (goodsData.length < 1) return;
|
|
|
+
|
|
|
+ // 기존상품
|
|
|
+ var oldGoodsSetList = gagaAgGrid.getAllRowData(gridGoodsSetOptions);
|
|
|
+ var idx = oldGoodsSetList.length+1;
|
|
|
+
|
|
|
+ var isExist = false;
|
|
|
+ goodsData.forEach(function(goods){
|
|
|
+ isExist = false;
|
|
|
+
|
|
|
+ gridGoodsSetOptions.api.forEachNode(function(rowNode, index) {
|
|
|
+ if (goods.goodsCd == rowNode.data.extendGoodsCd){
|
|
|
+ isExist = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (goods.goodsType != 'N'){
|
|
|
+ isExist = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!isExist){
|
|
|
+
|
|
|
+ var data = {
|
|
|
+ extendGoodsCd: goods.goodsCd
|
|
|
+ , goodsType: 'S'
|
|
|
+ , dispOrd: idx
|
|
|
+ , qty: 1
|
|
|
+ , extendCurrPrice: goods.currPrice
|
|
|
+ , extendStaffCurrPrice: goods.currPrice
|
|
|
+ , baseYn: 'N'
|
|
|
+ , goodsStat : goods.goodsStat
|
|
|
+ , useYn: 'Y'
|
|
|
+ , goodsNm : goods.goodsNm
|
|
|
+ , selfGoodsYn : goods.selfGoodsYn
|
|
|
+ , imgType : goods.imgType
|
|
|
+ , imgPath1 : goods.imgPath1
|
|
|
+ , imgPath6 : goods.imgPath6
|
|
|
+ };
|
|
|
+ //그리드 마지막에 추가해야함
|
|
|
+ gridGoodsSetOptions.api.updateRowData({add: [data], addIndex: idx});
|
|
|
+ gridGoodsSetOptions.api.refreshCells();
|
|
|
+ idx++;
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 저장클릭시
|
|
|
+ $('#btnGoodsSetSave').on('click', function() {
|
|
|
+
|
|
|
+ if(!fnGoodsSetConditionCheck()) return;
|
|
|
+
|
|
|
+ mcxDialog.confirm('세트상품을 등록 하시겠습니까?', {
|
|
|
+ cancelBtnText: "취소",
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function(){
|
|
|
+ var extendGoodsList = gagaAgGrid.getAllRowData(gridGoodsSetOptions);
|
|
|
+ $("#goodsSetForm input[name=extendGoodsList]").val(JSON.stringify(extendGoodsList));
|
|
|
+ gagajf.ajaxFormSubmit("/goods/set/save", "#goodsSetForm", fnGoodsSetFormClose);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ //저장 조건 확인
|
|
|
+ var fnGoodsSetConditionCheck = function(){
|
|
|
+ var optCheck = false;
|
|
|
+
|
|
|
+ if(gagajf.isNull($("#goodsSetForm input[name=goodsNm]").val())){
|
|
|
+ mcxDialog.alertC('상품명을 입력해 주세요.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm input[name=goodsNm]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(gagajf.isNull($("#goodsSetForm select[name=colorCd]").val())){
|
|
|
+ mcxDialog.alertC('색상을 입력해 주세요.<br/>기준여부를 선택하시면<br/>해당브랜드의 색상을 노출합니다.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm select[name=colorCd]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (gagajf.isNull($("#goodsSetForm input[name=selfMallYn]").val())){
|
|
|
+ mcxDialog.alertC('자사노출여부를 선택해 주세요.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm input[name=selfMallYn]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(gagajf.isNull($("#goodsSetForm select[name=styleYear]").val())){
|
|
|
+ mcxDialog.alertC('년도을 선택해 주세요.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm select[name=styleYear]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(gagajf.isNull($("#goodsSetForm select[name=seasonCd]").val())){
|
|
|
+ mcxDialog.alertC('시즌을 선택해주세요.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm select[name=seasonCd]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(gagajf.isNull($("#goodsSetForm select[name=sexGb]").val())){
|
|
|
+ mcxDialog.alertC('성별을 선택해주세요.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm select[name=sexGb]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(gagajf.isNull($("#goodsSetForm input[name=makeNm]").val())){
|
|
|
+ mcxDialog.alertC('원산지를 입력해 주세요.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm input[name=makeNm]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ var makeYmd = $("#goodsSetForm input[name=makeYmd]").val();
|
|
|
+
|
|
|
+ if(gagajf.isNull(makeYmd)){
|
|
|
+ mcxDialog.alertC('제조년월일를 입력해 주세요.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm input[name=makeYmd]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(makeYmd.length < 8){
|
|
|
+ mcxDialog.alertC('제조년월일를 바르게 주세요.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm input[name=makeYmd]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isNaN(Date.parse(makeYmd.substr(0, 4) +'-'+ makeYmd.substr(4, 2) +'-'+ makeYmd.substr(6, 2)))){
|
|
|
+ mcxDialog.alertC('날짜형식이 아닙니다.', {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ $("#goodsSetForm input[name=makeYmd]").focus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ var allData = gagaAgGrid.getAllRowData(gridGoodsSetOptions);
|
|
|
+ // Validation
|
|
|
+ if (!gagaAgGrid.validation(gridGoodsSetOptions, allData))
|
|
|
+ return false;
|
|
|
+
|
|
|
+ var comSupplyCompCd = '';
|
|
|
+ var comSelfGoodsYn = '';
|
|
|
+ //기준여부 Y 존재하는지 확인
|
|
|
+ var checkBaseYn = false;
|
|
|
+ optCheck = false;
|
|
|
+ $.each(allData, function(index, item) {
|
|
|
+ if (index == 0){
|
|
|
+ comSelfGoodsYn = item.selfGoodsYn;
|
|
|
+ comSupplyCompCd = item.supplyCompCd;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (item.baseYn == "Y"){
|
|
|
+ checkBaseYn = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(item.goodsStat != "90"){
|
|
|
+ optCheck = true;
|
|
|
+ mcxDialog.alertC("상품상태를 확인해 주세요.", {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ gridGoodsSetOptions.api.setFocusedCell(index, "goodsStat", null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Number(item.qty) == 0){
|
|
|
+ optCheck = true;
|
|
|
+ mcxDialog.alertC("수량을 입력해 주세요.", {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ gridGoodsSetOptions.api.setFocusedCell(index, "qty", null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (comSelfGoodsYn != item.selfGoodsYn){
|
|
|
+ optCheck = true;
|
|
|
+ mcxDialog.alertC("구상상품중 자사/입점상품 구분값이 다릅니다.\n확인해 주세요", {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ gridGoodsSetOptions.api.setFocusedCell(index, "goodsCd", null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ if (comSelfGoodsYn == "N" && (comSupplyCompCd != item.supplyCompCd)){
|
|
|
+ optCheck = true;
|
|
|
+ mcxDialog.alertC("구상상품중 입점은 같은 업체 상품만 가능합니다.\n확인해 주세요", {
|
|
|
+ sureBtnText: "확인",
|
|
|
+ sureBtnClick: function() {
|
|
|
+ gridGoodsSetOptions.api.setFocusedCell(index, "goodsCd", null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ if(optCheck) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!checkBaseYn){
|
|
|
+ mcxDialog.alert('구성상품중 기준여부를 선택해 주세요.');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ //상품삭제
|
|
|
+ var fnGoodsSetDeleteRow = function() {
|
|
|
+ var selectedData = gagaAgGrid.selectedRowData(gridGoodsSetOptions);
|
|
|
+
|
|
|
+ if (selectedData.length == 0) {
|
|
|
+ mcxDialog.alert('선택된 행이 없습니다.');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var iTotalCnt = 0;
|
|
|
+ var iCnt = 0;
|
|
|
+ $.each(selectedData, function(index, item) {
|
|
|
+ iTotalCnt ++;
|
|
|
+ if (item.crud == "C"){
|
|
|
+ gridGoodsSetOptions.api.updateRowData({remove: [item]});
|
|
|
+ iCnt ++;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+/*]]>*/
|
|
|
+</script>
|
|
|
+</html>
|