forked from kyeongwan/GDG_QR_Staff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
268 lines (250 loc) · 8.8 KB
/
test.html
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>GDG 참석자 관리메뉴</title>
<link type="text/css" rel="stylesheet" href="./assets/css_ext/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="./assets/css_ext/font-awesome.min.css">
<link type="text/css" rel="stylesheet" href="./assets/css_ext/dataTables.bootstrap.css">
<link type="text/css" rel="stylesheet" href="./assets/css_ext/dataTables.responsive.css">
<link type="text/css" rel="stylesheet" href="./assets/css_ext/bootstrap-toggle.min.css">
<script type="text/javascript" src="./assets/js_ext/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="./assets/js_ext/bootstrap.min.js"></script>
<script type="text/javascript" src="./assets/js_ext/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="./assets/js_ext/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="./assets/js_ext/bootstrap-toggle.min.js"></script>
<link type="text/css" rel="stylesheet" href="./assets/css/main.css">
<script type="text/javascript">
var eventId;
var groupName;
var apiKey;
var list_table;
var user_list = [];
function setListData(data) {
user_list = data;
list_table = $('#user_list').DataTable({
initComplete: function () {
var html = "";
html += "<label>";
html += "<button type='button' class='btn btn-primary' id='allPersonAbsent'>모든참가자 불참처리</button>";
html += "</label>";
html += "<label>";
html += "<button type='button' class='btn btn-primary' id='allPersonNoShow'>모든참가자 노쇼처리</button>";
html += "</label>";
$('#user_list_length').html(html);
$('#allPersonAbsent').off("click").on('click', function() {
var ret = confirm("모든 참가자를 불참처리 하시겠습니까?");
if(ret) {
allPersonReset("absent");
}
});
$('#allPersonNoShow').off("click").on('click', function() {
var ret = confirm("모든 참가자를 노쇼처리 하시겠습니까?");
if(ret) {
allPersonReset("noshow");
}
});
},
drawCallback: function() {
$(".btn_attended_person").off("click").on("click", function() {
var ret = confirm("참석처리 하시겠습니까?");
if(ret) {
var userID = $(this).parent("td").parent("tr").attr("id");
console.log(userID);
rsvpPerson(userID, "attended");
}
});
$(".btn_noshow_person").off("click").on("click", function() {
var ret = confirm("불참처리 하시겠습니까?");
if(ret) {
var userID = $(this).parent("td").parent("tr").attr("id");
console.log(userID);
rsvpPerson(userID, "noshow");
}
});
}
});
$.each(user_list, function(key, val) {
var noshow = "<button type='button' class='btn btn-warning btn-sm btn_noshow_person'>불참처리</button>";
var attended = "<button type='button' class='btn btn-primary btn-sm btn_attended_person'>확인</button>";
var photo = "<img src=" + val.photo+">";
if(val.rsvpedOn == null)
val.rsvpedOn = "";
else{
var week = new Array('일', '월', '화', '수', '목', '금', '토');
var date = new Date(val.rsvpedOn);
val.rsvpedOn = date.getFullYear() + ". " + (date.getMonth() + 1) + ". " + date.getDate() + " (" + week[date.getDay()] + ") "+date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
}
if(val.answer == null) {
val.answer = "";
}
if(val.price == null) {
val.price = "";
}
var new_node = list_table.row.add([
photo,
val.name,
val.userID,
val.rsvps,
val.price,
val.rsvpedOn,
val.answer,
attended,
noshow
]).node();
$(new_node).attr("id", val.userID);
});
list_table.draw();
}
function initData() {
$.ajax({
url:'./api?groupName=' + groupName + '&eventId=' + eventId + '&apiKey=' + apiKey,
success:function(data){
console.log(data);
setListData(data);
},
error:function(request,status,error){
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
}
});
};
$(document).ready(function() {
$("#btnApplyButton").off("click").on("click", function() {
eventId = $("#form_event").val();
groupName = $("#form_group").val();
apiKey = $("#form_api").val();
if (list_table != null ) {
list_table.clear();
list_table.destroy();
}
initData();
});
});
function rsvpPerson(id, result){
var params = new Object();
params.member = id;
params.status = result;
params.eventId = eventId;
params.groupName = groupName;
params.apiKey = apiKey;
console.log(params);
params = JSON.stringify(params);
console.log(params);
$.ajax({
url:'./rsvp',
type: 'POST',
contentType : 'application/json;charset=UTF-8',
data: JSON.stringify(params),
success:function(data){
console.log(data);
alert("처리 되었습니다.");
},
error:function(request,status,error){
console.log(error);
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
}
});
};
function allPersonReset(status){
console.log(user_list);
var userIDData = ""
for (var i = user_list.length - 1; i >= 0; i--) {
userIDData += user_list[i].userID;
if(i != 0)
userIDData += ",";
}
console.log(userIDData);
var params = new Object();
params.member = userIDData;
params.status = status;
params.eventId = eventId;
params.groupName = groupName;
params.apiKey = apiKey;
console.log(params);
params = JSON.stringify(params);
console.log(params);
$.ajax({
url:'./rsvp',
type: 'POST',
contentType : 'application/json;charset=UTF-8',
data: JSON.stringify(params),
success:function(data){
console.log(data);
alert("처리 되었습니다.");
},
error:function(request,status,error){
console.log(error);
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
}
});
};
</script>
</head>
<body>
<div id="wrapper">
<?php include_once CONF_URL_MENU; ?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">참가자 관리</h1>
</div>
</div>
<div class="row">
<div class="col-lg-4">
<input type="text" class="form-control" id="form_group" placeholder="GDG Group 이름">
</div>
<div class="col-lg-4">
<input type="text" class="form-control" id="form_event" placeholder="Event ID">
</div>
<div class="col-lg-3">
<input type="text" class="form-control" id="form_api" placeholder="API Key">
</div>
<div class="col-lg-1">
<button type="button" style="width: 100%" id="btnApplyButton" class="btn btn-primary">Apply</button>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">참가자 리스트</div>
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-bordered table-hover" id="user_list">
<thead>
<tr>
<th>#</th>
<th>이름</th>
<th>User ID</th>
<th>참가신청</th>
<th>Price</th>
<th>참가신청 날짜</th>
<th>Answer</th>
<th>참석처리</th>
<th>불참처리</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal_popup" tabindex="-1" role="dialog" aria-labelledby="modal_popup_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" i d="modal_popup_label"></h4>
</div>
<div class="modal-body" id="modal_popup_content"></div>
<div class="modal-footer" id="modal_popup_footer"></div>
</div>
</div>
</div>
</div>
</body>
</html>