Browse Source

Merge remote-tracking branch 'origin/xyzp1539' into xodud1202

xodud1202 5 years ago
parent
commit
97ee9df6d6

+ 108 - 2
src/main/java/com/style24/admin/biz/dao/TsaCouponDao.java

@@ -6,7 +6,9 @@ import java.util.Collection;
 import org.springframework.stereotype.Component;
 
 import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.CommonCode;
 import com.style24.persistence.domain.Coupon;
+import org.springframework.stereotype.Component;
 
 /**
  * 쿠폰 DAO
@@ -19,7 +21,7 @@ public interface TsaCouponDao {
 
 	/**
 	 * 쿠폰 리스트 조회
-	 * @param  Coupon
+	 * @param  param
 	 * @return ArrayList<Coupon>
 	 * @author xyzp1539
 	 * @since 2020-12-22
@@ -28,7 +30,7 @@ public interface TsaCouponDao {
 
 	/**
 	 * 쿠폰 리스트 카운트 조회
-	 * @param  Coupon
+	 * @param  param
 	 * @return int
 	 * @author xyzp1539
 	 * @since 2020-12-22
@@ -52,4 +54,108 @@ public interface TsaCouponDao {
 	 */
 	Collection<Coupon> getCouponRetrieveList(Coupon coupon);
 
+	/**
+	 * 쿠폰 적용대상 등록
+	 * @param supplyComp
+	 * @author xyzp1539
+	 * @since  2021-01-14
+	 */
+	void saveCouponRefVal(Coupon supplyComp);
+
+	/**
+	 * 쿠폰 입점업체 분담 등록
+	 * @param burden
+	 * @author xyzp1539
+	 * @since  2021-01-14
+	 */
+	void saveCouponBurden(Coupon burden);
+
+	/**
+	 * 자사브랜드 조회
+	 * @param
+	 * @author xyzp1539
+	 * @since  2021-01-14
+	 */
+    Collection<CommonCode> getSelfBrandList();
+
+	/**
+	 * 쿠폰 상세 조회
+	 * @param  cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-15
+	 */
+    Coupon getCouponDetail(String cpnId);
+
+	/**
+	 * 쿠폰 발급개수 조회
+	 * @param  cpnId
+	 * @return int
+	 * @author xyzp1539
+	 * @since 2021-01-15
+	 */
+	int getCouponIssueCnt(String cpnId);
+
+	/**
+	 * 쿠폰 적용 대상 - 제외상품
+	 * @param  cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<Coupon> getCouponRefvalExceptGoodsList(Coupon cpnRefval);
+
+	/**
+	 * 쿠폰 적용 대상 - 브랜드
+	 * @param cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<Coupon> getCouponRefvalBrandList(Coupon cpnRefval);
+
+	/**
+	 * 쿠폰 적용 대상 - 카테고리
+	 * @param cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<Coupon> getCouponRefvalCategoryList(Coupon cpnRefval);
+
+	/**
+	 * 쿠폰 적용 대상 - 적용/제외상품
+	 * @param  cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<Coupon> getCouponRefvalGoodsList(Coupon cpnRefval);
+
+	/**
+	 * 쿠폰 적용 대상 - 공급처
+	 * @param cpnRefval
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<Coupon> getCouponRefvalSupplyCompList(Coupon cpnRefval);
+
+	/**
+	 * 쿠폰 입점업쳅 분담율 조회
+	 * @param cpnId
+	 * @return  Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	ArrayList<Coupon> getCouponBurdenList(String cpnId);
+
+	/**
+	 * 쿠폰 적용대상 삭제
+	 * @param  coupon
+	 * @return
+	 * @author xyzp1539
+	 * @since 2021-01-19
+	 */
+    void updateCouponRefval(Coupon coupon);
 }

+ 218 - 77
src/main/java/com/style24/admin/biz/service/TsaCouponService.java

