feat: added a side bar

This commit is contained in:
Mann Patel
2025-09-05 15:39:06 -06:00
parent a5bdc27de0
commit 05001a53e0
28 changed files with 1631 additions and 1655 deletions

View File

@@ -65,7 +65,7 @@ func PollHandler(w http.ResponseWriter, r *http.Request) {
return
}
utils.Render(w, "volunteer/poll_form.html", map[string]interface{}{
utils.Render(w, "poll_form.html", map[string]interface{}{
"Title": "Poll Questions",
"IsAuthenticated": true,
"ShowAdminNav": true,
@@ -120,7 +120,6 @@ func PollHandler(w http.ResponseWriter, r *http.Request) {
}
}
// Insert poll response
_, err = models.DB.Exec(`
INSERT INTO poll_response (
@@ -135,6 +134,22 @@ func PollHandler(w http.ResponseWriter, r *http.Request) {
fmt.Print(err)
http.Error(w, "Failed to save poll response", http.StatusInternalServerError)
return
}else{
_, err := models.DB.Exec(`
UPDATE address_database
SET visited_validated = true
WHERE address_id IN (
SELECT address_id
FROM poll
WHERE poll_id = $1
)
`, pollID)
if err != nil {
fmt.Print(err)
http.Error(w, "Failed to save poll response", http.StatusInternalServerError)
return
}
}
http.Redirect(w, r, "/volunteer/Addresses", http.StatusSeeOther)