adminView.php
9.44 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
<? include $_SERVER["DOCUMENT_ROOT"] . "/common/classes/AdminUser.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/header.php" ?>
<? include $_SERVER["DOCUMENT_ROOT"] . "/admin/inc/php/leftUserManage.php" ?>
<?
$obj = new AdminUser($_REQUEST, "");
$userInfo = $obj->getInfoOfAdminUser();
$rurl = pack("H*", $_REQUEST["rurl"]) ;
?>
<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 dates = $("[name='birthDT[]']").datepicker({
showMonthAfterYear:true,
inline: true,
changeMonth: true,
changeYear: true,
yearRange: '1970',
dateFormat : 'yy-mm-dd',
dayNamesMin:['일', '월', '화', '수', '목', '금', ' 토'],
monthNames:['1월','2월','3월','4월','5월','6월','7 월','8월','9월','10월','11월','12월'],
monthNamesShort:['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
showButtonPanel: true, currentText: '오늘 ' , closeText: '닫기'
});
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(){
var confirmStr = (_no == "") ? "등록하시겠습니까?" : "수정하시겠습니까?";
var target_fk = $("#target_fk").val();
var admin_type = $("#admin_type").val();
var admin_id = $("#admin_id").val();
var admin_pwd = $("#admin_pwd").val();
var admin_name = $("#admin_name").val();
var admin_phone = $("#admin_phone").val();
var is_inquire_position = $("#is_inquire_position:checked").length > 0 ? "1" : "0";
if(target_fk == "")
{
if(admin_type == "2")
{
alert("관리 그룹을 선택해주세요.");
return false;
}
else if(admin_type == "3")
{
alert("관리 상점을 선택해주세요.");
return false;
}
}
if(admin_id == "")
{
alert("아이디를 입력해주세요.");
return false;
}
if(admin_name == "")
{
alert("이름을 입력해주세요.");
return false;
}
if(admin_phone == "")
{
alert("전화번호를 입력해주세요.");
return false;
}
if(_no == "" && admin_pwd == "")
{
alert("비밀번호를 입력해주세요.");
return false;
}
if(confirm(confirmStr))
{
$.ajax({
url : "/action_front.php?cmd=AdminUser.saveAdminUser",
async : false,
cache : false,
dataType : "json",
data : {
"no" : _no
, "admin_type" : admin_type
, "admin_id" : admin_id
, "admin_pwd" : admin_pwd
, "admin_name" : admin_name
, "admin_phone" : admin_phone
, "is_inquire_position" : is_inquire_position
, "target_fk" : target_fk
},
success : function(data){
alert(data.returnMessage);
if(data.returnCode == "1")
{
if(_no != "")
location.reload();
else
location.href = _rurl;
}
}
});
}
}) ;
$("#admin_type").change(function(){
setTargetView(false);
});
$(".jResetTargetData").click2(function(){
resetTargetData();
});
$(".jViewSearchBtn").click2(function(){
var admin_type = $("[name='admin_type']").val();
var title = "그룹 검색";
if(admin_type == "3")
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 target_fk = $(".jTargetNo:checked").val();
var target_name = $(".jTargetNo:checked").parents("tr").find(".jTargetName").attr("data");
if(target_fk == undefined)
{
alert("대상을 선택해주세요.");
return false;
}
else
{
$("#target_fk").val(target_fk);
$("#jTargetName").val(target_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 = "";
if(search_text == "")
{
alert("검색어를 입력해주세요.");
return false;
}
if($("#admin_type").val() == "2")
ajax_url = "/admin/entity/entityGroupSearch.php";
else
ajax_url = "/admin/entity/entityShopSearch.php";
$.ajax({
url : ajax_url,
data : {
"search_text" : search_text
},
dataType:"html",
success : function(data)
{
$("#jSearchResultArea").html(data);
setSearchAreaEventHandler();
}
});
});
setTargetView(true);
}) ;
function setSearchAreaEventHandler()
{
$(".jTargetNo").unbind("change");
$(".jTargetNo").change(function(){
$(".jTargetNo").prop("checked", false);
$(this).prop("checked", true);
});
}
function setTargetView(isInit)
{
if(!isInit)
resetTargetData();
if($("#admin_type").val() == "2")
{
$("#jTargetTitle").html("관리 그룹");
}
else
{
$("#jTargetTitle").html("관리 상점");
}
}
function resetTargetData()
{
$("#target_fk").val("");
$("#jTargetName").val("");
}
</script>
<div id="Contents" class="notice">
<h1>관리자 상세화면</h1>
<!-- location area -->
<h2>
회원 관리 > <span>관리자 상세화면</span>
</h2>
<!-- location area -->
<div class="data" style="width:50%;">
<h3>관리자 정보</h3>
<input type="hidden" id="target_fk" name="target_fk" value="<?=$userInfo["target_fk"]?>" />
<table class="datav" style="width:100%;">
<colgroup>
<col width="30%" />
<col width="70%" />
</colgroup>
<tr>
<th style="height:25px;">관리자 타입</th>
<td class="l">
<select name="admin_type" id="admin_type" <?= ($loginInfo["admin_type"] == "1") ? "" : "disabled='disabled'" ?>>
<option value="2" <?=$userInfo["admin_type"] == "2" ? "SELECTED" : ""?> >그룹관리자</option>
<option value="3" <?=$userInfo["admin_type"] == "3" ? "SELECTED" : ""?> >상점관리자</option>
</select>
</td>
</tr>
<tr>
<th style="height:25px;">관리자 아이디</th>
<td class="l">
<input type="text" id="admin_id" name="admin_id" value="<?=$userInfo["admin_id"]?>" />
<label style="margin-left:20px; <?= ($loginInfo["admin_type"] == "1") ? "" : " display:none;" ?>">
<input type="checkbox" id="is_inquire_position" style="vertical-align:middle; margin:auto; " value="1" <?=$userInfo["is_inquire_position"] == "1" ? "CHECKED" : "" ?> > 민원 담당자로 지정
</label>
</td>
</tr>
<tr>
<th style="height:25px;">관리자 비밀번호</th>
<td class="l">
<input type="password" id="admin_pwd" name="admin_pwd" value="" />
</td>
</tr>
<tr>
<th style="height:25px;">관리자 이름</th>
<td class="l">
<input type="text" id="admin_name" name="admin_name" value="<?=$userInfo["admin_name"]?>" />
</td>
</tr>
<tr>
<th style="height:25px;">관리자 전화번호</th>
<td class="l">
<input type="text" id="admin_phone" name="admin_phone" value="<?=$userInfo["admin_phone"]?>" />
</td>
</tr>
<tr>
<th style="height:25px;" id="jTargetTitle">관리 그룹</th>
<td class="l">
<input type="text" id="jTargetName" value="<?=$userInfo["target_name"]?>" disabled="disabled" />
<?if($loginInfo["admin_type"] == "1"){ ?>
<input type="button" class="button searchsmall white jViewSearchBtn" value="검색" />
<input type="button" class="button searchsmall white jResetTargetData" value="삭제"/>
<?} ?>
</td>
</tr>
</table>
<div class="btngroupcenter">
<span class="button bigrounded blue jCancel">목록으로 </span>
<span class="button bigrounded blue jSave" >저장</span>
</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>