<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminOperate.php" ?> <? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?> <? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftOperateManage.php" ?> <? $obj = new AdminOperate($_REQUEST, ""); $info = $obj->getInfoOfShop(); $cateCodeList = $obj->getShopCategoryCodeList(); $shopImgList = $obj->getShopImgList($info["no"]); $shopGroupRateList = $obj->getListOfShopRateForGroup($info["no"]); if($loginInfo["admin_type"] == "2") $adminGroupInfo = $obj->getGroupData($loginInfo["target_fk"]); $rurl = pack("H*", $_REQUEST["rurl"]) ; ?> <script src="/admin/inc/fileUpload/fileUploadJS.js"></script> <script type="text/javascript"> var _rurl = "<?=$rurl?>"; var _no = "<?=$_REQUEST[no]?>"; $(document).ready(function(){ //=====프레입웤 변수들==================================================================================// var FORM_TARGET_CLS_NM = ".data" ; // 폼을 동적 wrap 할 타겟 ID이름 var FORM_NAME = "alf" ; // 폼이름 var FORM_METHOD = "POST" ; // 폼 메쏘드 var FORM_USE_FILE = false ; // 파일폼 사용 여부 var FORM_ACTION = "/action_front.php" ; var NEXT_CMD = "" ; // 다은 수행 할 cmd //=====================================================================================================// var jForm = $(FORM_TARGET_CLS_NM).mf({ "name" : FORM_NAME , "method" : FORM_METHOD , "action" : FORM_ACTION , "useFile" : FORM_USE_FILE }) ; $(".jCancel").click2(function(){ location.href = _rurl; }); $(".jDel").click2(function(){ var noArr = new Array(_no); if(confirm("정말 삭제하시겠습니까?")) { deleteActrion(noArr); } }); $(".jSave").click2(function(){ location.href = "/admin/operateManage/shopForm.php?no=" + _no + "&rurl=" + jQuery.rich.bin2hex(document.URL); }); $(".jSearchGroup").click2(function(){ var title = "그룹 검색"; $('#jDialogArea').dialog({ modal : true, title : title, open : function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }, width : 400, height : 500, resizable : false, buttons: [ { text: "확인", click: function() { var group_no = $(".jTargetNo:checked").val(); var group_name = $(".jTargetNo:checked").parents("tr").find(".jTargetName").attr("data"); if(group_no == undefined) { alert("대상을 선택해주세요."); return false; } else { $("#group_no").val(group_no); $("#group_name").val(group_name); $( this ).dialog( "close" ); $("#jTargetSearchText").val(""); $("#jSearchResultArea").empty(); } } }, { text: "닫기", click: function() { $("#jTargetSearchText").val(""); $("#jSearchResultArea").empty(); $( this ).dialog( "close" ); } } ], closeOnEscape: false }); }); $(".jTargetSearchBtn").click2(function(){ var search_text = $("#jTargetSearchText").val(); var ajax_url = "/admin/entity/entityGroupSearch.php"; if(search_text == "") { alert("검색어를 입력해주세요."); return false; } $.ajax({ url : ajax_url, data : { "search_text" : search_text }, dataType:"html", success : function(data) { $("#jSearchResultArea").html(data); setSearchAreaEventHandler(); } }); }); $(".jSaveGroupRate").click2(function(){ var group_no = $("#group_no").val(); var discount_rate = $("#discount_rate").val(); if(group_no == "") { alert("그룹을 선택해주세요."); return false; } if(discount_rate == "") { alert("할인율을 입력해주세요."); return false; } $.ajax({ url : "/action_front.php?cmd=AdminOperate.saveShopGroupRate", data : { "shop_no" : _no, "group_no" : group_no, "discount_rate" : discount_rate }, dataType:"json", success : function(data) { alert(data.returnMessage); location.reload(); } }); }); $(".jDelGroupRate").click2(function(){ var shop_no = $(this).attr("shop_no"); var group_no = $(this).attr("group_no"); if(confirm("삭제하시겠습니까?")) { $.ajax({ url : "/action_front.php?cmd=AdminOperate.delShopGroupRate", data : { "shop_no" : _no, "group_no" : group_no }, dataType:"json", success : function(data) { alert(data.returnMessage); location.reload(); } }); } }); }) ; function deleteActrion(noArr) { $.ajax({ url : "/action_front.php?cmd=AdminOperate.delShop", async : false, cache : false, dataType : "json", data : { "no" : noArr }, success : function(data){ location.href = _rurl; } }); } function setSearchAreaEventHandler() { $(".jTargetNo").unbind("change"); $(".jTargetNo").change(function(){ $(".jTargetNo").prop("checked", false); $(this).prop("checked", true); }); } function resetTargetData() { $("#group_no").val(""); $("#group_name").val(""); } </script> <div id="Contents" class="notice"> <h1>상점 상세화면</h1> <!-- location area --> <h2> 운영 관리 > <span>상점 상세화면</span> </h2> <!-- location area --> <div class="data" style="width:60%;"> <h3>상점 상세정보</h3> <form id="jData" method="post" enctype="multipart/form-data"> <input type="hidden" name="no" value="<?=$_REQUEST[no]?>" /> <table class="datav" style="width:100%;"> <colgroup> <col width="30%" /> <col width="70%" /> </colgroup> <tr> <th style="height:25px;">상점 카테고리</th> <td class="l"> <? for ($i=0; $i<sizeof($cateCodeList); $i++) { if($info["category_cd"] == $cateCodeList[$i]["no"]) { echo $cateCodeList[$i]["name"]; break; } } ?> </td> </tr> <tr> <th style="height:25px;">상점타입</th> <td class="l"> <? switch ($info["promotion"]) { case "0": echo "일반상점"; case "1": echo "제휴상점"; } ?> </td> </tr> <tr> <th style="height:25px;">상점명</th> <td class="l"> <?=$info["name"] ?> </td> </tr> <tr> <th style="height:25px;">연락처</th> <td class="l"> <?=$info["tel"] ?> </td> </tr> <tr> <th style="height:25px;">상점 지번 주소</th> <td class="l"> <?=$info["addr_old"] ?> </td> </tr> <tr> <th style="height:25px;">상점 도로명 주소</th> <td class="l"> <?=$info["addr_new"] ?> </td> </tr> <tr> <th style="height:25px;">기본 할인율</th> <td class="l"> <?=$info["discount_rate"] ?> </td> </tr> <tr> <th style="height:25px;">할인 내용</th> <td class="l"> <?=$info["discount_desc"] ?> </td> </tr> <?for($i=0; $i<sizeof($shopImgList); $i++){ ?> <tr> <th style="height:25px;">이미지 <?=($i+1)?></th> <td class="l"> <img src="/upload_img/<?=$shopImgList[$i]["file_vir_name"] ?>" style="width:200px;"/> </td> </tr> <?} ?> </table> </form> <div class="btngroupcenter"> <span class="button bigrounded blue jCancel">목록으로 </span> <?if($loginInfo["admin_type"] == "1" || $loginInfo["admin_type"] == "3"){ ?> <span class="button bigrounded blue jSave" >수정</span> <?} ?> <?if($loginInfo["admin_type"] == "1"){ ?> <span class="button bigrounded blue jDel" >삭제</span> <?} ?> </div> <div> <?if($loginInfo["admin_type"] == "1"){ ?> <h3>그룹 할인율 등록</h3> <table class="datacList" style="width:100%;"> <thead> <tr> <th width="15%">그룹명</th> <th width="10%">할인율</th> <th width="10%">-</th> </tr> </thead> <tbody><!-- 10줄 리스트// 마지막 tr에 class="last" 넣어주세요 --> <tr class="last"> <td class="center"> <input type="hidden" id="group_no" /> <input type="text" style="width:95%;" disabled="disabled" id="group_name"/> </td> <td class="center"> <input type="text" style="width:95%;" id="discount_rate"/> </td> <td class="center"> <input type="button" class="button searchsmall white jSearchGroup" value="그룹검색" /> <input type="button" class="button searchsmall white jSaveGroupRate" value="저장" /> </td> </tr> </tbody> </table> <?} else if($loginInfo["admin_type"] == "2"){ ?> <h3>그룹 할인율 등록</h3> <table class="datacList" style="width:100%;"> <thead> <tr> <th width="15%">그룹명</th> <th width="10%">할인율</th> <th width="10%">-</th> </tr> </thead> <tbody><!-- 10줄 리스트// 마지막 tr에 class="last" 넣어주세요 --> <tr class="last"> <td class="center"> <input type="hidden" id="group_no" value="<?=$adminGroupInfo["no"] ?>"/> <input type="text" style="width:95%;" disabled="disabled" id="group_name" value="<?=$adminGroupInfo["name"] ?>"/> </td> <td class="center"> <input type="text" style="width:95%;" id="discount_rate" value="<?=$shopGroupRateList[0]["discount_rate"] ?>"/> </td> <td class="center"> <input type="button" class="button searchsmall white jSaveGroupRate" value="저장" /> <?if($shopGroupRateList[0] != null){ ?> <input type="button" class="button searchsmall white jDelGroupRate" value="삭제" shop_no="<?=$shopGroupRateList[0]["shop_fk"] ?>" group_no="<?=$shopGroupRateList[0]["group_fk"] ?>" /> <?} ?> </td> </tr> </tbody> </table> <?} ?> <h3>그룹별 할인율</h3> <table class="datacList" style="width:100%;"> <thead> <tr> <th class="no" width="5%">No</th> <th width="15%">그룹명</th> <th width="15%">할인율</th> <?if($loginInfo["admin_type"] == "1"){ ?> <th width="15%">-</th> <?} ?> </tr> </thead> <tbody><!-- 10줄 리스트// 마지막 tr에 class="last" 넣어주세요 --> <?for($i=0; $i<sizeof($shopGroupRateList); $i++){ ?> <tr class="<?=(sizeof($list)-1 == $i) ? "last" : "datacLists"?>"> <td class="center"> <?=sizeof($shopGroupRateList) - $i ?> </td> <td class="center"> <?=$shopGroupRateList[$i]["group_name"] ?> </td> <td class="center"> <?=$shopGroupRateList[$i]["discount_rate"] ?> </td> <?if($loginInfo["admin_type"] == "1"){ ?> <td class="center"> <input type="button" class="button searchsmall white jDelGroupRate" value="삭제" shop_no="<?=$shopGroupRateList[$i]["shop_fk"] ?>" group_no="<?=$shopGroupRateList[$i]["group_fk"] ?>" /> </td> <?} ?> </tr> <?} ?> </tbody> </table> </div> </div> <div id="jDialogArea" style="display:none;"> <table class="datacList" style="width:100%;"> <thead> <tr> <td class="no" colspan="2" style="text-align:center; height:35px;"> <input type="text" id="jTargetSearchText" style="width:50%;" placeholder="검색어를 입력해야 결과가 노출 됩니다."> <input type="button" class="button searchsmall white jTargetSearchBtn" value="검색" /> </td> </tr> </thead> <thead> <tr> <th class="no" colspan="2">검색결과</th> </tr> </thead> <tbody id="jSearchResultArea"><!-- 10줄 리스트// 마지막 tr에 class="last" 넣어주세요 --> </tbody> </table> </div> </div>