From b741c3e14d82b8c7fe4a4ec55dd241b193efac48 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Tue, 24 Feb 2026 16:14:35 +0000 Subject: [PATCH] Show pool uploads in the upload page And remove a bunch of things, like employee information and field notebooks --- html/func.go | 59 +++++++++++++++++++------- html/template/sync/upload-list.html | 66 +++++++++++------------------ sync/upload.go | 11 +++-- 3 files changed, 76 insertions(+), 60 deletions(-) diff --git a/html/func.go b/html/func.go index 9e745b15..89986841 100644 --- a/html/func.go +++ b/html/func.go @@ -15,25 +15,30 @@ import ( "github.com/aarondl/opt/null" "github.com/google/uuid" "github.com/rs/zerolog/log" + "golang.org/x/text/cases" + "golang.org/x/text/language" ) func addFuncMap(t *template.Template) { funcMap := template.FuncMap{ - "bigNumber": bigNumber, - "duration": duration, - "hasPassed": hasPassed, - "html": unescapeHTML, - "json": unescapeJS, - "GISStatement": gisStatement, - "latLngDisplay": latLngDisplay, - "publicReportID": publicReportID, - "timeAsRelativeDate": timeAsRelativeDate, - "timeDelta": timeDelta, - "timeElapsed": timeElapsed, - "timeInterval": timeInterval, - "timeRelative": timeRelative, - "timeRelativePtr": timeRelativePtr, - "uuidShort": uuidShort, + "bigNumber": bigNumber, + "displayUploadStatus": displayUploadStatus, + "displayUploadType": displayUploadType, + "duration": duration, + "hasPassed": hasPassed, + "html": unescapeHTML, + "json": unescapeJS, + "GISStatement": gisStatement, + "latLngDisplay": latLngDisplay, + "publicReportID": publicReportID, + "timeAsRelativeDate": timeAsRelativeDate, + "timeDelta": timeDelta, + "timeElapsed": timeElapsed, + "timeInterval": timeInterval, + "timeRelative": timeRelative, + "timeRelativePtr": timeRelativePtr, + "title": title, + "uuidShort": uuidShort, } t.Funcs(funcMap) } @@ -53,7 +58,26 @@ func bigNumber(n int) string { return result.String() } - +func displayUploadStatus(s string) string { + switch s { + case "error": + return "Bad upload" + case "parsed": + return "Waiting for review" + case "uploaded": + return "Processing" + default: + return "Unknown status type" + } +} +func displayUploadType(s string) string { + switch s { + case "PoolList": + return "Green Pool List" + default: + return "Unknown upload type" + } +} func duration(d time.Duration) string { seconds := int(d.Seconds()) @@ -265,6 +289,9 @@ func timeRelativePtr(t *time.Time) string { } return timeRelative(*t) } +func title(s string) string { + return cases.Title(language.AmericanEnglish).String(s) +} func unescapeHTML(s string) template.HTML { return template.HTML(s) } diff --git a/html/template/sync/upload-list.html b/html/template/sync/upload-list.html index 016ec4f9..ccc57b16 100644 --- a/html/template/sync/upload-list.html +++ b/html/template/sync/upload-list.html @@ -25,16 +25,6 @@ {{ define "content" }}
-
-
-
- - Select a data type below to import information into the system. - Supported file formats include CSV, Excel, and PDF documents. -
-
-
-
@@ -73,6 +63,7 @@ Import employee data including names, contact information, and responsibilities for system user creation.

+
diff --git a/sync/upload.go b/sync/upload.go index 8d2829bd..8020d32c 100644 --- a/sync/upload.go +++ b/sync/upload.go @@ -13,11 +13,16 @@ import ( "github.com/go-chi/chi/v5" ) +type contentUploadList struct { + RecentUploads []platform.UploadSummary +} type contentUploadPlaceholder struct{} -func getUploadList(ctx context.Context, r *http.Request, org *models.Organization, user *models.User) (*response[contentUploadPlaceholder], *errorWithStatus) { - content := contentUploadPlaceholder{} - return newResponse("sync/upload-list.html", content), nil +func getUploadList(ctx context.Context, r *http.Request, org *models.Organization, user *models.User) (*response[contentUploadList], *errorWithStatus) { + rows, err := platform.UploadSummaryList(ctx, org) + return newResponse("sync/upload-list.html", contentUploadList{ + RecentUploads: rows, + }), newErrorMaybe("get upload list: %w", err) } type contentPoolDetail struct {