2026-01-29 23:55:41 +00:00
|
|
|
package rmo
|
2026-01-09 19:45:33 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"net/http"
|
|
|
|
|
|
2026-01-30 18:21:27 +00:00
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/html"
|
2026-01-31 20:08:08 +00:00
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/platform/report"
|
2026-04-03 22:04:22 +00:00
|
|
|
//"github.com/rs/zerolog/log"
|
2026-01-09 19:45:33 +00:00
|
|
|
)
|
|
|
|
|
|
2026-01-30 20:41:02 +00:00
|
|
|
type ContentNuisance struct {
|
|
|
|
|
District *ContentDistrict
|
|
|
|
|
MapboxToken string
|
|
|
|
|
URL ContentURL
|
|
|
|
|
}
|
|
|
|
|
type ContentNuisanceSubmitComplete struct {
|
2026-01-31 16:44:41 +00:00
|
|
|
District *ContentDistrict
|
2026-01-09 19:45:33 +00:00
|
|
|
ReportID string
|
2026-01-31 16:44:41 +00:00
|
|
|
URL ContentURL
|
2026-01-09 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getNuisance(w http.ResponseWriter, r *http.Request) {
|
2026-01-30 18:21:27 +00:00
|
|
|
html.RenderOrError(
|
2026-01-09 19:45:33 +00:00
|
|
|
w,
|
2026-02-07 05:51:21 +00:00
|
|
|
"rmo/nuisance.html",
|
2026-01-30 20:41:02 +00:00
|
|
|
ContentNuisance{
|
2026-03-09 18:02:22 +00:00
|
|
|
District: nil,
|
|
|
|
|
URL: makeContentURL(nil),
|
2026-01-30 20:41:02 +00:00
|
|
|
},
|
2026-01-09 19:45:33 +00:00
|
|
|
)
|
|
|
|
|
}
|
2026-02-01 03:14:36 +00:00
|
|
|
func getNuisanceDistrict(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
district, err := districtBySlug(r)
|
|
|
|
|
if err != nil {
|
|
|
|
|
respondError(w, "Failed to lookup organization", err, http.StatusBadRequest)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
html.RenderOrError(
|
|
|
|
|
w,
|
2026-02-07 05:51:21 +00:00
|
|
|
"rmo/nuisance.html",
|
2026-02-01 03:14:36 +00:00
|
|
|
ContentNuisance{
|
2026-03-09 18:02:22 +00:00
|
|
|
District: newContentDistrict(district),
|
|
|
|
|
URL: makeContentURL(nil),
|
2026-02-01 03:14:36 +00:00
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
}
|
2026-01-31 16:44:41 +00:00
|
|
|
func getSubmitComplete(w http.ResponseWriter, r *http.Request) {
|
2026-02-01 02:37:35 +00:00
|
|
|
report_id := r.URL.Query().Get("report")
|
|
|
|
|
district, err := report.DistrictForReport(r.Context(), report_id)
|
|
|
|
|
if err != nil {
|
|
|
|
|
respondError(w, fmt.Sprintf("Failed to get district for report '%s'", report_id, err), err, http.StatusInternalServerError)
|
|
|
|
|
return
|
|
|
|
|
}
|
2026-01-30 18:21:27 +00:00
|
|
|
html.RenderOrError(
|
2026-01-09 19:45:33 +00:00
|
|
|
w,
|
2026-02-07 05:51:21 +00:00
|
|
|
"rmo/submit-complete.html",
|
2026-01-30 20:41:02 +00:00
|
|
|
ContentNuisanceSubmitComplete{
|
2026-02-01 02:37:35 +00:00
|
|
|
District: newContentDistrict(district),
|
|
|
|
|
ReportID: report_id,
|
2026-02-01 03:07:46 +00:00
|
|
|
URL: makeContentURL(nil),
|
2026-01-09 19:45:33 +00:00
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
}
|