diff --git a/adm/shop_admin/couponform.php b/adm/shop_admin/couponform.php index 19d8f2782..5cc3d5e57 100644 --- a/adm/shop_admin/couponform.php +++ b/adm/shop_admin/couponform.php @@ -52,7 +52,7 @@ include_once (G4_ADMIN_PATH.'/admin.head.php'); - + + @@ -149,38 +151,27 @@ $(function() { $("#tr_cp_trunc").hide(); + $("#cp_method_btn").click(function() { + var cp_method = $("#cp_method").val(); + change_method(cp_method); + }); + $("#cp_type_btn").click(function() { + var cp_type = $("#cp_type").val(); + change_type(cp_type); + }); + + /** select 변경때 반영하려면 주서 제거 $("#cp_method").change(function() { var cp_method = $(this).val(); - $("#sch_target_frm").hide(); - if(cp_method == "0") { - $("#sch_target").text("상품검색"); - $("#tr_cp_target").find("label").text("적용상품"); - $("#tr_cp_target").find("input").attr("required", true).addClass("required"); - $("#tr_cp_target").show(); - } else if(cp_method == "1") { - $("#sch_target").text("분류검색"); - $("#tr_cp_target").find("label").text("적용분류"); - $("#tr_cp_target").find("input").attr("required", true).addClass("required"); - $("#tr_cp_target").show(); - } else { - $("#tr_cp_target").hide(); - $("#tr_cp_target").find("input").attr("required", false).removeClass("required"); - } + change_method(cp_method); }); $("#cp_type").change(function() { var cp_type = $(this).val(); - if(cp_type == "0") { - $("#cp_amount_unit").text("원"); - $("#cp_amount_unit").closest("tr").find("label").text("할인금액"); - $("#tr_cp_trunc").hide(); - } else { - $("#cp_amount_unit").text("%"); - $("#cp_amount_unit").closest("tr").find("label").text("할인비율"); - $("#tr_cp_trunc").show(); - } + change_type(cp_type); }); + */ $("#sch_target").click(function() { var cp_method = $("#cp_method").val(); @@ -208,6 +199,37 @@ $(function() { }); }); +function change_method(cp_method) +{ + if(cp_method == "0") { + $("#sch_target").text("상품검색"); + $("#tr_cp_target").find("label").text("적용상품"); + $("#tr_cp_target").find("input").attr("required", true).addClass("required"); + $("#tr_cp_target").show(); + } else if(cp_method == "1") { + $("#sch_target").text("분류검색"); + $("#tr_cp_target").find("label").text("적용분류"); + $("#tr_cp_target").find("input").attr("required", true).addClass("required"); + $("#tr_cp_target").show(); + } else { + $("#tr_cp_target").hide(); + $("#tr_cp_target").find("input").attr("required", false).removeClass("required"); + } +} + +function change_type(cp_type) +{ + if(cp_type == "0") { + $("#cp_amount_unit").text("원"); + $("#cp_amount_unit").closest("tr").find("label").text("할인금액"); + $("#tr_cp_trunc").hide(); + } else { + $("#cp_amount_unit").text("%"); + $("#cp_amount_unit").closest("tr").find("label").text("할인비율"); + $("#tr_cp_trunc").show(); + } +} + function form_check(f) { var sel_type = f.cp_type;