shopForm.php 9.37 KB
<? 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"]);
	
	$admin_type = $obj->admUser["admin_type"]; 
	
	
	$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(){

		initFileUpload(101);
		initFileUpload(102);
		initFileUpload(103);
		initFileUpload(104);
		initFileUpload(105);

		<?if($admin_type == 3) { ?>
			setReadOnly();
		<?} ?>
		//=====프레입웤 변수들==================================================================================//
		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;
		});


		$(".jSave").click2(function(){

			$("#jData").ajaxSubmit({
				url:"/action_front.php?cmd=AdminOperate.saveShop",
				type : "post",
				forceSync : true,
				dataType : "json",
				success : function(data){
					alert(data.returnMessage);
					location.href = _rurl;
				}

			});
		});

		$("#jCategorCd").change(function(){
			setPromotion();
		});

		setPromotion();

	}) ;


	function setPromotion()
	{
		if($("#jCategorCd").val() == "1")
		{
			$("#jPromotionSelect").val("1");
			$("#jPromotionSelect").prop("disabled", true);
			$("#jPromotionHidden").prop("disabled", false);
		}
		else
		{
			$("#jPromotionSelect").prop("disabled", false);
			$("#jPromotionHidden").prop("disabled", true);
		}
	}

	function setReadOnly(){
		$("[name=name]").attr("readonly", true);
		$("[name=tel]").attr("readonly", true);
		$("[name=addr_old]").attr("readonly", true);
		$("[name=addr_new]").attr("readonly", true);
		$("[name=discount_rate]").attr("readonly", true);
		$("[name=discount_desc]").attr("readonly", true);
	}
</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">
<?
						if($admin_type == 3){
?>
<?
							for ($i=0; $i<sizeof($cateCodeList); $i++){
?>
							<?if($cateCodeList[$i]["no"] == $info["category_cd"]) echo $cateCodeList[$i]["name"]; ?>
<?
							}
?>						
						<input type = "hidden" name = "category_cd" value = "<?=$info["category_cd"] ?>"/>
<?
						} else {
?>
						<select name="category_cd" id="jCategorCd">
							<?for ($i=0; $i<sizeof($cateCodeList); $i++){ ?>
							<option value="<?=$cateCodeList[$i]["no"] ?>" <?=$info["category_cd"] == $cateCodeList[$i]["no"] ? "SELECTED" : "" ?> ><?=$cateCodeList[$i]["name"] ?></option>
							<?} ?>
						</select>
<?
						}
?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">상점타입</th>
					<td class="l">
<?
					if($admin_type == 3){
						switch ($info["promotion"])
						{
							case "0": echo "일반상점";
							case "1": echo "제휴상점";

						}
?>
						<input type="hidden" name="promotion" id="jPromotionHidden" value="<?=$info["promotion"] ?>" />
					
<?
					} else {
?>
						<input type="hidden" name="promotion" id="jPromotionHidden" value="1" />
						<select name="promotion" id="jPromotionSelect">
							<option value="1" <?=$info["promotion"] == "1" ? "SELECTED" : "" ?> >제휴상점</option>
							<option value="0" <?=$info["promotion"] == "0" ? "SELECTED" : "" ?> >일반상점</option>

						</select>
<?
					}
?>

					</td>
				</tr>
