-
Notifications
You must be signed in to change notification settings - Fork 3
/
page-js.html
85 lines (70 loc) · 3.41 KB
/
page-js.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
<script>
document.getElementById('idCBS').readOnly = true;
document.getElementById("btnserno").addEventListener("click",fetchCBS);
function fetchCBS(){
document.getElementById("idCBS").innerHTML = "";
var sernum = document.getElementById("serial").value;
google.script.run
.withSuccessHandler(printCBS)
.queryCBS(sernum);
document.getElementById("serial").value = "";
}
window.printCBS = function(CBS) {
// console.log(CBS);
var i,innerArray;
var L = CBS[0].length;
for (i=0;i<L;i++) {
innerArray = CBS[0][i];
value1 = innerArray[0];
value2 = innerArray[1];
value3 = innerArray[2];
value4 = innerArray[3];
value5 = innerArray[4];
let html='<style>td,th{border:0px solid black;}</style><table>';
html+='<tr><td><a target="_blank" href="https://script.google.com/a/macros/WebAddressOfTheCB_QueryDetailsWebApp/exec?sn=' + value1 + '">' + value1 + '</a></td><td>' + value2 + '</td><td>' + value3 + '</td><td>' + value4 + '</td><td>' + value5 + '</td></tr>';
// You may have to replace the entire web URL, since your Workspace domain may be a part of your URL
// Do note that enabling the previous line requires you first set up CB_QueryDetails, which will act on the clickable links
// CB_QueryDetails can be found here https://github.com/NoSubstitute/CB_QueryDetails
// Do also look into CB_DeviceDetails, as it has more features, even if it's in Swedish
// https://github.com/NoSubstitute/CB_DeviceDetails
html+='</table>';
var myTable = document.getElementById("idCBS");
myTable.insertAdjacentHTML("beforeend", html);
}
}
document.getElementById("btnusername").addEventListener("click",fetchUserDevices);
function fetchUserDevices(){
document.getElementById("idCBS").innerHTML = "";
var uname = document.getElementById("username").value;
google.script.run
.withSuccessHandler(printUD)
.queryUserDevices(uname);
document.getElementById("username").value = "";
}
window.printUD = function(UD) {
// console.log(UD);
var i,innerArray;
var L = UD[0].length;
for (i=0;i<L;i++) {
innerArray = UD[0][i];
value1 = innerArray[0];
value2 = innerArray[1];
value3 = innerArray[2];
value4 = innerArray[3];
value5 = innerArray[4];
let html='<style>td,th{border:0px solid black;}</style><table>';
html+='<tr><td><a target="_blank" href="https://script.google.com/a/macros/WebAddressOfTheCB_QueryDetailsWebApp/exec?sn=' + value1 + '">' + value1 + '</a></td><td>' + value2 + '</td><td>' + value3 + '</td><td>' + value4 + '</td><td>' + value5 + '</td></tr>';
// Do note that enabling the previous line requires you first set up CB_QueryDetails, which will act on the clickable links
// CB_QueryDetails can be found here https://github.com/NoSubstitute/CB_QueryDetails
// Do also look into CB_DeviceDetails, as it has more features, even if it's in Swedish
// https://github.com/NoSubstitute/CB_DeviceDetails
html+='</table>';
var myTable = document.getElementById("idCBS");
myTable.insertAdjacentHTML("beforeend", html);
}
}
document.getElementById("clearResults").addEventListener("click",clrResults);
function clrResults(){
document.getElementById("idCBS").innerHTML = "";
}
</script>