{{define "pgcreds_form"}}
{{if .PGCred}}
Host
{{.PGCred.PGHost}}:{{.PGCred.PGPort}}
Database
{{.PGCred.PGDatabase}}
Username
{{.PGCred.PGUsername}}
Password
stored (not shown)
Updated
{{formatTime .PGCred.UpdatedAt}}
{{else}}

No credentials stored.

{{end}} {{/* Any admin can add or update credentials; creator of the first set becomes owner */}}
{{if .PGCred}}Update credentials{{else}}Add new credentials{{end}}
{{/* Access grants section — shown whenever credentials exist */}} {{if .PGCred}}

Access Grants

{{if .PGCredGrants}} {{if isPGCredOwner $.ActorID $.PGCred}}{{end}} {{range .PGCredGrants}} {{if isPGCredOwner $.ActorID $.PGCred}} {{end}} {{end}}
User Granted
{{.GranteeName}} {{formatTime .GrantedAt}}
{{else}}

No access grants.

{{end}} {{/* Grant form — owner only */}} {{if and (isPGCredOwner .ActorID .PGCred) .GrantableAccounts}}
{{end}}
{{end}}
{{end}}