<?
				if($admin_type == 3){
?>
				<tr>
					<th style="height:25px;">상점명</th>
					<td class="l">
						<input type="hidden" name="name" class="wl" value="<?=$info["name"] ?>" />
						<?=$info["name"] ?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">연락처</th>
					<td class="l">
						<input type="hidden" name="tel" class="wl" value="<?=$info["tel"] ?>" />
						<?=$info["tel"] ?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">상점 지번 주소</th>
					<td class="l">
						<input type="hidden" name="addr_old" class="wl" value="<?=$info["addr_old"] ?>" />
						<?=$info["addr_old"] ?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">상점 도로명 주소</th>
					<td class="l">
						<input type="hidden" name="addr_new" class="wl" value="<?=$info["addr_new"] ?>" />
						<?=$info["addr_new"] ?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">기본 할인율</th>
					<td class="l">
						<input type="hidden" name="discount_rate" class="wl" value="<?=$info["discount_rate"] ?>" />
						<?=$info["discount_rate"] ?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">기타 안내</th>
					<td class="l">
						<input type="hidden" name="discount_desc" class="wl" value="<?=$info["discount_desc"] ?>" />
						<?=$info["discount_desc"] ?>
					</td>
				</tr>
<?
				} else {
?>
				<tr>
					<th style="height:25px;">상점명</th>
					<td class="l">
						<input type="text" name="name" class="wl" value="<?=$info["name"] ?>" />
					</td>
				</tr>
				<tr>
					<th style="height:25px;">연락처</th>
					<td class="l">
						<input type="text" name="tel" class="wl" value="<?=$info["tel"] ?>" />
					</td>
				</tr>
				<tr>
					<th style="height:25px;">상점 지번 주소</th>
					<td class="l">
						<input type="text" name="addr_old" class="wl" value="<?=$info["addr_old"] ?>" />
					</td>
				</tr>
				<tr>
					<th style="height:25px;">상점 도로명 주소</th>
					<td class="l">
						<input type="text" name="addr_new" class="wl" value="<?=$info["addr_new"] ?>" />
					</td>
				</tr>
				<tr>
					<th style="height:25px;">기본 할인율</th>
					<td class="l">
						<input type="text" name="discount_rate" class="wl" value="<?=$info["discount_rate"] ?>" />
					</td>
				</tr>
				<tr>
					<th style="height:25px;">기타 안내</th>
					<td class="l">
						<input type="text" name="discount_desc" class="wl" value="<?=$info["discount_desc"] ?>" />
					</td>
				</tr>
<?
				}
?>
				<tr>
					<th style="height:25px;">이미지 1</th>
					<td class="l">
						<?
							$fileIndex	= "101";
							$fileName	= "img1";
							$filePath	= ($shopImgList[0]["file_vir_name"] == "" ? "" : $shopImgList[0]["file_vir_name"]);
							$fileNumber	= ($shopImgList[0]["no"] == "" ? "0" : $shopImgList[0]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">이미지 2</th>
					<td class="l">
						<?
							$fileIndex	= "102";
							$fileName	= "img2";
							$filePath	= ($shopImgList[1]["file_vir_name"] == "" ? "" : $shopImgList[1]["file_vir_name"]);
							$fileNumber	= ($shopImgList[1]["no"] == "" ? "0" : $shopImgList[1]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">이미지 3</th>
					<td class="l">
						<?
							$fileIndex	= "103";
							$fileName	= "img3";
							$filePath	= ($shopImgList[2]["file_vir_name"] == "" ? "" : $shopImgList[2]["file_vir_name"]);
							$fileNumber	= ($shopImgList[2]["no"] == "" ? "0" : $shopImgList[2]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">이미지 4</th>
					<td class="l">
						<?
							$fileIndex	= "104";
							$fileName	= "img4";
							$filePath	= ($shopImgList[3]["file_vir_name"] == "" ? "" : $shopImgList[3]["file_vir_name"]);
							$fileNumber	= ($shopImgList[3]["no"] == "" ? "0" : $shopImgList[3]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
					</td>
				</tr>
				<tr>
					<th style="height:25px;">이미지 5</th>
					<td class="l">
						<?
							$fileIndex	= "105";
							$fileName	= "img5";
							$filePath	= ($shopImgList[4]["file_vir_name"] == "" ? "" : $shopImgList[4]["file_vir_name"]);
							$fileNumber	= ($shopImgList[4]["no"] == "" ? "0" : $shopImgList[4]["no"]);
							include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/fileUpload/fileUpload.php";
						?>
					</td>
				</tr>
			</table>
		</form>
		
		<div class="btngroupcenter">
			<span class="button bigrounded blue jCancel">취소 </span>
			<span class="button bigrounded blue jSave" >저장</span>
		</div>

	</div>
</div>