diff --git a/endpoint.go b/endpoint.go index fa930581..9a22c81b 100644 --- a/endpoint.go +++ b/endpoint.go @@ -219,6 +219,20 @@ func getServiceRequestPool(w http.ResponseWriter, r *http.Request) { } } +func getServiceRequestQuick(w http.ResponseWriter, r *http.Request) { + err := htmlServiceRequestQuick(w) + if err != nil { + respondError(w, "Failed to generate service request quick page", err, http.StatusInternalServerError) + } +} + +func getServiceRequestQuickConfirmation(w http.ResponseWriter, r *http.Request) { + err := htmlServiceRequestQuickConfirmation(w) + if err != nil { + respondError(w, "Failed to generate service request quick confirmation page", err, http.StatusInternalServerError) + } +} + func getServiceRequestUpdates(w http.ResponseWriter, r *http.Request) { err := htmlServiceRequestUpdates(w) if err != nil { diff --git a/html.go b/html.go index a6c26b0a..da9fd305 100644 --- a/html.go +++ b/html.go @@ -13,28 +13,30 @@ import ( "github.com/Gleipnir-Technology/nidus-sync/models" "github.com/aarondl/opt/null" - "github.com/riverqueue/river/rivershared/util/slogutil" + //"github.com/riverqueue/river/rivershared/util/slogutil" "github.com/stephenafamo/bob/dialect/psql/sm" ) var ( - dashboard = newBuiltTemplate("dashboard", "authenticated") - oauthPrompt = newBuiltTemplate("oauth-prompt", "authenticated") - report = newBuiltTemplate("report", "base") - reportConfirmation = newBuiltTemplate("report-confirmation", "base") - reportContribute = newBuiltTemplate("report-contribute", "base") - reportDetail = newBuiltTemplate("report-detail", "base") - reportEvidence = newBuiltTemplate("report-evidence", "base") - reportSchedule = newBuiltTemplate("report-schedule", "base") - reportUpdate = newBuiltTemplate("report-update", "base") - serviceRequest = newBuiltTemplate("service-request", "base") - serviceRequestDetail = newBuiltTemplate("service-request-detail", "base") - serviceRequestLocation = newBuiltTemplate("service-request-location", "base") - serviceRequestMosquito = newBuiltTemplate("service-request-mosquito", "base") - serviceRequestPool = newBuiltTemplate("service-request-pool", "base") - serviceRequestUpdates = newBuiltTemplate("service-request-updates", "base") - signin = newBuiltTemplate("signin", "base") - signup = newBuiltTemplate("signup", "base") + dashboard = newBuiltTemplate("dashboard", "authenticated") + oauthPrompt = newBuiltTemplate("oauth-prompt", "authenticated") + report = newBuiltTemplate("report", "base") + reportConfirmation = newBuiltTemplate("report-confirmation", "base") + reportContribute = newBuiltTemplate("report-contribute", "base") + reportDetail = newBuiltTemplate("report-detail", "base") + reportEvidence = newBuiltTemplate("report-evidence", "base") + reportSchedule = newBuiltTemplate("report-schedule", "base") + reportUpdate = newBuiltTemplate("report-update", "base") + serviceRequest = newBuiltTemplate("service-request", "base") + serviceRequestDetail = newBuiltTemplate("service-request-detail", "base") + serviceRequestLocation = newBuiltTemplate("service-request-location", "base") + serviceRequestMosquito = newBuiltTemplate("service-request-mosquito", "base") + serviceRequestPool = newBuiltTemplate("service-request-pool", "base") + serviceRequestQuick = newBuiltTemplate("service-request-quick", "base") + serviceRequestQuickConfirmation = newBuiltTemplate("service-request-quick-confirmation", "base") + serviceRequestUpdates = newBuiltTemplate("service-request-updates", "base") + signin = newBuiltTemplate("signin", "base") + signup = newBuiltTemplate("signup", "base") ) var components = [...]string{"header"} @@ -256,6 +258,16 @@ func htmlServiceRequestPool(w io.Writer) error { return serviceRequestPool.ExecuteTemplate(w, data) } +func htmlServiceRequestQuick(w io.Writer) error { + data := ContentPlaceholder{} + return serviceRequestQuick.ExecuteTemplate(w, data) +} + +func htmlServiceRequestQuickConfirmation(w io.Writer) error { + data := ContentPlaceholder{} + return serviceRequestQuickConfirmation.ExecuteTemplate(w, data) +} + func htmlServiceRequestUpdates(w io.Writer) error { data := ContentPlaceholder{} return serviceRequestUpdates.ExecuteTemplate(w, data) @@ -316,7 +328,7 @@ func parseFromDisk(files []string) (*template.Template, error) { for _, f := range components { paths = append(paths, "templates/components/"+f+".html") } - slog.Info("Rendering templates from disk", slog.Any("paths", slogutil.SliceString(paths))) + //slog.Info("Rendering templates from disk", slog.Any("paths", slogutil.SliceString(paths))) templ, err := template.New(name).Funcs(funcMap).ParseFiles(paths...) if err != nil { return nil, fmt.Errorf("Failed to parse %s: %v", paths, err) diff --git a/main.go b/main.go index 939fcadd..8296ea71 100644 --- a/main.go +++ b/main.go @@ -76,6 +76,8 @@ func main() { r.Get("/service-request-location", getServiceRequestLocation) r.Get("/service-request-mosquito", getServiceRequestMosquito) r.Get("/service-request-pool", getServiceRequestPool) + r.Get("/service-request-quick", getServiceRequestQuick) + r.Get("/service-request-quick-confirmation", getServiceRequestQuickConfirmation) r.Get("/service-request-updates", getServiceRequestUpdates) r.Post("/signin", postSignin) r.Get("/signup", getSignup) diff --git a/templates/service-request-quick-confirmation.html b/templates/service-request-quick-confirmation.html new file mode 100644 index 00000000..babd7457 --- /dev/null +++ b/templates/service-request-quick-confirmation.html @@ -0,0 +1,113 @@ +{{template "base.html" .}} + +{{define "title"}}Dash{{end}} +{{define "style"}} +.district-logo { + max-height: 60px; + width: auto; +} + +.success-icon { + width: 100px; + height: 100px; + background-color: #28a745; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + margin: 0 auto 2rem; + color: white; +} + +.confirmation-card { + max-width: 600px; + margin: 0 auto; + border-radius: 10px; +} + +.home-button { + padding: 12px 30px; + border-radius: 30px; + font-weight: 600; +} + +@media (max-width: 767px) { + .header-title { + font-size: 1.5rem; + } + + .success-icon { + width: 80px; + height: 80px; + } +} +{{end}} +{{define "content"}} + +
+
+
+
+

[District Name]

+
+
+ +
+
+
+
+ + +
+
+
+
+
+ +
+ + + +
+ +

Report Received!

+ +

Thank you for contributing to the health and well-being of our community.

+ +
+

Your mosquito report has been submitted successfully and will be reviewed by our team. Your effort helps us identify problem areas and better manage mosquito populations throughout our district.

+
+ +

Report ID: #MM

+ + + Return Home + +
+
+ + +
+
+
What happens next?
+

Our team reviews all reports daily. Depending on the nature of your report, we may deploy field technicians to assess the area or add it to our scheduled mosquito control activities. For urgent matters, we prioritize responses based on public health risk factors.

+
+
+
+
+
+ + + +{{end}} diff --git a/templates/service-request-quick.html b/templates/service-request-quick.html new file mode 100644 index 00000000..7fdc075a --- /dev/null +++ b/templates/service-request-quick.html @@ -0,0 +1,152 @@ +{{template "base.html" .}} + +{{define "title"}}Dash{{end}} +{{define "style"}} +.district-logo { + max-height: 60px; + width: auto; +} + +.photo-upload-area { + border: 2px dashed #ccc; + border-radius: 8px; + padding: 20px; + text-align: center; + margin-bottom: 20px; + background-color: #f9f9f9; +} + +.photo-preview { + display: flex; + flex-wrap: wrap; + gap: 10px; + margin-top: 15px; +} + +.photo-preview img { + width: 80px; + height: 80px; + object-fit: cover; + border-radius: 4px; +} + +.submit-btn { + padding: 15px 0; + font-size: 1.25rem; + border-radius: 8px; +} + +.location-info { + background-color: #e9f5ff; + border-radius: 8px; + padding: 12px; + margin-bottom: 20px; + font-size: 0.9rem; +} + +@media (max-width: 767px) { + .header-title { + font-size: 1.5rem; + } +} +{{end}} +{{define "content"}} + +
+
+
+
+

[District Name]

+
+
+ +
+
+
+
+ + +
+
+
+
+
+

Quick Mosquito Report

+ + +
+ +
+ + + + + Your location and current time will be automatically collected with your report. +
+ + +
+ +
+ + + + +
+ + +
+ Take pictures of the mosquito problem area + + +
+ + Preview +
+
+
+ + +
+ + +
+ + + +
+
+
+ + + +
+
+
+ + + +{{end}}