-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasycoll.html
169 lines (155 loc) · 6.15 KB
/
easycoll.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Weasy - Weak Signals made easy !</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all,follow">
<!-- Bootstrap CSS-->
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome CSS-->
<link rel="stylesheet" href="vendor/font-awesome/css/font-awesome.min.css">
<!-- Fontastic Custom icon font-->
<link rel="stylesheet" href="css/fontastic.css">
<!-- Google fonts - Roboto -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
<!-- jQuery Circle-->
<link rel="stylesheet" href="css/grasp_mobile_progress_circle-1.0.0.min.css">
<!-- Custom Scrollbar-->
<link rel="stylesheet" href="vendor/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css">
<!-- theme stylesheet-->
<link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">
<!-- Custom stylesheet - for your changes-->
<link rel="stylesheet" href="css/custom.css">
<!-- Favicon-->
<link rel="shortcut icon" href="img/favicon.ico">
<!-- Tweaks for older IEs-->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {
'packages': ['corechart', 'table']
});
google.charts.setOnLoadCallback(initialize);
/**
*
* Variable
*
*/
var teams = [
{ name:'Equipe 1 Strass', dateColumn : 'A', moodColumn : 'B'},
{ name:'Equipe 2 Paillettes', dateColumn : 'A', moodColumn : 'C'},
{ name:'Equipe 3 Cotillons', dateColumn : 'A', moodColumn : 'D'},
{ name:'Equipe 4 Champagne', dateColumn : 'A', moodColumn : 'E'},
{ name:'Equipe 5 DSN', dateColumn : 'A', moodColumn : 'F'},
{ name:'PO', dateColumn : 'A', moodColumn : 'G'},
]
/**
*
* @param columns an array of columns to be selected
*/
function getQuery(...columns) {
return encodeURIComponent('select ' + columns.join(","));
}
function initialize() {
var opts = {
sendMethod: 'auto'
};
const document = 'https://docs.google.com/spreadsheets/d/1-73adNzB6YPvF4hEedzhlEWQ1Dqm1gnFSw0VoqUKw3U/gviz/tq?tq=';
const gid = '&gid=1605932708';
const commentsSheet = '&gid=2142381352'
const createQueryResponseHandler = id => response => handleQueryResponse(response, id);
const createQueryCommentsResponseHandler = id => response => handleCommentsQueryResponseData(response, id);
const initTeam = (name, id, idComments, ...columns) => {
const query = new google.visualization.Query(document + getQuery(columns) + gid, opts);
query.send(createQueryResponseHandler(id));
if (idComments) {
const reqComments = encodeURIComponent(`select E, D , C WHERE C is not null AND D = "${name}"`);
const queryComment = new google.visualization.Query(document + reqComments + commentsSheet, opts);
queryComment.send(createQueryCommentsResponseHandler(idComments));
}
};
for (team of teams) {
initTeam(team.name,team.name+'_mood', team.name+'_comments', team.dateColumn, team.moodColumn);
}
}
function handleQueryResponse(response, divId) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
if(data.ng.length > 2){
data.setColumnProperty(2, 'role', 'annotation');
}
// ({type: 'string', role: 'tooltip'});
var chart = new google.visualization.LineChart(document.getElementById(divId));
chart.draw(data,
{
vAxis:{
minValue: 1,
maxValue: 5,
viewWindowMode:'explicit',
viewWindow: {
min: 1,
max: 5,
}
},
width: 800,
height: 240,
is3D: true
});
}
function handleCommentsQueryResponseData(response, divId) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var view = new google.visualization.DataView(data);
view.setColumns([0,2]);
var table = new google.visualization.Table(document.getElementById(divId));
table.draw(view, {
sortColumn: 1
});
}
function createQueryResponseHandler(id) {
return function(response) {
handleQueryResponse(response, id);
}
}
</script>
</head>
<body>
<div class="page">
<!-- navbar-->
<header class="header">
<nav class="navbar">
<div class="container-fluid">
<div class="navbar-holder d-flex align-items-center justify-content-between">
<div class="navbar-header"><a id="toggle-btn" href="#" class="menu-btn"><i class="icon-bars"> </i></a>
<a href="index.html" class="navbar-brand">
<div class="brand-text d-none d-md-inline-block"><span> Weasy </span><strong class="text-primary"> Weak Signals Dashboard</strong></div>
</a>
</div>
</div>
</div>
</nav>
</header>
<div id="content"></div>
</div>
<!-- Javascript files-->
</body>
<script>
function generateDiv(team){
document.getElementById('content').innerHTML += '<section class="dashboard-header section-padding"> <div class="container-fluid"> <div class="row d-flex align-items-md-stretch"> <div class="col-lg-9 col-md-12 flex-lg-last flex-md-first align-self-baseline"> <div class="card sales-report"> <h3 class="display h3">'+team+' team signals</h3> <div id="'+team+'_mood"> </div> </div> </div> <div class="col-lg-3 col-md-6"> <div class="card to-do"> <h3 class="display h3">Comments</h3> <div id="'+team+'_comments"></div> </div> </div> </div> </div></section>'
}
for (team of teams) {
generateDiv(team.name);
}
</script>
</html>