diff --git a/html/template/sync/component/sidebar.html b/html/template/sync/component/sidebar.html index 1af7d599..3aa16bbd 100644 --- a/html/template/sync/component/sidebar.html +++ b/html/template/sync/component/sidebar.html @@ -41,7 +41,7 @@
  • - + Settings diff --git a/html/template/sync/dashboard.html b/html/template/sync/dashboard.html index a3f4a9ae..44919f02 100644 --- a/html/template/sync/dashboard.html +++ b/html/template/sync/dashboard.html @@ -146,7 +146,7 @@ latitude="36.3" longitude="-119.2" organization-id="{{ .User.Organization.ID }}" - tegola="{{ .Config.URLTegola }}" + tegola="{{ .URL.Tegola }}" zoom="9" /> diff --git a/html/template/sync/setting-mock.html b/html/template/sync/setting-mock.html index a48c9c94..45dfd935 100644 --- a/html/template/sync/setting-mock.html +++ b/html/template/sync/setting-mock.html @@ -2,217 +2,6 @@ {{ define "title" }}Dash{{ end }} {{ define "extraheader" }} - {{ end }} {{ define "content" }} -
    -
    -
    -

    Settings

    -

    - Configure your organization's preferences and integrations -

    -
    -
    - -
    - -
    -
    -
    -
    - -
    -

    User Management

    -

    - Manage staff accounts, roles, and permissions for your - organization. -

    -
    - - Manage Users - - - 23 users -
    -
    -
    -
    - - -
    -
    -
    -
    - -
    -

    Pesticide Products

    -

    - Configure products, application rates, and field recommendations. -

    -
    - - Manage Products - - - 12 active products -
    -
    -
    -
    - - -
    -
    -
    -
    - -
    -

    Integrations

    -

    - Configure connections with FieldSeeker, VectorSurv, and other - services. -

    -
    - - Manage Integrations - - - 3 active connections -
    -
    -
    -
    - - -
    -
    -
    -
    - -
    -

    Equipment

    -

    - Manage your field equipment inventory, calibration, and - maintenance. -

    -
    - - Manage Equipment - - - Updated 5 days ago -
    -
    -
    -
    - - -
    -
    -
    -
    - -
    -

    Notifications

    -

    - Configure email alerts, SMS notifications, and reporting - preferences. -

    -
    - - Manage Notifications - - - 5 active alerts -
    -
    -
    -
    - - -
    -
    -
    -
    - -
    -

    General Settings

    -

    - Configure organization details, branding, and system preferences. -

    -
    - - Manage Settings - - - Updated yesterday -
    -
    -
    -
    -
    - -
    -

    - - All changes made in settings are logged for audit purposes -

    -
    -
    {{ end }} diff --git a/html/template/sync/settings.html b/html/template/sync/settings.html index 650f5c9f..d4e258ec 100644 --- a/html/template/sync/settings.html +++ b/html/template/sync/settings.html @@ -2,7 +2,217 @@ {{ define "title" }}Dash{{ end }} {{ define "extraheader" }} + {{ end }} {{ define "content" }} -

    Imagine settings here

    +
    +
    +
    +

    Settings

    +

    + Configure your organization's preferences and integrations +

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

    User Management

    +

    + Manage staff accounts, roles, and permissions for your + organization. +

    +
    + + Manage Users + + + 23 users +
    +
    +
    +
    + + +
    +
    +
    +
    + +
    +

    Pesticide Products

    +

    + Configure products, application rates, and field recommendations. +

    +
    + + Manage Products + + + 12 active products +
    +
    +
    +
    + + +
    +
    +
    +
    + +
    +

    Integrations

    +

    + Configure connections with FieldSeeker, VectorSurv, and other + services. +

    +
    + + Manage Integrations + + + 3 active connections +
    +
    +
    +
    + + +
    +
    +
    +
    + +
    +

    Equipment

    +

    + Manage your field equipment inventory, calibration, and + maintenance. +

    +
    + + Manage Equipment + + + Updated 5 days ago +
    +
    +
    +
    + + +
    +
    +
    +
    + +
    +

    Notifications

    +

    + Configure email alerts, SMS notifications, and reporting + preferences. +

    +
    + + Manage Notifications + + + 5 active alerts +
    +
    +
    +
    + + +
    +
    +
    +
    + +
    +

    General Settings

    +

    + Configure organization details, branding, and system preferences. +

    +
    + + Manage Settings + + + Updated yesterday +
    +
    +
    +
    +
    + +
    +

    + + All changes made in settings are logged for audit purposes +

    +
    +
    {{ end }} diff --git a/sync/dash.go b/sync/dash.go index a2a61037..45b7aa3c 100644 --- a/sync/dash.go +++ b/sync/dash.go @@ -24,7 +24,6 @@ import ( var () type Config struct { - URLTegola string } type ContentSource struct { @@ -52,7 +51,6 @@ type ContextCell struct { User User } type ContextDashboard struct { - Config Config CountTraps int CountMosquitoSources int CountServiceRequests int @@ -61,6 +59,7 @@ type ContextDashboard struct { LastSync *time.Time MapData ComponentMap RecentRequests []ServiceRequestSummary + URL ContentURL User User } @@ -137,7 +136,16 @@ func getRoot(w http.ResponseWriter, r *http.Request) { } func getSettings(w http.ResponseWriter, r *http.Request, u *models.User) { - settings(w, r, u) + userContent, err := contentForUser(r.Context(), u) + if err != nil { + respondError(w, "Failed to get user content", err, http.StatusInternalServerError) + return + } + data := ContentAuthenticatedPlaceholder{ + URL: newContentURL(), + User: userContent, + } + html.RenderOrError(w, "sync/settings.html", data) } func getSource(w http.ResponseWriter, r *http.Request, u *models.User) { @@ -291,9 +299,6 @@ func dashboard(ctx context.Context, w http.ResponseWriter, user *models.User) { return } data := ContextDashboard{ - Config: Config{ - URLTegola: config.MakeURLTegola("/"), - }, CountTraps: int(trapCount), CountMosquitoSources: int(sourceCount), CountServiceRequests: int(serviceCount), @@ -308,18 +313,6 @@ func dashboard(ctx context.Context, w http.ResponseWriter, user *models.User) { html.RenderOrError(w, "sync/dashboard.html", data) } -func settings(w http.ResponseWriter, r *http.Request, user *models.User) { - userContent, err := contentForUser(r.Context(), user) - if err != nil { - respondError(w, "Failed to get user content", err, http.StatusInternalServerError) - return - } - data := ContentAuthenticatedPlaceholder{ - User: userContent, - } - html.RenderOrError(w, "sync/settings.html", data) -} - func source(w http.ResponseWriter, r *http.Request, user *models.User, id uuid.UUID) { org, err := user.Organization().One(r.Context(), db.PGInstance.BobDB) if err != nil { diff --git a/sync/types.go b/sync/types.go index 8306d280..4177e0d9 100644 --- a/sync/types.go +++ b/sync/types.go @@ -26,6 +26,7 @@ type ComponentMap struct { Zoom int } type ContentAuthenticatedPlaceholder struct { + URL ContentURL User User } type ContentMockURLs struct { diff --git a/sync/url.go b/sync/url.go index 3fcf1a92..aee22bea 100644 --- a/sync/url.go +++ b/sync/url.go @@ -5,13 +5,27 @@ import ( ) type ContentURL struct { - PoolCSVUpload string - SamplePoolCSV string + PoolCSVUpload string + SamplePoolCSV string + Setting string + SettingIntegration string + SettingPesticide string + SettingPesticideAdd string + SettingUser string + SettingUserAdd string + Tegola string } func newContentURL() ContentURL { return ContentURL{ - PoolCSVUpload: config.MakeURLNidus("/pool/upload"), - SamplePoolCSV: config.MakeURLNidus("/static/file/sample-pool.csv"), + PoolCSVUpload: config.MakeURLNidus("/pool/upload"), + SamplePoolCSV: config.MakeURLNidus("/static/file/sample-pool.csv"), + Setting: config.MakeURLNidus("/setting"), + SettingIntegration: config.MakeURLNidus("/setting/integration"), + SettingPesticide: config.MakeURLNidus("/setting/pesticide"), + SettingPesticideAdd: config.MakeURLNidus("/setting/pesticide/add"), + SettingUser: config.MakeURLNidus("/setting/user"), + SettingUserAdd: config.MakeURLNidus("/setting/user/add"), + Tegola: config.MakeURLTegola("/"), } }