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"}} +
Your file contains several errors that must be fixed before it can be processed. Details are provided below.
+We found 12 errors in your CSV file. The most common issues are:
+| Line Number | +Error | +Suggestion | +
|---|---|---|
| 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. + | +
Matches found in previous records
+Not found in existing records
+Potential geocoding errors
+| Plat ID | +Latitude | +Longitude | +Street Address | +Status | +In District | +
|---|---|---|---|---|---|
| P12345 | +37.7749 | +-122.4194 | +123 Main St, Anytown, CA | +Existing | +Yes | +
| P23456 | +37.3352 | +-121.8811 | +456 Oak Ave, Someville, CA | +Existing | +Yes | +
| P34567 | +38.5816 | +-121.4944 | +789 Pine Rd, Outtown, CA | +New | ++ + No - Outside northern boundary + | +
| P45678 | +37.4419 | +-122.1430 | +101 Elm St, Cityville, CA | +New | +Yes | +
| P56789 | +37.3541 | +-121.9552 | +202 Maple Dr, Townburg, CA | +Existing | +Yes | +
| P67890 | +35.3733 | +-119.0187 | +303 Cedar Ln, Farville, CA | +New | ++ + No - Outside southern boundary + | +
| P78901 | +37.8044 | +-122.2712 | +404 Birch Ave, Metroburg, CA | +Existing | +Yes | +
| P89012 | +37.4032 | +-123.9612 | +505 Walnut St, Edgetown, CA | +New | ++ + No - Outside western boundary + | +
Issues detected:
+Your CSV file must contain the following columns in any order. Please ensure your data matches the required format.
+ +| Field | +Description | +Format | +Required | +
|---|---|---|---|
| Latitude | +GPS latitude coordinate | +Decimal (e.g., 37.7749) | +Yes | +
| Longitude | +GPS longitude coordinate | +Decimal (e.g., -122.4194) | +Yes | +
| Plat ID | +Unique identifier for the property | +Alphanumeric (e.g., P12345) | +Yes | +
| Street Address | +Nearest street address to the pool | +Text (e.g., 123 Main St) | +No | +
Drag and drop a file here or click to browse
+ +