A short explanation. . .
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
<!--
QUICK CUSTOMIZATION:
TO INCLUDE ONLY SELECTED TEAMS SET THIS TO false,
{% assign all_teams = true %}
INDIVIDUAL NAMES OF TEAMS TO INCLUDE
{% array my_teams = "Band", "Vocals" %}
IF YOU DON'T WANT TO PRINT THE SERVICES INCLUDED SET THIS TO false
{% array print_services = true %}
IF YOU DON'T WANT TO PRINT THE TEAMS INCLUDED SET THIS TO false
{% array print_teams = true %}
-->
<html>
<head>
<title>Volunteer Statuses</title>
<style>
* { font-family: Verdana, Arial; font-size: 10pt; }
body { padding:0; margin:0; }
table#header { width: 100%; border: none; padding: 0; border-collapse: collapse;}
table#header td { padding: 2px; vertical-align: top; }
table#status { width: 100%; border: none; padding: 0; border-collapse: separate; border-spacing: 20px;}
table#services { padding: 3% 33%; border-spacing: 10px; }
table#teams { padding: 0% 33%; border-spacing: 10px; }
.report_title { font-size: 28pt; font-weight: bold; text-align: center; border-bottom: dashed 1px black; }
.plan_dates { text-align: center; font-weight: bold; font-size: 14pt; padding-top: 15px;}
.total { text-align: center; font-size: 20pt; padding-top: 15px; }
.stat_box { border: 2px solid; border-radius: 8px; height: 120px; width: 33.33%; border-color: #808080; }
.stat_number { text-align: center; font-size: 22pt; }
.status { text-align: center; padding: 5px; font-weight: bold;}
.stat_percent { text-align: center; font-size: 16pt; color: #808080; }
.table_heading { font-size: 16pt; padding-bottom: 10px; }
.bottom_cell { border: 1px solid; border-radius: 12px; text-align: center; height: 40px; border-color: #808080; }
</style>
</head>
{% for plan in plans %}
<!-- Collecting start and end dates from the plans in this Matrix -->
{% if forloop.first %}{% assign first_date = plan.dates %}{% endif %}
{% if forloop.last %}{% assign last_date = plan.dates %}{% endif %}
{% assign stored_services = stored_services | append: plan.ministry.name | append: ','%}
<!-- Collecting Statuses across all plans -->
{% for plan_person in plan.plan_people %}
{% if all_teams == true %}
{% case plan_person.status %}
{% when 'C' %}
{% assign c_person_ids = c_person_ids | append: plan_person.person.id | append: ' '%} <!-- Assigning confirmed people to an array -->
{% when 'U' %}
{% assign u_person_ids = u_person_ids | append: plan_person.person.id | append: ' '%} <!-- Assigning unconfirmed people to an array -->
{% when 'D'%}
{% assign d_person_ids = d_person_ids | append: plan_person.person.id | append: ' '%} <!-- Assigning declined people to an array -->
{% endcase %}
{% else %}
{% for team_name in my_teams %}
{% if plan_person.category.name contains team_name %}
{% case plan_person.status %}
{% when 'C' %}
{% assign c_person_ids = c_person_ids | append: plan_person.person.id | append: ' '%} <!-- Assigning confirmed people to an array -->
{% when 'U' %}
{% assign u_person_ids = u_person_ids | append: plan_person.person.id | append: ' '%} <!-- Assigning unconfirmed people to an array -->
{% when 'D'%}
{% assign d_person_ids = d_person_ids | append: plan_person.person.id | append: ' '%} <!-- Assigning declined people to an array -->
{% endcase %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
<!-- Service Type Logic -->
{% assign service_uniq = stored_services | split: ','%} <!-- Splitting the Service Type names into an array. -->
{% assign services = service_uniq | uniq %} <!-- Taking that array, and shoving it into a new array with one of each Service Type -->
<!-- Converting the Status Totals into Numbers -->
{% assign confirmed = c_person_ids | split: " " | uniq | size | plus: 0 %}
{% assign unconfirmed = u_person_ids | split: " " | uniq | size | plus: 0 %}
{% assign declined = d_person_ids | split: " " | uniq | size | plus: 0 %}
{% assign total = confirmed | plus: unconfirmed | plus: declined | plus: 0.0 %}
<!-- Percentage Calculation -->
{% assign confirmed_decrease = total | minus: confirmed %}
{% assign confirmed_percentage = confirmed_decrease | minus: total | times:100 | divided_by: total %}
{% assign unconfirmed_decrease = total | minus: unconfirmed %}
{% assign unconfirmed_percentage = unconfirmed_decrease | minus: total | times:100 | divided_by: total %}
{% assign declined_decrease = total | minus: declined %}
{% assign declined_percentage = declined_decrease | minus: total | times:100 | divided_by: total %}
<body>
<table width="100%">
<tr>
<td class="report_title">Statuses of Scheduled People</td>
</tr>
<tr>
<td class="plan_dates">{{ first_date }} - {{ last_date }}</td>
</tr>
<tr>
<td class="total">{{ total | round }} Positions Scheduled</td>
</tr>
</table >
<table width="100%" id="status">
<tr>
<td class="stat_box">
<div class="stat_number">
{{ confirmed }}
</div>
<div class="status">
Confirmed
</div>
<div class="stat_percent">
{{ confirmed_percentage | remove: '-' | slice: 0, 5 }}%
</div>
</td>
<td class="stat_box">
<div class="stat_number">
{{ unconfirmed }}
</div>
<div class="status">
Unconfirmed
</div>
<div class="stat_percent">
{{ unconfirmed_percentage | remove: '-' | slice: 0, 5 }}%
</div>
</td>
<td class="stat_box">
<div class="stat_number">
{{ declined }}
</div>
<div class="status">
Declined
</div>
<div class="stat_percent">
{{ declined_percentage | remove: '-' | slice: 0, 5 }}%
</div>
</td>
</tr>
</table>
{% if print_services %}
<table width="100%" id="services">
<tr>
<th class="table_heading">
Services Included
</th>
</tr>
{% for service in services %}
<tr>
<td class="bottom_cell">
{{ service }}
</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if print_teams %}
<table width="100%" id="teams">
<tr>
<th class="table_heading">
Teams Included
</th>
</tr>
{% if all_teams %}
<tr>
<td class="bottom_cell">
All Teams
</td>
</tr>
{% else%}
{% for team in my_teams %}
<tr>
<td class="bottom_cell">
{{ team }}
</td>
</tr>
{% endfor %}
{% endif%}
</table>
{% endif %}
</body>
</html>