shopView.php
12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
<? 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>