Files
sake/src/main/webapp/WEB-INF/views/mngr/promtn/coupon/CouponDtlUpdtU.jsp
2025-12-18 14:23:23 +09:00

2098 lines
116 KiB
Plaintext

<%@ page import="java.util.Date" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="ui" uri="http://www.winbit.kr/ctl/ui"%>
<%--
Class Name : CouponDtlUpdtU.jsp
Description : 쿠폰 상세 수정 화면
Modification Information
수정일 수정자 수정내용
------- -------- ---------------------------
2023-11-28 추지훈 최초 생성
--%>
<!DOCTYPE html>
<html lang="ko">
<head>
<%@ include file="/WEB-INF/views/comm/mngr/Include.jsp"%>
<spring:eval expression="@environment.getProperty('currency-unit.default')" var="curUnit"/>
<script>
// 페이지 로딩시
$( document ).ready(function() {
$('input[name="goodsApplcDvCd"]:checked').click();
$('input[name="aditDscntCd"]:selected').each(function() {
$(this).click(); // 체크되어 있으면 클릭하여 해제
});
//사용환경이 오프라인 일 경우 혜택 설정의 혜택이 상품금액할인만 보이도록 수정
if($('input[name="useEnvrnCd"]:checked').val() ==='02'){
$('input[name="bnefDv"]').each(function () {
//오프라인 일경우 상품금액할인만 체크됨
if(!$(this).prop('checked')){
$(this).closest('.custom-radio').hide()
}
})
}else{
//그외일 경우 혜택구분이 장바구니일 경우 쿠폰 대상 hide 처리
if($('input[name="bnefDv"]:checked').val() ==='03'){
$('#couponForm5').hide();
}
}
// 라디오버튼 쿠폰수량 구분값에 따른 입력 제어
updateQylmttAtInput();
// 라디오버튼 유효기간 구분값에 따른 입력 제어
updateValidpdKndInput();
// 라디오버튼 배송비 구분값에 따른 입력 제어
updateDlvyAmtDscntDvInput();
// 라디오버튼 선정기준 구분값에 따른 입력 제어
updateApplcGoodsRadio();
// 체크박스 제외 상품/카테고리 DIV 제어
updateIssueGoodsCheckbox();
// 라디오버튼 혜택 구분값에 따른 하위영역 제어
updateDvradioDiv();
// 사용환경에 따른 pos 영역 제어
hidePosSectionRadio();
// 셀렉트박스 값에 따른 input 제어
updateDiscountInput();
// 타 쿠폰과 함께 사용 중복할인 제어
fn_otr_coupon_smtm_ctrl();
// 셀렉스박스 이벤트 change
$('#goodsDscntDv').on('change', function() {
updateDiscountInput();
});
// 셀렉트 박스 선택값에 따라 다른 input 을 보여주는 함수
function updateDiscountInput() {
var selectedValue = $('#goodsDscntDv').val();
// 이벤트 발생 시 제어
if (selectedValue === '02') {
$('#dscntAmtDiv').show();
$('#dscntMaxDiv').hide();
$('#aditDscntAmt').show();
$('#aditDscntRt').hide();
$('#aditDscntRt ').hide();
$('#aditDscntAmt').prop('disabled', false);
$('#aditDscntRt').prop('disabled', true);
$('#dscntMxmmAmt').prop('disabled', true);
} else if (selectedValue === '01') {
$('#dscntAmtDiv').hide();
$('#dscntMaxDiv').show();
$('#aditDscntAmt').hide();
$('#aditDscntRt').show();
$('#aditDscntAmt').prop('disabled', true);
$('#aditDscntRt').prop('disabled', false);
$('#dscntMxmmAmt').prop('disabled', false);
}
}
// 할인혜택
$('#bnefDvRadioDiv').on('change', function() {
updateDvradioDiv();
});
// 할인혜택 라디오버튼 제어 함수
function updateDvradioDiv() {
var radioValue = $('input[name="bnefDv"]:checked').val();
if (radioValue === "01" || radioValue === "03") {
$('#aditDscntAmt').prop('disabled', false);
$('#aditDscntRt').prop('disabled', false);
$('#dscntMxmmAmt').prop('disabled', false);
$('#dlvyAmtMxmmDscntAmt').prop('disabled', true);
$('#dlvyAmtDscntAmt').prop('disabled', true);
$('#dlivyDv').hide();
$('#goodsDv').show();
$('#issueGoodsSec').show();
$('.notall').find('input').prop('disabled', false);
if (radioValue === "03") {
// $('.notall').find('input').prop('disabled', true);
$('#issueGoodsSec').hide();
$('.goodsOnly').hide();
$('.goodsOnly').prop('disabled', true);
$('#couponForm5').hide();
$('#couponForm5').prop('disabled', true);
$('#usePosblAllAmtSec').hide();
$('#usePosblAllAmt').val(0);
$('#r-29').prop('checked', true);
} else {
$('.goodsOnly').show();
$('.goodsOnly').prop('disabled', false);
$('#couponForm5').show();
$('#couponForm5').prop('disabled', false);
$('#usePosblAllAmtSec').show();
}
} else if (radioValue === "02") {
$('#aditDscntAmt').prop('disabled', true);
$('#aditDscntRt').prop('disabled', true);
$('#dscntMxmmAmt').prop('disabled', true);
$('#usePosblAllAmtSec').hide();
$('#usePosblAllAmt').val(0);
$('#r-29').prop('checked', true);
var dlvyValue = $('input[name="dlvyAmtDscntDv"]:checked').val();
if (dlvyValue === "01") {
$('#dlvyAmtMxmmDscntAmt').prop("disabled", false);
$('#dlvyAmtDscntAmt').prop("disabled", true);
} else if (dlvyValue === "02") {
$('#dlvyAmtMxmmDscntAmt').prop("disabled", true);
$('#dlvyAmtDscntAmt').prop("disabled", false);
}
$('#dlivyDv').show();
$('#goodsDv').hide();
$('.notall').find('input').prop('disabled', false);
$('#issueGoodsSec').show();
$('.goodsOnly').hide();
$('.goodsOnly').prop('disabled', true);
}
};
// 수량제한
$('#radioQyLmttAt').on('change', function() {
updateQylmttAtInput();
});
// 수량제한 라디오버튼 제어 함수
function updateQylmttAtInput() {
var radioValue = $('input[name="qyLmttAt"]:checked').val();
if (radioValue === "N") {
$('#lmttQy').prop("disabled", true);
} else if (radioValue === "Y") {
$('#lmttQy').prop("disabled", false);
}
}
// 유효기간
$('#radioValidpdknd').on('change', function() {
updateValidpdKndInput();
});
// 유효기간 라디오버튼 제어 함수
function updateValidpdKndInput() {
var radioValue = $('input[name="validpdKnd"]:checked').val();
if (radioValue === "01") {
$('#validpdBgnDt').prop("disabled", false);
$('#validpdEndDt').prop("disabled", false);
$('#validpdDeCnt').prop("disabled", true);
$('#validpdBgnDtTime').prop("disabled", false);
$('#validpdEndDtTime').prop("disabled", false);
} else if (radioValue === "02") {
$('#validpdBgnDt').prop("disabled", true);
$('#validpdEndDt').prop("disabled", true);
$('#validpdDeCnt').prop("disabled", false);
$('#validpdBgnDtTime').prop("disabled", true);
$('#validpdEndDtTime').prop("disabled", true);
}
}
// 배송비
$('#radioDlvyAmtDscntDv').on('change', function() {
updateDlvyAmtDscntDvInput();
});
// 배송비 라디오버튼 제어 함수
function updateDlvyAmtDscntDvInput() {
var radioValue = $('input[name="dlvyAmtDscntDv"]:checked').val();
if (radioValue === "01") {
$('#dlvyAmtMxmmDscntAmt').prop("disabled", false);
$('#dlvyAmtDscntAmt').prop("disabled", true);
} else if (radioValue === "02") {
$('#dlvyAmtMxmmDscntAmt').prop("disabled", true);
$('#dlvyAmtDscntAmt').prop("disabled", false);
}
}
// 선정 기준 라디오 버튼 제어
$('#radioGoodsCtgryLmttDv').change(function() {
updateApplcGoodsRadio();
});
// 선정 기준 라디오 버튼 제어 함수
function updateApplcGoodsRadio() {
var radioValue = $('input[name="goodsCtgryLmttDv"]:checked').val();
if (radioValue === "01") {
$('#allDiv :input').prop('disabled', false);
$('#issueDiv :input').prop('disabled', true);
} else if (radioValue === "02") {
$('#issueDiv :input').prop('disabled', false);
$('#allDiv :input').prop('disabled', true);
}
}
// 선정 기준 라디오버튼 제어
$('#exclIssueGoodsCheckbox').change(function() {
updateIssueGoodsCheckbox();
});
// 선정 기준 제어 함수
function updateIssueGoodsCheckbox() {
var checkboxValue = $('#exclIssueGoodsCheckbox').prop('checked');
var checkedDiv = $('#exclIssueGoodsDiv');
// 체크 여부에 따라 DIV 제어
if (checkboxValue) {
$('#exclIssueGoodsDiv :input').prop('disabled', false); // 활성화
} else {
$('#exclIssueGoodsDiv :input').prop('disabled', true); // 비활성화
}
};
// 사용환경에 따른 pos 영역 제어
$('#radioUseEnvrnCd').change(function() {
hidePosSectionRadio();
})
// 사용환경에 따른 pos 영역 제어
function hidePosSectionRadio() {
var useEnvrnCdValue = $('input[name="useEnvrnCd"]:checked').val();
// 오프라인
if (useEnvrnCdValue === "02" || useEnvrnCdValue === "03") {
$('#posSection').show();
$('#bnefSection').hide();
$('.otherSection').hide();
const enArr = $('#posSection');
const bnefArea = $('#bnefSection');
const otherArea = $('.otherSection');
const propUpdate = function(selector, bool) {
const boolean = bool;
$(selector).eq(0).find('input, select').each(function() {
let type = this.type;
let tag = this.tagName.toLowerCase();
if (type === 'checkbox') {
this.disabled = boolean;
}
let checkedRows = $('#posTable input[type="checkbox"]:checked').closest('tr');
checkedRows.find('input, select').prop('disabled', false);
checkedRows.find('.nice-select').removeAttr('disabled').removeClass('disabled');
});
};
if (enArr != null && enArr.length > 0) {
const isFalse = false;
for (let idx = 0; idx < enArr.length; idx++) {
propUpdate.call(this, enArr[idx], isFalse);
}
}
const propUpdate2 = function (selector, bool) {
const boolean = bool;
$(selector).find('input, select').each(function () {
let type = this.type;
let tag = this.tagName.toLowerCase();
if (type === 'text' || tag === 'textarea' || type === 'checkbox' || type === 'radio') {
this.disabled = boolean;
} else if (tag === 'select') {
this.disabled = boolean;
$(this).niceSelect('update');
}
});
};
// if (useEnvrnCdValue === "02") { // TODO : ( 2024-12-30 ) 오프라인도 혜택이 필요해서 주석처리
// if (bnefArea != null && bnefArea.length > 0) {
// const isTrue = true;
// for (let idx = 0; idx < bnefArea.length; idx++) {
// propUpdate2.call(this, bnefArea[idx], isTrue);
// }
// }
// if (otherArea != null && otherArea.length > 0) {
// const isTrue = true;
// for (let idx = 0; idx < otherArea.length; idx++) {
// propUpdate2.call(this, otherArea[idx], isTrue);
// }
// }
// }
$('#온라인01').prop('disabled', true);
}
if (useEnvrnCdValue === "01" || useEnvrnCdValue === "02" || useEnvrnCdValue === "03") {
// 온라인 선택시 pos 연동 체크박스 모두 해제
<%-- var checkBoxAll = true;
$('#posTbody tr').each(function() {
console.log("체크박스 해제", $(this));
if (!$(this).find('#posCheckbox').prop('checked')) {
console.log("체크박스 해제", $(this));
checkBoxAll = false;
$('input[type="checkbox"]').prop('checked', checkBoxAll);
const tr = $('#posTable input[type="checkbox"]').closest('tr');
const hd = tr.find('#posHdqrtrsCd');
const cd = tr.find('#posCouponCd');
const year = tr.find('#year1');
const select = tr.find('.nice-select');
if ($('#posTable input[type="checkbox"]').prop('checked')) {
tr.removeAttr('disabled').removeClass('disabled');
hd.removeAttr('disabled').removeClass('disabled');
cd.removeAttr('disabled').removeClass('disabled');
year.removeAttr('disabled').removeClass('disabled');
select.removeAttr('disabled').removeClass('disabled');
} else {
tr.attr('disabled', 'disabled').addClass('disabled');
hd.attr('disabled', 'disabled').addClass('disabled');
cd.attr('disabled', 'disabled').addClass('disabled');
year.attr('disabled', 'disabled').addClass('disabled');
select.attr('disabled', 'disabled').addClass('disabled');
cd.val(null);
}
}
}); --%>
// 쿠폰 수량 제어
var radioValue = $('input[name="qyLmttAt"]:checked').val();
if (radioValue === "N") {
$('#lmttQy').prop("disabled", true);
} else if (radioValue === "Y") {
$('#lmttQy').prop("disabled", false);
}
// 유효기간 제어
var radioValue = $('input[name="validpdKnd"]:checked').val();
if (radioValue === "01") {
$('#validpdBgnDt').prop("disabled", false);
$('#validpdEndDt').prop("disabled", false);
$('#validpdDeCnt').prop("disabled", true);
$('#validpdBgnDtTime').prop("disabled", false);
$('#validpdEndDtTime').prop("disabled", false);
} else if (radioValue === "02") {
$('#validpdBgnDt').prop("disabled", true);
$('#validpdEndDt').prop("disabled", true);
$('#validpdDeCnt').prop("disabled", false);
$('#validpdBgnDtTime').prop("disabled", true);
$('#validpdEndDtTime').prop("disabled", true);
}
// 배송비 disabled 제어
var radioValue = $('input[name="dlvyAmtDscntDv"]:checked').val();
if (radioValue === "01") {
$('#dlvyAmtMxmmDscntAmt').prop("disabled", false);
$('#dlvyAmtDscntAmt').prop("disabled", true);
} else if (radioValue === "02") {
$('#dlvyAmtMxmmDscntAmt').prop("disabled", true);
$('#dlvyAmtDscntAmt').prop("disabled", false);
}
// 금액 비율 disabled 제어
var selectedValue = $('#goodsDscntDv').val();
// 이벤트 발생 시 제어
if (selectedValue === '02') {
$('#dscntAmtDiv').show();
$('#dscntMaxDiv').hide();
$('#aditDscntAmt').show();
$('#aditDscntRt').hide();
$('#aditDscntRt ').hide();
$('#aditDscntAmt').prop('disabled', false);
$('#aditDscntRt').prop('disabled', true);
$('#dscntMxmmAmt').prop('disabled', true);
} else if (selectedValue === '01') {
$('#dscntAmtDiv').hide();
$('#dscntMaxDiv').show();
$('#aditDscntAmt').hide();
$('#aditDscntRt').show();
$('#aditDscntAmt').prop('disabled', true);
$('#aditDscntRt').prop('disabled', false);
$('#dscntMxmmAmt').prop('disabled', false);
}
var radioValue = $('input[name="bnefDv"]:checked').val();
if (radioValue === "01" || radioValue === "03") {
$('#aditDscntAmt').prop('disabled', false);
$('#aditDscntRt').prop('disabled', false);
$('#dscntMxmmAmt').prop('disabled', false);
$('#dlvyAmtMxmmDscntAmt').prop('disabled', true);
$('#dlvyAmtDscntAmt').prop('disabled', true);
$('#dlivyDv').hide();
$('#goodsDv').show();
} else if (radioValue === "02") {
$('#aditDscntAmt').prop('disabled', true);
$('#aditDscntRt').prop('disabled', true);
$('#dscntMxmmAmt').prop('disabled', true);
var dlvyValue = $('input[name="dlvyAmtDscntDv"]:checked').val();
if (dlvyValue === "01") {
$('#dlvyAmtMxmmDscntAmt').prop("disabled", false);
$('#dlvyAmtDscntAmt').prop("disabled", true);
} else if (dlvyValue === "02") {
$('#dlvyAmtMxmmDscntAmt').prop("disabled", true);
$('#dlvyAmtDscntAmt').prop("disabled", false);
}
$('#dlivyDv').show();
$('#goodsDv').hide();
}
$('#posSection').hide();
$('#bnefSection').show();
$('.otherSection').show();
<%-- $('#bnefSection input').each(function() {
$(this).prop('disabled', false);
});
$('.otherSection input').each(function() {
$(this).prop('disabled', false);
}); --%>
<%-- // 온라인 선택시 pos 연동 체크박스 모두 해제
$('posTbody input').each(function() {
console.log("체크박스 해제", $(this));
$('posTbody input[type="checkbox"]').prop('checked', false);
}); --%>
if (useEnvrnCdValue === "01") {
// pos 영역 disabled 처리
const disArr = $('#posSection');
const propUpdate = function(selector, bool) {
const boolean = bool;
$(selector).eq(0).find('input, select').each(function() {
let type = this.type;
let tag = this.tagName.toLowerCase();
if (type === 'text' || tag === 'textarea' || type === 'checkbox' || type === 'radio') {
this.disabled = boolean;
} else if (tag === 'select') {
this.disabled = boolean;
$(this).niceSelect('update');
}
});
};
if (disArr != null && disArr.length > 0) {
const isTrue = true;
for (let idx = 0; idx < disArr.length; idx++) {
propUpdate(disArr[idx], isTrue);
}
}
$('#오프라인02').prop('disabled', true);
$('#온\\/오프라인03').prop('disabled', true);
}
// 온/오프라인
}
if (useEnvrnCdValue === "03") {
$('#posSection').show();
$('#bnefSection').show();
$('.otherSection').show();
}
if (useEnvrnCdValue === "02") {
$('#posSection').show();
$('#bnefSection').show();
$('.otherSection').show();
}
};
// 적용상품 체크박스 제어
$('#exclIssueGoodsCheckbox').change(function() {
updateIssueGoodsCheckbox();
});
function updateIssueGoodsCheckbox() {
var checkboxValue = $('#exclIssueGoodsCheckbox').prop('checked');
// div 영역 선택
var checkedDiv = $('#exclIssueGoodsDiv');
if (checkboxValue) {
$('#exclIssueGoodsDiv :input').prop('disabled', false);
} else {
$('#exclIssueGoodsDiv :input').prop('disabled', true);
}
};
// 연동된 pos 코드에 쿠폰코드 할당 ( 상세수정 only )
$('input[id="posCouponCd"]').each(function() {
var value = $(this).val();
var checkbox = $(this).closest('tr').find('input[type="checkbox"]');
if (value && value.trim() !== "") {
checkbox.prop('checked', true);
const tr = $(this).closest('tr');
const hd = tr.find('#posHdqrtrsCd');
const cd = tr.find('#posCouponCd');
const year = tr.find('#year1');
const select = tr.find('.nice-select');
tr.removeAttr('disabled').removeClass('disabled');
hd.removeAttr('disabled').removeClass('disabled');
cd.removeAttr('disabled').removeClass('disabled');
year.removeAttr('disabled').removeClass('disabled');
select.removeAttr('disabled').removeClass('disabled');
}
});
// 전체 체크 박스 tr, input, select 제어
$('#posTable thead th input[type="checkbox"]').on('change', function() {
var isChecked = $(this).prop('checked');
// tr 반복
$('#posTable tbody tr').each(function() {
if ( isChecked ) {
$('#posTable thead th input[type="checkbox"]').prop('checked', true);
} else {
$('#posTable thead th input[type="checkbox"]').prop('checked', false);
}
if (isChecked) {
$(this).removeAttr('disabled').removeClass('disabled');
} else {
$(this).attr('disabled', 'disabled').addClass('disabled');
}
// 체크박스를 제외한 input, select 찾아서 반복
$(this).find('#posHdqrtrsCd, #year1, .nice-select').each(function() {
if (isChecked) {
$(this).removeAttr('disabled').removeClass('disabled');
} else {
$(this).attr('disabled', 'disabled').addClass('disabled');
}
});
$(this).find('#posCouponCd').each(function() {
if (isChecked) {
$(this).removeAttr('disabled').removeClass('disabled');
} else {
$(this).attr('disabled', 'disabled').addClass('disabled');
}
});
});
});
// pos 연동 체크박스에 따라 disable 처리 제어
$('#posTable input[type="checkbox"]').on('change', function() {
const tr = $(this).closest('tr');
const hd = tr.find('#posHdqrtrsCd');
const cd = tr.find('#posCouponCd');
const year = tr.find('#year1');
const select = tr.find('.nice-select');
if ($(this).prop('checked')) {
tr.removeAttr('disabled').removeClass('disabled');
hd.removeAttr('disabled').removeClass('disabled');
cd.removeAttr('disabled').removeClass('disabled');
year.removeAttr('disabled').removeClass('disabled');
select.removeAttr('disabled').removeClass('disabled');
} else {
tr.attr('disabled', 'disabled').addClass('disabled');
hd.attr('disabled', 'disabled').addClass('disabled');
cd.attr('disabled', 'disabled').addClass('disabled');
year.attr('disabled', 'disabled').addClass('disabled');
select.attr('disabled', 'disabled').addClass('disabled');
// cd.val(null);
}
});
// 모두 체크되었을 경우 전체 체크, 체크 해제되었을 경우 전체 체크 해제
// 전체 체크박스 상태 확인
$('#posTbody').on('click', '.posList input[type="checkbox"]', function() {
var checkBoxAll = true;
// 개별 체크박스 반복
$('#posTbody tr').each(function() {
// 개별 체크박스 해제시 상태 변경
if (!$(this).find('#posCheckbox').prop('checked')) {
checkBoxAll = false;
}
});
// 전체 체크박스 체크 해제
$('.check-all input[type="checkbox"]').prop('checked', checkBoxAll);
});
/* 카테고리 조회 이벤트 */
$(document).on('click', '.category-select', function () {
const upperCtgryId = $(this).val(); // 상위카테고리
const currCtgryDepth = $(this).attr('id').replace('ctgryDepth', '');
const targetDepth = (parseInt(currCtgryDepth) + 1);
const targetCtgryId = 'ctgryDepth' + targetDepth;
if (fn_is_empty(upperCtgryId)) {
for (let i = targetDepth; i < 5; i++) {
$('#section01').find('#ctgryDepth' + i).empty();
}
} else {
fn_get_goods_ctgry(upperCtgryId, targetCtgryId);
}
// 1차 카테고리 선택 하위 비우기
if (currCtgryDepth == 1) {
for (let i = 2; i < 5; i++) {
$('#section01').find('#ctgryDepth' + i).empty();
}
}
// 2차 카테고리 선택 하위 비우기
if (currCtgryDepth == 2) {
for (let i = 3; i < 5; i++) {
$('#section01').find('#ctgryDepth' + i).empty();
}
}
// 3차 카테고리 선택 하위 비우기
if (currCtgryDepth == 3) {
for (let i = 4; i < 5; i++) {
$('#section01').find('#ctgryDepth' + i).empty();
}
}
$('#section01').find('#ctgryId').val(upperCtgryId);
});
/* 카테고리 선택 이벤트 */
$('#selectCategoriesBtn').on('click', function (event) {
event.preventDefault();
const target = event.target;
let selectedCategories = [];
const depth1Selected = $('#ctgryDepth1 option:selected');
const depth2Selected = $('#ctgryDepth2 option:selected');
const depth3Selected = $('#ctgryDepth3 option:selected');
const depth4Selected = $('#ctgryDepth4 option:selected');
if (depth4Selected.length > 0) {
depth4Selected.each(function () {
let categoryPath = depth1Selected.text() + ' > ' + depth2Selected.text() + ' > ' + depth3Selected.text() + ' > ' + $(this).text();
let ctgryId = $(this).val();
selectedCategories.push({ path: categoryPath, id: ctgryId });
});
} else if (depth3Selected.length > 0) {
depth3Selected.each(function () {
let categoryPath = depth1Selected.text() + ' > ' + depth2Selected.text() + ' > ' + $(this).text();
let ctgryId = $(this).val();
selectedCategories.push({ path: categoryPath, id: ctgryId });
});
} else if (depth2Selected.length > 0) {
depth2Selected.each(function () {
let categoryPath = depth1Selected.text() + ' > ' + $(this).text();
let ctgryId = $(this).val();
selectedCategories.push({ path: categoryPath, id: ctgryId });
});
} else if (depth1Selected.length > 0) {
depth1Selected.each(function () {
let categoryPath = $(this).text();
let ctgryId = $(this).val();
selectedCategories.push({ path: categoryPath, id: ctgryId });
});
}
// 선택한 카테고리를 테이블에 추가
let $tableBody = $('#selectedCategoriesTable tbody');
// $tableBody.empty(); // 기존 내용을 지움
selectedCategories.forEach((category, index) => {
let $row = $('<tr></tr>');
let $radioTd = $('<td></td>');
let $radioDiv = $('<div>적용</div>');
let $radioInput = $('<input type="hidden" id="r-' + index + '" name="reprsntCtgryId" value="' + category.id + '">');
$radioDiv.append($radioInput) // .append($radioLabel);
$radioTd.append($radioDiv);
let $categoryTd = $('<td class="left"></td>').text(category.path).attr('data-value', category.id);
let $deleteTd = $('<td></td>');
let $deleteBtn = $('<button class="circle-btn delete"><span class="visually-hidden">삭제</span></button>');
$deleteTd.append($deleteBtn);
$row.append($radioTd).append($categoryTd).append($deleteTd);
$tableBody.append($row);
// 마지막 항목을 기본으로 선택
if (index === index) {
$radioInput.prop('checked', true);
}
// 삭제 버튼에 클릭 이벤트 추가
$deleteBtn.on('click', function () {
$(this).closest('tr').remove();
});
});
});
/**
* 타 쿠폰과 함께 사용 변경 제어
*/
$('input[name="otrCouponSmtmUseAt"]').on('change', function() {
fn_otr_coupon_smtm_ctrl();
});
}); // document.ready end
/* ********************************************************
* 카테고리 조회 AJAX
******************************************************** */
const fn_get_goods_ctgry = function(upperCtgryId, targetCtgryId) {
$.ajax({
type : 'post',
url : '<c:url value="/admin/sys/ctgry/selectGoodsCategoryList"/>',
data : {
'upperCtgryId': upperCtgryId
},
success : function(data) {
if (data.resBody != null) {
const result = JSON.parse(data.resBody.result);
const goodsCategoryList = result.goodsCategoryList;
if (goodsCategoryList.length > 0) {
$('#section01').find('#' + targetCtgryId).empty();
for (let i=0; i < goodsCategoryList.length; i++) {
const goodsCategory = goodsCategoryList[i];
$('#section01').find('#' + targetCtgryId).append('<option value="' + goodsCategory.ctgryId + '">' + goodsCategory.ctgryNm + '</option>');
}
$('#section01').find('#' + targetCtgryId).niceSelect('update');
}
}
},
error: function(data) {
fn_proc_error_message(data);
}
});
}
/**
* 쿠폰 조회
*/
function fn_select_coupon_list() {
$('.listForm').attr('action', '<c:url value="/mngr/promtn/coupon/selectCouponListInqireForm"/>');
$('.listForm').attr('method', 'post');
$('.listForm').submit();
};
/**
* 쿠폰 수정
*/
const fn_update = function() {
data = $('.listForm').serialize();
console.log(data);
if (confirm('쿠폰을 <spring:message code="confirm.common.update"/>')) {
$.ajax({
type: "post",
url : "/mngr/promtn/coupon/updateCouponUpdt",
data : data,
success:function(result) {
if(result.resBody != null) {
// 응답객체 선언
const resBody = result.resBody;
// 객체 -> JSON 파싱
const parsedResult = JSON.parse(resBody.result);
// 파싱값에 데이터가 있으면 실행
if (parsedResult.couponInnb != null) {
alert('<spring:message code="success.common.insert"/>');
// 상세 수정 호출
// fn_move_dtlupdt(parsedResult.couponInnb);
location.reload();
} else {
alert('<spring:message code="fail.common.update"/>');
location.reload();
}
}
}
});
}
};
/**
* 쿠폰 상세 수정 이동
*/
function fn_move_dtlupdt(couponInnb) {
$('.listForm').attr('action', '<c:url value="/mngr/promtn/coupon/selectCouponDtlUpdtForm"/>');
$('.listForm').attr('method', 'post');
$('#couponInnb').val(couponInnb);
$('#pageIndex').val(1);
$('.listForm').submit();
}
/************************************************************
* 숫자 혹은 영어만 입력
*************************************************************/
function validateInputNotKorean(thisVlaue) {
if (/[ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/.test(thisVlaue.value)) {
alert('한글은 입력할 수 없습니다.');
thisVlaue.value = thisVlaue.value.replace(/[ㄱ-ㅎ|ㅏ-ㅣ|가-힣]/g, '');
}
thisVlaue.value = thisVlaue.value.replace(/[^a-zA-Z0-9]/g, '');
}
/* ********************************************************
* 상품 검색 팝업 > 상품 목록 조회
******************************************************** */
const fn_goods_search_popup_list = function (pageIndex,selected) {
let dataStr;
if (!pageIndex) {
$('#pageIndex').val(1);
} else {
$('#pageIndex').val(pageIndex);
}
$('#popupListForm').find('input[name=pageIndex]').eq(0).val(pageIndex);
const popupListForm = $("#popupListForm").serialize();
$.ajax({
type: "post",
url: "<c:url value="/mngr/goods/goodsmngr/selectGoodsSrchPopupList"/>",
data: popupListForm,
success: function (resultHtml) {
$('#goodsList').empty();
$('#goodsList').html(resultHtml);
}
});
}
/* ********************************************************
* 상품 검색 팝업 배열 값 불러오기
******************************************************** */
var selected = [];
function fn_select_goods_search() {
selected = [];
$('#appendList tr').each(function() {
const goodsId = $(this).attr('id').replace('choiseListId', '');
const goodsImg = $(this).find('input[name="goodsImgCours"]').val();
const goodsNm = $(this).find('input[name="goodsNm"]').val();
const goodsPrice = $(this).find('input[name="slepric"]').val();
const goodsSttusNm = $(this).find('input[name="goodsSttusNm"]').val();
selected.push({
goodsId: goodsId,
goodsImg: goodsImg,
goodsNm: goodsNm,
goodsPrice: goodsPrice,
goodsSttusNm: goodsSttusNm
});
});
// 각 화면에 맞춰서 HTML 변경 START
var tableBody = $("#parentGoodsContainer");
tableBody.empty();
var curUnit = '${curUnit}';
selected.forEach((good, index) => {
var productHtml = `
<div class="product-group__item">
<input type="hidden" id="relatedGoodsId" name="relatedGoodsId" value="` + good.goodsId+ `">
<span class="product-group__item-number">` + (index + 1) + `</span>
<div class="product-group__image">
<img src="` + good.goodsImg+ `" width="140" alt="` + good.goodsNm+ `">
</div>
<div class="product-group__description">
<p>` + good.goodsNm+ `</p>
<p class="product-group__description-price">` + good.goodsPrice + curUnit + `</p>
</div>
</div>
`;
tableBody.append(productHtml);
});
// 각 화면에 맞춰서 HTML 변경 END
fn_close_modal('product-search');
}
/*********************************************************************
* 인증번호 확인 모달
* *******************************************************************/
const fn_open_crtnb_list = function (modalDivSltr, modalSlrt, url, couponInnb) {
$.ajax({
type: 'POST',
url: url,
data : {
couponInnb : couponInnb
},
success: function (data) {
$(modalSlrt).remove();
$(modalDivSltr).html(data);
$(modalSlrt).modal();
}
});
}
/**
* 인증번호 조회
*/
const fn_select_offline_coupon_list = function(pageIndex, pageUnit) {
let dataStr;
if(!pageIndex) {
$('#pageIndexOff').val(1);
} else {
$('#pageIndexOff').val(pageIndex);
}
if(!pageUnit) {
dataStr = $('#offlineCouponListForm').serialize();
} else {
if($('#pageUnitOff').length){
$('#pageUnitOff').val(pageUnit);
dataStr = $('#offlineCouponListForm').serialize();
} else {
dataStr = $('#offlineCouponListForm').serialize()+'&pageUnit='+pageUnit;
}
}
$('#pageIndexOff').val(pageIndex);
$.ajax({
type: "post",
url : "<c:url value="/mngr/promtn/coupon/selectOfflineCouponCrtnbListInqire"/>",
data : dataStr,
success:function(resultHtml) {
$('#pageDiv').html(resultHtml);
}
});
}
/*********************************************************************
* 인증번호 추가
* *******************************************************************/
const fn_create_crtnb = function(couponInnb) {
let createQy = $('#createQy').val();
createQy = createQy.replace(",", "");
if (confirm('인증번호를 <spring:message code="confirm.common.insert"/>')) {
$.ajax({
type: "post",
url: "<c:url value="/mngr/promtn/coupon/insertMkCouponOflneCouponCrtnb"/>",
data: {
createQy: createQy,
couponInnb: couponInnb
},
success: function (result) {
alert('<spring:message code="success.common.insert"/>');
$('#createQy').val("0");
}
});
}
}
//관련 상품 검색 모달
const fn_open_search_modal = function (modalDivSltr, modalSlrt, url, param, callback) {
let submitType = 'POST';
$.ajax({
type: submitType,
url: url,
data: param,
success: function (data) {
$(modalSlrt).remove();
$(modalDivSltr).html(data);
//최초오픈시에 관련상품 정보 있을 경우 실행
if(custom_open_modal_cnt === 0){
var tableBody = $("#appendList");
const cdnurl = $('#cdnurl').val()
selectedDtl.forEach((good, index) => {
var row = `
<tr id="choiseListId` +good.goodsId + `" class="draggable" ondblclick="fn_remove_append_goods_list(this)">
<td class="text-left">
<input type="hidden" id="goodsInnb" name="goodsInnb" value="` + good.goodsId + `"/>
<input type="hidden" id="goodsImgCours" name="goodsImgCours" value="`+cdnurl + good.goodsImg + `"/>
<input type="hidden" id="goodsNm" name="goodsNm" value="` + good.goodsNm + `"/>
<input type="hidden" id="slepric" name="slepric" value="` + good.goodsPrice + `"/>
<input type="hidden" id="goodsSttusNm" name="goodsSttusNm" value="` + good.goodsSttusNm + `"/>
<div class="product-search-box__product">
<img src="`+cdnurl + good.goodsImg+ `"
onerror="this.src='<c:url value="/mngr/images/image_placeholder.png"/>'"
alt="` +good.goodsNm+ `" width="64">
` +good.goodsNm+ `
</div>
</td>
<td>` +good.goodsPrice+ `</td>
<td>` +good.goodsSttusNm+ `</td>
</tr>
`;
tableBody.append(row);
});
custom_open_modal_cnt++;
}
$(modalSlrt).modal();
}
});
}
let custom_open_modal_cnt = 0;
//현재 등록된 관련 상품 정보
let selectedDtl = [];
const fn_custom_open_modal = (modalDivSltr, modalSlrt, url, param, callback) => {
selectedDtl = [];
if(custom_open_modal_cnt === 0){
$('.product-group__item').each(function() {
const goodsId = $(this).find('input[name="relatedGoodsId"]').val();
const goodsImg = $(this).find('input[name="relatedGoodsImg"]').val();
const goodsNm = $(this).find('input[name="relatedGoodsNm"]').val();
const goodsPrice = $(this).find('input[name="relatedGoodsPrice"]').val();
const goodsSttusNm = $(this).find('input[name="goodsSttusNm"]').val();
selectedDtl.push({
goodsId: goodsId,
goodsImg: goodsImg,
goodsNm: goodsNm,
goodsPrice: goodsPrice,
goodsSttusNm: goodsSttusNm
});
});
}
fn_open_search_modal(modalDivSltr, modalSlrt, url, param, callback);
}
/**
* 타 쿠폰과 함께 사용 라디오 제어
*/
const fn_otr_coupon_smtm_ctrl = function() {
let radioVal = $('input[name="otrCouponSmtmUseAt"]:checked').val();
if (radioVal === 'Y') { // 단독사용일 경우 중복할인 불가 제어
$('input[name="dplctDscntAt"][value="N"]').prop('checked', true); // 'N' 라디오버튼 클릭
$('input[name="dplctDscntAt"]').on('click', function(e) {
e.preventDefault();
});
} else {
// 클릭 이벤트 차단 해제
$('input[name="dplctDscntAt"]').off('click');
}
}
//사용환경이 오프라인일 경우 혜택 설정을 상품금액할인만 되도록 표시
$(document).on('change', 'input[name="useEnvrnCd"]', function () {
const bnefDvRadioDiv = $('#bnefDvRadioDiv').find('.custom-radio')
const useEnvrnCd = $(this).val();
bnefDvRadioDiv.each(function () {
//사용환경이 오프라인일 경우 배송비할인, 장바구니 라디오버튼 hide
const bnefDv = $(this).find('input[name="bnefDv"]')
if(useEnvrnCd ==='02'){
//상품금액 빼고 hide
if(bnefDv.val() !== '01'){
$(this).hide()
}
//상품금액 할인 클릭
if(bnefDv.val() === '01' && useEnvrnCd ==='02'){
bnefDv.click()
}
}else{
$(this).show()
}
})
//장바구니 일경우 쿠폰 대상 hide 처리
if(bnefDvRadioDiv.find('input[name="bnefDv"]:checked').val() === '03'){
$('#issueGoodsSec').hide()
}else{
$('#issueGoodsSec').show()
}
})
</script>
</head>
<body>
<%-- 상단메뉴 공통화 적용 : 2023-11-30 / 박철민 추가 --%>
<%@ include file="/WEB-INF/views/comm/mngr/Header.jsp"%>
<main class="main">
<%-- 좌측메뉴 공통화 적용 : 2023-11-30 / 박철민 추가 --%>
<%@ include file="/WEB-INF/views/comm/mngr/Left.jsp"%>
<div class="content">
<div class="content__inner">
<button class="side-nav__fold"><span class="visually-hidden">좌측메뉴 펼치기/닫기</span></button>
<div class="page-title">
<h2 class="page-title__title">쿠폰 상세</h2>
<div class="page-title__btn-container">
<button class="btn outline" onclick="fn_select_coupon_list(); return false;" ><spring:message code="button.list"/></button>
<button class="btn primary" onclick="fn_update(); return false;" ><spring:message code="button.save"/></button>
</div>
</div>
<form id="listForm" class="listForm" method="post" >
<spring:eval expression="@environment.getProperty('mngrfo.common.fileupload.cdnurl')" var="cdnurl"/>
<input type="hidden" id="cdnurl" value="${cdnurl}"/>
<section class="content-section">
<h3 class="content-section__title">기본 정보</h3>
<div class="table-wrapper">
<table class="table">
<caption>해당 테이블에 대한 설명</caption>
<colgroup>
<col style="width: 12%;">
<col>
<col style="width: 12%;">
<col style="width: 32.5%;">
</colgroup>
<tbody>
<tr>
<th>쿠폰 명</th>
<td>
<div class="td-inner">
<input class="input-text md" type="text" id="coupNm" name="coupNm" value="<c:out value="${ resultMap.couponVO.coupNm }"/>" title="쿠폰명" maxlength="40">
</div>
</td>
<th>사용여부</th>
<td>
<div class="td-inner">
<div class="custom-radio-container">
<div class="custom-radio">
<input type="radio" id="r-1" name="couponUseAt" value="Y" <c:if test="${ 'Y' eq resultMap.couponVO.couponUseAt }">checked="checked"</c:if>>
<label for="r-1">사용</label>
</div>
<div class="custom-radio">
<input type="radio" id="r-2" name="couponUseAt" value="N" <c:if test="${ 'N' eq resultMap.couponVO.couponUseAt }">checked="checked"</c:if>>
<label for="r-2">미사용</label>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>쿠폰 설명</th>
<td colspan="3">
<div class="td-inner">
<input class="input-text xl" type="text" id="couponDc" name="couponDc" value="<c:out value="${ resultMap.couponVO.couponDc }"/>" title="쿠폰설명" maxlength="100">
</div>
</td>
</tr>
<tr>
<th>사용환경</th>
<td>
<div class="td-inner">
<div class="custom-radio-container" id="radioUseEnvrnCd">
<c:forEach var="codeList" items="${ resultMap.useEnvrnCdList }" varStatus="">
<div class="custom-radio">
<input type="radio" id="<c:out value="${ codeList.cdNm }"/><c:out value="${ codeList.cd }"/>" name="useEnvrnCd" value="<c:out value="${ codeList.cd }"/>"
<c:if test="${ resultMap.couponVO.useEnvrnCd eq codeList.cd }">checked="checked"</c:if>
<c:if test="${ '02' eq codeList.cd }">onclick="fn_ctrl_disable([], ['.otherSection', '#bnefSection']);"</c:if>
<c:if test="${ '01' eq codeList.cd || '03' eq codeList.cd }">onclick="fn_ctrl_disable([], ['.otherSection', '#bnefSection']);"</c:if>
<c:if test="${ resultMap.couponVO.useEnvrnCd eq '02' }">readonly</c:if>
>
<label for="<c:out value="${ codeList.cdNm }"/><c:out value="${ codeList.cd }"/>"><c:out value="${ codeList.cdNm}" /></label>
</div>
</c:forEach>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section class="content-section" id="posSection">
<h3 class="content-section__title">POS 연동</h3>
<div class="table-wrapper">
<table class="table vertical" id="posTable">
<caption>해당 테이블에 대한 설명</caption>
<!-- 각 열 width 설정 -->
<colgroup>
<col style="width: 3%;">
<col style="width: 20%;">
<col style="width: 10%;">
<col style="width: auto;">
</colgroup>
<thead>
<tr>
<th>
<label class="b-checkbox checkbox is-medium tr-color-check check-all">
<input type="checkbox" value="">
<span class="check"></span>
</label>
</th>
<th>POS 본부</th>
<th>년도</th>
<th>POS 쿠폰코드</th>
</tr>
</thead>
<tbody id="posTbody">
<c:choose>
<c:when test="${ not empty resultMap.posCodeList }">
<c:forEach items="${ resultMap.posCodeList }" var="posCd" varStatus="status">
<tr class="posList" disabled>
<td class="center">
<label class="b-checkbox checkbox is-medium tr-color-check">
<input type="checkbox" id="posCheckbox" value="">
<span class="check"></span>
</label>
</td>
<td>
<input type="text" id="posHdqrtrsCd" name="posHdqrtrsCdList" value="<c:out value="${ posCd.cd }"/>" disabled />
</td>
<td>
<div class="select-box" id="selectBoxDiv" >
<jsp:useBean id="now" class="java.util.Date" />
<fmt:formatDate var="year" value="${now}" pattern="yyyy" />
<select id="year1" name="posCouponRegistYearList" disabled>
<%-- <c:forEach var="i" begin="0" end="4" >
<option>${fn:substring(year,0,4)-i}</option>
</c:forEach> --%>
<c:forEach var="i" begin="0" end="4" >
posCd.posCouponRegistYear : <c:out value="${ posCd.posCouponRegistYear }"/>
<c:choose>
<c:when test="${ (year-i) eq posCd.posCouponRegistYear }">
<option value="<c:out value="${ year-i }"/>" selected="selected"><c:out value="${ year-i }"/></option>
</c:when>
<c:otherwise>
<option value="<c:out value="${ year-i }"/>"><c:out value="${ year-i }"/></option>
</c:otherwise>
</c:choose>
<%--
<option>${fn:substring(year,0,4)-i}</option>
--%>
</c:forEach>
</select>
</div>
</td>
<td>
<div class="td-inner">
<input class="input-text xl" type="text" title="POS 쿠폰 코드" id="posCouponCd" name="posCouponCdList" value="<c:out value="${ posCd.posCouponCd }"/>" maxlength="4" oninput="validateInputNotKorean(this)" disabled>
</div>
</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<c:forEach items="${ resultMap.posCdList }" var="posCd" varStatus="status">
<tr class="posList" disabled>
<td class="center">
<label class="b-checkbox checkbox is-medium tr-color-check">
<input type="checkbox" id="posCheckbox" value="">
<span class="check"></span>
</label>
</td>
<td>
<input type="text" id="posHdqrtrsCd" name="posHdqrtrsCdList" value="<c:out value="${ posCd.cd }"/>" disabled />
</td>
<td>
<div class="select-box" id="selectBoxDiv" >
<jsp:useBean id="nowC" class="java.util.Date" />
<fmt:formatDate var="yeaCr" value="${nowC}" pattern="yyyy" />
<select id="year1" name="posCouponRegistYearList" disabled>
<c:forEach var="i" begin="0" end="4" >
<option>${fn:substring(yeaCr,0,4)-i}</option>
</c:forEach>
</select>
</div>
</td>
<td>
<div class="td-inner">
<input class="input-text xl" type="text" title="POS 쿠폰 코드" id="posCouponCd" name="posCouponCdList" value="" maxlength="4" oninput="validateInputNotKorean(this)" disabled>
</div>
</td>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</tbody>
</table>
</div>
</section>
<section class="content-section" id="bnefSection">
<h3 class="content-section__title">혜택 설정</h3>
<div class="table-wrapper">
<table class="table">
<caption>해당 테이블에 대한 설명</caption>
<colgroup>
<col style="width: 12%;">
<col>
</colgroup>
<tbody>
<tr>
<th>혜택</th>
<td>
<div class="td-inner">
<div class="custom-radio-container" id="bnefDvRadioDiv">
<c:forEach var="codeList" items="${ resultMap.benfDvCdList }" varStatus="">
<div class="custom-radio">
<input type="radio" id="<c:out value="${ codeList.cdNm }"/><c:out value="${ codeList.cd }"/>" name="bnefDv" value="<c:out value="${ codeList.cd }"/>"
<c:choose>
<c:when test="${ not empty resultMap.couponVO.bnefDv }">
<c:if test="${ resultMap.couponVO.bnefDv eq codeList.cd }">checked="checked"</c:if>
</c:when>
<c:when test="${ empty resultMap.couponVO.bnefDv }">
<c:if test="${ codeList.cd eq '01' }">checked="checked"</c:if>
</c:when>
</c:choose>
<c:choose>
<c:when test="${ codeList.cd eq '03' }">
onclick="fn_ui_showHide('', '.targetGoods', 'Y');"
</c:when>
<c:otherwise>
onclick="fn_ui_showHide('.targetGoods', '', 'Y');"
</c:otherwise>
</c:choose>
>
<label for="<c:out value="${ codeList.cdNm }"/><c:out value="${ codeList.cd }"/>"><c:out value="${ codeList.cdNm}" /></label>
</div>
</c:forEach>
</div>
</div>
</td>
</tr>
<tr id="goodsDv" style="display: none;">
<th>상품금액 할인</th>
<td>
<div class="td-inner">
<input class="input-text sm number right" value="<fmt:formatNumber value="${ resultMap.couponVO.aditDscntAmt }" pattern="#,###" />" type="text" id="aditDscntAmt" name="aditDscntAmt" title="금액일경우 값" style="display: none;" maxlength="15">
<input class="input-text sm number right" value="<fmt:formatNumber value="${ resultMap.couponVO.aditDscntAmt }" pattern="#,###" />" type="text" id="aditDscntRt" name="aditDscntRt" title="비율일경우 값" style="display: none;" maxlength="2">
<div class="select-box">
<select class="short " title="금액 비율 선택" name="goodsDscntDv" id="goodsDscntDv">
<c:forEach var="codeList" items="${ resultMap.goodsDscntDvCdList }" varStatus="">
<option value="<c:out value="${ codeList.cd }"/>" <c:if test="${ resultMap.couponVO.goodsDscntDv eq codeList.cd }">selected</c:if> ><c:out value="${ codeList.cdNm }" /></option>
</c:forEach>
</select>
</div>
<div class="input-container ml-5" >
<span class="input-unit-text">할인</span>
<span class="blue-6 fw-500 ml-15 fyi" id="dscntAmtDiv">상품 판매가가 할인금액보다 낮으면 상품 판매가 만큼
할인</span>
</div>
<div class="input-container ml-5 " id="dscntMaxDiv">
<span class="input-unit-text left">최대</span>
<input class="input-text sm number" type="text" title="해당 인풋에 대한 설명" id="dscntMxmmAmt" name="dscntMxmmAmt" value="<fmt:formatNumber value="${ resultMap.couponVO.dscntMxmmAmt }" pattern="#,###" />" maxlength="15">
<span class="input-unit-text">${curUnit} 할인</span>
</div>
</div>
</td>
</tr>
<tr id="dlivyDv" style="display: none;">
<th>배송비 할인</th>
<td>
<div class="td-inner">
<div class="custom-radio-container vertical" id="radioDlvyAmtDscntDv">
<c:forEach var="codeList" items="${ resultMap.dlvyAmtDscntDvCdList }" varStatus="">
<div class="custom-radio inner-input">
<input type="radio" id="<c:out value="${ codeList.cdNm }"/><c:out value="${ codeList.cd }" />" name="dlvyAmtDscntDv" value="<c:out value="${ codeList.cd }" />"
<%-- <c:if test="${ resultMap.couponVO.dlvyAmtDscntDv eq codeList.cd || empty resultMap.couponVO.dlvyAmtDscntDv }">checked="checked"</c:if> --%>
<c:choose>
<c:when test="${ not empty resultMap.couponVO.dlvyAmtDscntDv }">
<c:if test="${ resultMap.couponVO.dlvyAmtDscntDv eq codeList.cd }">checked="checked"</c:if>
</c:when>
<c:when test="${ empty resultMap.couponVO.dlvyAmtDscntDv }">
<c:if test="${ codeList.cd eq '01' }">checked="checked"</c:if>
</c:when>
</c:choose>
>
<label for="<c:out value="${ codeList.cdNm }"/><c:out value="${ codeList.cd}" />"><c:out value="${ codeList.cdNm}" />
</label>
<div>
<c:choose>
<c:when test="${ '01' eq codeList.cd }">
, 최대 <input class="input-text sm ml-5 number right" value="<fmt:formatNumber value="${ resultMap.couponVO.dlvyAmtMxmmDscntAmt }" pattern="#,###" />" id="dlvyAmtMxmmDscntAmt" name="dlvyAmtMxmmDscntAmt" type="text" title="해당 인풋에 대한 설명" maxlength="15">
${curUnit} 할인(개별 배송 상품 제외)
</c:when>
<c:when test="${ '02' eq codeList.cd }">
<input class="input-text sm ml-5 number right" value="<fmt:formatNumber value="${ resultMap.couponVO.dlvyAmtDscntAmt }" pattern="#,###" />" id="dlvyAmtDscntAmt" name="dlvyAmtDscntAmt" type="text" title="해당 인풋에 대한 설명" maxlength="15">
${curUnit} 할인(개별 배송 상품 제외)
</c:when>
</c:choose>
</div>
</div>
</c:forEach>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</form>
<form id="couponForm5" class="common-form listForm" method="post">
<%-- 이벤트 대상 --%>
<section class="content-section otherSection" id="issueGoodsSec">
<h3 class="content-section__title">쿠폰 대상</h3>
<div class="table-wrapper">
<table class="table">
<caption>해당 테이블에 대한 설명</caption>
<colgroup>
<col style="width: 12%;">
<col>
</colgroup>
<tbody>
<tr class=".disabledTr">
<th>선정 기준</th>
<td>
<div class="td-inner">
<div class="custom-radio-container radio-tab-trigger" data-radiotab="radio-tab-01" id="radioGoodsCtgryLmttDv">
<c:forEach var="codeList" items="${ resultMap.goodsCtgryLmttDvCdList }" varStatus="status">
<div class="custom-radio">
<input type="radio" id="<c:out value="${ codeList.cdNm }"/><c:out value="${ codeList.cd}" />" name="goodsApplcDvCd" value="<c:out value="${ codeList.cd}" />"
<c:choose>
<c:when test="${ not empty resultMap.couponVO.goodsApplcDvCd }">
<c:if test="${ resultMap.couponVO.goodsApplcDvCd eq codeList.cd }">checked="checked"</c:if>
</c:when>
<c:otherwise>
<c:if test="${ status.first }">checked="checked"</c:if>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${ codeList.cd eq '01'}">
onclick="fn_ui_showHide('', '.notall', 'Y');"
</c:when>
<c:when test="${ codeList.cd eq '02' || codeList.cd eq '04'}">
onclick="fn_ui_showHide('#catgrySelctDiv', '#goodsSelctDiv', 'Y');"
</c:when>
<c:when test="${ codeList.cd eq '03' || codeList.cd eq '05'}">
onclick="fn_ui_showHide('#goodsSelctDiv', '#catgrySelctDiv', 'Y');"
</c:when>
</c:choose>
/>
<label for="<c:out value="${ codeList.cdNm }"/><c:out value="${ codeList.cd}" />"><c:out value="${ codeList.cdNm}" /></label>
</div>
</c:forEach>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-wrapper notall" id="catgrySelctDiv">
<div class="table-wrapper" id="section01">
<table class="table">
<caption>해당 테이블에 대한 설명</caption>
<colgroup>
<col style="width: 12%;">
<col>
</colgroup>
<tbody>
<tr>
<th>카테고리 선택</th>
<td>
<div class="td-inner">
<div class="table-wrapper">
<table class="table vertical">
<caption>해당 테이블에 대한 설명</caption>
<!-- 각 열 width 설정 -->
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<thead>
<tr>
<th>1차 카테고리</th>
<th>2차 카테고리</th>
<th>3차 카테고리</th>
<th>4차 카테고리</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<select class="category-select" multiple
id="ctgryDepth1" title="1차 카테고리">
<c:forEach items="${resultMap.goodsCategoryList}"
var="goodsCategory"
varStatus="status">
<option value="${goodsCategory.ctgryId}">${goodsCategory.ctgryNm}</option>
</c:forEach>
</select>
</td>
<td>
<select class="category-select" multiple id="ctgryDepth2"
title="2차 카테고리">
</select>
</td>
<td>
<select class="category-select" multiple
id="ctgryDepth3" title="3차 카테고리">
</select>
</td>
<td>
<select class="category-select" multiple
id="ctgryDepth4" title="4차 카테고리">
</select>
</td>
</tr>
</tbody>
</table>
<div class="form-control-container mt-10">
<div class="left"></div>
<div class="center">
<button class="btn primary" id="selectCategoriesBtn">선택</button>
</div>
<div class="right">
</div>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>선택한 카테고리</th>
<td>
<div class="td-inner">
<div class="table-wrapper">
<table class="table vertical" id="selectedCategoriesTable">
<caption>해당 테이블에 대한 설명</caption>
<colgroup>
<col style="width: 100px;">
<col style="width: auto;">
<col style="width: 200px;">
</colgroup>
<thead>
<tr>
<th>구분</th>
<th>카테고리</th>
<th>삭제</th>
</tr>
</thead>
<tbody>
<!-- 선택한 카테고리들이 여기에 추가됩니다 -->
<c:forEach var="selectCtgry" items="${resultMap.goodsCtgryList}" varStatus="selectCtgryIndex">
<tr>
<td>
<div class ="custom-radio no-text">
적용
<input type="hidden" id="r-${selectCtgryIndex.index}" name="reprsntCtgryId" value="<c:out value="${selectCtgry.ctgryId}"/>" <c:if test="${selectCtgry.reprsntCtgryAt eq 'Y'}"> checked="checked"</c:if> />
</div>
</td>
<td data-value="${selectCtgry.ctgryId}" style="text-align: left;" ><c:out value="${selectCtgry.fullPath}" /> </td>
<td>
<button class="circle-btn delete"><span class="visually-hidden">삭제</span></button>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="content-fold__content table-wrapper notall" id="goodsSelctDiv">
<div class="table-wrapper">
<table class="table">
<caption>해당 테이블에 대한 설명</caption>
<colgroup>
<col style="width: 12%;">
<col>
</colgroup>
<tbody>
<tr>
<th>
<div>
<span class="ml-10">상품</span>
<br>
<c:if test="${not empty resultMap.relatedGoods.goodsInfo}">
<a type="button" onclick="fn_custom_open_modal('#modalDiv','#product-search','/mngr/goods/goodsmngr/selectGoodsSrchPopupForm',{'goodsKndCd':'01'}); return false;"
class="btn xsm primary mt-5">검색</a>
</c:if>
<c:if test="${empty resultMap.relatedGoods.goodsInfo}">
<a type="button" onclick="fn_open_modal('#modalDiv','#product-search','/mngr/goods/goodsmngr/selectGoodsSrchPopupForm',{'goodsKndCd':'01'}); return false;"
class="btn xsm primary mt-5">검색</a>
</c:if>
</div>
</th>
<td>
<div class="td-inner">
<div id="parentGoodsContainer" class="product-group">
<!-- 여기에 선택한 상품 정보가 추가됩니다 -->
<c:if test="${not empty resultMap.relatedGoods.goodsInfo}">
<c:forEach items="${ resultMap.relatedGoods.goodsInfo }" var="goodsInfo" varStatus="gdsInfoStatus">
<div class="product-group__item">
<input type="hidden" id="relatedGoodsId" name="relatedGoodsId" value="<c:out value="${(goodsInfo.goodsInnb)}"/>">
<input type="hidden" name="relatedGoodsNm" value="<c:out value="${(goodsInfo.goodsNm)}"/>">
<input type="hidden" name="relatedGoodsImg" value="<c:out value="${(goodsInfo.goodsImgCours)}"/>">
<input type="hidden" name="relatedGoodsPrice" value="<c:out value="${(goodsInfo.slepric)}"/>">
<input type="hidden" name="goodsSttusNm" value="<c:out value="${(goodsInfo.goodsSttusNm)}"/>">
<span class="product-group__item-number"><c:out value="${(gdsInfoStatus.count)}"/></span>
<div class="product-group__image">
<img src="<c:out value="${cdnurl}${(goodsInfo.goodsImgCours)}"/>" onerror="this.src='/mngr/images/image_placeholder.png'" width="140" alt="<c:out value="${(goodsInfo.goodsNm)}"/>">
</div>
<div class="product-group__description">
<p><c:out value="${(goodsInfo.goodsNm)}"/></p>
<p class="product-group__description-price">(<fmt:formatNumber value="${goodsInfo.slepric}" pattern="#,###"/>)${curUnit}</p>
</div>
</div>
</c:forEach>
</c:if>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
</form>
<%--
<c:if test="${ resultMap.couponVO.useEnvrnCd eq '03' || resultMap.couponVO.useEnvrnCd eq '02' }">
<form id="couponForm6" class="common-form" method="post">
<section class="content-section">
<h3 class="content-section__title">쿠폰 인증번호</h3>
<div class="table-wrapper">
<table class="table">
<caption>해당 테이블에 대한 설명</caption>
<colgroup>
<col style="width: 12%;">
<col>
</colgroup>
<tbody>
<tr class=".disabledTr">
<th>선정 기준</th>
<td>
<div class="td-inner input-container">
인증번호 수동등록 [ 총 <c:out value="${ resultMap.couponVO.offlineCnt }"/>건 ]
<button type ="button" class="btn xsm primary" onclick="fn_open_crtnb_list('#modalDiv', '#offlie-coupon_pop', '<c:url value="/mngr/promtn/coupon/selectOfflineCouponCrtnbListInqireForm"/>', '<c:out value="${ resultMap.couponVO.couponInnb }"/>'); return false;">인증번호 <spring:message code="button.view"/></button>
<button class="btn outline sm" type="button" id="excelDwldBtn" onclick="fn_excel_download(); return false;">
<i class="icon icon_excel"></i>다운로드
</button>
<input class="input-text sm ml-5 number right" type="text" id="createQy" name="createQy"
title="생성 개수" value="0" maxlength="15">
<span class="input-unit-text">개</span>
<button type ="button" class="btn xsm primary" onclick="fn_create_crtnb('<c:out value="${ resultMap.couponVO.couponInnb }"/>');">인증번호 <spring:message code="button.add"/></button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</form>
</c:if>
--%>
<form class="listForm">
<section class="content-section otherSection" id="otherSection">
<h3 class="content-section__title">사용 제한 설정</h3>
<div class="table-wrapper">
<table class="table">
<caption>해당 테이블에 대한 설명</caption>
<colgroup>
<col style="width: 12%;">
<col>
</colgroup>
<tbody>
<tr class="goodsOnly">
<th>타 쿠폰과 함께 사용(주문)</th>
<td>
<div class="td-inner">
<div class="custom-radio-container">
<div class="custom-radio">
<input type="radio" id="r-12" name="otrCouponSmtmUseAt" value="N" <c:if test="${ 'N' eq resultMap.couponVO.otrCouponSmtmUseAt }">checked="checked"</c:if>>
<label for="r-12">공동사용</label>
</div>
<div class="custom-radio">
<input type="radio" id="r-11" name="otrCouponSmtmUseAt" value="Y" <c:if test="${ 'Y' eq resultMap.couponVO.otrCouponSmtmUseAt || empty resultMap.couponVO.otrCouponSmtmUseAt }">checked="checked"</c:if>>
<label for="r-11">단독사용</label>
</div>
</div>
</div>
</td>
</tr>
<tr class="goodsOnly">
<th>중복할인</th>
<td>
<div class="td-inner">
<div class="custom-radio-container">
<div class="custom-radio">
<input type="radio" id="r-16" name="dplctDscntAt" value="N" <c:if test="${ 'N' eq resultMap.couponVO.dplctDscntAt }">checked="checked"</c:if>>
<label for="r-16">불가능</label>
</div>
<div class="custom-radio">
<input type="radio" id="r-15" name="dplctDscntAt" value="Y" <c:if test="${ 'Y' eq resultMap.couponVO.dplctDscntAt || empty resultMap.couponVO.dplctDscntAt}">checked="checked"</c:if>>
<label for="r-15">가능</label>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>중복다운로드</th>
<td>
<div class="td-inner">
<div class="custom-radio-container">
<div class="custom-radio">
<input type="radio" id="r-14" name="dplctDwldAt" value="N" <c:if test="${ 'N' eq resultMap.couponVO.dplctDwldAt }">checked="checked"</c:if>>
<label for="r-14">불가능</label>
</div>
<div class="custom-radio">
<input type="radio" id="r-13" name="dplctDwldAt" value="Y" <c:if test="${ 'Y' eq resultMap.couponVO.dplctDwldAt || empty resultMap.couponVO.dplctDwldAt}">checked="checked"</c:if>>
<label for="r-13">가능</label>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>쿠폰 사용 가능<br>금액 제한(대상제품)</th>
<td>
<div class="td-inner">
<div class="input-container">
<input class="input-text sm ml-5 number right" type="text" id="usePosblAmt" name="usePosblAmt" title="사용가능금액"
value="<fmt:formatNumber value="${ resultMap.couponVO.usePosblAmt }" pattern="#,###" />" maxlength="15">
<span class="input-unit-text">${curUnit}</span>
</div>
<span>이상이면 사용 가능</span>
<span class="fyi ml-10 gray-6">예시 : 2000円 이상 구매시</span>
</div>
</td>
</tr>
<tr id="usePosblAllAmtSec">
<th>쿠폰 사용 가능<br>금액 제한(대상제품 포함 구매제품 총합)</th>
<td>
<div class="td-inner">
<div class="custom-radio">
<input type="radio" id="r-28" name="usePosblAllAmtUseAt" value="Y" <c:if test="${ 'Y' eq resultMap.couponVO.usePosblAllAmtUseAt }">checked="checked"</c:if>>
<label for="r-28">사용</label>
</div>
<div class="custom-radio">
<input type="radio" id="r-29" name="usePosblAllAmtUseAt" value="N" <c:if test="${ 'N' eq resultMap.couponVO.usePosblAllAmtUseAt || empty resultMap.couponVO.usePosblAllAmtUseAt}">checked="checked"</c:if>>
<label for="r-29">미사용</label>
</div>
<div class="input-container">
<input class="input-text sm ml-5 number right" type="text" id="usePosblAllAmt" name="usePosblAllAmt" title="사용가능금액"
value="<fmt:formatNumber value="${ resultMap.couponVO.usePosblAllAmt }" pattern="#,###" />" maxlength="15">
<span class="input-unit-text">${curUnit}</span>
</div>
<span>이상이면 사용 가능</span>
<span class="fyi ml-10 gray-6">예시 : 2000円 이상 구매시</span>
</div>
</td>
</tr>
<%--
<tr>
<th>쿠폰수량</th>
<td>
<div class="td-inner">
<div class="custom-radio-container" id="radioQyLmttAt">
<div class="custom-radio">
<input type="radio" id="r-20" name="qyLmttAt" value="N" <c:if test="${ 'N' eq resultMap.couponVO.qyLmttAt || empty resultMap.couponVO.qyLmttAt}">checked="checked"</c:if>>
<label for="r-20">무제한
</label>
</div>
<div class="custom-radio inner-input">
<input type="radio" id="r-21" name="qyLmttAt" value="Y" <c:if test="${ 'Y' eq resultMap.couponVO.qyLmttAt }">checked="checked"</c:if>>
<label for="r-21">수량제한
</label>
<div>
<input class="input-text sm ml-5 number right" value="<fmt:formatNumber value="${ resultMap.couponVO.lmttQy }" pattern="#,###" />" id="lmttQy" name="lmttQy" type="text" title="수량제한" maxlength="10">
장
</div>
</div>
</div>
</div>
</td>
</tr>
--%>
<tr>
<th>유효기간</th>
<td>
<div class="td-inner">
<div class="custom-radio-container" id="radioValidpdknd">
<div class="custom-radio inner-input">
<input type="radio" id="r-22" name="validpdKnd" value="<c:out value="${ resultMap.validpdKndCdList[0].cd}" />" <c:if test="${ '01' eq resultMap.couponVO.validpdKnd || empty resultMap.couponVO.validpdKnd}">checked="checked"</c:if>>
<label for="r-22"><c:out value="${ resultMap.validpdKndCdList[0].cdNm}" /></label>&ensp;
<div class="td-inner">
<fmt:parseDate var="parsedDateBgn" value="${resultMap.couponVO.validpdBgnDt}" pattern="yyyy-MM-dd HH:mm:ss" />
<input type="text" id="validpdBgnDt" name="validpdBgnDt" class="datepicker" title="시작 날짜 선택" autocomplete="off" value="<fmt:formatDate value="${parsedDateBgn}" pattern="yyyy-MM-dd" />">
<div class="timepicker-container">
<input type="text" class="bs-timepicker" id="validpdBgnDtTime" name="validpdBgnDt" title="시간 설정" value="<fmt:formatDate value="${parsedDateBgn}" pattern="HH:mm" />">
</div>
~
<fmt:parseDate var="parsedDateEnd" value="${resultMap.couponVO.validpdEndDt}" pattern="yyyy-MM-dd HH:mm:ss" />
<input type="text" id="validpdEndDt" name="validpdEndDt" class="datepicker" title="종료 날짜 선택" autocomplete="off" value="<fmt:formatDate value="${parsedDateEnd}" pattern="yyyy-MM-dd" />">
<div class="timepicker-container">
<input type="text" class="bs-timepicker" id="validpdEndDtTime" name="validpdEndDt" title="시간 설정" value="<fmt:formatDate value="${parsedDateEnd}" pattern="HH:mm" />">
</div>
</div>
</div>
<div class="custom-radio inner-input">
<input type="radio" id="r-23" name="validpdKnd" value="<c:out value="${ resultMap.validpdKndCdList[1].cd}" />" <c:if test="${ '02' eq resultMap.couponVO.validpdKnd }">checked="checked"</c:if>>
<label for="r-23"><c:out value="${ resultMap.validpdKndCdList[1].cdNm}" />
</label>
<div>
<input class="input-text sm ml-5 number right" id="validpdDeCnt" name="validpdDeCnt" value="<fmt:formatNumber value="${ resultMap.couponVO.validpdDeCnt }" pattern="#,###" />" type="text" title="유효일수" maxlength="3">
일
</div>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>사용제한(쿠폰팩)</th>
<td>
<div class="td-inner">
<div class="custom-radio-container">
<div class="custom-radio">
<input type="radio" id="r-24" name="cupnpkRegistPosblAt" value="Y" <c:if test="${ 'Y' eq resultMap.couponVO.cupnpkRegistPosblAt || empty resultMap.couponVO.cupnpkRegistPosblAt}">checked="checked"</c:if>>
<label for="r-24">쿠폰팩용(쿠폰팩 사용 가능)</label>
</div>
<div class="custom-radio">
<input type="radio" id="r-25" name="cupnpkRegistPosblAt" value="N" <c:if test="${ 'N' eq resultMap.couponVO.cupnpkRegistPosblAt}">checked="checked"</c:if>>
<label for="r-25">쿠폰 단독(쿠폰팩 사용 불가)</label>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>가격 측정 노출 여부</th>
<td>
<div class="td-inner">
<div class="custom-radio-container">
<div class="custom-radio">
<input type="radio" id="r-26" name="pricStdrExpsrAt" value="Y" <c:if test="${ 'Y' eq resultMap.couponVO.pricStdrExpsrAt || empty resultMap.couponVO.pricStdrExpsrAt}">checked="checked"</c:if>>
<label for="r-26">사용</label>
</div>
<div class="custom-radio">
<input type="radio" id="r-27" name="pricStdrExpsrAt" value="N" <c:if test="${ 'N' eq resultMap.couponVO.pricStdrExpsrAt}">checked="checked"</c:if>>
<label for="r-27">미사용</label>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<input type="hidden" id="couponInnb" name ="couponInnb" value="<c:out value="${ resultMap.couponVO.couponInnb }"/>"/>
<input type="hidden" id="searchCoupNm" name="searchCoupNm" title="검색_쿠폰명" value="${ searchForm.searchCoupNm }">
<c:if test="${ not empty searchForm.searchUseEnvrnCd }" >
<input type="hidden" id="searchUseEnvrnCd" name="searchUseEnvrnCd" value="
<%
String[] list3 = request.getParameterValues("searchUseEnvrnCd");
if (list3 != null && list3.length > 0) {
// 첫번째만 콤마 없이
out.print(list3[0]);
if (list3.length > 1) {
// 나머지는 콤마 붙여서 출력
for (int i = 1; i < list3.length; i++) {
out.print(", " + list3[i]);
}
}
}
%>
">
</c:if>
<c:if test="${ not empty searchForm.searchBnefDv }" >
<input type="hidden" name="searchBnefDv" value="
<%
String[] list4 = request.getParameterValues("searchBnefDv");
if (list4 != null && list4.length > 0) {
// 첫번째만 콤마 없이
out.print(list4[0]);
// 나머지는 콤마 붙여서 출력
for (int i = 1; i < list4.length; i++) {
out.print(", " + list4[i]);
}
}
%>
">
</c:if>
<input type="hidden" id="searchOtrCouponSmtmUseAt" name="searchOtrCouponSmtmUseAt" value="${ searchForm.searchOtrCouponSmtmUseAt }"/>
<input type="hidden" id="searchUseAt" name="searchUseAt" title="쿠폰 사용여부" value="<c:out value="${ searchForm.searchUseAt }"/>">
<input type="hidden" id="pageIndex" name="pageIndex" value="<c:out value="${ searchForm.pageIndex }"/>"/>
<input type="hidden" id="recordCountPerPage" name="recordCountPerPage" value="<c:out value="${ searchForm.recordCountPerPage }"/>"/>
<input type="hidden" id="pageUnit" name="pageUnit" value="<c:out value="${ searchForm.pageUnit }"/>"/>
</form>
</div>
</div>
<div id="modalDiv">
</div>
</main>
</body>
</html>