From 9939434cb386d922bd7d774a99f8d0a970d5f655 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Sun, 1 Mar 2026 22:21:20 +0000 Subject: [PATCH] Create secondary upload for pool data --- html/template/sync/upload-csv-pool-bob.html | 110 +++++++ .../template/sync/upload-csv-pool-custom.html | 186 +++++++++++ html/template/sync/upload-csv-pool.html | 295 ++++++++---------- html/template/sync/upload-list.html | 2 +- sync/routes.go | 7 +- sync/upload.go | 25 +- sync/url.go | 22 +- 7 files changed, 472 insertions(+), 175 deletions(-) create mode 100644 html/template/sync/upload-csv-pool-bob.html create mode 100644 html/template/sync/upload-csv-pool-custom.html diff --git a/html/template/sync/upload-csv-pool-bob.html b/html/template/sync/upload-csv-pool-bob.html new file mode 100644 index 00000000..8a12cc30 --- /dev/null +++ b/html/template/sync/upload-csv-pool-bob.html @@ -0,0 +1,110 @@ +{{ template "sync/layout/authenticated.html" . }} +{{ define "title" }}Pool Upload{{ end }} +{{ define "extraheader" }} + +{{ 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. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescriptionFormatExample
TargetLatThe latitude of the target locationDecimal Number36.56245379
TargetLonThe longitude of the target locationDecimal Number-119.3948222
CommentThe condition of the poolText"blue", "dry", "false pool", "green", or "murky"
+
+
+ +
+
+
Upload Data
+
+
+
+
+ + + + +
Select your CSV file
+

+ Drag and drop a file here or click to browse +

+ +
+ +
+ +
+
+
+
+ +
+ Need assistance? Contact + support@example.com +
+
+{{ end }} diff --git a/html/template/sync/upload-csv-pool-custom.html b/html/template/sync/upload-csv-pool-custom.html new file mode 100644 index 00000000..b3170910 --- /dev/null +++ b/html/template/sync/upload-csv-pool-custom.html @@ -0,0 +1,186 @@ +{{ template "sync/layout/authenticated.html" . }} +{{ define "title" }}Pool Upload{{ end }} +{{ define "extraheader" }} + +{{ 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. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescriptionFormatExample
Street AddressStreet number and name of the address of the poolText123 Main St.
CityThe city portion of the pool's addressTextVisalia
Notes + Any notes from the district to include with the pool record + Text"Collects rain water when empty"
Postal CodePostal (Zip) Code of the pool's addressnumbers and optional hypen81234 or 91234-5678
Pool ConditionThe condition of the pool when it was last inspectedText"blue", "dry", "false pool", "green", or "murky"
Property Owner NameName of the person or entity that owns the propertyTextNo
Property Owner Phone + Phone number of the person or entity that owns the property + + E164 format, or enough digits to be a valid phone number + + "+14155552671" or "1-(901)-555-1234" or "9015551234" or + "1901-555-12-34" +
Resident Owned + Whether or not the current resident of the property is also the + owner + Yes, No, or empty"Yes" or "No" or ""
Resident PhonePhone number of the resident + E164 format, or enough digits to be a valid phone number + + "+14155552671" or "1-(901)-555-1234" or "9015551234" or + "1901-555-12-34" +
Tags + Any additional columns in the file will be treated as tags and + attached to the record + Text"Hostile" or "Unresponsive" or "Dog"
+ +
+ 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 }} diff --git a/html/template/sync/upload-csv-pool.html b/html/template/sync/upload-csv-pool.html index 3434bc31..6e28130d 100644 --- a/html/template/sync/upload-csv-pool.html +++ b/html/template/sync/upload-csv-pool.html @@ -1,186 +1,153 @@ {{ template "sync/layout/authenticated.html" . }} -{{ define "title" }}Pool Upload{{ end }} +{{ define "title" }}Choose Pool Upload Type{{ end }} {{ define "extraheader" }} - + {{ 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. +

+
+
+

Green Pool CSV Data

+

+ Select the type of data you want to upload

+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldDescriptionFormatExample
Street AddressStreet number and name of the address of the poolText123 Main St.
CityThe city portion of the pool's addressTextVisalia
Notes - Any notes from the district to include with the pool record - Text"Collects rain water when empty"
Postal CodePostal (Zip) Code of the pool's addressnumbers and optional hypen81234 or 91234-5678
Pool ConditionThe condition of the pool when it was last inspectedText"blue", "dry", "false pool", "green", or "murky"
Property Owner NameName of the person or entity that owns the propertyTextNo
Property Owner Phone - Phone number of the person or entity that owns the property - - E164 format, or enough digits to be a valid phone number - - "+14155552671" or "1-(901)-555-1234" or "9015551234" or - "1901-555-12-34" -
Resident Owned - Whether or not the current resident of the property is also the - owner - Yes, No, or empty"Yes" or "No" or ""
Resident PhonePhone number of the resident - E164 format, or enough digits to be a valid phone number - - "+14155552671" or "1-(901)-555-1234" or "9015551234" or - "1901-555-12-34" -
Tags - Any additional columns in the file will be treated as tags and - attached to the record - Text"Hostile" or "Unresponsive" or "Dog"
+
+ +
+
+
+
+ +
+

Green Pool Flyover Data

+

+ Upload aerial survey data from ABC Data Analytics. This includes + GPS coordinates, timestamp information, and pool identification + data. +

+
+ + ABC Data Analytics + + + CSV Format + +
+ + Let's do this + +
+
+
-
- Need a template? - Download sample CSV file + +
+
+
+
+ +
+

Custom Operations Data

+

+ Upload custom green pool operations data. This includes treatment + records, inspection logs, and maintenance activities in your own + CSV format. +

+
+ + Custom Format + + + CSV Format + +
+ + Pick me + +
+
-
-
-
Upload Data
-
-
-
-
- - - - -
Select your CSV file
-

- Drag and drop a file here or click to browse -

+ + diff --git a/sync/routes.go b/sync/routes.go index 0c77645c..43af57f5 100644 --- a/sync/routes.go +++ b/sync/routes.go @@ -59,8 +59,11 @@ func Router() chi.Router { r.Method("GET", "/configuration/pesticide", authenticatedHandler(getConfigurationPesticide)) r.Method("GET", "/configuration/pesticide/add", authenticatedHandler(getConfigurationPesticideAdd)) r.Method("GET", "/configuration/upload", authenticatedHandler(getUploadList)) - r.Method("GET", "/configuration/upload/pool", authenticatedHandler(getUploadPoolCreate)) - r.Method("POST", "/configuration/upload/pool", authenticatedHandlerPostMultipart(postUploadPoolCreate)) + r.Method("GET", "/configuration/upload/pool", authenticatedHandler(getUploadPool)) + r.Method("GET", "/configuration/upload/pool/bob", authenticatedHandler(getUploadPoolBobCreate)) + r.Method("POST", "/configuration/upload/pool/bob", authenticatedHandlerPostMultipart(postUploadPoolBobCreate)) + r.Method("GET", "/configuration/upload/pool/custom", authenticatedHandler(getUploadPoolCustomCreate)) + r.Method("POST", "/configuration/upload/pool/custom", authenticatedHandlerPostMultipart(postUploadPoolCustomCreate)) r.Method("GET", "/configuration/upload/{id}", authenticatedHandler(getUploadByID)) r.Method("POST", "/configuration/upload/{id}/discard", authenticatedHandlerPost(postUploadDiscard)) r.Method("GET", "/configuration/user", authenticatedHandler(getConfigurationUserList)) diff --git a/sync/upload.go b/sync/upload.go index eb3435aa..c8eaaac2 100644 --- a/sync/upload.go +++ b/sync/upload.go @@ -45,12 +45,26 @@ type contentUploadDetail struct { type contentUploadPoolList struct { Uploads []platform.PoolUpload } -type contentUploadPoolCreate struct{} +type contentUploadPool struct{} -func getUploadPoolCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadPoolCreate], *errorWithStatus) { - data := contentUploadPoolCreate{} +func getUploadPool(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadPool], *errorWithStatus) { + data := contentUploadPool{} return newResponse("sync/upload-csv-pool.html", data), nil } + +type contentUploadPoolBobCreate struct{} + +func getUploadPoolBobCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadPoolBobCreate], *errorWithStatus) { + data := contentUploadPoolBobCreate{} + return newResponse("sync/upload-csv-pool-bob.html", data), nil +} + +type contentUploadPoolCustomCreate struct{} + +func getUploadPoolCustomCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadPoolCustomCreate], *errorWithStatus) { + data := contentUploadPoolCustomCreate{} + return newResponse("sync/upload-csv-pool-custom.html", data), nil +} func getUploadByID(ctx context.Context, r *http.Request, org *models.Organization, u *models.User) (*response[contentUploadDetail], *errorWithStatus) { file_id_str := chi.URLParam(r, "id") file_id_, err := strconv.ParseInt(file_id_str, 10, 32) @@ -88,7 +102,10 @@ func postUploadDiscard(ctx context.Context, r *http.Request, org *models.Organiz type FormUploadPool struct{} -func postUploadPoolCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User, f FormUploadPool) (string, *errorWithStatus) { +func postUploadPoolBobCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User, f FormUploadPool) (string, *errorWithStatus) { + return "", nil +} +func postUploadPoolCustomCreate(ctx context.Context, r *http.Request, org *models.Organization, u *models.User, f FormUploadPool) (string, *errorWithStatus) { uploads, err := userfile.SaveFileUpload(r, "csvfile", userfile.CollectionCSV) if err != nil { return "", newError("Failed to extract image uploads: %s", err) diff --git a/sync/url.go b/sync/url.go index d18e137c..8b80126b 100644 --- a/sync/url.go +++ b/sync/url.go @@ -9,10 +9,9 @@ type contentURL struct { OAuthRefreshArcGIS string Root string Route string - SamplePoolCSV string Sidebar contentURLSidebar Tegola string - UploadCSVPool string + Upload contentURLUpload } func newContentURL() contentURL { @@ -21,10 +20,9 @@ func newContentURL() contentURL { OAuthRefreshArcGIS: config.MakeURLNidus("/arcgis/oauth/begin"), Root: config.MakeURLNidus("/"), Route: config.MakeURLNidus("/route"), - SamplePoolCSV: config.MakeURLNidus("/static/file/sample-pool.csv"), Sidebar: newContentURLSidebar(), Tegola: config.MakeURLTegola("/"), - UploadCSVPool: config.MakeURLNidus("/configuration/upload/pool"), + Upload: newContentURLUpload(), } } @@ -75,3 +73,19 @@ func newContentURLSidebar() contentURLSidebar { Review: config.MakeURLNidus("/review"), } } + +type contentURLUpload struct { + Pool string + PoolBob string + PoolCustom string + SamplePoolCSV string +} + +func newContentURLUpload() contentURLUpload { + return contentURLUpload{ + Pool: config.MakeURLNidus("/configuration/upload/pool"), + PoolBob: config.MakeURLNidus("/configuration/upload/pool/bob"), + PoolCustom: config.MakeURLNidus("/configuration/upload/pool/custom"), + SamplePoolCSV: config.MakeURLNidus("/static/file/sample-pool.csv"), + } +}