-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmembership_class.liquid
221 lines (197 loc) · 5.68 KB
/
membership_class.liquid
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
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Setup -->
{% assign member_status = "Member" %}
{{ helpers.bootstrap_3 }}
<!-- This report is styled using the Bootstrap framework. http://getbootstrap.com/css/
If you'd rather provide your own styles, add them to the style section below. -->
<style>
@page {
margin: .125in;
}
/*-- PDF margin reset --*/
tr.person > td {
padding: 0.5em;
}
tr:nth-child(even) {
background-color: #edf2f7 !important;
}
thead {
border-bottom: 1px solid #bec9d3;
}
th {
padding: .5em;
}
.avatar {
width: 30px;
height: 30px;
border-radius: 25px 25px 25px 25px;
-moz-border-radius: 25px 25px 25px 25px;
-webkit-border-radius: 25px 25px 25px 25px;
}
.container {
width: 100%;
padding-top: 0px;
}
</style>
</head>
<body>
<div class="container">
<div class="pull-right">
<div class="well well-sm text-right">
{{ people.size }} {{ people.size | pluralize: "person", "people" }}<br>
Report Date: {{ list.updated_at | date: "%B %e, %Y" }}
</div>
</div>
<h2>
{{ list.name }}
<br>
<small>
{{ organization.name }}
</small>
</h2>
{% assign member_percent = 60 %}
{% assign serving_percent = 30 %}
<!-- Calculate Member Percent -->
{% assign member_number = 0 | plus: 0 %}
{% assign volunteer_number = 0 | plus: 0 %}
{% for result in results %}
{% assign volunteer = false %}
{% if result.person.membership == member_status %}
{% assign member_number = member_number | plus: 1 %}
{% endif %}
{% assign volunteering_len = result.person.custom_tabs.serving.fields | size %}
{% if volunteering_len > 0 %}
{% assign volunteer_number = volunteer_number | plus: 1 %}
{% endif %}
{% endfor %}
<!-- Calculate Retention Percent -->
{% assign retention_percent = member_number | times: 100.0 | divided_by: people.size | round: 2 %}
<!-- Calculate Volunteer Percent -->
{% assign volunteer_percent = volunteer_number | times: 100.0 | divided_by: people.size | round: 2 %}
<table class="table mt-0" style="width: 100%">
<thead>
<tr>
<th class="text-center" colspan="2"><h2>Class Size: {{ people.size }}</h2></th>
</tr>
</thead>
<thead>
<tr>
<th class="text-center"><h2>{{ retention_percent }}% Retention: {{ member_number }}</h2></th>
<th class="text-center"><h2>{{ volunteer_percent }}% Volunteering: {{ volunteer_number }}</h2></th>
</tr>
</thead>
<!-- Display Pie -->
<tbody>
<tr>
<td class="text-center">
<img width="300" src="https://quickchart.io/chart?c={
type: 'doughnut',
data: {
datasets: [
{
data: [{{ people.size | minus: member_number }},{{ member_number }}],
backgroundColor: [
'rgb(255, 159, 64)',
'rgb(75, 192, 192)',
],
label: 'Dataset 1',
},
],
labels: ['Non Retention', 'Retention'],
},
options: {
title: {
display: false,
text: 'Member Status',
},
plugins: {
datalabels: {
display: true,
borderRadius: 4,
font: {
size: 22,
weight: 'bold'
},
backgroundColor: 'white',
}
}
},
}
"/>
</td>
<td class="text-center">
{% comment %}<div class="pie animate no-round" style="--p:20;--c:{{ serving_color }};"> 20%</div>{% endcomment %}
<img width="300" src="https://quickchart.io/chart?c={
type: 'doughnut',
data: {
datasets: [
{
data: [{{ people.size | minus: volunteer_number }},{{ volunteer_number }}],
backgroundColor: [
'rgb(255, 159, 64)',
'rgb(75, 192, 192)',
],
label: 'Dataset 1',
},
],
labels: ['Non Volunteer', 'Volunteer'],
},
options: {
title: {
display: false,
text: 'Member Status',
},
plugins: {
datalabels: {
display: true,
borderRadius: 4,
font: {
size: 22,
weight: 'bold'
},
backgroundColor: 'white',
}
}
},
}
"/>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%">
<thead>
<tr>
<th style="text-align: left">Photo</th>
<th style="text-align: left">Name</th>
<th style="text-align: left">Status</th>
<th style="text-align: left">Area Of Service</th>
<th style="text-align: left">Top Three</th>
</tr>
</thead>
<tbody>
{% for result in results %}
<tr class="person">
<td>
<img class="avatar" src="{{ result.person.photo_url }}"/>
<td>{{ result.person.name }}</td>
<td class="mr-3">{{ result.person.membership }}</td>
<td>{% for item in result.person.custom_tabs.serving.fields %}
{{ item.name }}: {{ item.value }},
{% endfor %}
</td>
<td>{% for item in result.person.custom_tabs.spiritual_gifts.fields %}
{% if item.name == "Top Three" %}
{{ item.value }}
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</body>
</html>