-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathindividual-tracking.Rmd
65 lines (58 loc) · 2.09 KB
/
individual-tracking.Rmd
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
<!-- scripts: [{"src" : "https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"}] -->
<!-- header-meta: [{"name" : "google-signin-client_id", "content" : "842324757776-nonjllne8m8as9djg51e6cg98h6ijam7.apps.googleusercontent.com"}] -->
<!-- header-link: [{"href" : "https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css", "rel" : "stylesheet"}] -->
## 帳務專區
登入後,會將您的追蹤紀錄顯示於下方。
`r paste(readLines("chunks/login.md"), collapse="\n")`
## 報表專區
<div id="report_container">
</div>
<div id="fb-root"></div>
<script type="text/javascript">
var datascienceandrUserData;
var datascienceandrGetUserData = function() {
$.ajax({
url : datascienceandrUrls() + "/api/auth/getCurrentUserRecords",
type : "POST",
data : {},
dataType : "json",
success : function(data) {
datascienceandrUserData = data;
datascienceandrOverlayDiv.hide();
},
complete : datascienceandrRenderUserData,
error: function(jqXHR, textStatus, errorThrown) {
throw errorThrown;
},
timeout : 5000,
xhrFields: {
withCredentials: true
},
crossDomain: true
});
};
var datascienceandrRenderUserData = function() {
var div = $("#report_container");
div.empty();
var src = '<div id="user_id" style="text-align : center;"><h3>以下是' + datascienceandrUser + '的操作紀錄</h3></div>' +
'<table id="used_record_table" class="display">' +
'<thead><td>課程名稱</td><td>單元名稱</td><td>進入/完成</td><td>時間</td></tr></thead>' +
"<tfoot><tr><td>課程名稱</td><td>單元名稱</td><td>進入/完成</td><td>時間</td></tr></tfoot>" +
"<tbody>";
_.forEach(datascienceandrUserData, function(record) {
var result = "<tr><td>" +
record.course.split(":")[0] +
"</td><td>" +
record.course.split(":")[1] +
"</td><td>" +
(record.type == 1 ? "完成" : "進入") +
"</td><td>" +
record.created_at +
"</td></tr>";
src += result;
});
src += "</tbody>";
div.append(src);
$("#used_record_table").DataTable({"columnDefs" : []});
};
</script>