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
|
<!DOCTYPE html> <html lang="en">
<head> <?php include 'inc/head.php'; ?> <link href="./assets/css/datatables.min.css?<?php rand(10,100) ?>" rel="stylesheet" /> <?php include 'inc/links.php'; ?> </head>
<body> <div class="app-container app-theme-white body-tabs-shadow fixed-sidebar ">
<?php include 'inc/header.php'; ?> <!-- <?php include 'inc/setting.php'; ?> -->
<div class="app-main">
<?php include 'inc/side_menu.php'; ?> <div class="app-main__outer"> <div class="app-main__inner"> <div class="app-page-title"> <div class="page-title-wrapper"> <div class="page-title-heading">
<div> 設定公司課程 <!-- <div class="page-title-subheading"> This is an example dashboard created using build-in elements and components. </div> --> </div> </div> <div class="page-title-actions">
<div class="page-title-actionsWrap dropdown"> <button type="button" class="btn-shadow btn btn-primary" onclick="window.location.href = 'company_course_add.php';"> <span class="btn-icon-wrapper pr-2 opacity-7">
<i class="fas fa-plus-circle fa-w-20"></i> </span> 新增 </button> <!-- <div tabindex="-1" role="menu" aria-hidden="true" class="dropdown-menu dropdown-menu-right"> <ul class="nav flex-column"> <li class="nav-item"> <a href="javascript:void(0);" class="nav-link"> <i class="nav-link-icon lnr-inbox"></i> <span> Inbox </span> <div class="ml-auto badge badge-pill badge-secondary"> 86 </div> </a> </li> <li class="nav-item"> <a href="javascript:void(0);" class="nav-link"> <i class="nav-link-icon lnr-book"></i> <span> Book </span> <div class="ml-auto badge badge-pill badge-danger"> 5 </div> </a> </li> <li class="nav-item"> <a href="javascript:void(0);" class="nav-link"> <i class="nav-link-icon lnr-picture"></i> <span> Picture </span> </a> </li> <li class="nav-item"> <a disabled href="javascript:void(0);" class="nav-link disabled"> <i class="nav-link-icon lnr-file-empty"></i> <span> File Disabled </span> </a> </li> </ul> </div> --> </div> </div> </div> </div> <div class="filterSearch"> <div class="row w-100 gaptop10"> <div class="col-md-6">
<div class="input-group"> <div class="input-group-prepend"><span class="input-group-text">公司帳戶編號/名稱</span> </div> <select name="select" class="form-control"> <option>全部/公司A</option> <option>公司B</option> <option>公司C</option>
</select> </div>
</div> <div class="col-md-6"> <div class="input-group"> <div class="input-group-prepend"><span class="input-group-text">課程名稱</span> </div> <select name="select" class="form-control"> <option>全部</option> <option>課程A</option> <option>課程B</option> <option>課程C</option>
</select> </div> </div>
</div> <button class="btn btn-secondary filterSubmitBtn"><i class="fas fa-search"></i> 搜尋</button> </div> <div class="table-responsive"> <table id="datatable" class="display table" style="width:100%"> <thead>
</thead> <tbody></tbody>
</table> </div>
</div> <?php include 'inc/footer.php'; ?> </div> <script src="http://maps.google.com/maps/api/js?sensor=true"></script> </div> </div>
<?php include 'inc/custom.php'; ?> <script type="text/javascript" src="./assets/scripts/main.js"></script> <script> $(document).ready(function() {
function format(d) {
var row = '';
$.each(d.column07, function(index, item) { row += ` <tr> <td>${item.name_tc}</td> <td>${item.name_en}</td> <td>${item.id}</td> <td>${item.tel}</td> <td>${item.startdate}</td> <td>${item.enddate}</td> </tr>`; });
// `d` is the original data object for the row return ( `<table class="table" style="width:100%"> <thead> <tr> <th>員工中文名稱</th> <th>員工英文名稱</th> <th>身份証號碼(英文字母及頭四位數字)</th> <th>聯絡電話</th> <th>報名日期時間</th> <th>完成日期時間</th> </tr> </thead> <tbody> <tr> ${row} </tr> </tbody> </table>` );
}
var columnDefs = [{ className: 'dt-control', orderable: false, data: null, defaultContent: '', }, { data: "column01", title: "公司帳戶名稱" }, { data: "column02", title: "課程名稱/編號"
}, { data: "column03", title: "開放日期",
}, { data: "column04", title: "完結日期"
}, {
render: function(data, type, row) {
var result = `<a href="course_record.php">查閱/管理</a>`; return result; },
title: "參加者名單"
}, {
render: function(data, type, row) {
var result = `<div class="mb-2 mr-2 badge badge-${row.column06}">${row.column05}</div>`; return result; },
title: "狀態"
}, { render: function(data, type, row) { status = row.column12; var result = `<button class="mb-2 mr-2 btn btn-info text-white" ><i class="fas fa-eye"></i></button> <button class="mb-2 mr-2 btn btn-warning text-white" onclick="window.location.href = 'company_course_edit.php';"><i class="fas fa-pencil-alt"></i></button> <button class="mb-2 mr-2 btn btn-danger text-white" ><i class="fas fa-trash-alt"></i></button> `; return result; },
title: "動作" } ];
var siteTable = $('#datatable').DataTable({ scrollX: false, ajax: "../course_admin/assets/json/demo_data3.json",
columns: columnDefs,
searching: false, select: 'single', responsive: true, lengthMenu: [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ], altEditor: true, // Enable altEditor pageLength: 10, order: [] });
$('#datatable tbody').on('click', 'td.dt-control', function() { var tr = $(this).closest('tr'); var row = siteTable.row(tr);
if (row.child.isShown()) { // This row is already open - close it row.child.hide(); tr.removeClass('shown'); } else { // Open this row row.child(format(row.data())).show(); tr.addClass('shown'); } });
}); </script> </body>
</html>
|