Skip to content

Commit 8d1b336

Browse files
committed
Merge branch 'development' of github.com:BCStudentSoftwareDevTeam/celts into development
2 parents bd60f5f + 6da68a6 commit 8d1b336

File tree

3 files changed

+172
-76
lines changed

3 files changed

+172
-76
lines changed

app/models/program.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@ class Program(baseModel):
1818

1919
@property
2020
def url(self):
21-
22-
return (self.bereaUrl or self.instagramUrl or self.facebookUrl)
23-
21+
if self.bereaUrl:
22+
return self.bereaUrl
23+
if self.instagramUrl:
24+
return self.instagramUrl
25+
if self.facebookUrl:
26+
return self.facebookUrl
27+
return None # Explicitly return None if nothing else is available
2428
@property
2529
def description(self):
26-
2730
return self.programDescription
31+
32+
33+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
/* Alternating row colors for Service Learning Courses */
3+
.slc-table tbody tr:nth-child(odd) {
4+
background-color: white;
5+
}
6+
7+
.slc-table tbody tr:nth-child(even) {
8+
background-color: #F8F9FA;
9+
}
10+
/* Print styles */
11+
@media print {
12+
@page {
13+
size: letter;
14+
margin: 0.5in 0.1in 0.5in 0.1in;
15+
}
16+
}
Lines changed: 146 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,159 @@
1-
{%set title ="Service Transcript"%}
2-
{% extends "base.html"%}
3-
1+
{% set title = "Service Transcript" %}
2+
{% extends "base.html" %}
43
{% block app_content %}
5-
<div class="w-100 d-print-inline-block">
6-
<div class="float-end"><button type="button" class="btn btn-primary d-print-none m-4" onclick="window.print()"><span class="bi bi-printer d-print-none"></span> Print</button></div>
7-
<h1 class="text-center mb-3">{{userData.firstName}} {{userData.lastName}}</h1>
8-
<p class="text-center">Volunteering Since {{ startDate }}</p>
9-
{% if studentLabor %}
10-
<div class="card-body">
11-
<h5 class="card-title">CELTS Labor History:</h5>
12-
{% for position, term in studentLabor.items() %}
13-
<p class="card-text">{{position}}: {{term|join(", ")}}</p>
14-
{% endfor %}
15-
</div>
16-
{% endif %}
17-
{% if allEventTranscript %}
18-
{% for program in allEventTranscript %}
19-
{% set programTitle = program.programName %}
20-
{% if not programTitle %}
21-
{% set programTitle = program %}
22-
{% endif %}
23-
<div class="card-body">
24-
<h5 class="card-title bg-light ps-2 pe-5 border-bottom">{{programTitle}}</h5>
25-
{% for item in allEventTranscript[program] %}
26-
{% if item[1] != None %}
27-
<h6 class="card-subtitle mb-2 text-muted"> {{item[0]}} - {{item[1]|round(2)}} hour(s)</h6>
28-
{% endif %}
29-
{% endfor %}
30-
{% if programTitle != "CELTS Sponsored Events" %}
31-
<p class="card-text">{{program.description}}</p>
32-
<a class="d-print-none" href="{{program.url}}" target="_blank" class="card-link">More Information</a>
33-
{% endif %}
34-
</div>
35-
{% endfor %}
36-
{% endif %}
37-
{% if totalHours["totalHours"] > 0%}
38-
39-
{% if slCourses.exists() %}
40-
<h2 class="m-3">Service-Learning Courses</h2>
41-
<table class="table table-bordered table-striped m-3">
42-
<tr>
43-
<th>Course</th>
44-
<th>Term</th>
45-
<th class="w-25">Accrued Service Hours</th>
46-
</tr>
47-
{% for slcourse in slCourses %}
48-
<tr>
49-
<td> {{ slcourse.courseName if slcourse.courseName else slcourse.courseAbbreviation }}</td>
50-
<td> {{ slcourse.term.description }}</td>
51-
<td class="w-25">{{ slcourse.hoursEarned }}</td>
52-
</tr>
4+
<link rel="stylesheet" href="{{ url_for('static', filename='css/serviceTranscript.css') }}">
5+
6+
{# Calculate filtered totals excluding Bonner Scholars #}
7+
{% set filteredEventHours = [] %}
8+
{% set filteredCourseHours = totalHours["totalCourseHours"] | round(2) | int %}
9+
{% if allEventTranscript %}
10+
{% for program in allEventTranscript %}
11+
{% set programTitle = program.programName if program.programName else program %}
12+
{% if programTitle != "Bonner Scholars" %}
13+
{% for item in allEventTranscript[program] %}
14+
{% if item[1] is not none and item[1] != "" %}
15+
{% set _ = filteredEventHours.append(item[1] | float) %}
16+
{% endif %}
5317
{% endfor %}
54-
</table>
5518
{% endif %}
19+
{% endfor %}
20+
{% endif %}
21+
{% set filteredEventHoursTotal = filteredEventHours | sum | round(2) | int %}
22+
{% set filteredTotalHours = filteredEventHoursTotal + filteredCourseHours %}
5623

57-
<div class="float-front ms-3 pt-1">
58-
<p class="fw-bold pd-3 d-inline fs-6 ">Event Hours:</p>
59-
<p class="d-inline bg-light ps-2 pe-5 border-bottom fs-6" id="hourTotal">{{ totalHours["totalEventHours"]|round(2) }}</p>
60-
24+
<div class="w-100 d-print-inline-block">
25+
<div class="container-fluid bg-light p-4 mb-4">
26+
<div class="row align-items-center d-print-none">
27+
<!-- CELTS Logo Section -->
28+
<div class="col-md-3 d-flex align-items-center">
29+
<img src="{{ url_for('static', filename='/images/logos/celts_logo.png') }}" alt="CELTS Logo" class="img-fluid me-3" style="max-height: 60px;">
30+
</div>
31+
<!-- Personal Info Section -->
32+
<div class="col-md-6 text-center">
33+
<h2 class="mb-1 fw-bold" style = "color: #000000">{{ userData.firstName }} {{ userData.lastName }}</h2>
34+
<h4 class="mb-0 text-muted" >Service Transcript</h4>
35+
<small class="text-muted">Volunteering Since {{ startDate }}</small>
36+
</div>
37+
<!-- Print Button -->
38+
<div class="col-md-3 text-end">
39+
<button type="button" class="btn btn-primary d-print-none" onclick="window.print()">
40+
<span class="bi bi-printer"></span> Print
41+
</button>
42+
</div>
6143
</div>
6244

63-
<div class="ms-3">
64-
<div class="float-front pt-1">
65-
<p class="fw-bold pb-3 d-inline fs-6 ">Service Hours:</p>
66-
<p class="d-inline bg-light ps-2 pe-5 border-bottom fs-6" id="hourTotal">{{ totalHours["totalCourseHours"]|round(2) }}</p>
45+
<!-- Print-only header -->
46+
<div class="d-none d-print-flex align-items-center mb-2" style="gap: 20px;">
47+
<div>
48+
<img src="{{ url_for('static', filename='/images/logos/celts_logo.png') }}" alt="CELTS Logo" class="img-fluid" style="max-width: 200px;">
49+
</div>
50+
<div class="flex-grow-1 text-center">
51+
<h2 class="mb-0 fw-bold" style="font-size: 22px; color: #000000">{{ userData.firstName }} {{ userData.lastName }}</h2>
52+
<h4 class="mb-0 text-muted" style="font-size: 16px">Service Transcript</h4>
53+
<small class="text-muted" style="font-size: 11px; color: #005c90">Volunteering Since {{ startDate }}</small>
6754
</div>
6855
</div>
69-
70-
<div class="float-front ms-3 pt-1">
71-
72-
<p class="fw-bold pb-3 d-inline fs-6">Total Hours:</p>
73-
<p class="d-inline bg-light ps-2 pe-5 border-bottom fs-6" id="hourTotal">{{ totalHours["totalHours"]|round(2) }}</p>
56+
</div>
57+
58+
{% if filteredTotalHours > 0 %}
59+
<div class="card mb-4">
60+
<div class="card-header text-white" style = "background-color: #005c90">
61+
<h5 class="mb-0">Volunteer Hours</h5>
62+
<small>All hours below have been validated and approved by an affiliated administrator or coordinator.</small>
63+
</div>
64+
<div class="card-body p-0">
65+
<table class="table table-bordered mb-0" >
66+
<thead class="table-light">
67+
<tr>
68+
<th class="text-center">Volunteer Hours</th>
69+
<th class="text-center">Service-Learning Hours</th>
70+
<th class="text-center">Total Hours</th>
71+
</tr>
72+
</thead>
73+
<tbody>
74+
<tr>
75+
<td class="text-center fw-bold">{{ filteredEventHoursTotal }}</td>
76+
<td class="text-center fw-bold">{{ filteredCourseHours | int }}</td>
77+
<td class="text-center fw-bold">{{ filteredTotalHours | int }}</td>
78+
</tr>
79+
</tbody>
80+
</table>
81+
</div>
82+
</div>
83+
{% endif %}
84+
85+
<div class="card mb-4">
86+
<div class="card-header bg-light">
87+
<h5 class="mb-0">Volunteer Hour Details</h5>
7488
</div>
89+
<div class="card-body">
90+
{% if allEventTranscript %}
91+
{% set item_counter = 0 %}
92+
{% for program in allEventTranscript %}
93+
{% set programTitle = program.programName if program.programName else program %}
94+
{% if programTitle != "Bonner Scholars" %}
95+
{% set item_counter = item_counter + 1 %}
96+
<div class="mb-4 p-3 {% if item_counter % 2 == 0 %}bg-light{% endif %}" style="page-break-inside: avoid;">
97+
<h6 class="fw-bold" style = "color: #005c90">{{ programTitle }}</h6>
98+
{% for item in allEventTranscript[program] %}
99+
{% if item[1] is not none %}
100+
<div class="mb-2">
101+
<small class="text-muted">{{ item[0] }} - {{ item[1] | round(2) }} hour(s)</small>
102+
</div>
103+
{% endif %}
104+
{% endfor %}
105+
{% if programTitle != "CELTS Sponsored Events" %}
106+
<p class="text-muted small mb-2">{{ program.description }}</p>
107+
<a class="d-print-none small" href="{{ program.url }}" target="_blank">More Information</a>
108+
{% endif %}
109+
</div>
110+
{% endif %}
111+
{% endfor %}
75112
{% else %}
76-
<div class="float-front ms-3 pt-1"></div>
77-
<h5>No Volunteer Record</h5>
78-
{% endif %}
79-
<div class="d-print-none pt-5">
80-
<br><p class="text-center">If there are any corrections that need to be made, contact <a href="mailto:cochranea@berea.edu">Ashley Cochrane</a></p>
113+
<div class="text-center py-4">
114+
<h6 class="text-muted">No Volunteer Record</h6>
115+
</div>
116+
{% endif %}
117+
</div>
81118
</div>
82-
</div>
83-
{% endblock %}
84119

120+
{% if slCourses.exists() %}
121+
<div class="card mb-4" style="page-break-inside: avoid;">
122+
<div class="card-header bg-light">
123+
<h5 class="mb-0">Service-Learning Courses</h5>
124+
</div>
125+
<div class="card-body p-0">
126+
<table class="table table-bordered mb-0 slc-table">
127+
<thead class="table-light">
128+
<tr>
129+
<th>Course</th>
130+
<th>Term</th>
131+
<th>Accrued Service Hours</th>
132+
</tr>
133+
</thead>
134+
<tbody>
135+
{% for slcourse in slCourses %}
136+
{% if "Bonner" not in slcourse.courseName %}
137+
<tr>
138+
<td>{{ slcourse.courseName if slcourse.courseName else slcourse.courseAbbreviation }}</td>
139+
<td>{{ slcourse.term.description }}</td>
140+
<td>{{ slcourse.hoursEarned }}</td>
141+
</tr>
142+
{% endif %}
143+
{% endfor %}
144+
</tbody>
145+
</table>
146+
</div>
147+
</div>
148+
{% endif %}
85149

150+
<div class="mt-5 pt-4 text-center" style="page-break-inside: avoid;">
151+
<div class="d-print-none mt-5">
152+
<p class="text-muted">
153+
If there are any corrections that need to be made, contact
154+
<a href="mailto:cochranea@berea.edu">Ashley Cochrane</a>
155+
</p>
156+
</div>
157+
</div>
158+
</div>
159+
{% endblock %}

0 commit comments

Comments
 (0)