Add pages for reviewing evidence and contributing evidence.

This commit is contained in:
Eli Ribble 2025-11-05 21:51:23 +00:00
parent 4eebb6b88a
commit 056b871c38
No known key found for this signature in database
5 changed files with 515 additions and 0 deletions

View file

@ -82,6 +82,15 @@ func getReport(w http.ResponseWriter, r *http.Request) {
respondError(w, "Failed to generate report page", err, http.StatusInternalServerError)
}
}
func getReportContribute(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")
err := htmlReportContribute(w, code)
if err != nil {
respondError(w, "Failed to generate report page", err, http.StatusInternalServerError)
}
}
func getReportDetail(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")
err := htmlReportDetail(w, code)
@ -90,6 +99,14 @@ func getReportDetail(w http.ResponseWriter, r *http.Request) {
}
}
func getReportEvidence(w http.ResponseWriter, r *http.Request) {
code := chi.URLParam(r, "code")
err := htmlReportEvidence(w, code)
if err != nil {
respondError(w, "Failed to generate report page", err, http.StatusInternalServerError)
}
}
func getRoot(w http.ResponseWriter, r *http.Request) {
user, err := getAuthenticatedUser(r)
if err != nil && !errors.Is(err, &NoCredentialsError{}) {

18
html.go
View file

@ -16,7 +16,9 @@ import (
var (
dashboard = newBuiltTemplate("dashboard", "authenticated")
report = newBuiltTemplate("report", "base")
reportContribute = newBuiltTemplate("report-contribute", "base")
reportDetail = newBuiltTemplate("report-detail", "base")
reportEvidence = newBuiltTemplate("report-evidence", "base")
signin = newBuiltTemplate("signin", "base")
signup = newBuiltTemplate("signup", "base")
)
@ -101,6 +103,14 @@ func htmlReport(w io.Writer) error {
return report.ExecuteTemplate(w, data)
}
func htmlReportContribute(w io.Writer, code string) error {
nextURL := BaseURL + "/report/" + code + "/schedule"
data := ContentReportDetail{
NextURL: nextURL,
}
return reportContribute.ExecuteTemplate(w, data)
}
func htmlReportDetail(w io.Writer, code string) error {
nextURL := BaseURL + "/report/" + code + "/evidence"
data := ContentReportDetail{
@ -109,6 +119,14 @@ func htmlReportDetail(w io.Writer, code string) error {
return reportDetail.ExecuteTemplate(w, data)
}
func htmlReportEvidence(w io.Writer, code string) error {
nextURL := BaseURL + "/report/" + code + "/contribute"
data := ContentReportDetail{
NextURL: nextURL,
}
return reportEvidence.ExecuteTemplate(w, data)
}
func htmlSignin(w io.Writer, errorCode string) error {
data := ContentSignin{
InvalidCredentials: errorCode == "invalid-credentials",

View file

@ -61,6 +61,8 @@ func main() {
r.Get("/qr-code/report/{code}", getQRCodeReport)
r.Get("/report", getReport)
r.Get("/report/{code}", getReportDetail)
r.Get("/report/{code}/contribute", getReportContribute)
r.Get("/report/{code}/evidence", getReportEvidence)
r.Post("/signin", postSignin)
r.Get("/signup", getSignup)
r.Post("/signup", postSignup)

View file

@ -0,0 +1,237 @@
{{template "base.html" .}}
{{define "title"}}Login{{end}}
{{define "style"}}
body {
background-color: #f8f9fa;
}
.page-container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.content-card {
background-color: white;
border-radius: 15px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
padding: 25px;
margin-bottom: 20px;
}
.logo-area {
text-align: center;
margin-bottom: 20px;
}
.logo-placeholder {
height: 50px;
max-width: 200px;
margin: 0 auto;
}
.progress-container {
margin: 30px 0 20px;
}
.progress {
height: 8px;
}
.upload-area {
border: 2px dashed #dee2e6;
border-radius: 10px;
padding: 30px;
text-align: center;
margin-bottom: 25px;
background-color: #f8f9fa;
transition: all 0.3s ease;
}
.upload-area:hover {
border-color: #0d6efd;
background-color: #f0f7ff;
}
.upload-icon {
font-size: 48px;
color: #6c757d;
margin-bottom: 15px;
}
.photo-example {
display: flex;
gap: 15px;
margin-bottom: 20px;
flex-wrap: wrap;
}
.example-item {
flex: 1;
min-width: 200px;
text-align: center;
}
.example-img {
width: 100%;
height: 150px;
object-fit: cover;
border-radius: 8px;
margin-bottom: 10px;
border: 2px solid #dee2e6;
}
.good-example {
border-color: #198754;
}
.poor-example {
border-color: #dc3545;
}
.upload-options {
display: flex;
gap: 10px;
margin-top: 20px;
flex-wrap: wrap;
}
.upload-options button {
flex: 1;
min-width: 150px;
}
.uploaded-photos {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 15px;
margin-top: 20px;
}
.uploaded-photo {
position: relative;
height: 150px;
border-radius: 8px;
overflow: hidden;
border: 2px solid #dee2e6;
}
.uploaded-photo img {
width: 100%;
height: 100%;
object-fit: cover;
}
.remove-photo {
position: absolute;
top: 5px;
right: 5px;
background-color: rgba(255, 255, 255, 0.8);
color: #dc3545;
border: none;
border-radius: 50%;
width: 30px;
height: 30px;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
}
.tips-section {
background-color: #e8f4f8;
border-left: 4px solid #0d6efd;
padding: 15px;
border-radius: 5px;
margin-bottom: 20px;
}
{{end}}
{{define "content"}}
<div class="page-container">
<!-- Logo -->
<div class="logo-area">
<img src="https://placehold.co/200x50/e9ecef/adb5bd?text=County+Vector+Control" alt="County Vector Control" class="logo-placeholder">
</div>
<!-- Progress Bar -->
<div class="progress-container">
<div class="d-flex justify-content-between mb-1">
<span class="text-muted small">Upload Photos</span>
<span class="text-muted small">3 of 4</span>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
<!-- Main Content -->
<div class="content-card">
<h1 class="h4 mb-3">Upload Current Pool Photos</h1>
<p>Please provide current photos of your pool to help us assess its condition.</p>
<!-- Photo Tips Section -->
<div class="tips-section">
<h5><i class="bi bi-lightbulb me-2"></i>Photo Tips</h5>
<ul class="mb-0">
<li><strong>Take photos from as high an angle as possible</strong> (second story window, deck, etc.)</li>
<li>Try to capture the <strong>entire pool</strong> in your photo</li>
<li>Ensure photos are <strong>clear and well-lit</strong></li>
<li>You can add <strong>multiple photos</strong> from different angles</li>
</ul>
</div>
<!-- Photo Examples -->
<h5 class="mb-3">Photo Examples:</h5>
<div class="photo-example">
<div class="example-item">
<img src="https://placehold.co/400x300/198754/ffffff?text=Good+Example" alt="Good photo example" class="example-img good-example">
<div class="text-success"><i class="bi bi-check-circle me-1"></i>Good: High angle, full view</div>
</div>
<div class="example-item">
<img src="https://placehold.co/400x300/dc3545/ffffff?text=Poor+Example" alt="Poor photo example" class="example-img poor-example">
<div class="text-danger"><i class="bi bi-x-circle me-1"></i>Poor: Ground level, partial view</div>
</div>
</div>
<!-- Upload Area -->
<div class="upload-area">
<div class="upload-icon">
<i class="bi bi-camera"></i>
</div>
<h5>Add Pool Photos</h5>
<p class="text-muted">Take a new photo or upload from your device</p>
<div class="upload-options">
<button type="button" class="btn btn-primary">
<i class="bi bi-camera-fill me-2"></i> Take Photo
</button>
<button type="button" class="btn btn-outline-primary">
<i class="bi bi-image me-2"></i> Upload from Device
</button>
</div>
<input type="file" id="photo-upload" accept="image/*" multiple style="display: none;">
</div>
<!-- Already Uploaded Photos Section -->
<div>
<h5 class="mb-3">Uploaded Photos (2)</h5>
<div class="uploaded-photos">
<div class="uploaded-photo">
<img src="https://placehold.co/300x300/76b5c5/ffffff?text=Pool+Photo+1" alt="Uploaded pool photo">
<button type="button" class="remove-photo" aria-label="Remove photo">
<i class="bi bi-x"></i>
</button>
</div>
<div class="uploaded-photo">
<img src="https://placehold.co/300x300/3e8e7e/ffffff?text=Pool+Photo+2" alt="Uploaded pool photo">
<button type="button" class="remove-photo" aria-label="Remove photo">
<i class="bi bi-x"></i>
</button>
</div>
</div>
</div>
<!-- Information -->
<div class="alert alert-secondary mt-4">
<small>You can add up to 5 photos to provide a complete view of your pool area. We recommend taking photos from multiple angles.</small>
</div>
<!-- Action Buttons -->
<div class="d-flex justify-content-between mt-4">
<button type="button" class="btn btn-outline-secondary">
<i class="bi bi-arrow-left me-2"></i> Back
</button>
<a href="{{ .NextURL }}" class="btn btn-primary">
Next Step <i class="bi bi-arrow-right ms-2"></i>
</a>
</div>
</div>
<!-- Help Text -->
<div class="text-center text-muted small">
<p>If you need assistance, please contact Vector Control at (555) 123-4567</p>
</div>
</div>
{{end}}

View file

@ -0,0 +1,241 @@
{{template "base.html" .}}
{{define "title"}}Login{{end}}
{{define "style"}}
body {
background-color: #f8f9fa;
}
.page-container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.content-card {
background-color: white;
border-radius: 15px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
padding: 25px;
margin-bottom: 20px;
}
.logo-area {
text-align: center;
margin-bottom: 20px;
}
.logo-placeholder {
height: 50px;
max-width: 200px;
margin: 0 auto;
}
.photo-gallery {
display: flex;
gap: 10px;
margin-bottom: 20px;
overflow-x: auto;
padding-bottom: 10px;
}
.photo-item {
min-width: 200px;
height: 150px;
border-radius: 8px;
overflow: hidden;
border: 2px solid #dee2e6;
}
.photo-item img {
width: 100%;
height: 100%;
object-fit: cover;
}
.data-section {
margin-bottom: 25px;
}
.section-title {
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 10px;
color: #0d6efd;
display: flex;
align-items: center;
}
.section-title i {
margin-right: 8px;
}
.table-container {
overflow-x: auto;
margin-bottom: 15px;
}
.alert-info {
background-color: #e8f4f8;
border-color: #b8daff;
}
.progress-container {
margin: 30px 0 20px;
}
.progress {
height: 8px;
}
.trap-high {
color: #dc3545;
font-weight: bold;
}
.trap-medium {
color: #fd7e14;
font-weight: bold;
}
.trap-low {
color: #198754;
}
{{end}}
{{define "content"}}
<div class="page-container">
<!-- Logo -->
<div class="logo-area">
<img src="https://placehold.co/200x50/e9ecef/adb5bd?text=County+Vector+Control" alt="County Vector Control" class="logo-placeholder">
</div>
<!-- Progress Bar -->
<div class="progress-container">
<div class="d-flex justify-content-between mb-1">
<span class="text-muted small">Evidence</span>
<span class="text-muted small">2 of 4</span>
</div>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
<!-- Main Content -->
<div class="content-card">
<h1 class="h4 mb-4">Evidence of Potential Breeding Site</h1>
<!-- Aerial Photos -->
<div class="data-section">
<div class="section-title">
<i class="bi bi-camera-fill"></i> Aerial Surveillance Photos
</div>
<p class="small text-muted mb-2">These photos were taken during routine aerial surveillance of the area.</p>
<div class="photo-gallery">
<div class="photo-item">
<img src="https://placehold.co/200x150/76b5c5/ffffff?text=Aerial+Photo+1" alt="Aerial photo of property">
</div>
<div class="photo-item">
<img src="https://placehold.co/200x150/3e8e7e/ffffff?text=Aerial+Photo+2" alt="Aerial photo of property">
</div>
<div class="photo-item">
<img src="https://placehold.co/200x150/7accc8/ffffff?text=Aerial+Photo+3" alt="Aerial photo of property">
</div>
</div>
</div>
<!-- Historical Inspections -->
<div class="data-section">
<div class="section-title">
<i class="bi bi-clipboard-check-fill"></i> Historical Inspection Data
</div>
<div class="table-container">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>Date</th>
<th>Inspector</th>
<th>Findings</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mar 15, 2023</td>
<td>J. Martinez</td>
<td>Pool water stagnant, green</td>
<td>Treatment applied, owner notified</td>
</tr>
<tr>
<td>Nov 02, 2022</td>
<td>L. Johnson</td>
<td>Pool water clear, maintained</td>
<td>No action needed</td>
</tr>
<tr>
<td>Aug 18, 2022</td>
<td>S. Williams</td>
<td>Minor algae formation</td>
<td>Owner provided maintenance resources</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Mosquito Trap Data -->
<div class="data-section">
<div class="section-title">
<i class="bi bi-bug-fill"></i> Mosquito Trap Count Data
</div>
<div class="table-container">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>Date Collected</th>
<th>Count</th>
<th>Distance</th>
<th>Level</th>
</tr>
</thead>
<tbody>
<tr>
<td>Jun 12, 2023</td>
<td>42</td>
<td>0.3 miles</td>
<td class="trap-high">High</td>
</tr>
<tr>
<td>Jun 05, 2023</td>
<td>36</td>
<td>0.3 miles</td>
<td class="trap-high">High</td>
</tr>
<tr>
<td>May 29, 2023</td>
<td>28</td>
<td>0.3 miles</td>
<td class="trap-medium">Medium</td>
</tr>
<tr>
<td>May 22, 2023</td>
<td>15</td>
<td>0.3 miles</td>
<td class="trap-low">Low</td>
</tr>
<tr>
<td>May 15, 2023</td>
<td>12</td>
<td>0.3 miles</td>
<td class="trap-low">Low</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Public Health Information -->
<div class="alert alert-info">
<h5><i class="bi bi-info-circle me-2"></i>Why This Matters</h5>
<p>The data above shows mosquito activity in your area. Recent trap counts indicate elevated mosquito populations, which increases the risk of mosquito-borne diseases like West Nile virus.</p>
<p>Unmaintained swimming pools can produce thousands of mosquitoes each week. By addressing potential breeding sites, you're helping protect your family and neighbors from these health risks.</p>
<p class="mb-0"><strong>We need your help</strong> to ensure we maintain public health by keeping mosquito counts low in your neighborhood. Your cooperation makes a significant difference in community safety.</p>
</div>
<!-- Action Button -->
<div class="d-grid gap-2 mt-4">
<a href="{{ .NextURL }}" class="btn btn-primary btn-lg">
<i class="bi bi-arrow-right-circle me-2"></i> Next Step: Upload Current Photos
</a>
</div>
</div>
<!-- Help Text -->
<div class="text-center text-muted small">
<p>If you need assistance, please contact Vector Control at (555) 123-4567</p>
</div>
</div>
{{end}}