@@ -8,6 +8,7 @@ import java.util.Date;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
+import com.style24.persistence.domain.CommonCode;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -37,9 +38,6 @@ public class TsaCouponService {
 	@Autowired
 	private TsaCommonService commonService;
 
-
-
-
 	/**
 	 * 쿠폰 저장
 	 * @param params
@@ -47,14 +45,14 @@ public class TsaCouponService {
 	 * @since  2021-01-11
 	 */
 	@Transactional("shopTxnManager")
-	public void couponSave(Coupon params) {
+	public void saveCoupon(Coupon params) {
 		String cpnId = "";		// 쿠폰ID
 
 		params.setRegNo(TsaSession.getInfo().getUserNo());
 		params.setUpdNo(TsaSession.getInfo().getUserNo());
 
 		// 자동생성이면 시퀀스 가져오기
-		/*if(StringUtils.isBlank(params.getCpnId())) {
+		if(StringUtils.isBlank(params.getCpnId())) {
 			Integer sequence = commonService.getNextSequence("SEQ_COUPON");
 			cpnId = "CPN"+sequence;
 		} else {
@@ -63,21 +61,111 @@ public class TsaCouponService {
 		params.setCpnId(cpnId);
 
 		couponDao.couponInsert(params);
-		*/
-		Gson gson = new Gson();
 
+		Gson gson = new Gson();
+		Integer sequence;
+		// 적용대상 - 공급업체
 		Collection<Coupon>	supplyCompList = gson.fromJson(params.getSupplyCompList() , new TypeToken<Collection<Coupon>>(){}.getType());
 		for(Coupon supplyComp : supplyCompList) {
-		//	couponDao.couponRefValInsert(supplyComp);
+			sequence = null;
+			if(supplyComp.getCpnRefvalSq() != null && supplyComp.getCpnRefvalSq() > 0){
+				sequence = supplyComp.getCpnRefvalSq();
+			} else {
+				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
+			}
+
+			supplyComp.setCpnId(cpnId);
+			supplyComp.setCpnRefvalSq(sequence);
+			supplyComp.setCpnTarget("G260_13");
+			supplyComp.setRefVal(supplyComp.getSupplyCompCd());
+			supplyComp.setRegNo(TsaSession.getInfo().getUserNo());
+			supplyComp.setUpdNo(TsaSession.getInfo().getUserNo());
+			couponDao.saveCouponRefVal(supplyComp);
 		}
+		// 적용대상 - 브랜드
 		Collection<Coupon> brandList = gson.fromJson(params.getBrandList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		for(Coupon brand : brandList) {
+			sequence = null;
+			if(brand.getCpnRefvalSq() != null && brand.getCpnRefvalSq() > 0){
+				sequence = brand.getCpnRefvalSq();
+			} else {
+				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
+			}
+
+			brand.setCpnId(cpnId);
+			brand.setCpnRefvalSq(sequence);
+			brand.setCpnTarget("G260_12");
+			brand.setRefVal(brand.getBrandCd());
+			brand.setRegNo(TsaSession.getInfo().getUserNo());
+			brand.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			couponDao.saveCouponRefVal(brand);
+		}
+		// 적용대상 - 적용상품
 		Collection<Coupon> applyGoodsList = gson.fromJson(params.getApplyGoodsList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		for(Coupon applyGoods : applyGoodsList ) {
+			sequence = null;
+			if(applyGoods.getCpnRefvalSq() != null && applyGoods.getCpnRefvalSq() > 0){
+				sequence = applyGoods.getCpnRefvalSq();
+			} else {
+				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
+			}
+			applyGoods.setCpnId(cpnId);
+			applyGoods.setCpnRefvalSq(sequence);
+			applyGoods.setCpnTarget("G260_10");
+			applyGoods.setRefVal(applyGoods.getGoodsCd());
+			applyGoods.setRegNo(TsaSession.getInfo().getUserNo());
+			applyGoods.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			couponDao.saveCouponRefVal(applyGoods);
+		}
+		// 적용대상 - 카테고리
 		Collection<Coupon> cateList = gson.fromJson(params.getCateList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		for(Coupon cate : cateList ) {
+			sequence = null;
+			if(cate.getCpnRefvalSq() != null && cate.getCpnRefvalSq() > 0){
+				sequence = cate.getCpnRefvalSq();
+			} else {
+				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
+			}
+			cate.setCpnId(cpnId);
+			cate.setCpnRefvalSq(sequence);
+			cate.setCpnTarget("G260_11");
+			cate.setRefVal(cate.getCateNo());
+			cate.setRefFormalGb(cate.getFormalGb());
+			cate.setRefBrandCd(cate.getBrandCd());		// ag-grid 브랜드코드
+			cate.setRegNo(TsaSession.getInfo().getUserNo());
+			cate.setUpdNo(TsaSession.getInfo().getUserNo());
+
+			couponDao.saveCouponRefVal(cate);
+		}
+		// 적용대상 - 제외상품
 		Collection<Coupon> exceptGoodsList = gson.fromJson(params.getExceptGoodsList() , new TypeToken<Collection<Coupon>>(){}.getType());
-		Collection<Coupon> burdenList = gson.fromJson(params.getBurdenList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		for(Coupon exceptGoods: exceptGoodsList ) {
+			sequence = null;
+			if(exceptGoods.getCpnRefvalSq() != null && exceptGoods.getCpnRefvalSq() > 0){
+				sequence = exceptGoods.getCpnRefvalSq();
+			} else {
+				sequence = commonService.getNextSequence("SEQ_COUPON_REFVAL");
+			}
+			exceptGoods.setCpnId(cpnId);
+			exceptGoods.setCpnRefvalSq(sequence);
+			exceptGoods.setCpnTarget("G260_14");
+			exceptGoods.setRefVal(exceptGoods.getGoodsCd());
+			exceptGoods.setRegNo(TsaSession.getInfo().getUserNo());
+			exceptGoods.setUpdNo(TsaSession.getInfo().getUserNo());
 
-		//checkCpnValidation(params);
+			couponDao.saveCouponRefVal(exceptGoods);
+		}
+		// 입점업체분담율
+		Collection<Coupon> burdenList = gson.fromJson(params.getBurdenList() , new TypeToken<Collection<Coupon>>(){}.getType());
+		for(Coupon burden: burdenList ) {
+			burden.setCpnId(cpnId);
+			burden.setRegNo(TsaSession.getInfo().getUserNo());
+			burden.setUpdNo(TsaSession.getInfo().getUserNo());
 
+			couponDao.saveCouponBurden(burden);
+		}
 	}
 
 	/**
@@ -103,85 +191,138 @@ public class TsaCouponService {
 	}
 
 	/**
-	 * 쿠폰 벨리데이션 체크
-	 * @param params
+	 * 쿠폰조회 목록
+	 * @param coupon - 쿠폰 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 1. 8
+	 */
+	public Collection<Coupon> getCouponRetrieveList(Coupon coupon) {
+		return couponDao.getCouponRetrieveList(coupon);
+	}
+
+	/**
+	 * 쿠폰조회 목록
+	 * @param
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 1. 8
+	 */
+	public Collection<CommonCode> getSelfBrandList() {
+		return couponDao.getSelfBrandList();
+	}
+
+	/**
+	 * 쿠폰 상세 조회
+	 * @param  cpnId
+	 * @return Coupon
 	 * @author xyzp1539
-	 * @since  2021-01-12
+	 * @since 2021-01-15
 	 */
-	public void checkCpnValidation(Coupon params) {
-		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		// 할인율이면  100% 초과 체크하기
-		if(params.getDcWay() != null && params.getDcWay().equals("G240_11")) {
-			if(params.getDcAval() > 100) {
-				throw new IllegalStateException("모바일 앱 할인율은 100을 초과할수 없습니다.");
-			} else if(params.getDcPval() > 100) {
-				throw new IllegalStateException("PC할인율은 100을 초과할수 없습니다.");
-			} else if(params.getDcMval() > 100) {
-				throw new IllegalStateException("모바일 웹 100을 초과할수 없습니다.");
-			}
-		}
+    public Coupon getCouponDetail(String cpnId) { return couponDao.getCouponDetail(cpnId);}
 
-		// 기간/일수구분이 일수인 경우 날짜 체크
-		if(params.getPdGb() != null && params.getPdGb().equals("D")) {
-			try {
-				Date date1 = format.parse(params.getAvailStdt());
-				Date date2 = format.parse(params.getAvailEddt());
-
-				log.info("checkCpnValidation params.getAvailEddt() :  {}" , params.getAvailEddt());
-				log.info("checkCpnValidation params.getAvailStdt :  {}" , params.getAvailStdt());
-				if(date2.before(date1)) {
-					throw new IllegalStateException("유효기간 종료날짜가 시작날짜보다 작습니다.");
-				}
-			} catch (ParseException exception) {
-			}
-		}
+	/**
+	 * 쿠폰 발급 개수 조회
+	 * @param  cpnId
+	 * @return  cnt
+	 * @author xyzp1539
+	 * @since 2021-01-15
+	 */
+	public int getCouponIssueCnt(String cpnId) {
+		return couponDao.getCouponIssueCnt(cpnId);
+	}
 
-		// 직접다운로드인 경우 기간 체크
-		if(params.getDnGb() != null && params.getDnGb().equals("G058_20")) {
-			try {
-				Date date1 = format.parse(params.getDownStdt());
-				Date date2 = format.parse(params.getDownEddt());
-
-				log.info("checkCpnValidation params.getDownStdt() :  {}" , params.getDownStdt());
-				log.info("checkCpnValidation params.getDownEddt :  {}" , params.getDownEddt());
-				if(date2.before(date1)) {
-					throw new IllegalStateException("다운로드 종료날짜가 시작날짜보다 작습니다.");
-				}
-			} catch (ParseException exception) {
-			}
-		}
+	/**
+	 * 쿠폰 적용 대상 - 제외상품
+	 * @param  cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<Coupon> getCouponRefvalExceptGoodsList(String cpnId ) {
+		Coupon cpnRefval = new Coupon();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget("G260_14");
+		return couponDao.getCouponRefvalExceptGoodsList(cpnRefval);
+	}
 
-		// 첫구매 적용하는 경우 날짜 체크
-		if(params.getFirstYn() != null && params.getFirstYn().equals("Y")) {
-			try {
-				Date date1 = format.parse(params.getBuyStdt());
-				Date date2 = format.parse(params.getBuyEddt());
-
-				log.info("checkCpnValidation params.getBuyStdt() :  {}" , params.getBuyStdt());
-				log.info("checkCpnValidation params.getBuyEddt :  {}" , params.getBuyEddt());
-				if(date2.before(date1)) {
-					throw new IllegalStateException("첫구매 종료날짜가 시작날짜보다 작습니다.");
-				}
-			} catch (ParseException exception) {
-			}
-		}
+	/**
+	 * 쿠폰 적용 대상 - 브랜드
+	 * @param cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<Coupon> getCouponRefvalBrandList(String cpnId ) {
+		Coupon cpnRefval = new Coupon();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget("G260_12");
+		return couponDao.getCouponRefvalBrandList(cpnRefval);
+	}
+
+	/**
+	 * 쿠폰 적용 대상 - 카테고리
+	 * @param cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<Coupon> getCouponRefvalCategoryList(String cpnId) {
+		Coupon cpnRefval = new Coupon();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget("G260_11");
+		return couponDao.getCouponRefvalCategoryList(cpnRefval);
+	}
 
-		// 신규회원여부 적용하는 경우 날짜 체크
-		if(params.getCustJoinYn() != null && params.getCustJoinYn().equals("Y")) {
+	/**
+	 * 쿠폰 적용 대상 - 적용상품
+	 * @param  cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<Coupon> getCouponRefvalGoodsList(String cpnId , String cpnTarget) {
+		Coupon cpnRefval = new Coupon();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget(cpnTarget);
+		return couponDao.getCouponRefvalGoodsList(cpnRefval);
+	}
 
-		}
+	/**
+	 * 쿠폰 적용 대상 - 공급처
+	 * @param cpnId
+	 * @return Coupon
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<Coupon> getCouponRefvalSupplyCompList(String cpnId) {
+		Coupon cpnRefval = new Coupon();
+		cpnRefval.setCpnId(cpnId);
+		cpnRefval.setCpnTarget("G260_30");
+		return couponDao.getCouponRefvalSupplyCompList(cpnRefval);
+	}
 
+	/**
+	 * 쿠폰 입점업체 분담율 조회
+	 * @param  
+	 * @return 
+	 * @author xyzp1539
+	 * @since 2021-01-18
+	 */
+	public ArrayList<Coupon> getCouponBurdenList(String cpnId) {
+		return couponDao.getCouponBurdenList(cpnId);
 	}
 
 	/**
-	 * 쿠폰조회 목록
-	 * @param coupon - 쿠폰 정보
+	 * 쿠폰 적용대상 삭제
+	 * @param   coupon
 	 * @return
-	 * @author gagamel
-	 * @since 2021. 1. 8
+	 * @author xyzp1539
+	 * @since 2021-01-19
 	 */
-	public Collection<Coupon> getCouponRetrieveList(Coupon coupon) {
-		return couponDao.getCouponRetrieveList(coupon);
+	@Transactional("shopTxnManager")
+	public void updateCouponRefval(Coupon coupon) {
+		coupon.setUpdNo(TsaSession.getInfo().getUserNo());
+		couponDao.updateCouponRefval(coupon);
 	}
-
 }

+ 68 - 15
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -226,9 +226,11 @@ public class TsaMarketingController extends TsaBaseController {
 	 */
 	@GetMapping("/coupon/popup/form")
 	@ResponseBody
-	public ModelAndView couponCreatePopup() {
+	public ModelAndView couponCreatePopup(@RequestParam(value="cpnId") String cpnId ) {
 		ModelAndView mav = new ModelAndView();
 		String num = "";
+		String mode = "N";
+		int issueCnt = 0;
 
 		// 일시 시 리스트 세팅
 		Collection<CommonCode> hhList = new ArrayList<CommonCode>();
@@ -265,15 +267,28 @@ public class TsaMarketingController extends TsaBaseController {
 
 			mmList.add(temp);
 		}
-
+		// 시간 분 리스트 세팅
+		mav.addObject("mmList", mmList);
+		// 시간 시 리스트 세팅
+		mav.addObject("hhList", hhList);
+		// 입점업체 조회
+		mav.addObject("ibSupplyCompList", rendererService.getSupplyCompanyList("", "N"));
+		// 정상/이월 조회
+		mav.addObject("formalGbList" , rendererService.getCommonCodeList("G009"));
+		// 카테고리 구분 조회
+		mav.addObject("cateGbList" , rendererService.getCommonCodeList("G032"));
+		// 자사 브랜드 조회
+		mav.addObject("selfBrandList" , couponService.getSelfBrandList());
+		// 사이트코드 조회
+		mav.addObject("siteCdList", rendererService.getCommonCodeList("G000"));
+		// 쿠폰상태 조회
+		mav.addObject("cpnStatList", rendererService.getCommonCodeList("G232"));
 		// 쿠폰 유형 조회
 		mav.addObject("cpnTypeList", rendererService.getCommonCodeList("G230"));
 		// 사용가능 고객구분 조회
 		mav.addObject("usableCustGbList", rendererService.getCommonCodeList("G100"));
 		// 사용가능 고객등급 조회
 		mav.addObject("usableCustGradeList", rendererService.getCommonCodeList("G101"));
-		// 사이트코드 조회
-		mav.addObject("siteCdList", rendererService.getCommonCodeList("G000"));
 		// 재발급 여부 조회
 		mav.addObject("reissuanceList", rendererService.getCommonCodeList("G231"));
 		// 할인방식 조회
@@ -282,16 +297,35 @@ public class TsaMarketingController extends TsaBaseController {
 		mav.addObject("dnGbList", rendererService.getCommonCodeList("G058"));
 		// 결제수단 조회
 		mav.addObject("payTypeList", rendererService.getCommonCodeList("G015"));
-		// 쿠폰상태 조회
-		mav.addObject("cpnStatList", rendererService.getCommonCodeList("G232"));
-		// 시간 분 리스트 세팅
-		mav.addObject("mmList", mmList);
-		// 시간 시 리스트 세팅
-		mav.addObject("hhList", hhList);
-		// 입점업체 조회
-		mav.addObject("ibSupplyCompList", rendererService.getSupplyCompanyList("", "N"));
+		// 상위제휴채널 조회
+		mav.addObject("upperAfLinkCdList", rendererService.getCommonCodeList("G053"));
+
+		// 이미 쿠폰 아이디가 있으면 적용대상 조회
+		if(!StringUtils.isBlank(cpnId)) {
+			mode = "U";
+			issueCnt = couponService.getCouponIssueCnt(cpnId);
+			// 쿠폰상세조회
+			mav.addObject("cpnDetail" , couponService.getCouponDetail(cpnId));
+			// 쿠폰적용대상 - 공급업체 조회
+			mav.addObject("cpnDtlRefvalSupplyCompList" , couponService.getCouponRefvalSupplyCompList(cpnId));
+			// 쿠폰적용대상 - 적용상품 조회
+			mav.addObject("cpnDtlRefvalApplyGoodsList" , couponService.getCouponRefvalGoodsList(cpnId , "G260_10"));
+			// 쿠폰적용대상 - 카테고리 조회
+			mav.addObject("cpnDtlRefvalCateList" , couponService.getCouponRefvalCategoryList(cpnId));
+			// 쿠폰적용대상 - 브랜드 조회
+			mav.addObject("cpnDtlRefvalBrandList" , couponService.getCouponRefvalBrandList(cpnId));
+			// 쿠폰적용대상 - 제외상품 조회
+			mav.addObject("cpnDtlRefvalExceptGoodsList" , couponService.getCouponRefvalGoodsList(cpnId , "G260_14"));
+			// 쿠폰 입점업체분담율 조회
+			mav.addObject("cpnDtlBurdenList" , couponService.getCouponBurdenList(cpnId));
+		}
+
+		//issueCnt = 3;
+
+		mav.addObject("mode" , mode);
+		mav.addObject("issueCnt" , issueCnt);
 
-		mav.setViewName("marketing/CouponCreatePopupForm");
+		mav.setViewName("marketing/CouponPopupForm");
 		return mav;
 	}
 
@@ -304,13 +338,32 @@ public class TsaMarketingController extends TsaBaseController {
 	 */
 	@PostMapping("/coupon/save")
 	@ResponseBody
-	public GagaResponse couponSave(@RequestBody Coupon coupon) {
+	public GagaResponse saveCoupon(@RequestBody Coupon coupon) {
+		log.info("couponSave : {}", coupon);
+
+		couponService.saveCoupon(coupon);
+
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
+	/**
+	 * 쿠폰 적용대상 삭제수정
+	 * @param coupon
+	 * @return
+	 * @author xyzp1539
+	 * @since 2021-01-19
+	 */
+	@PostMapping("/coupon/refval/update")
+	@ResponseBody
+	public GagaResponse updateCouponRefval(@RequestBody Coupon coupon) {
 		log.info("couponSave : {}", coupon);
 
-		couponService.couponSave(coupon);
+		couponService.updateCouponRefval(coupon);
 
 		return super.ok(message.getMessage("SUCC_0001"));
 	}
+
+
 	/* // JSM 진행 */
 
 	/* CSB 진행 */

+ 1 - 1
src/main/java/com/style24/persistence/domain/Category.java

@@ -41,7 +41,7 @@ public class Category extends TscBaseDomain {
 	// 검색조건
 	private String siteCd;		// 사이트코드
 	private Integer selLvl;		// 선택레벨
-	private String callbackFn;	// 콜백함수
+	private String callBackFun;	// 콜백함수
 
 	// 품목카테고리매핑관리 화면에서 사용
 	private String fullCateNo;	// FULL카테고리번호

+ 17 - 6
src/main/java/com/style24/persistence/domain/Coupon.java

@@ -1,5 +1,6 @@
 package com.style24.persistence.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 import com.style24.persistence.TscPageRequest;
 import lombok.Data;
@@ -15,7 +16,7 @@ import java.util.Collection;
 @SuppressWarnings("serial")
 @Data
 public class Coupon extends TscBaseDomain {
-
+    // TB_COUPON
     private String  cpnId;					// 쿠폰ID
     private String  cpnNm;					// 쿠폰명
     private String  siteCd;					// 사이트코드(공통코드G000)
@@ -55,27 +56,37 @@ public class Coupon extends TscBaseDomain {
     private String  payType;                 // 결제수단
     private String  custJoinYn;             // 신규회원여부
 
+    // 그리드 컬럼
     private String  supplyCompCd;            // 공급업체코드
-    private int     burdenRate;                 // 업체분담율
+    private Integer burdenRate;              // 업체분담율
     private String  delYn;                   // 삭제여부
     private String  supplyCompNm;            // 공급업체명
-
     private String  brandCd;                 // 브랜드코드
     private String  brandEnm;                // 브랜드영문명
-
     private String  goodsGb;                 // 상품구분
     private String  goodsCd;                 // 상품코드
     private String  goodsNm;                 // 상품명
-
     private String  cateNm;                  // 카테고리코드명
     private String  cateNo;                  // 카테고리코드
-
     private String  supplyCompList;          // 공급업체 리스트
     private String  brandList;               // 브랜드 리스트
     private String  applyGoodsList;          // 적용상품 리스트
     private String  exceptGoodsList;         // 제외상품 리스트
     private String  burdenList;              // 업체 분담율 리스트
     private String  cateList;                // 카테고리 리스트
+    private String  formalGb;                // 이월정상구분
+
+    // TB_COUPON_REFVAL
+    private String  cpnTarget;               // 쿠폰대상구분(공통코드G260)
+    private String  refVal;                  // 관련값(쿠폰대상이 "10:상품"일 때는 상품코드, "20:브랜드"일 때는 브랜드코드, "30:카테고리"일 때는 카테고리코드, "40:제외상품"일 때는 상품코드)
+    private Integer cpnRefvalSq;             // 쿠폰대상일련번호
+    private String  refFormalGb;             // 정상/이월구분(G009). 쿠폰대상구분이 카테고리일 경우 사용
+    private String  refBrandCd;              // 브랜드코드. 쿠폰대상구분이 카테고리일 경우 사용
+    @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+    private Integer[] cpnRefvalSqArr;        // 쿠폰적용대상시퀀스배열
+
+    // TB_COUPON_BAN_GOODS
+    private Integer  cpnBanGoodsSq;          //
 
     // Pagination
     private TscPageRequest pageable;

+ 329 - 79
src/main/java/com/style24/persistence/mybatis/shop/TsaCoupon.xml

@@ -5,67 +5,67 @@
 	<select id="getCouponList" parameterType="Coupon" resultType="Coupon">
 		/* TsaCoupon.getCouponList */
 		SELECT T.*
-		, COUNT(CUST_CPN_SQ) AS ISSUE_CNT
-		, COUNT(USED_DT) AS USE_CNT
-		FROM (
-		SELECT SITE_CD
-		, CPN_ID
-		, CPN_NM
-		, USABLE_CUST_GB
-		, CPN_TYPE
-		, DC_WAY
-		, DC_PVAL
-		, DC_MVAL
-		, MAX_DC_AMT
-		, PD_GB
-		, AVAIL_STDT
-		, AVAIL_EDDT
-		, FN_GET_USER_NM(REG_NO) AS REG_NM
-		, REG_DT
-		FROM TB_COUPON
-		WHERE 1=1
-		<if test="siteCd != null and siteCd != ''">
-			AND SITE_CD = #{siteCd}
-		</if>
-		<if test="cpnId != null and cpnId != ''">
-			AND CPN_ID = #{cpnId}
-		</if>
-		<if test="cpnType != null and cpnType != ''">
-			AND CPN_TYPE = #{cpnType}
-		</if>
-		<if test="regNo != null and regNo != ''">
-			AND REG_NO = #{regNo}
-		</if>
-		<if test="dcWay != null and dcWay != ''">
-			AND DC_WAY = #{dcWay}
-		</if>
-		<if test="cpnNm != null and cpnNm != ''">
-			AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
-		</if>
-		<if test="pdGb != null and pdGb != ''">
-			AND PD_GB = #{pdGb}
-		</if>
-		<if test="availStdt != null and availStdt != '' and availEddt != null and availEddt != ''">
-			AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
-			AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
-		</if>
-		) T
+			 , COUNT(CUST_CPN_SQ) AS ISSUE_CNT
+			 , COUNT(USED_DT) AS USE_CNT
+		 FROM (
+				SELECT SITE_CD
+					 , CPN_ID
+					 , CPN_NM
+					 , USABLE_CUST_GB
+					 , CPN_TYPE
+					 , DC_WAY
+					 , DC_PVAL
+					 , DC_MVAL
+					 , MAX_DC_AMT
+					 , PD_GB
+					 , AVAIL_STDT
+					 , AVAIL_EDDT
+					 , FN_GET_USER_NM(REG_NO) AS REG_NM
+					 , REG_DT
+				  FROM TB_COUPON
+				 WHERE 1=1
+				<if test="siteCd != null and siteCd != ''">
+				   AND SITE_CD = #{siteCd}
+				</if>
+				<if test="cpnId != null and cpnId != ''">
+				   AND CPN_ID = #{cpnId}
+				</if>
+				<if test="cpnType != null and cpnType != ''">
+				   AND CPN_TYPE = #{cpnType}
+				</if>
+				<if test="regNo != null and regNo != ''">
+				   AND REG_NO = #{regNo}
+				</if>
+				<if test="dcWay != null and dcWay != ''">
+				   AND DC_WAY = #{dcWay}
+				</if>
+				<if test="cpnNm != null and cpnNm != ''">
+				   AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
+				</if>
+				<if test="pdGb != null and pdGb != ''">
+				   AND PD_GB = #{pdGb}
+				</if>
+				<if test="availStdt != null and availStdt != '' and availEddt != null and availEddt != ''">
+				   AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
+				   AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
+				</if>
+			) T
 		LEFT OUTER JOIN TB_CUST_COUPON CC
-		ON T.CPN_ID = CC.CPN_ID
+		             ON T.CPN_ID = CC.CPN_ID
 		GROUP BY  T.SITE_CD
-		, T.CPN_ID
-		, T.CPN_NM
-		, T.USABLE_CUST_GB
-		, T.CPN_TYPE
-		, T.DC_WAY
-		, T.DC_PVAL
-		, T.DC_MVAL
-		, T.MAX_DC_AMT
-		, T.PD_GB
-		, T.AVAIL_STDT
-		, T.AVAIL_EDDT
-		, T.REG_NM
-		, T.REG_DT
+				, T.CPN_ID
+				, T.CPN_NM
+				, T.USABLE_CUST_GB
+				, T.CPN_TYPE
+				, T.DC_WAY
+				, T.DC_PVAL
+				, T.DC_MVAL
+				, T.MAX_DC_AMT
+				, T.PD_GB
+				, T.AVAIL_STDT
+				, T.AVAIL_EDDT
+				, T.REG_NM
+				, T.REG_DT
 		ORDER BY  T.REG_DT DESC
 	</select>
 
@@ -73,32 +73,32 @@
 	<select id="getCouponListCnt" parameterType="Coupon" resultType="int">
 		/* TsaCoupon.getCouponListCnt */
 		SELECT COUNT(1)
-		FROM TB_COUPON
-		WHERE 1=1
+		  FROM TB_COUPON
+		 WHERE 1=1
 		<if test="siteCd != null and siteCd != ''">
-			AND SITE_CD = #{siteCd}
+		   AND SITE_CD = #{siteCd}
 		</if>
 		<if test="cpnId != null and cpnId != ''">
-			AND CPN_ID = #{cpnId}
+		   AND CPN_ID = #{cpnId}
 		</if>
 		<if test="cpnType != null and cpnType != ''">
-			AND CPN_TYPE = #{cpnType}
+		   AND CPN_TYPE = #{cpnType}
 		</if>
 		<if test="regNo != null and regNo != ''">
-			AND REG_NO = #{regNo}
+		   AND REG_NO = #{regNo}
 		</if>
 		<if test="dcWay != null and dcWay != ''">
-			AND DC_WAY = #{dcWay}
+		   AND DC_WAY = #{dcWay}
 		</if>
 		<if test="cpnNm != null and cpnNm != ''">
-			AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
+		   AND CPN_NM LIKE LOWER('%' || #{cpnNm} || '%')
 		</if>
 		<if test="pdGb != null and pdGb != ''">
-			AND PD_GB = #{pdGb}
+		   AND PD_GB = #{pdGb}
 		</if>
 		<if test="availStdt != null and availStdt != '' and availEddt != null and availEddt != ''">
-			AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
-			AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
+		   AND AVAIL_STDT >= DATE_FORMAT(#{availStdt} , '%Y-%m-%d')
+		   AND AVAIL_EDDT <![CDATA[ <= ]]> DATE_FORMAT(#{availEddt} , '%Y-%m-%d')
 		</if>
 	</select>
 
@@ -109,9 +109,7 @@
 			CPN_ID
 		  , CPN_NM
 		  , SITE_CD
-		  <if test='afLinkCd != null and afLinkCd != ""'>
 		  , AF_LINK_CD
-	      </if>
 		  , USABLE_CUST_GB
 		  , USABLE_CUST_GRADE
 		  , CPN_TYPE
@@ -134,10 +132,8 @@
 		  , TOT_PUB_LIMIT_QTY
 		  , ONE_PUB_QTY
 		  , DN_GB
-		  <if test='dnGb != null and dnGb == "G058_20"'>
 		  , DOWN_STDT
 		  , DOWN_EDDT
-		  </if>
 		  , BUY_LIMIT_AMT
 		  , PLAN_SQ
 		  , REISSUANCE
@@ -165,9 +161,7 @@
 		    #{cpnId}
 		  , #{cpnNm}
 		  , #{siteCd}
-		  <if test='afLinkCd != null and afLinkCd != ""'>
 		  , #{afLinkCd}
-		  </if>
 		  , #{usableCustGb}
 		  , #{usableCustGrade}
 		  , #{cpnType}
@@ -190,10 +184,8 @@
 		  , #{totPubLimitQty}
 		  , #{onePubQty}
 		  , #{dnGb}
-		  <if test='dnGb != null and dnGb == "G058_20"'>
 		  , DATE_FORMAT(#{downStdt} , '%Y-%m-%d %H:%i:%s')
 		  , DATE_FORMAT(#{downEddt} , '%Y-%m-%d %H:%i:%s')
-		  </if>
 		  , #{buyLimitAmt}
 		  , #{planSq}
 		  , #{reissuance}
@@ -217,7 +209,43 @@
 		  , #{payType}
 		  </if>
 		  , #{custJoinYn}
-		)
+		) ON DUPLICATE KEY UPDATE
+			CPN_NM = #{cpnNm}
+		  , SITE_CD = #{siteCd}
+		  , AF_LINK_CD = #{afLinkCd}
+		  , USABLE_CUST_GB = #{usableCustGb}
+		  , USABLE_CUST_GRADE = #{usableCustGrade}
+		  , CPN_TYPE = #{cpnType}
+		  , APPLY_SCOPE = #{applyScope}
+		  , DC_WAY = #{dcWay}
+		  , DC_PVAL = #{dcPval}
+		  , DC_MVAL = #{dcMval}
+		  , DC_AVAL = #{dcAval}
+		  , MAX_DC_AMT = #{maxDcAmt}
+		  , PD_GB = #{pdGb}
+		  , AVAIL_STDT = #{availStdt}
+		  , AVAIL_EDDT = #{availEddt}
+		  , AVAIL_DAYS = #{availDays}
+		  , CUST_PUB_LIMIT_QTY = #{custPubLimitQty}
+		  , TOT_PUB_LIMIT_QTY = #{totPubLimitQty}
+		  , ONE_PUB_QTY = #{onePubQty}
+		  , DOWN_STDT = #{downStdt}
+		  , DOWN_EDDT = #{downEddt}
+		  , BUY_LIMIT_AMT = #{buyLimitAmt}
+		  , PLAN_SQ = #{planSq}
+		  , REISSUANCE = #{reissuance}
+		  , CPN_STAT = #{cpnStat}
+		  , END_ALIM_YN = #{endAlimYn}
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = now()
+		  , FIRST_YN = #{firstYn}
+		  , DOWN_YN = #{downYn}
+		  , CUST_JOIN_STDT = #{custJoinStdt}
+		  , CUST_JOIN_EDDT = #{custJoinEddt}
+		  , BUY_STDT = #{buyStdt}
+		  , BUY_EDDT = #{buyEddt}
+		  , PAY_TYPE = #{payType}
+		  , CUST_JOIN_YN = #{custJoinYn}
 	</insert>
 
 	<!-- 쿠폰조회 목록 -->
@@ -254,4 +282,226 @@
 		</if>
 	</select>
 
+	<!-- 쿠폰 적용대상 등록 -->
+	<insert id="saveCouponRefVal" parameterType="Coupon">
+		/* TsaCoupon.saveCouponRefVal */
+		INSERT INTO TB_COUPON_REFVAL (
+			CPN_REFVAL_SQ
+		  , CPN_ID
+		  , CPN_TYPE
+		  , CPN_TARGET
+		  , REF_VAL
+		  <if test='refFormalGb != null and refFormalGb != ""'>
+		  , REF_FORMAL_GB
+		  </if>
+		  <if test='refBrandCd != null and refBrandCd != ""'>
+		  , REF_BRAND_CD
+		  </if>
+		  , REG_NO
+		  , REG_DT
+		  , UPD_NO
+		  , UPD_DT
+		)
+		SELECT #{cpnRefvalSq}
+			 , CPN_ID
+			 , CPN_TYPE
+			 , #{cpnTarget}
+			 , #{refVal}
+			 <if test='refFormalGb != null and refFormalGb != ""'>
+			 , #{refFormalGb}
+			 </if>
+			 <if test='refBrandCd != null and refBrandCd != ""'>
+			 , #{refBrandCd}
+			 </if>
+			 , REG_NO
+			 , now()
+			 , UPD_NO
+			 , now()
+		  FROM TB_COUPON
+		 WHERE CPN_ID = #{cpnId}
+		    ON DUPLICATE KEY UPDATE
+			REF_VAL = #{refVal}
+		  , REF_FORMAL_GB = #{refFormalGb}
+		  , REF_BRAND_CD = #{refBrandCd}
+		  , UPD_NO = #{updNo}
+		  , UPD_DT = now()
+	</insert>
+
+	<!-- 쿠폰 입점업체 분담율 등록 -->
+	<insert id="saveCouponBurden" parameterType="Coupon">
+		/* TsaCoupon.saveCouponBurden */
+		INSERT INTO TB_COUPON_BURDEN(
+		    CPN_ID
+		  , SUPPLY_COMP_CD
+		  , BURDEN_RATE
+		  , REG_NO
+		  , REG_DT
+		  , UPD_NO
+		  , UPD_DT
+		)
+		SELECT CPN_ID
+			 , #{supplyCompCd}
+			 , #{burdenRate}
+			 , REG_NO
+			 , now()
+			 , UPD_NO
+			 , now()
+		  FROM TB_COUPON
+		 WHERE CPN_ID = #{cpnId}
+			ON DUPLICATE KEY UPDATE
+			   SUPPLY_COMP_CD = #{supplyCompCd}
+			 , BURDEN_RATE = #{burdenRate}
+			 , UPD_NO = #{updNo}
+			 , UPD_DT = now()
+	</insert>
+
+	<!-- 자사브랜드 조회-->
+	<select id="getSelfBrandList" resultType="CommonCode">
+		/* TsaCoupon.getSelfBrandList */
+		SELECT BRAND_CD  AS CD
+		     , BRAND_ENM AS CD_NM
+		  FROM TB_BRAND
+		 WHERE 1 = 1
+		   AND USE_YN = 'Y'
+		   AND SELF_YN = 'Y'
+		ORDER  BY SUPPLY_COMP_CD, DISP_ORD
+	</select>
+
+	<!-- 쿠폰 상세 조회-->
+	<select id="getCouponDetail" parameterType="String" resultType="Coupon">
+		/* TsaCoupon.getCouponDetail */
+		SELECT CPN_ID
+			 , CPN_NM
+			 , SITE_CD
+			 , AF_LINK_CD
+			 , USABLE_CUST_GB
+			 , USABLE_CUST_GRADE
+			 , CPN_TYPE
+			 , APPLY_SCOPE
+			 , DC_WAY
+			 , DC_PVAL
+			 , DC_MVAL
+			 , DC_AVAL
+			 , MAX_DC_AMT
+			 , PD_GB
+			 , AVAIL_STDT
+			 , AVAIL_EDDT
+			 , AVAIL_DAYS
+			 , CUST_PUB_LIMIT_QTY
+			 , TOT_PUB_LIMIT_QTY
+			 , ONE_PUB_QTY
+			 , DN_GB
+			 , DOWN_STDT
+			 , DOWN_EDDT
+			 , BUY_LIMIT_AMT
+			 , PLAN_SQ
+			 , REISSUANCE
+			 , CPN_STAT
+			 , END_ALIM_YN
+			 , FIRST_YN
+			 , DOWN_YN
+			 , CUST_JOIN_STDT
+			 , CUST_JOIN_EDDT
+			 , BUY_STDT
+			 , BUY_EDDT
+			 , PAY_TYPE
+			 , CUST_JOIN_YN
+  		  FROM TB_COUPON
+    	 WHERE CPN_ID = #{value}
+	</select>
+
+	<!-- 쿠폰 발급 개수 조회 -->
+	<select id="getCouponIssueCnt" parameterType="String" resultType="int">
+		/* TsaCoupon.getCouponIssueCnt*/
+		SELECT COUNT(1)
+		  FROM TB_CUST_COUPON
+		 WHERE CPN_ID = #{cpnId}
+	</select>
+
+	<!-- 쿠폰 적용대상 조회 - 제외/적용 상품 -->
+	<select id="getCouponRefvalGoodsList" parameterType="Coupon" resultType="Coupon">
+		/* TsaCoupon.getCouponRefvalGoodsList */
+		SELECT FN_GET_CODE_NM('G073',B.GOODS_GB) AS GOODS_GB
+			 , B.GOODS_CD
+			 , B.GOODS_NM
+			 , C.BRAND_ENM
+			 , A.CPN_REFVAL_SQ
+		  FROM TB_COUPON_REFVAL A
+		 INNER JOIN TB_GOODS B ON A.REF_VAL = B.GOODS_CD
+		 INNER JOIN TB_BRAND C ON B.BRAND_CD = C.BRAND_CD
+		 WHERE A.CPN_ID = #{cpnId}
+		   AND A.CPN_TARGET = #{cpnTarget}
+		 ORDER BY A.CPN_REFVAL_SQ DESC
+	</select>
+
+	<!-- 쿠폰 적용대상 조회 - 브랜드 -->
+	<select id="getCouponRefvalBrandList" parameterType="Coupon" resultType="Coupon">
+		/* TsaCoupon.getCouponRefvalExceptGoodsList */
+		SELECT B.BRAND_CD
+			 , B.BRAND_ENM
+		     , C.SUPPLY_COMP_NM
+			 , A.CPN_REFVAL_SQ
+		  FROM TB_COUPON_REFVAL A
+		 INNER JOIN TB_BRAND B ON A.REF_VAL = B.BRAND_CD
+		 INNER JOIN TB_SUPPLY_COMPANY C ON B.SUPPLY_COMP_CD = C.SUPPLY_COMP_CD
+		 WHERE A.CPN_ID = #{cpnId}
+		   AND A.CPN_TARGET = #{cpnTarget}
+		 ORDER BY A.CPN_REFVAL_SQ DESC
+	</select>
+
+	<!-- 쿠폰적용대상 - 카테고리 조회 -->
+	<select id="getCouponRefvalCategoryList" parameterType="Coupon" resultType="Coupon">
+		/* TsaCoupon.getCouponRefvalCategoryList */
+		SELECT B.CATE_GB
+			 , A.REF_VAL AS CATE_CD
+			 , B.FULL_CATE_NM 					AS CATE_NM
+			 , B.SITE_CD
+			 , A.REF_FORMAL_GB					AS FORMAL_GB
+		     , A.REF_BRAND_CD					AS BRAND_CD
+			 , A.CPN_REFVAL_SQ
+		  FROM TB_COUPON_REFVAL A
+		 INNER JOIN TB_CATE_4SRCH B ON A.REF_VAL = B.LEAF_CATE_NO
+		 WHERE A.CPN_ID = #{cpnId}
+		   AND A.CPN_TARGET = #{cpnTarget}
+		 ORDER BY A.CPN_REFVAL_SQ DESC
+	</select>
+
+	<!-- 쿠폰 적용대상 - 공급처 조회 -->
+	<select id="getCouponRefvalSupplyCompList" parameterType="Coupon" resultType="Coupon">
+		/* TsaCoupon.getCouponRefvalSupplyCompList */
+		SELECT B.SUPPLY_COMP_CD
+			 , B.SUPPLY_COMP_NM
+			 , A.CPN_REFVAL_SQ
+		  FROM TB_COUPON_REFVAL A
+		 INNER JOIN TB_SUPPLY_COMPANY B ON A.REF_VAL = B.SUPPLY_COMP_CD
+		 WHERE A.CPN_ID = #{cpnId}
+		   AND A.CPN_TARGET = #{cpnTarget}
+		 ORDER BY A.CPN_REFVAL_SQ DESC
+	</select>
+
+	<!-- 쿠폰 입점업체 분담율 조회-->
+	<select id="getCouponBurdenList" parameterType="String" resultType="Coupon">
+		/* TsaCoupon.getCouponBurdenList */
+		SELECT SUPPLY_COMP_CD
+			 , BURDEN_RATE
+			 , DEL_YN
+			 , CPN_ID
+		  FROM TB_COUPON_BURDEN
+		 WHERE CPN_ID = #{value}
+	</select>
+
+	<!-- 쿠폰 적용대상 수정-->
+	<update id="updateCouponRefval" >
+		/* TsaCoupon.updateCouponRefval */
+		UPDATE TB_COUPON_REFVAL
+		   SET DEL_YN = 'Y'
+			 , UPD_NO = #{updNo}
+			 , UPD_DT = now()
+		 WHERE CPN_ID = #{cpnId}
+		   AND CPN_REFVAL_SQ IN
+		  <foreach collection="cpnRefvalSqArr" item="item" open="(" separator="," close=")">
+			#{item}
+		  </foreach>
+	</update>
+
 </mapper>

+ 5 - 5
src/main/webapp/WEB-INF/views/display/CategorySearchForm.html

@@ -14,7 +14,7 @@
  * 1.0  2021.01.11   xyzp1539    최초 작성
  *******************************************************************************
  -->
-<div class="modalPopup" data-width="900" id="popupCategory">
+<div class="modalPopup" data-width="1100" id="popupCategory">
 	<div class="panelStyle">
 		<!-- TITLE -->
 		<div class="panelTitle">
@@ -126,7 +126,7 @@
 			return false;
 		}
 		
-		var callbackFn = [[${params.callbackFn}]];
+		var callbackFn = [[${params.callBackFun}]];
 
 		var jsonData = JSON.stringify(selectedData);
 
@@ -162,11 +162,11 @@
 				selLvl = 1;
 			}
 		}
-		$('#searchForm input[name=selLvl]').val(selLvl);
+		$('#searchCategoryListForm input[name=selLvl]').val(selLvl);
 
 		// Fetch data
-		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm', function(data) {
-			let selLvl = Number($('#searchForm input[name=selLvl]').val()) + 1;
+		gagaAgGrid.fetch($('#searchCategoryListForm').prop('action'), categoryGridOptions, '#searchCategoryListForm', function(data) {
+			let selLvl = Number($('#searchCategoryListForm input[name=selLvl]').val()) + 1;
 
 			for (let i = 2; i <= 5; i++) {
 				if (i >= selLvl) {

+ 0 - 944
src/main/webapp/WEB-INF/views/marketing/CouponCreatePopupForm.html

@@ -1,944 +0,0 @@
-<!DOCTYPE html>
-<html lang="ko"
-	  xmlns:th="http://www.thymeleaf.org">
-<!--
- *******************************************************************************
- * @source  : CouponCreatePopupForm.html
- * @desc    : 쿠폰 등록 팝업 화면
- *============================================================================
- * ISTYLE24
- * Copyright(C) 2020 TSIT, All rights reserved.
- *============================================================================
- * VER  DATE         AUTHOR      DESCRIPTION
- * ===  ===========  ==========  =============================================
- * 1.0  2020.12.23   xyzp1539       최초 작성
- *******************************************************************************
- -->
-<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>
-							<li class="on"><a href="#coupontab1">기본정보</a></li>
-							<li><a href="#coupontab2">적용대상</a></li>
-							<li><a href="#coupontab3">입점업체분담율</a></li>
-						</ul>
-					</div>
-					<ul class="tabsCont">
-						<li class="tab on" id="coupontab1">
-							<div class="panelStyle">
-								<table class="frmStyle">
-									<colgroup>
-										<col style="width:10%">
-										<col style="width:40%;">
-										<col style="width:10%">
-										<col style="width:40%;">
-									</colgroup>
-									<tr>
-										<th>쿠폰번호<em class="required" title="필수"></em></th>
-										<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="자동생성" data-valid-name="쿠폰번호">
-											<label class="chkBox checked" onclick="clickCreateChk(this);" id="cpnCreateLab">
-												<input type="checkbox" name="cpnCreateType" id="cpnCreateType" value="true" class="type-check" checked />쿠폰번호 자동생성
-											</label>
-										</td>
-									</tr>
-									<tr>
-										<th>쿠폰명<em class="required" title="필수"></em></th>
-										<td colspan="5">
-											<input type="text" name="cpnNm" id="cpnNm" style="width: 70%;" required="required" data-valid-name="쿠폰명">
-										</td>
-									</tr>
-									<tr>
-										<th>쿠폰유형<em class="required" title="필수"></em></th>
-										<td colspan="5">
-											<input type="hidden" id="cpnType" name="cpnType" required="required" data-valid-name="쿠폰유형">
-											<label class="rdoBtn" th:if="${cpnTypeList}" th:each="oneData, status : ${cpnTypeList}"> <input type="radio" name="rdoCpnType"  th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
-										</td>
-									</tr>
-									<tr>
-										<th>사용가능고객구분<em class="required" title="필수"></em></th>
-										<td>
-											<select name="usableCustGb" id="usableCustGb" required="required" data-valid-name="사용가능고객구분">
-												<option th:if="${usableCustGbList}" th:each="oneData , status : ${usableCustGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-										<th>사이트<em class="required" title="필수"></em></th>
-										<td>
-											<select name="siteCd" id="siteCd" required="required" data-valid-name="사이트">
-												<option th:if="${siteCdList}" th:each="oneData , status : ${siteCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>사용고객등급구분<em class="required" title="필수"></em></th>
-										<td>
-											<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>
-										<th>만료알림여부<em class="required" title="필수"></em></th>
-										<td>
-											<select name="endAlimYn" id="endAlimYn" required="required" data-valid-name="만료알림여부">
-												<option value="Y">Y</option>
-												<option value="N" selected="selected">N</option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>할인방식<em class="required" title="필수"></em></th>
-										<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>
-										<td>
-											<input type="text" class="w200" id="dcPval" name="dcPval" value="0" required="required" data-valid-name="할인값(PC)" data-valid-type="numeric" style="text-align: right"><span id="dcPvalSpan">원</span>
-										</td>
-										<th>할인값(모바일웹)<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" id="dcMval" name="dcMval" value="0" required="required" data-valid-name="할인값(모바일웹)" data-valid-type="numeric" style="text-align: right"><span id="dcMvalSpan">원</span>
-										</td>
-									</tr>
-									<tr>
-										<th>할인값(모바일앱)<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" id="dcAval" name="dcAval" value="0" required="required" data-valid-name="할인값(모바일앱)" data-valid-type="numeric" style="text-align: right"><span id="dcAvalSpan">원</span>
-										</td>
-										<th>최대할인금액<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" id="maxDcAmt" name="maxDcAmt" value="0" required="required" data-valid-name="최대할인금액" data-valid-type="numeric" style="text-align: right;"><span id="maxDcAmtSpan">원</span>
-										</td>
-									</tr>
-									<tr>
-										<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="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>
-											<select name="downStMM" id="downStMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										<th>다운로드종료일시<em class="required" title="필수"></em></th>
-										<td>
-											<input type="hidden" id="downEddt" name="downEddt" required="required" data-valid-name="다운로드종료일시">
-											<input type="text" class="schDate w100" name="downEdDay" id="downEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="downEdHH" id="downEdHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="downEdMM" id="downEdMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>기간/일수구분<em class="required" title="필수"></em></th>
-										<td>
-											<select name="pdGb" id="pdGb" onchange="pdGbChange(this)" required="required" data-valid-name="기간/일수구분">
-												<option value="P">기간</option>
-												<option value="D">일수</option>
-											</select>
-										</td>
-										<th>적용범위<em class="required" title="필수"></em></th>
-										<td>
-											<input type="hidden" name="applyScope" id="applyScope" required="required" data-valid-name="적용범위">
-											<label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="A"/>전체</label>
-											<label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="I"/>개별</label>
-										</td>
-									</tr>
-									<tr class="availDayTr" style="display: none;">
-										<th>유효기간일수<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" name="availDays" id="availDays" class="w200" data-valid-name="유효기간일수">
-										</td>
-									</tr>
-									<tr>
-										<th class="availDateTr">유효기간시작일시<em class="required" title="필수"></em></th>
-										<td class="availDateTr">
-											<input type="hidden" name="availStdt" id="availStdt" data-valid-name="유효기간시작일시">
-											<input type="text" class="schDate w100" name="availStDay" id="availStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="availStHH" id="availStHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="availStMM" id="availStMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										<th class="availDateTr">유효기간종료일시<em class="required" title="필수"></em></th>
-										<td class="availDateTr">
-											<input type="hidden" id="availEddt" name="availEddt" data-valid-name="유효기간종료일시">
-											<input type="text" class="schDate w100" name="availEdDay" id="availEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="availEdHH" id="availEdHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="availEdMM" id="availEdMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>첫구매여부<em class="required" title="필수"></em></th>
-										<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" 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>
-											</select>
-											<select name="buyStMM" id="buyStMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										<th class="buyDateTr">첫구매기간종료일시<em class="required" title="필수"></em></th>
-										<td class="buyDateTr">
-											<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>
-											</select>
-											<select name="buyEdMM" id="buyEdMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>신규회원여부<em class="required" title="필수"></em></th>
-										<td colspan="5">
-											<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>
-										</td>
-									</tr>
-									<tr>
-										<th class="custJoinDateTr">신규회원기간시작일시<em class="required" title="필수"></em></th>
-										<td class="custJoinDateTr">
-											<input type="hidden" name="custJoinStdt" id="custJoinStdt" data-valid-name="신규회원기간시작일시">
-											<input type="text" class="schDate w100" name="custJoinStDay" id="custJoinStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="custJoinStHH" id="custJoinStHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="custJoinStMM" id="custJoinStMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										<th class="custJoinDateTr">신규회원기간종료일시<em class="required" title="필수"></em></th>
-										<td class="custJoinDateTr">
-											<input type="hidden" id="custJoinEddt" name="custJoinEddt" data-valid-name="신규회원기간종료일시">
-											<input type="text" class="schDate w100" name="custJoinEdDay" id="custJoinEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
-											<select name="custJoinEdHH" id="custJoinEdHH">
-												<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-											<select name="custJoinEdMM" id="custJoinEdMM">
-												<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>총발행제한수량<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" name="totPubLimitQty" id="totPubLimitQty" value="0" required="required" data-valid-name="총발행제한수량" data-valid-type="numeric" style="text-align: right;">개<span class="cRed" id="totPubLimitQtySpan"> *제한없음</span>
-										</td>
-										<th>1인당발행제한수량<em class="required" title="필수"></em></th>
-										<td>
-											<input type="text" class="w200" name="custPubLimitQty" id="custPubLimitQty" value="0" required="required" data-valid-name="1인당발행제한수량" data-valid-type="numeric" style="text-align: right;">개<span class="cRed" id="custPubLimitQtySpan"> *제한없음</span>
-										</td>
-									</tr>
-									<tr>
-										<th>최소주문금액<em class="required" title="필수"></em></th>
-										<td><input type="text" class="w200" name="minBuyAmt" id="minBuyAmt" value="0" required="required" data-valid-name="최소주문금액" data-valid-type="numeric" style="text-align: right;">원<span class="cRed" id="minBuyAmtSpan"> *제한없음</span></td>
-										<th>1회발행수량<em class="required" title="필수"></em></th>
-										<td><input type="text" class="w200" name="onePubQty" id="onePubQty" value="1" required="required" data-valid-name="1회발행수량" data-valid-type="numeric" style="text-align: right;">개</td>
-									</tr>
-									<tr>
-										<th>재발급여부<em class="required" title="필수"></em></th>
-										<td>
-											<select name="reissuance" id="reissuance" required="required" data-valid-name="재발급여부" >
-												<option th:if="${reissuanceList}" th:each="oneData , status : ${reissuanceList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-										<th>다운로드구분<em class="required" title="필수"></em></th>
-										<td>
-											<select name="dnGb" id="dnGb" required="required" data-valid-name="다운로드구분">
-												<option th:if="${dnGbList}" th:each="oneData , status:${dnGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr>
-										<th>쿠폰상태<em class="required" title="필수"></em></th>
-										<td>
-											<select name="cpnStat" id="cpnStat" ata-valid-name="쿠폰상태" required="required">
-												<option th:if="${cpnStatList}" th:each="oneData , status : ${cpnStatList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</td>
-									</tr>
-									<tr class="payTypeTr" style="display: none;">
-										<th>결제수단<em class="required" title="필수"></em></th>
-										<td>
-											<select name="payType" id="payType" data-valid-name="결제수단">
-												<option value="">[전체]</option>
-												<option th:if="${payTypeList}" th:each="oneData , status : ${payTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
-											</select>
-										</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>
-<script th:inline="javascript">
-	/*<![CDATA[*/
-	var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
-	var delYnList = { "Y":"Yes", "N":"No" };
-
-	// 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을 초과할수없습니다.');
-				$('#dcPval').focus();
-				return false;
-			} else if( $('#dcMval').val() > 100) {
-				mcxDialog.alert('모바일(웹)할인율은 100을 초과할수없습니다.');
-				$('#dcMval').focus();
-				return false;
-			}  else if( $('#dcAval').val() > 100) {
-				mcxDialog.alert('모바일(앱)할인율은 100을 초과할수없습니다.');
-				$('#dcAval').focus();
-				return false;
-			}
-		}
-
-		mcxDialog.confirm('저장하시겠습니까?' , {
-			cancelBtnText:"취소",
-			sureBtnText:"확인",
-			sureBtnClick: function () {
-				gagajf.ajaxFormSubmit($('#couponCreateForm').prop('action'), '#couponCreateForm', function() {
-					uifnPopupClose('CouponCreatePopup');
-					$('#btnSearch').trigger('click');
-				});
-			}
-		});
-	}
-
-	// 할인방식 변경
-	$("#couponCreateForm input[name=rdoDcWay]").bind('click change', function () {
-		var radioValue = $(this).val();
-
-		if(radioValue == 'G240_10') {
-			$('#dcPvalSpan').text("원");
-			$('#dcMvalSpan').text("원");
-			$('#dcAvalSpan').text("원");
-		} else {
-			$('#dcPvalSpan').text("%");
-			$('#dcMvalSpan').text("%");
-			$('#dcAvalSpan').text("%");
-		}
-	});
-
-	// 쿠폰 상태 변경
-	$("#couponCreateForm input[name=rdoCpnType]").bind('click change', function () {
-		var radioValue = $(this).val();
-
-		// 상품쿠폰 선택시 적용범위 개별로 변경 나머진 전체
-		if(radioValue == 'G230_11') {
-			$("input:radio[name='rdoApplyScope']:radio[value='I']").prop('checked', true);
-		} else {
-			$("input:radio[name='rdoApplyScope']:radio[value='A']").prop('checked', true);
-		}
-
-		// 주문서 쿠폰 선택시 결제수단 노출
-		if(radioValue == 'G230_20') {
-			$('.payTypeTr').css('display' , '');
-			$('#couponCreateForm #payType').attr('required' , true);
-		} else {
-			$('.payTypeTr').css('display' , 'none');
-			$('#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});
-			}
-		}
-	};
-
-	// 적용대상 - 브랜드 삭제 버튼시
-	$('#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});
-			}
-		}
-	};
-
-	// 적용대상 - 공급처 삭제시시
-	$('#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});
-			}
-		}
-	}
-
-	// 적용대상 - 카테고리 삭제시
-	$('#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});
-			}
-		}
-	}
-
-	// 기간 일수 변경시
-	function pdGbChange(pThis){
-		var selectVal = $(pThis).val();
-
-		if(typeof selectVal == "undefined") {
-			selectVal = "P";
-		}
-
-		if(selectVal == "P") {
-			$('.availDateTr').css('display' , '');
-			$('.availDayTr').css('display' , 'none');
-			$('#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' , '');
-			$('#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);
-		}
-	}
-
-	// 첫구매여부 변경시
-	function firstYnChange(pThis){
-		var selectVal = $(pThis).val();
-
-		if(typeof selectVal == "undefined") {
-			selectVal = "N";
-		}
-
-		if(selectVal == "Y" ) {
-			$('.buyDateTr').css('display' , '');
-			$('#buyStdt').attr('required' , true);
-			$('#buyEddt').attr('required' , true);
-		} else {
-			$('.buyDateTr').css('display' , 'none');
-			$('#buyStdt').attr('required' , false);
-			$('#buyEddt').attr('required' , false);
-		}
-	}
-
-	// 신규회원여부 변경시
-	function custJoinYnChange(pThis){
-		var selectVal = $(pThis).val();
-
-		if(typeof selectVal == "undefined") {
-			selectVal = "N";
-		}
-
-		if(selectVal == "Y" ) {
-			$('.custJoinDateTr').css('display' , '');
-			$('#custJoinStdt').attr('required' , true);
-			$('#custJoinEddt').attr('required' , true);
-		} else {
-			$('.custJoinDateTr').css('display' , 'none');
-			$('#custJoinStdt').attr('required' , false);
-			$('#custJoinEddt').attr('required' , false);
-		}
-	}
-
-	// 행추가시
-	$('#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);
-		}
-	}
-
-	// 전송시 값 세팅
-	function setReqValue(){
-		// 쿠폰유형값 세팅
-		$('#couponCreateForm #cpnType').val($('#couponCreateForm input:radio[name="rdoCpnType"]:checked').val());
-		// 할인방식값 세팅
-		$('#couponCreateForm #dcWay').val($('#couponCreateForm input:radio[name="rdoDcWay"]:checked').val());
-		// 적용범위값 세팅
-		$('#couponCreateForm #applyScope').val($('#couponCreateForm input:radio[name="rdoApplyScope"]:checked').val());
-		// 다운로드기간 세팅
-		$('#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");
-		// 유효기간 세팅
-		$('#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");
-		// 첫구매기간세팅
-		$('#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");
-		// 신규회원기간 세팅
-		$('#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);
-		// 입점업체분담율 그리드 전체값 세팅
-		var inCompBurdenAllData = gagaAgGrid.getAllRowData(inComGridOptions);
-		var jsonInCompBurdenData = JSON.stringify(inCompBurdenAllData);
-		$('#couponCreateForm #burdenList').val(jsonInCompBurdenData);
-
-	}
-
-	$(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>

+ 4 - 13
src/main/webapp/WEB-INF/views/marketing/CouponListForm.html

@@ -154,7 +154,9 @@
 				valueParser: function (params) { return gagaAgGrid.lookupKey(siteCdList, params.newValue); }
 			},
 			{headerName: "쿠폰ID", field: "cpnId", width: 130, cellClass: 'text-center'},
-			{headerName: "쿠폰명", field: "cpnNm", width: 140, cellClass: 'text-center'},
+			{headerName: "쿠폰명", field: "cpnNm", width: 140, cellClass: 'text-center' , cellRenderer: function (params) {
+				return "<a href=\"javascript:void(0);\" onclick=\"cfnCouponCreatePopup('" + params.data.cpnId + "');\">" + params.value + "</a>";
+			}},
 			{headerName: "사용가능고객구분", field: "usableCustGb", width: 140, cellClass: 'text-center' ,
 				cellEditor: 'agRichSelectCellEditor',
 				cellEditorParams: { values: gagaAgGrid.extractValues(usableCustGbList) },
@@ -210,20 +212,9 @@
 
 		// 쿠폰등록 팝업창
 		function fnCouponCreateForm(){
-			cfnCouponCreatePopup();
+			cfnCouponCreatePopup('');
 		}
 
-		// Row Click
-		/*
-        gridOptions.onCellClicked = function(event) {
-            var goodsCd = event.data.goodsCd;
-            if (event.colDef.field == "freeGiftName"){
-                // 수ㅜ정 필요
-                // cfnOpenGoodsDetailPopup('U',goodsCd);
-            }
-        }
-        */
-
 		// 초기화 클릭시
 		$('#btnInit').on('click', function() {
 			$('#searchForm')[0].reset();

+ 1276 - 0
src/main/webapp/WEB-INF/views/marketing/CouponPopupForm.html

@@ -0,0 +1,1276 @@
+<!DOCTYPE html>
+<html lang="ko"
+	  xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : CouponPopupForm.html
+ * @desc    : 쿠폰 등록 팝업 화면
+ *============================================================================
+ * ISTYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.12.23   xyzp1539       최초 작성
+ *******************************************************************************
+ -->
+<div class="modalPopup" data-width="1200">
+	<div class="panelStyle" >
+		<div class="panelTitle">
+			<h2 th:text="${'쿠폰 ' + (mode == 'N' ? '등록' : '수정')}">쿠폰등록</h2>
+			<button type="button" class="close" onclick="uifnPopupClose('CouponRegForm')"><i class="fa fa-times"></i></button>
+		</div>
+		<div class="panelContent">
+			<form id="CouponForm" name="CouponForm" action="#" 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>
+							<li class="on"><a href="#coupontab1">기본정보</a></li>
+							<li><a href="#coupontab2">적용대상</a></li>
+							<li><a href="#coupontab3">입점업체분담율</a></li>
+						</ul>
+					</div>
+					<ul class="tabsCont">
+						<li class="tab on" id="coupontab1">
+							<div class="panelStyle">
+								<table class="frmStyle">
+									<colgroup>
+										<col style="width:10%">
+										<col style="width:40%;">
+										<col style="width:10%">
+										<col style="width:40%;">
+									</colgroup>
+									<tbody>
+										<tr>
+											<th>쿠폰번호<em class="required" title="필수"></em></th>
+											<td colspan="5">
+												<input type="hidden" name="copyCpnId" maxlength="50" value="">
+												<input type="text" name="cpnId" id="cpnId" maxlength="50"  style="width:70%;" disabled="true" readonly="readonly" placeholder="자동생성" data-valid-name="쿠폰번호">
+												<label class="chkBox checked" onclick="clickCreateChk(this);">
+													<input type="checkbox" name="cpnCreateType" value="true" class="type-check" checked />쿠폰번호 자동생성
+												</label>
+											</td>
+										</tr>
+										<tr>
+											<th>쿠폰명<em class="required" title="필수"></em></th>
+											<td colspan="5">
+												<input type="text" name="cpnNm" id="cpnNm" style="width: 70%;" required="required" data-valid-name="쿠폰명">
+											</td>
+										</tr>
+										<tr>
+											<th>쿠폰유형<em class="required" title="필수"></em></th>
+											<td colspan="5">
+												<input type="hidden" id="cpnType" name="cpnType" required="required"  data-valid-name="쿠폰유형">
+												<label class="rdoBtn" th:if="${cpnTypeList}" th:each="oneData, status : ${cpnTypeList}"> <input type="radio" name="rdoCpnType"  th:text="${oneData.cdNm}" th:value="${oneData.cd}"/></label>
+											</td>
+										</tr>
+										<tr>
+											<th>사용가능고객구분<em class="required" title="필수"></em></th>
+											<td>
+												<select name="usableCustGb" id="usableCustGb" required="required" data-valid-name="사용가능고객구분">
+													<option th:if="${usableCustGbList}" th:each="oneData , status : ${usableCustGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+											<th>사이트<em class="required" title="필수"></em></th>
+											<td>
+												<select name="siteCd" id="siteCd" required="required" data-valid-name="사이트">
+													<option th:if="${siteCdList}" th:each="oneData , status : ${siteCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>사용고객등급구분<em class="required" title="필수"></em></th>
+											<td>
+												<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>
+											<th>만료알림여부<em class="required" title="필수"></em></th>
+											<td>
+												<select name="endAlimYn" id="endAlimYn" required="required" data-valid-name="만료알림여부">
+													<option value="Y">Y</option>
+													<option value="N" selected="selected">N</option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>할인방식<em class="required" title="필수"></em></th>
+											<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="구매제한금액" data-valid-type="numeric">원
+											</td>
+										</tr>
+										<tr>
+											<th>할인값(PC)<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" id="dcPval" name="dcPval" value="0" required="required" data-valid-name="할인값(PC)" data-valid-type="numeric" style="text-align: right"><span id="dcPvalSpan">원</span>
+											</td>
+											<th>할인값(모바일웹)<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" id="dcMval" name="dcMval" value="0" required="required" data-valid-name="할인값(모바일웹)" data-valid-type="numeric" style="text-align: right"><span id="dcMvalSpan">원</span>
+											</td>
+										</tr>
+										<tr>
+											<th>할인값(모바일앱)<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" id="dcAval" name="dcAval" value="0" required="required" data-valid-name="할인값(모바일앱)" data-valid-type="numeric" style="text-align: right"><span id="dcAvalSpan">원</span>
+											</td>
+											<th>최대할인금액<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" id="maxDcAmt" name="maxDcAmt" value="0" required="required" data-valid-name="최대할인금액" data-valid-type="numeric" style="text-align: right;"><span id="maxDcAmtSpan">원</span>
+											</td>
+										</tr>
+										<tr>
+											<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="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>
+												<select name="downStMM" id="downStMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											<th>다운로드종료일시<em class="required" title="필수"></em></th>
+											<td>
+												<input type="hidden" id="downEddt" name="downEddt" required="required" data-valid-name="다운로드종료일시">
+												<input type="text" class="schDate w100" name="downEdDay" id="downEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="downEdHH" id="downEdHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="downEdMM" id="downEdMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>기간/일수구분<em class="required" title="필수"></em></th>
+											<td>
+												<select name="pdGb" id="pdGb" onchange="pdGbChange(this)" required="required" data-valid-name="기간/일수구분">
+													<option value="P">기간</option>
+													<option value="D">일수</option>
+												</select>
+											</td>
+											<th>적용범위<em class="required" title="필수"></em></th>
+											<td>
+												<input type="hidden" name="applyScope" id="applyScope" required="required" data-valid-name="적용범위">
+												<label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="A"/>전체</label>
+												<label class="rdoBtn"> <input type="radio" name="rdoApplyScope" value="I"/>개별</label>
+											</td>
+										</tr>
+										<tr class="availDayTr" style="display: none;">
+											<th>유효기간일수<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" name="availDays" id="availDays" class="w200" data-valid-name="유효기간일수">
+											</td>
+										</tr>
+										<tr>
+											<th class="availDateTr">유효기간시작일시<em class="required" title="필수"></em></th>
+											<td class="availDateTr">
+												<input type="hidden" name="availStdt" id="availStdt" data-valid-name="유효기간시작일시">
+												<input type="text" class="schDate w100" name="availStDay" id="availStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="availStHH" id="availStHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="availStMM" id="availStMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											<th class="availDateTr">유효기간종료일시<em class="required" title="필수"></em></th>
+											<td class="availDateTr">
+												<input type="hidden" id="availEddt" name="availEddt" data-valid-name="유효기간종료일시">
+												<input type="text" class="schDate w100" name="availEdDay" id="availEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="availEdHH" id="availEdHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="availEdMM" id="availEdMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>첫구매여부<em class="required" title="필수"></em></th>
+											<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" 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>
+												</select>
+												<select name="buyStMM" id="buyStMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											<th class="buyDateTr">첫구매기간종료일시<em class="required" title="필수"></em></th>
+											<td class="buyDateTr">
+												<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>
+												</select>
+												<select name="buyEdMM" id="buyEdMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>신규회원여부<em class="required" title="필수"></em></th>
+											<td>
+												<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>
+											</td>
+											<th>총발행제한수량<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" name="totPubLimitQty" id="totPubLimitQty" value="0" required="required" data-valid-name="총발행제한수량" data-valid-type="numeric" style="text-align: right;">개<span class="cRed" id="totPubLimitQtySpan"> *제한없음</span>
+											</td>
+										</tr>
+										<tr>
+											<th class="custJoinDateTr">신규회원기간시작일시<em class="required" title="필수"></em></th>
+											<td class="custJoinDateTr">
+												<input type="hidden" name="custJoinStdt" id="custJoinStdt" data-valid-name="신규회원기간시작일시">
+												<input type="text" class="schDate w100" name="custJoinStDay" id="custJoinStDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="custJoinStHH" id="custJoinStHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="custJoinStMM" id="custJoinStMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											<th class="custJoinDateTr">신규회원기간종료일시<em class="required" title="필수"></em></th>
+											<td class="custJoinDateTr">
+												<input type="hidden" id="custJoinEddt" name="custJoinEddt" data-valid-name="신규회원기간종료일시">
+												<input type="text" class="schDate w100" name="custJoinEdDay" id="custJoinEdDay" maxlength="10" th:value="${#calendars.format(#calendars.createNow(), 'yyyy-MM-dd')}"/>
+												<select name="custJoinEdHH" id="custJoinEdHH">
+													<option th:if="${hhList}" th:each="oneData , status : ${hhList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+												<select name="custJoinEdMM" id="custJoinEdMM">
+													<option th:if="${mmList}" th:each="oneData , status : ${mmList}" th:text="${oneData.cdNm}" th:value="${oneData.cd}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>1인당발행제한수량<em class="required" title="필수"></em></th>
+											<td>
+												<input type="text" class="w200" name="custPubLimitQty" id="custPubLimitQty" value="0" required="required" data-valid-name="1인당발행제한수량" data-valid-type="numeric" style="text-align: right;">개<span class="cRed" id="custPubLimitQtySpan"> *제한없음</span>
+											</td>
+											<th>1회발행수량<em class="required" title="필수"></em></th>
+											<td><input type="text" class="w200" name="onePubQty" id="onePubQty" value="1" required="required" data-valid-name="1회발행수량" data-valid-type="numeric" style="text-align: right;">개</td>
+										</tr>
+										<tr>
+											<th>재발급여부<em class="required" title="필수"></em></th>
+											<td>
+												<select name="reissuance" id="reissuance" required="required" data-valid-name="재발급여부" >
+													<option th:if="${reissuanceList}" th:each="oneData , status : ${reissuanceList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+											<th>다운로드구분<em class="required" title="필수"></em></th>
+											<td>
+												<select name="dnGb" id="dnGb" required="required" data-valid-name="다운로드구분">
+													<option th:if="${dnGbList}" th:each="oneData , status:${dnGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr class="payTypeTr" style="display: none;">
+											<th>결제수단<em class="required" title="필수"></em></th>
+											<td colspan="5">
+												<select name="payType" id="payType" data-valid-name="결제수단">
+													<option value="">[전체]</option>
+													<option th:if="${payTypeList}" th:each="oneData , status : ${payTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+										</tr>
+										<tr>
+											<th>쿠폰상태<em class="required" title="필수"></em></th>
+											<td>
+												<select name="cpnStat" id="cpnStat" data-valid-name="쿠폰상태" required="required">
+													<option th:if="${cpnStatList}" th:each="oneData , status : ${cpnStatList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+											</td>
+											<th>제휴링크코드<em class="required" title="필수"></em></th>
+											<td>
+												<select name="afChannel" id="afChannel" onchange="fnChangeAfLinkCdList()" data-valid-name="제휴링크코드" required="required">
+													<option th:if="${upperAfLinkCdList}" th:each="oneData , status : ${upperAfLinkCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+												</select>
+												<select name="afLinkCd" id="afLinkCd">
+												</select>
+											</td>
+										</tr>
+									</tbody>
+								</table>
+								<div class="mdPopBtnB aR">
+									<button type="button" class="btn btn-info btn-lg" onclick="fnCouponCreate();" th:if="${mode == 'N'}">등록</button>
+									<button type="button" class="btn btn-info btn-lg" onclick="fnCouponUpdate();" th:if="${mode == 'U'}">수정</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>
+<script th:inline="javascript">
+	/*<![CDATA[*/
+	// 상세조회 리스트
+	var mode = [[${mode}]];
+	var cpnDetail = [[${cpnDetail}]];
+	var cpnDtlRefvalSupplyCompList = [[${cpnDtlRefvalSupplyCompList}]];
+	var cpnDtlRefvalApplyGoodsList = [[${cpnDtlRefvalApplyGoodsList}]];
+	var cpnDtlRefvalCateList = [[${cpnDtlRefvalCateList}]];
+	var cpnDtlRefvalBrandList = [[${cpnDtlRefvalBrandList}]];
+	var cpnDtlRefvalExceptGoodsList = [[${cpnDtlRefvalExceptGoodsList}]];
+	var cpnDtlBurdenList = [[${cpnDtlBurdenList}]];
+	var issueCnt = [[${issueCnt}]];
+
+	// 공통코드 리스트
+	var ibSupplyComList = gagajf.convertToArray([[${ibSupplyCompList}]]);
+	var formalGbList = gagajf.convertToArray([[${formalGbList}]]);
+	var cateGbList = gagajf.convertToArray([[${cateGbList}]]);
+	var delYnList = { "Y":"Yes", "N":"No" };
+	var siteCdList = gagajf.convertToArray([[${siteCdList}]]);
+	var selfBrandList = gagajf.convertToArray([[${selfBrandList}]]);
+
+	// 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); }
+		} ,
+		{ headerName: "쿠폰번호"  , field: "cpnId" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// 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'},
+		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// 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: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// 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: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// ag-grid 카테고리 컬럼
+	var cateSelColumnDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{ headerName: "사이트" , field: "siteCd" , width: 100 , cellClass: 'text-center' ,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(siteCdList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(siteCdList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(siteCdList, params.newValue); }
+		},
+		{ headerName: "카테고리구분" , field: "cateGb" , width: 100 , cellClass: 'text-center' ,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(cateGbList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(cateGbList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(cateGbList, params.newValue); }
+		},
+		{ headerName: "카테고리코드" , field: "cateNo" , width: 100 , cellClass: 'text-center'} ,
+		{ headerName: "카테고리명" , field: "cateNm" , width: 120 , cellClass: 'text-center'},
+		{ headerName: "이월/정상구분" , field: "formalGb" , width: 120 , cellClass: 'text-center',
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(formalGbList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(formalGbList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(formalGbList, params.newValue); }
+		},
+		{ headerName: "브랜드명" , field:"brandCd" , width:150, cellClass: "text-center", required: true ,
+			editable: true, cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(selfBrandList) },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(selfBrandList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(selfBrandList, params.newValue); }
+		},
+		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	// 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'} ,
+		{ headerName: "쿠폰대상일련번호"  , field: "cpnRefvalSq" , width: 120 , cellClass: 'text-center' , hide:true}
+	];
+
+	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('#CouponForm')) {
+			return false;
+		}
+
+		checkValidation();
+
+		mcxDialog.confirm('저장하시겠습니까?' , {
+			cancelBtnText:"취소",
+			sureBtnText:"확인",
+			sureBtnClick: function () {
+				gagajf.ajaxFormSubmit($('#CouponForm').prop('action'), '#CouponForm', function() {
+					uifnPopupClose('CouponRegForm');
+					$('#btnSearch').trigger('click');
+				});
+			}
+		});
+	}
+
+	// 쿠폰 수정 시
+	function fnCouponUpdate(){
+		// 필수값들 셋팅
+		setReqValue();
+		gagajf.removeCommaAtNumberFormattedInput('#CouponForm');
+		// 필수값 validation 체크
+		if (!gagajf.validation('#CouponForm')) {
+			return false;
+		}
+
+		checkValidation();
+
+		mcxDialog.confirm('수정하시겠습니까?' , {
+			cancelBtnText:"취소",
+			sureBtnText:"확인",
+			sureBtnClick: function () {
+				$("#CouponForm input[name=cpnId]").prop("disabled", false);
+				$("#CouponForm input[name=cpnId]").attr("required", true);
+				$("#CouponForm input[name=cpnId]").attr("placeholder", "");
+				$("#CouponForm input[name=cpnId]").attr("readonly", false);
+
+				gagajf.ajaxFormSubmit($('#CouponForm').prop('action'), '#CouponForm', function() {
+					uifnPopupClose('CouponRegForm');
+					$('#btnSearch').trigger('click');
+				});
+			}
+		});
+	}
+
+	function checkValidation(){
+		//신규가입 지급한다면 validation 체크
+		if( $('#custJoinYn option:selected').val() == "Y" ){
+			var fromDate = $('#CouponForm input[name=custJoinStdt]').val();
+			var toDate = $('#CouponForm input[name=custJoinEddt]').val();
+
+			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
+				mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#CouponForm input[name=custJoinStdt]').focus();
+					}
+				});
+				return false;
+			}
+
+			if (fromDate > toDate) {
+				mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#CouponForm input[name=custJoinEddt]').focus();
+					}
+				});
+				return false;
+			}
+		}
+
+		// 첫구매 지급하면 validation 체크
+		if( $('#firstYn option:selected').val() == "Y" ){
+			var fromDate = $('#CouponForm input[name=buyStdt]').val();
+			var toDate = $('#CouponForm input[name=buyEddt]').val();
+
+			if (gagajf.isNull(fromDate) || gagajf.isNull(toDate)) {
+				mcxDialog.alertC("신규가입기간 시작일자와 종료일자를 입력하세요.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#CouponForm input[name=buyStdt]').focus();
+					}
+				});
+				return false;
+			}
+
+			if (fromDate > toDate) {
+				mcxDialog.alertC("등록 시작일자는 종료일자 보다 클 수 없습니다.", {
+					sureBtnText: "확인",
+					sureBtnClick: function() {
+						$('#CouponForm input[name=buyEddt]').focus();
+					}
+				});
+				return false;
+			}
+		}
+
+		// 할인율 validation 체크 (100을 넘길수없음)
+		if($('#dcWay').val() == 'G240_11') {
+			if($('#dcPval').val() > 100) {
+				mcxDialog.alert('PC할인율은 100을 초과할수없습니다.');
+				$('#dcPval').focus();
+				return false;
+			} else if( $('#dcMval').val() > 100) {
+				mcxDialog.alert('모바일(웹)할인율은 100을 초과할수없습니다.');
+				$('#dcMval').focus();
+				return false;
+			}  else if( $('#dcAval').val() > 100) {
+				mcxDialog.alert('모바일(앱)할인율은 100을 초과할수없습니다.');
+				$('#dcAval').focus();
+				return false;
+			}
+		}
+	}
+
+	// 할인방식 변경
+	$("#CouponForm input[name=rdoDcWay]").bind('click change', function () {
+		var radioValue = $(this).val();
+		//발급이력이있으면 수정안됨
+		if(issueCnt > 0 ) {
+			return false;
+		}
+
+		if(radioValue == 'G240_10') {
+			$('#dcPvalSpan').text("원");
+			$('#dcMvalSpan').text("원");
+			$('#dcAvalSpan').text("원");
+		} else {
+			$('#dcPvalSpan').text("%");
+			$('#dcMvalSpan').text("%");
+			$('#dcAvalSpan').text("%");
+		}
+	});
+
+	// 쿠폰 상태 변경
+	$("#CouponForm input[name=rdoCpnType]").bind('click change', function () {
+		var radioValue = $(this).val();
+
+		if(mode == "U") {
+			radioValue = cpnDetail.cpnType;
+		}
+		// 상품쿠폰 선택시 적용범위 개별로 변경 나머진 전체
+		if(radioValue == 'G230_11') {
+			$("input:radio[name='rdoApplyScope']:radio[value='I']").prop('checked', true);
+		} else {
+			$("input:radio[name='rdoApplyScope']:radio[value='A']").prop('checked', true);
+		}
+
+		// 주문서 쿠폰 선택시 결제수단 노출
+		if(radioValue == 'G230_20') {
+			$('.payTypeTr').css('display' , '');
+			$('#CouponForm #payType').attr('required' , true);
+		} else {
+			$('.payTypeTr').css('display' , 'none');
+			$('#CouponForm #payType').attr('required' , false );
+		}
+
+		$('#CouponForm #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});
+			}
+		}
+	};
+
+	// 적용대상 - 브랜드 삭제 버튼시
+	$('#btnBrandDel').on('click' , function(){
+		brandGridOptions.api.updateRowData({remove:gagaAgGrid.selectedRowData(brandGridOptions)});
+	});
+
+	// 적용대상 - 공급처 추가 버튼시
+	$('#btnSupplyAdd').on('click' , function (){
+		cfnOpenCompanyListPopup("fnSetPopupComapnyInfo" , "M");
+	});
+
+	// 공급업체 설정 / 업체 추가 콜백함수
+	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});
+			}
+		}
+	};
+
+	// 적용대상 - 공급처 삭제시시
+	$('#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].cateNo == result[i].cateNo) {	addChk = false;	}		// 중복체크
+			}
+
+			// 중복되지 않은 데이터 리스트에 추가
+			if(addChk) {
+				gagaAgGrid.addRowData(cateGridOptions, {"siteCd":result[i].siteCd , "cateGb":result[i].cateGb , "cateNo":result[i].cateNo, "cateNm":result[i].cateNm , "formalGb":result[i].formalGb , "brandEnm":null});
+			}
+		}
+	}
+
+	// 적용대상 - 카테고리 삭제시
+	$('#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(result){
+		gridAddGoodsList(excepGoodsGridOptions, result , "except");
+	});
+
+	$('#btnExcepGoodsDel').on('click' , function () {
+		var selectVal = exceptGoodsGbList.api.getSelectedRows();
+
+		if(selectVal.length == 0) {
+			mcxDialog.alert("선택된 행이 없습니다");
+			return;
+		}
+
+		var removeVal = gagaAgGrid.removeRowData(exceptGoodsGbList , false);
+		var cpnRefvalSqArr = [];
+
+		$.each(selectVal , function(idx , item){
+			cpnRefvalSqArr.push(item.cpnRefvalSq);
+		});
+
+		if(removeVal.length > 0) {
+			mcxDialog.confirm('삭제하시겠습니까?', {
+				cancelBtnText: "취소",
+				sureBtnText: "확인",
+				sureBtnClick: function(){
+					var data = { cpnRefvalSqArr : cpnRefvalSqArr
+						,cpnId : $('#CouponForm #cpnId').val();
+					};
+
+					var jsonData = JSON.stringify(data);
+					gagajf.ajaxJsonSubmit('/marketing/coupon/refval/update', jsonData);
+				}
+			});
+		}
+	});
+
+	// 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});
+			}
+		}
+	}
+
+	// 기간 일수 변경시
+	function pdGbChange(pThis){
+		var selectVal = $(pThis).val();
+
+		if(typeof selectVal == "undefined") {
+			if(mode == "U") {
+				selectVal = cpnDetail.pdGb;
+			} else {
+				selectVal = "P";
+			}
+		}
+
+		if(selectVal == "P") {
+			$('.availDateTr').css('display' , '');
+			$('.availDayTr').css('display' , 'none');
+			$('#CouponForm #availDays').attr('required' , false);
+			$('#CouponForm #availStDay').attr('required' , true);
+			$('#CouponForm #availEdDay').attr('required' , true);
+			$('#CouponForm #availStdt').attr('required' , true);
+			$('#CouponForm #availEddt').attr('required' , true);
+		} else {
+			$('.availDateTr').css('display' , 'none');
+			$('.availDayTr').css('display' , '');
+			$('#CouponForm #availDays').attr('required' , true);
+			$('#CouponForm #availStDay').attr('required' , false);
+			$('#CouponForm #availEdDay').attr('required' , false);
+			$('#CouponForm #availStdt').attr('required' , false);
+			$('#CouponForm #availEddt').attr('required' , false);
+		}
+	}
+
+	// 첫구매여부 변경시
+	function firstYnChange(pThis){
+		var selectVal = $(pThis).val();
+
+		if(typeof selectVal == "undefined") {
+			if(mode == "U") {
+				selectVal = cpnDetail.firstYn;
+			} else {
+				selectVal = "N";
+			}
+		}
+
+		if(selectVal == "Y" ) {
+			$('.buyDateTr').css('display' , '');
+			$('#buyStdt').attr('required' , true);
+			$('#buyEddt').attr('required' , true);
+		} else {
+			$('.buyDateTr').css('display' , 'none');
+			$('#buyStdt').attr('required' , false);
+			$('#buyEddt').attr('required' , false);
+		}
+	}
+
+	// 신규회원여부 변경시
+	function custJoinYnChange(pThis){
+		var selectVal = $(pThis).val();
+
+		if(typeof selectVal == "undefined") {
+			if(mode == "U") {
+				selectVal = cpnDetail.custJoinYn;
+			} else {
+				selectVal = "N";
+			}
+		}
+
+		if(selectVal == "Y" ) {
+			$('.custJoinDateTr').css('display' , '');
+			$('#custJoinStdt').attr('required' , true);
+			$('#custJoinEddt').attr('required' , true);
+		} else {
+			$('.custJoinDateTr').css('display' , 'none');
+			$('#custJoinStdt').attr('required' , false);
+			$('#custJoinEddt').attr('required' , false);
+		}
+	}
+
+	// 행추가시
+	$('#btnAddRow').on('click' , function(){
+		var data = { supplyCompCd: null , burdenRate : null , delYn : null};
+		gagaAgGrid.addRowData(inComGridOptions , data , "supplyCompCd" );
+	});
+
+	// 쿠폰번호 자동생성 클릭시
+	function clickCreateChk(){
+		var flag = $('#CouponForm input[name=cpnCreateType]').prop("checked");
+		// 발급받은 이력이 있으면 수정 안됨
+		if(issueCnt > 0 ) {
+			return false;
+		}
+
+		if(!flag) {
+			$("#CouponForm input[name=cpnId]").prop("disabled", true);
+			$("#CouponForm input[name=cpnId]").attr("required", false);
+			$("#CouponForm input[name=cpnId]").attr("readonly", true);
+			$("#CouponForm input[name=cpnId]").attr("placeholder", "자동생성");
+			$('#CouponForm input[name=cpnCreateType]').prop("checked" , false);
+		} else{
+			$("#CouponForm input[name=cpnId]").prop("disabled", false);
+			$("#CouponForm input[name=cpnId]").attr("required", true);
+			$("#CouponForm input[name=cpnId]").attr("placeholder", "");
+			$("#CouponForm input[name=cpnId]").attr("readonly", false);
+			$('#CouponForm input[name=cpnCreateType]').prop("checked" , true);
+		}
+	}
+
+	// 제휴링크채널 수정 (제휴링크가 꼭필요한지 확인필요)
+	function fnChangeAfLinkCdList(){
+		var actionUrl = "/business/aflink/list" + '?' + $('#afChannel').serialize();
+		var tag = "";
+
+		$("#CouponForm #afLinkCd").children('option').remove();
+
+		gagajf.ajaxJsonSubmit(actionUrl, '', function(data) {
+			for (let i = 0; i < data.length; i++) {
+				if (data[i].useYn == 'Y') {
+					tag += '<option value="' + data[i].afLinkCd + '">[' + data[i].afLinkCd + '] ' + data[i].afLinkNm + '</option>';
+				}
+			}
+
+			$("#CouponForm #afLinkCd").append(tag);
+			$("#CouponForm #afLinkCd option:first").attr("selected" , "selected");
+
+		});
+	}
+
+	// 전송시 값 세팅
+	function setReqValue(){
+		// 쿠폰유형값 세팅
+		$('#CouponForm #cpnType').val($('#CouponForm input:radio[name="rdoCpnType"]:checked').val());
+		// 할인방식값 세팅
+		$('#CouponForm #dcWay').val($('#CouponForm input:radio[name="rdoDcWay"]:checked').val());
+		// 적용범위값 세팅
+		$('#CouponForm #applyScope').val($('#CouponForm input:radio[name="rdoApplyScope"]:checked').val());
+		// 다운로드기간 세팅
+		$('#CouponForm #downStdt').val($('#CouponForm #downStDay').val() + " " + $('#CouponForm #downStHH').val() + ":" + $('#CouponForm #downStMM').val() + ":00");
+		$('#CouponForm #downEddt').val($('#CouponForm #downEdDay').val() + " " + $('#CouponForm #downEdHH').val() + ":" + $('#CouponForm #downEdMM').val() + ":59");
+		// 유효기간 세팅
+		$('#CouponForm #availStdt').val($('#CouponForm #availStDay').val() + " " + $('#CouponForm #availStHH').val() + ":" + $('#CouponForm #availStMM').val() + ":00");
+		$('#CouponForm #availEddt').val($('#CouponForm #availEdDay').val() + " " + $('#CouponForm #availEdHH').val() + ":" + $('#CouponForm #availEdMM').val() + ":59");
+		// 첫구매기간세팅
+		$('#CouponForm #buyStdt').val($('#CouponForm #buyStDay').val() + " " + $('#CouponForm #buyStHH').val() + ":" + $('#CouponForm #buyStMM').val() + ":00");
+		$('#CouponForm #buyEddt').val($('#CouponForm #buyEdDay').val() + " " + $('#CouponForm #buyEdHH').val() + ":" + $('#CouponForm #buyEdMM').val() + ":59");
+		// 신규회원기간 세팅
+		$('#CouponForm #custJoinStdt').val($('#CouponForm #custJoinStDay').val() + " " + $('#CouponForm #custJoinStHH').val() + ":" + $('#CouponForm #custJoinStMM').val() + ":00");
+		$('#CouponForm #custJoinEddt').val($('#CouponForm #custJoinEdDay').val() + " " + $('#CouponForm #custJoinEdHH').val() + ":" + $('#CouponForm #custJoinEdMM').val() + ":59");
+		// 적용대상 - 공급처 그리드 전체값 세팅
+		var supplyAllData = gagaAgGrid.getAllRowData(supplyGridOptions);
+		var jsonSupplyCompData = JSON.stringify(supplyAllData);
+		$('#CouponForm #supplyCompList').val(jsonSupplyCompData);
+		// 적용대상 - 브랜드 그리드 전체값 세팅
+		var brandAllData = gagaAgGrid.getAllRowData(brandGridOptions);
+		var jsonBrandData = JSON.stringify(brandAllData);
+		$('#CouponForm #brandList').val(jsonBrandData);
+		// // 적용대상 - 카테고리 그리드 전체값 세팅
+		var cateAllData = gagaAgGrid.getAllRowData(cateGridOptions);
+		var jsonCateData = JSON.stringify(cateAllData);
+		$('#CouponForm #cateList').val(jsonCateData);
+		// 적용대상 - 적용상품 그리드 전체값 세팅
+		var goodsAllData = gagaAgGrid.getAllRowData(goodsGridOptions);
+		var jsonGoodsData = JSON.stringify(goodsAllData);
+		$('#CouponForm #applyGoodsList').val(jsonGoodsData);
+		// 적용대상 - 제외상품 그리드 전체값 세팅
+		var exceptGoodsAllData = gagaAgGrid.getAllRowData(excepGoodsGridOptions);
+		var jsonExceptGoodsData = JSON.stringify(exceptGoodsAllData);
+		$('#CouponForm #excepGoodsList').val(jsonExceptGoodsData);
+		// 입점업체분담율 그리드 전체값 세팅
+		var inCompBurdenAllData = gagaAgGrid.getAllRowData(inComGridOptions);
+		var jsonInCompBurdenData = JSON.stringify(inCompBurdenAllData);
+		$('#CouponForm #burdenList').val(jsonInCompBurdenData);
+
+	}
+
+	$(document).ready(function() {
+		gagaAgGrid.createGrid('inComGridList', inComGridOptions);
+		gagaAgGrid.createGrid('brandGridList', brandGridOptions);
+		gagaAgGrid.createGrid('cateGridList', cateGridOptions);
+		gagaAgGrid.createGrid('supplyGridList', supplyGridOptions);
+		gagaAgGrid.createGrid('goodsGridList', goodsGridOptions);
+		gagaAgGrid.createGrid('excepGoodsGridList', excepGoodsGridOptions);
+
+		// 초기화시 데이터 세팅
+		if (mode == "N") {
+			$('input[name=rdoCpnType]').eq(0).attr("checked", true);
+			$('input[name=rdoDcWay]').eq(0).attr("checked", true);
+			$('input[name=rdoApplyScope]').eq(0).attr("checked", true)
+			$('#CouponForm #availEdHH option:last').attr("selected", "selected");
+			$('#CouponForm #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");
+			$("#CouponForm #afChannel option:first").attr("selected" , "selected");
+		} else {
+			// 수정모드시 그리드 세팅
+			inComGridOptions.api.setRowData(cpnDtlBurdenList);
+			supplyGridOptions.api.setRowData(cpnDtlRefvalSupplyCompList);
+			goodsGridOptions.api.setRowData(cpnDtlRefvalApplyGoodsList);
+			excepGoodsGridOptions.api.setRowData(cpnDtlRefvalExceptGoodsList);
+			brandGridOptions.api.setRowData(cpnDtlRefvalBrandList);
+			cateGridOptions.api.setRowData(cpnDtlRefvalCateList);
+			// 기본정보 세팅
+			$("#CouponForm input:radio[name='rdoDcWay']:radio[value=" + cpnDetail.dcWay + "]").prop('checked', true);
+			$("#CouponForm input:radio[name='rdoCpnType']:radio[value=" + cpnDetail.cpnType + "]").prop('checked', true);
+			$("#CouponForm input:radio[name='rdoApplyScope']:radio[value=" + cpnDetail.applyScope + "]").prop('checked', true);
+			$("#CouponForm #dcPval").val(cpnDetail.dcPval.addComma());
+			$("#CouponForm #dcMval").val(cpnDetail.dcMval.addComma());
+			$("#CouponForm #dcAval").val(cpnDetail.dcAval.addComma());
+			$("#CouponForm #maxDcAmt").val(cpnDetail.maxDcAmt.addComma());
+			$("#CouponForm #totPubLimitQty").val(cpnDetail.totPubLimitQty.addComma());
+			$("#CouponForm #custPubLimitQty").val(cpnDetail.custPubLimitQty.addComma());
+			$("#CouponForm #onePubQty").val(cpnDetail.onePubQty.addComma());
+			$("#CouponForm #usableCustGb").val(cpnDetail.usableCustGb).prop("selected", true);
+			$("#CouponForm #usableCustGrade").val(cpnDetail.usableCustGrade).prop("selected", true);
+			$("#CouponForm #endAlimYn").val(cpnDetail.endAlimYn).prop("selected", true);
+			$("#CouponForm #firstYn").val(cpnDetail.firstYn).prop("selected", true);
+			$("#CouponForm #reissuance").val(cpnDetail.reissuance).prop("selected", true);
+			$("#CouponForm #dnGb").val(cpnDetail.dnGb).prop("selected", true);
+			$("#CouponForm #cpnStat").val(cpnDetail.cpnStat).prop("selected", true);
+			$("#CouponForm #custJoinYn").val(cpnDetail.custJoinYn).prop("selected", true);
+			$("#CouponForm #pdGb").val(cpnDetail.pdGb).prop("selected", true);
+			$("#CouponForm #siteCd").val(cpnDetail.siteCd).prop("selected", true);
+			$("#CouponForm #cpnNm").val(cpnDetail.cpnNm);
+			$("#CouponForm #downYn").val(cpnDetail.downYn);
+			$("#CouponForm #buyLimitAmt").val(cpnDetail.buyLimitAmt.addComma());
+			$("#CouponForm #cpnId").val(cpnDetail.cpnId);
+			// 만약 쿠폰 발급한 내역이 있으면 쿠폰수정못하게 readonly , disabled 속성 추가
+			if (issueCnt > 0) {
+				$("#CouponForm #usableCustGb").attr('readonly', true);
+				$("#CouponForm #usableCustGb").attr('disabled', true);
+				$("#CouponForm #usableCustGrade").attr('readonly', true);
+				$("#CouponForm #usableCustGrade").attr('disabled', true);
+				$("#CouponForm #endAlimYn").attr('readonly', true);
+				$("#CouponForm #endAlimYn").attr('disabled', true);
+				$("#CouponForm #firstYn").attr('readonly', true);
+				$("#CouponForm #firstYn").attr('disabled', true);
+				$("#CouponForm #reissuance").attr('readonly', true);
+				$("#CouponForm #reissuance").attr('disabled', true);
+				$("#CouponForm #dnGb").attr('readonly', true);
+				$("#CouponForm #dnGb").attr('disabled', true);
+				$("#CouponForm #custJoinYn").attr('readonly', true);
+				$("#CouponForm #custJoinYn").attr('disabled', true);
+				$("#CouponForm #pdGb").attr('readonly', true);
+				$("#CouponForm #pdGb").attr('disabled', true);
+				$("#CouponForm #downYn").attr('readonly', true);
+				$("#CouponForm #downYn").attr('disabled', true);
+				$("#CouponForm #siteCd").attr('readonly', true);
+				$("#CouponForm #siteCd").attr('disabled', true);
+				$("#CouponForm #cpnNm").attr('readonly', true);
+				$("#CouponForm #cpnNm").attr('disabled', true);
+				$("#CouponForm #dcPval").attr('readonly', true);
+				$("#CouponForm #dcPval").attr('disabled', true);
+				$("#CouponForm #dcMval").attr('readonly', true);
+				$("#CouponForm #dcMval").attr('disabled', true);
+				$("#CouponForm #dcAval").attr('readonly', true);
+				$("#CouponForm #dcAval").attr('disabled', true);
+				$("#CouponForm #maxDcAmt").attr('readonly', true);
+				$("#CouponForm #maxDcAmt").attr('disabled', true);
+				$("#CouponForm #totPubLimitQty").attr('readonly', true);
+				$("#CouponForm #totPubLimitQty").attr('disabled', true);
+				$("#CouponForm #custPubLimitQty").attr('readonly', true);
+				$("#CouponForm #custPubLimitQty").attr('disabled', true);
+				$("#CouponForm #onePubQty").attr('readonly', true);
+				$("#CouponForm #onePubQty").attr('disabled', true);
+				$("#CouponForm #downStDay").attr('readonly', true);
+				$("#CouponForm #downStDay").attr('disabled', true);
+				$("#CouponForm #downStHH").attr('readonly', true);
+				$("#CouponForm #downStHH").attr('disabled', true);
+				$("#CouponForm #downStMM").attr('readonly', true);
+				$("#CouponForm #downStMM").attr('disabled', true);
+				$("#CouponForm #buyLimitAmt").attr('readonly', true);
+				$("#CouponForm input:radio[name='rdoDcWay']").attr('readonly', true);
+				$("#CouponForm input:radio[name='rdoCpnType']").attr('readonly', true);
+				$("#CouponForm input:radio[name='rdoApplyScope']").attr('readonly', true);
+				$("#CouponForm .rdoBtn").css('cursor', 'auto');
+				$("#CouponForm #cpnId").attr('readonly', true);
+				$("#CouponForm #cpnId").attr('disabled', true);
+				$("#CouponForm input:checkbox[name='cpnCreateType']").attr('readonly', true);
+				$("#CouponForm input:checkbox[name='cpnCreateType']").attr('disabled', true);
+				$("#CouponForm input:checkbox[name=cpnCreateType]").attr('checked', true);
+				$("#CouponForm input:checkbox[name=cpnCreateType]").parent().addClass('checked');
+			}
+			// 다운로드기간 세팅
+			splitDate("start", cpnDetail.downStdt, "down");
+			splitDate("end", cpnDetail.downEddt, "down");
+			// 유효기간이 날짜인경우 날짜 세팅
+			if (cpnDetail.pdGb == "P") {
+				splitDate("start", cpnDetail.availStdt, "avail");
+				splitDate("end", cpnDetail.availEddt, "avail");
+				$("#CouponForm #availStDay").attr('readonly', true);
+				$("#CouponForm #availStDay").attr('disabled', true);
+				$("#CouponForm #availStHH").attr('readonly', true);
+				$("#CouponForm #availStHH").attr('disabled', true);
+				$("#CouponForm #availStMM").attr('readonly', true);
+				$("#CouponForm #availStMM").attr('disabled', true);
+			} else {
+				$("#CouponForm #availDays").val(cpnDetail.availDays);
+			}
+			// 첫구매여부 적용하는 경우 날짜 세팅
+			if (cpnDetail.firstYn == "Y") {
+				splitDate("start", cpnDetail.buyStdt, "buy");
+				splitDate("end", cpnDetail.buyEddt, "buy");
+				$("#CouponForm #buyStDay").attr('readonly', true);
+				$("#CouponForm #buyStDay").attr('disabled', true);
+				$("#CouponForm #buyStHH").attr('readonly', true);
+				$("#CouponForm #buyStHH").attr('disabled', true);
+				$("#CouponForm #buyStMM").attr('readonly', true);
+				$("#CouponForm #buyStMM").attr('disabled', true);
+			}
+			// 신규회원여부 적용하는 경우 날짜 세팅
+			if (cpnDetail.custJoinYn == "Y") {
+				splitDate("start", cpnDetail.custJoinStdt, "custJoin");
+				splitDate("end", cpnDetail.custJoinEddt, "custJoin");
+				$("#CouponForm #custJoinStDay").attr('readonly', true);
+				$("#CouponForm #custJoinStDay").attr('disabled', true);
+				$("#CouponForm #custJoinStHH").attr('readonly', true);
+				$("#CouponForm #custJoinStHH").attr('disabled', true);
+				$("#CouponForm #custJoinStMM").attr('readonly', true);
+				$("#CouponForm #custJoinStMM").attr('disabled', true);
+			}
+		}
+		pdGbChange();
+		firstYnChange();
+		custJoinYnChange();
+		fnChangeAfLinkCdList();
+	});
+
+	// 날짜분리 ( 시작/종료날짜구분(start , end) , 날짜String , 적용타겟대상 )
+	function splitDate(stedGb , date , targetGb ){
+		var str = date;
+		var dateStr = str.split(' ');
+		var timeArr = dateStr[1].split(':');
+
+		if(stedGb == "start") {
+			$("#CouponForm #"+targetGb+"StDay").val(dateStr[0]);
+			$("#CouponForm #"+targetGb+"StHH").val(timeArr[0]);
+			$("#CouponForm #"+targetGb+"StMM").val(timeArr[1]);
+		} else {
+			$("#CouponForm #"+targetGb+"EdDay").val(dateStr[0]);
+			$("#CouponForm #"+targetGb+"EdHH").val(timeArr[0]);
+			$("#CouponForm #"+targetGb+"EdMM").val(timeArr[1]);
+		}
+	}
+
+	$("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change(function(){
+		if($(this).val() == "0"){
+			$("#"+$(this).attr("name")+"Span").html("*제한없음");
+		}else{
+			$("#"+$(this).attr("name")+"Span").html("");
+		}
+		$("#"+$(this).attr("name")+"Span").css("color", "red");
+	});
+	setTimeout(function(){
+		$("input[name=totPubLimitQty],input[name=custPubLimitQty],input[name=buyLimitAmt],input[name=onePubQty]").change();
+	}, 1);
+
+	function setComma(formId, pBoolean){
+		setTimeout(function(){
+			//숫자타입 콤마 찍어주기
+			$("#"+formId+" [data-valid-type=numeric]").each(function(){
+				$(this).change(function(){
+					if(pBoolean){
+						$(this).val($(this).val().addComma());
+					}else{
+						$(this).val($(this).val().removeComma());
+					}
+				});
+				if(pBoolean){
+					$(this).val($(this).val().addComma());
+				}else{
+					$(this).val($(this).val().removeComma());
+				}
+			});
+		}, 300);
+	}
+
+	/*]]>*/
+</script>
+</html>

+ 3 - 3
src/main/webapp/ux/js/admin.popup.js

@@ -377,9 +377,9 @@ var cfnOpenPointDetailPopup = function(callbackfun, siteCd, custNo) {
  * @author : LMC
  */
 function cfnCouponCreatePopup(cpnId, callbackfun){
-	var actionUrl = "/marketing/coupon/popup/form";
-	if (typeof(callbackfun) != 'undefined') actionUrl += "?callBackFun=" + callbackfun;
-	cfnOpenModalPopup(actionUrl,'CouponCreatePopup');
+	var actionUrl = "/marketing/coupon/popup/form?cpnId=" + cpnId;
+	if (typeof(callbackfun) != 'undefined') actionUrl += "&callBackFun=" + callbackfun;
+	cfnOpenModalPopup(actionUrl,'CouponRegForm');
 }