diff --git a/endpoint.go b/endpoint.go index 65aed704..c490a92a 100644 --- a/endpoint.go +++ b/endpoint.go @@ -70,6 +70,15 @@ func getPhoneCall(w http.ResponseWriter, r *http.Request) { htmlPhoneCall(w) } +func getDataEntry(w http.ResponseWriter, r *http.Request) { + htmlDataEntry(w) +} +func getDataEntryBad(w http.ResponseWriter, r *http.Request) { + htmlDataEntryBad(w) +} +func getDataEntryGood(w http.ResponseWriter, r *http.Request) { + htmlDataEntryGood(w) +} func getQRCodeReport(w http.ResponseWriter, r *http.Request) { code := chi.URLParam(r, "code") if code == "" { diff --git a/go-geojson2h3 b/go-geojson2h3 new file mode 160000 index 00000000..c2ff1a96 --- /dev/null +++ b/go-geojson2h3 @@ -0,0 +1 @@ +Subproject commit c2ff1a96abb4f4418b4741c1d868e20881cdc9bf diff --git a/html.go b/html.go index 3be7c400..f91a22a9 100644 --- a/html.go +++ b/html.go @@ -41,6 +41,9 @@ var ( // Unauthenticated pages var ( + dataEntry = newBuiltTemplate("data-entry", "base") + dataEntryGood = newBuiltTemplate("data-entry-good", "base") + dataEntryBad = newBuiltTemplate("data-entry-bad", "base") phoneCall = newBuiltTemplate("phone-call", "base") report = newBuiltTemplate("report", "base") reportConfirmation = newBuiltTemplate("report-confirmation", "base") @@ -276,6 +279,21 @@ func htmlCell(ctx context.Context, w http.ResponseWriter, user *models.User, c i renderOrError(w, cell, &data) } +func htmlDataEntry(w http.ResponseWriter) { + data := ContentPlaceholder{} + renderOrError(w, dataEntry, data) +} + +func htmlDataEntryBad(w http.ResponseWriter) { + data := ContentPlaceholder{} + renderOrError(w, dataEntryBad, data) +} + +func htmlDataEntryGood(w http.ResponseWriter) { + data := ContentPlaceholder{} + renderOrError(w, dataEntryGood, data) +} + func htmlDashboard(ctx context.Context, w http.ResponseWriter, user *models.User) { org, err := user.Organization().One(ctx, db.PGInstance.BobDB) if err != nil { diff --git a/main.go b/main.go index 0bdf4f36..1929e567 100644 --- a/main.go +++ b/main.go @@ -94,6 +94,10 @@ func main() { r.Get("/arcgis/oauth/callback", getArcgisOauthCallback) r.Get("/favicon.ico", getFavicon) + r.Get("/mock/data-entry", getDataEntry) + r.Get("/mock/data-entry/bad", getDataEntryBad) + r.Get("/mock/data-entry/good", getDataEntryGood) + r.Get("/oauth/refresh", getOAuthRefresh) r.Get("/phone-call", getPhoneCall) diff --git a/templates/data-entry-bad.html b/templates/data-entry-bad.html new file mode 100644 index 00000000..6cf685b8 --- /dev/null +++ b/templates/data-entry-bad.html @@ -0,0 +1,198 @@ +{{template "base.html" .}} + +{{define "title"}}Data Entry{{end}} +{{define "style"}} +.results-container { + max-width: 1000px; + margin: 0 auto; +} +.error-code { + font-family: monospace; + padding: 0.2rem 0.4rem; + background-color: rgba(220, 53, 69, 0.1); + border-radius: 0.2rem; + color: #dc3545; +} +.error-table { + font-size: 0.9rem; +} +.error-suggestions { + color: #495057; +} +.table-header-error { + width: 40%; +} +.table-header-suggestion { + width: 40%; +} +.table-header-line { + width: 20%; +} +{{end}} +{{define "content"}} +
+
+

Upload Failed: pools-data-2023.csv

+ + Validation Errors + +
+ + + +
+
+
Error Summary
+ + Download Error Log + +
+
+

We found 12 errors in your CSV file. The most common issues are:

+
    +
  • Missing required column: The "Latitude" column is not present in your file
  • +
  • Invalid data format: 8 GPS coordinates contain non-numeric values
  • +
  • Empty required fields: 3 records are missing Plat ID values
  • +
+ + +
+
+ +
+
+
Detailed Error Report
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Line NumberErrorSuggestion
1 + MISSING_COLUMN
+ Required column "Latitude" is missing from the header row +
+ Add a "Latitude" column to your CSV file. Make sure the spelling and capitalization match exactly. +
5 + INVALID_DATA_FORMAT
+ GPS coordinate "37.45N" is not a valid decimal number +
+ Change "37.45N" to a decimal format (e.g., "37.45"). Remove any non-numeric characters except for the decimal point. +
8 + EMPTY_REQUIRED_FIELD
+ Plat ID is empty or missing +
+ Add a Plat ID value for this record. Each pool must have a unique identifier. +
12 + INVALID_DATA_FORMAT
+ GPS coordinate "unknown" is not a valid decimal number +
+ Replace "unknown" with the actual longitude value in decimal format (e.g., "-122.4194"). +
17 + INVALID_DATA_FORMAT
+ GPS coordinate "N/A" is not a valid decimal number +
+ Replace "N/A" with the actual latitude value in decimal format (e.g., "37.7749"). +
21 + EMPTY_REQUIRED_FIELD
+ Plat ID is empty or missing +
+ Add a Plat ID value for this record. Each pool must have a unique identifier. +
+
+ +
+ +
+
+
Next Steps
+
+
+
    +
  1. Download the error log for a complete list of issues (optional)
  2. +
  3. Fix the errors in your CSV file
  4. +
  5. Re-upload the corrected file using the button below
  6. +
+ + + +
+ +
+
+
+ +
+ + Need help? Contact support + +
+
+{{end}} diff --git a/templates/data-entry-good.html b/templates/data-entry-good.html new file mode 100644 index 00000000..c1c4d5a2 --- /dev/null +++ b/templates/data-entry-good.html @@ -0,0 +1,210 @@ +{{template "base.html" .}} + +{{define "title"}}Data Entry{{end}} +{{define "style"}} +.results-container { + max-width: 1200px; + margin: 0 auto; +} +.summary-card { + transition: transform 0.2s; +} +.summary-card:hover { + transform: translateY(-5px); +} +.warning-row { + background-color: rgba(255, 193, 7, 0.15) !important; +} +.status-badge { + font-size: 0.85rem; +} +{{end}} +{{define "content"}} +
+
+

Upload Results: pools-data-2023.csv

+ + File Parsed Successfully + +
+ +
+
+
+
+

45

+
Existing Pools
+

Matches found in previous records

+
+
+
+
+
+
+

23

+
New Pools
+

Not found in existing records

+
+
+
+
+
+
+

4

+
Outside District
+

Potential geocoding errors

+
+
+
+
+ +
+
+
Data Preview
+
+ + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Plat IDLatitudeLongitudeStreet AddressStatusIn District
P1234537.7749-122.4194123 Main St, Anytown, CAExisting Yes
P2345637.3352-121.8811456 Oak Ave, Someville, CAExisting Yes
P3456738.5816-121.4944789 Pine Rd, Outtown, CANew + + No - Outside northern boundary +
P4567837.4419-122.1430101 Elm St, Cityville, CANew Yes
P5678937.3541-121.9552202 Maple Dr, Townburg, CAExisting Yes
P6789035.3733-119.0187303 Cedar Ln, Farville, CANew + + No - Outside southern boundary +
P7890137.8044-122.2712404 Birch Ave, Metroburg, CAExisting Yes
P8901237.4032-123.9612505 Walnut St, Edgetown, CANew + + No - Outside western boundary +
+
+ + +
+
+ +
+
+
Notes & Recommendations
+
+
+
+

Issues detected:

+
    +
  • 4 pools appear to be outside district boundaries (possible geocoding errors)
  • +
  • All required fields are present and properly formatted
  • +
+
+ + +
+
+ +
+ + Upload Edited File + + +
+
+{{end}} diff --git a/templates/data-entry.html b/templates/data-entry.html new file mode 100644 index 00000000..26d3550b --- /dev/null +++ b/templates/data-entry.html @@ -0,0 +1,112 @@ +{{template "base.html" .}} + +{{define "title"}}Data Entry{{end}} +{{define "style"}} +.upload-container { + max-width: 800px; + margin: 0 auto; +} +.schema-table { + font-size: 0.9rem; +} +.upload-area { + border: 2px dashed #dee2e6; + padding: 2rem; + text-align: center; + margin: 1.5rem 0; + border-radius: 5px; + background-color: #f8f9fa; +} +.required-field::after { + content: "*"; + color: red; + margin-left: 3px; +} +{{end}} +{{define "content"}} +
+

Upload Pool Data

+ +
+
+
CSV Upload Requirements
+
+
+

Your CSV file must contain the following columns in any order. Please ensure your data matches the required format.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescriptionFormatRequired
LatitudeGPS latitude coordinateDecimal (e.g., 37.7749)Yes
LongitudeGPS longitude coordinateDecimal (e.g., -122.4194)Yes
Plat IDUnique identifier for the propertyAlphanumeric (e.g., P12345)Yes
Street AddressNearest street address to the poolText (e.g., 123 Main St)No
+ +
+ Need a template? Download sample CSV file +
+
+
+ +
+
+
Upload Data
+
+
+
+ + + + +
Select your CSV file
+

Drag and drop a file here or click to browse

+ +
+ + +
+
+ +
+ Need assistance? Contact support@example.com +
+
+{{end}}