Make standing water form actually submit
This commit is contained in:
parent
0eb5118459
commit
8bd83207dd
4 changed files with 15 additions and 6 deletions
|
|
@ -27,6 +27,7 @@ type ContentURL struct {
|
|||
Status string
|
||||
Tegola string
|
||||
Water string
|
||||
WaterSubmit string
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -102,15 +103,17 @@ func makeContentURL(district *models.Organization) ContentURL {
|
|||
Status: makeURL("/status"),
|
||||
Tegola: config.MakeURLTegola("/"),
|
||||
Water: makeURL("/water"),
|
||||
WaterSubmit: makeURL("/water"),
|
||||
}
|
||||
} else {
|
||||
slug := district.Slug.MustGet()
|
||||
return ContentURL{
|
||||
Nuisance: makeURL("/district/%s/nuisance", slug),
|
||||
NuisanceSubmit: makeURL("/district/%s/nuisance", slug),
|
||||
NuisanceSubmit: makeURL("/nuisance", slug),
|
||||
Status: makeURL("/status"),
|
||||
Tegola: config.MakeURLTegola("/"),
|
||||
Water: makeURL("/district/%s/water", slug),
|
||||
WaterSubmit: makeURL("/water"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,19 +12,20 @@ func Router() chi.Router {
|
|||
r.Post("/nuisance", postNuisance)
|
||||
r.Get("/submit-complete", getSubmitComplete)
|
||||
r.Get("/water", getWater)
|
||||
r.Post("/water", postWater)
|
||||
|
||||
r.Get("/district/{slug}", getRootDistrict)
|
||||
r.Get("/district/{slug}/nuisance", getNuisanceDistrict)
|
||||
//r.Get("/district/{slug}/nuisance-submit-complete", renderMock(mockNuisanceSubmitCompleteT))
|
||||
//r.Get("/district/{slug}/status", renderMock(mockStatusT))
|
||||
r.Get("/district/{slug}/water", getWaterDistrict)
|
||||
//r.Post("/district/{slug}/water", postWaterDistrict)
|
||||
|
||||
r.Get("/privacy", getPrivacy)
|
||||
r.Get("/robots.txt", getRobots)
|
||||
r.Get("/email", getEmailByCode)
|
||||
r.Get("/image/{uuid}", getImageByUUID)
|
||||
r.Route("/mock", addMockRoutes)
|
||||
r.Post("/pool-submit", postPool)
|
||||
r.Get("/pool-submit-complete", getPoolSubmitComplete)
|
||||
r.Get("/quick", getQuick)
|
||||
r.Post("/quick-submit", postQuick)
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
</div>
|
||||
|
||||
<!-- Report Form -->
|
||||
<form id="standingWater" action="/water-submit" method="POST" enctype="multipart/form-data">
|
||||
<form id="standingWater" action="{{ .URL.WaterSubmit }}" method="POST" enctype="multipart/form-data">
|
||||
<!-- Photo Upload Section -->
|
||||
<div class="form-section">
|
||||
<div class="section-heading">
|
||||
|
|
@ -377,9 +377,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
<p class="mb-0 small text-muted">After submission, you will receive a confirmation with a report ID for tracking purposes.</p>
|
||||
</div>
|
||||
<div class="col-md-4 text-md-end mt-3 mt-md-0">
|
||||
<a class="btn btn-primary btn-lg" href="{{.URL.SubmitComplete}}">
|
||||
<button type="submit" class="btn btn-primary btn-lg">
|
||||
Submit Report
|
||||
</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ func getWater(w http.ResponseWriter, r *http.Request) {
|
|||
w,
|
||||
WaterT,
|
||||
ContentPool{
|
||||
District: nil,
|
||||
MapboxToken: config.MapboxToken,
|
||||
URL: makeContentURL(nil),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -54,6 +56,7 @@ func getWaterDistrict(w http.ResponseWriter, r *http.Request) {
|
|||
ContentPool{
|
||||
District: newContentDistrict(district),
|
||||
MapboxToken: config.MapboxToken,
|
||||
URL: makeContentURL(district),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
@ -67,7 +70,7 @@ func getPoolSubmitComplete(w http.ResponseWriter, r *http.Request) {
|
|||
},
|
||||
)
|
||||
}
|
||||
func postPool(w http.ResponseWriter, r *http.Request) {
|
||||
func postWater(w http.ResponseWriter, r *http.Request) {
|
||||
err := r.ParseMultipartForm(32 << 10) // 32 MB buffer
|
||||
if err != nil {
|
||||
respondError(w, "Failed to parse form", err, http.StatusBadRequest)
|
||||
|
|
@ -193,3 +196,5 @@ func postPool(w http.ResponseWriter, r *http.Request) {
|
|||
tx.Commit(ctx)
|
||||
http.Redirect(w, r, fmt.Sprintf("/pool-submit-complete?report=%s", public_id), http.StatusFound)
|
||||
}
|
||||
func postWaterDistrict(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue