-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
180 lines (171 loc) · 8.72 KB
/
index.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
<html>
<head>
<!-- Styles -->
<style>
#chartdiv {
width: 100%;
height: 500px;
}
</style>
<script src="./jquery.min.js"></script>
<!-- Resources -->
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
<script src="https://cdn.amcharts.com/lib/4/charts.js"></script>
<script src="https://cdn.amcharts.com/lib/4/themes/animated.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- Chart code -->
</head>
<!-- HTML -->
<body>
<div style="text-align: center;">
<h2>Faith Leader RSVP Tracker</h2>
<h3>August 13, 2020</h3>
<div id="total"></div>
<div id="rsvp"></div>
<div id="decline"></div>
<div id="needFollowUp"></div>
</div>
<div id="chartdiv" style="text-align: center;"> Loading...</div>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="confirmation-tab" data-toggle="tab" href="#confirmations" role="tab" aria-controls="confirmations" aria-selected="true">Confirmations</a>
</li>
<li class="nav-item">
<a class="nav-link" id="decline-tab" data-toggle="tab" href="#declines" role="tab" aria-controls="declines" aria-selected="false">Declines</a>
</li>
<li class="nav-item">
<a class="nav-link" id="follow-up-tab" data-toggle="tab" href="#follow" role="tab" aria-controls="needFollowUp" aria-selected="false">Follow Up</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="confirmations" role="tabpanel" aria-labelledby="confirmations-tab">
<div class="table-responsive">
<table id="confirmationTable" class="table table-striped">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Organization</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="declines" role="tabpanel" aria-labelledby="declines-tab">
<div class="table-responsive">
<table id="declineTable" class="table table-striped">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Organization</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="tab-pane fade" id="follow" role="tabpanel" aria-labelledby="follow-up-tab">
<div class="table-responsive">
<table id="followUpTable" class="table table-striped">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Organization</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</body>
<script>
var total = 0;
var confirm = 0;
var decline = 0;
var needFollowUp = 0;
$(function () {
var confirmationsUrl = 'https://spreadsheets.google.com/feeds/list/1BLVsb7bkJVuXOxf-hfVzqVBrsSNwtA_OC_jBX2lMDHk/3/public/full?alt=json';
$.getJSON(confirmationsUrl, function (data) {
var entries = data.feed.entry;
for (let entry of entries) {
if (entry["gsx$firstname"]["$t"] != "#N/A"){
$('#confirmationTable tbody').append('<tr><td>' + entry["gsx$title"]["$t"] + ' ' + entry["gsx$firstname"]["$t"] + ' ' + entry["gsx$lastname"]["$t"] + '</td><td>' + entry["gsx$organization"]["$t"] +'</td></tr>');
}
}
})
var declinesUrl = 'https://spreadsheets.google.com/feeds/list/1BLVsb7bkJVuXOxf-hfVzqVBrsSNwtA_OC_jBX2lMDHk/4/public/full?alt=json';
$.getJSON(declinesUrl, function (data) {
var entries = data.feed.entry;
for (let entry of entries) {
if (entry["gsx$firstname"]["$t"] != "#N/A"){
$('#declineTable tbody').append('<tr><td>' + entry["gsx$title"]["$t"] + ' ' + entry["gsx$firstname"]["$t"] + ' ' + entry["gsx$lastname"]["$t"] + '</td><td>' + entry["gsx$organization"]["$t"] +'</td></tr>');
}
}
})
var needFollowUpUrl = 'https://spreadsheets.google.com/feeds/list/1BLVsb7bkJVuXOxf-hfVzqVBrsSNwtA_OC_jBX2lMDHk/5/public/full?alt=json';
$.getJSON(needFollowUpUrl, function (data) {
var entries = data.feed.entry;
for (let entry of entries) {
if (entry["gsx$firstname"]["$t"] != "#N/A"){
$('#followUpTable tbody').append('<tr><td>' + entry["gsx$title"]["$t"] + ' ' + entry["gsx$firstname"]["$t"] + ' ' + entry["gsx$lastname"]["$t"] + '</td><td>' + entry["gsx$organization"]["$t"] +'</td></tr>');
}
}
})
var sheetUrl = 'https://spreadsheets.google.com/feeds/list/1BLVsb7bkJVuXOxf-hfVzqVBrsSNwtA_OC_jBX2lMDHk/2/public/full?alt=json';
$.getJSON(sheetUrl, function (data) {
var entries = data.feed.entry;
for (let entry of entries) {
if (entry["gsx$agg"]["$t"] == "Confirm"){
confirm = parseInt(entry["gsx$count"]["$t"]);
$( "#rsvp" ).text("Confirmed: " + confirm);
} else if (entry["gsx$agg"]["$t"] == "Need Follow Up") {
needFollowUp = parseInt(entry["gsx$count"]["$t"]);
$( "#needFollowUp" ).text("Awaiting Follow Up: " + needFollowUp);
} else if (entry["gsx$agg"]["$t"] == "Total") {
total = parseInt(entry["gsx$count"]["$t"]);
$( "#total" ).text("Total: " + total);
} else if (entry["gsx$agg"]["$t"] == "Decline") {
decline = parseInt(entry["gsx$count"]["$t"]);
$( "#decline" ).text("Decline: " + decline);
}
}
}).then(function() {
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.PieChart);
// Add data
chart.data = [ {
"status": "No Response",
"count": total - confirm - needFollowUp - decline
}, {
"status": "Awaiting Follow Up",
"count": needFollowUp
}, {
"status": "Confirmed",
"count": confirm
}, {
"status": "Decline",
"count": decline
}];
// Add and configure Series
var pieSeries = chart.series.push(new am4charts.PieSeries());
pieSeries.dataFields.value = "count";
pieSeries.dataFields.category = "status";
pieSeries.slices.template.stroke = am4core.color("#fff");
pieSeries.slices.template.strokeWidth = 2;
pieSeries.slices.template.strokeOpacity = 1;
// This creates initial animation
pieSeries.hiddenState.properties.opacity = 1;
pieSeries.hiddenState.properties.endAngle = -90;
pieSeries.hiddenState.properties.startAngle = -90;
});// end am4core.ready()
});
</script>
</html>