M accounts/routes.go => accounts/routes.go +35 -11
@@ 212,29 212,23 @@ func (s *Service) Settings(c echo.Context) error {
lt := localizer.GetSessionLocalizer(c)
pd := localizer.NewPageData(lt.Translate("Settings"))
pd.Data["name"] = lt.Translate("Name")
+ pd.Data["slug"] = lt.Translate("Slug")
+ pd.Data["subscription"] = lt.Translate("Subscription")
+ pd.Data["is_active"] = lt.Translate("Is Active")
pd.Data["email"] = lt.Translate("Email")
pd.Data["default_lang"] = lt.Translate("Default Language")
pd.Data["timezone"] = lt.Translate("Timezone")
pd.Data["organizations"] = lt.Translate("Organizations")
- pd.Data["type"] = lt.Translate("Type")
+ pd.Data["cur_organization"] = lt.Translate("Current Organization")
pd.Data["action"] = lt.Translate("Action")
- pd.Data["business"] = lt.Translate("Business")
- pd.Data["personal"] = lt.Translate("Personal")
pd.Data["edit"] = lt.Translate("Edit")
pd.Data["members"] = lt.Translate("Members")
- pd.Data["integrations"] = lt.Translate("Integrations")
- pd.Data["platform"] = lt.Translate("Platform")
- pd.Data["connect"] = lt.Translate("Connect")
- pd.Data["org_connected"] = lt.Translate("Organization connected")
- pd.Data["date"] = lt.Translate("Date")
- pd.Data["disconnect"] = lt.Translate("Disconnect")
- pd.Data["no_connections"] = lt.Translate("No connections")
- pd.Data["domains"] = lt.Translate("Domains")
pd.Data["actions"] = lt.Translate("Actions")
pd.Data["change_password"] = lt.Translate("Change password")
pd.Data["update_email"] = lt.Translate("Update email")
pd.Data["edit_profile"] = lt.Translate("Edit profile")
pd.Data["manage"] = lt.Translate("Manage Your Organizations")
+ pd.Data["upgrade"] = lt.Translate("Upgrade Org")
user := gctx.User.(*models.User)
langTrans := map[string]string{
@@ 242,11 236,41 @@ func (s *Service) Settings(c echo.Context) error {
"en": lt.Translate("English"),
}
+ type GraphQLResponse struct {
+ Orgs []models.Organization `json:"getOrganizations"`
+ }
+ var result GraphQLResponse
+ op := gqlclient.NewOperation(
+ `query GetOrganizations($search: String) {
+ getOrganizations(input: {search: $search}) {
+ id
+ name
+ slug
+ settings {
+ billing {
+ status
+ }
+ }
+ isActive
+ }
+ }`)
+ op.Var("search", links.GetOrgSelection(c)) // Get currently selected org
+ err := links.Execute(c.Request().Context(), op, &result)
+ if err != nil {
+ return err
+ }
+
+ var org *models.Organization
+ if len(result.Orgs) > 0 {
+ org = &result.Orgs[0]
+ }
+
gmap := gobwebs.Map{
"pd": pd,
"user": user,
"defaultLang": core.GetDefaultLang(),
"defaultTZ": links.DefaultTZ,
+ "curOrg": org,
"settingSection": true,
"langTrans": langTrans,
"navFlag": "settings",
M templates/settings.html => templates/settings.html +32 -0
@@ 44,5 44,37 @@
</tr>
</tbody>
</table>
+
+ {{ if .curOrg }}
+ <table class="striped">
+ <thead>
+ <tr>
+ <th>{{ .pd.Data.cur_organization }} {{.pd.Data.name}}</th>
+ <th>{{.pd.Data.slug}}</th>
+ <th>{{.pd.Data.subscription}}</th>
+ <th>{{.pd.Data.is_active}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{.curOrg.Name}}</td>
+ <td>{{.curOrg.Slug}}</td>
+ <td>{{ .curOrg.DisplayBillingStatus $.context }}{{ if .curOrg.IsFreeAccount }} (<a href="{{ reverse "billing:create_subscription" .curOrg.Slug }}" class="is-small">{{ .pd.Data.upgrade }}</a>){{ end }}</td>
+ <td>
+ {{if .curOrg.IsActive}}
+ <svg style="width:20px" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-primary">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
+ </svg>
+ {{else}}
+ <svg style="width:20px" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="text-error">
+ <path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
+ </svg>
+ {{end}}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ {{ end }}
+
</section>
{{template "base_footer" .}}
M values.go => values.go +1 -0
@@ 81,6 81,7 @@ var InvalidSlugs = []string{
"blog",
"weblog",
"well-known",
+ "api",
}
// Interval used to display data in analytics engagement chart