package templates import ( "fmt" "veola/internal/models" ) type SettingsData struct { Page Values map[string]string // CredentialStatus maps each secret settings key to a human-readable // status ("Saved in settings", "Set in config.toml", "Not set"). Secret // values are never rendered into the form itself. CredentialStatus map[string]string IsAdmin bool Users []models.User TestNtfyOK string TestApifyOK string TestEbayOK string TestResendOK string EbayUsedToday int EbayDailyLimit int ApifyToday int ApifyMonth int ApifyCostPerCall float64 MonthlyBudget float64 PasswordMsg string PasswordError string UserMsg string UserError string EmailMsg string EmailError string } // ApifyMonthCost is the estimated month-to-date Apify spend. func (d SettingsData) ApifyMonthCost() float64 { return float64(d.ApifyMonth) * d.ApifyCostPerCall } // EbayLimitReached reports whether eBay polling is currently halted because // the daily call limit has been hit. func (d SettingsData) EbayLimitReached() bool { return d.EbayDailyLimit > 0 && d.EbayUsedToday >= d.EbayDailyLimit } // credStatus renders the "Saved in settings / Set in config.toml / Not set" // indicator for a secret field without ever printing the secret itself. templ credStatus(d SettingsData, key string) { if s := d.CredentialStatus[key]; s != "" {
Credentials, budget, notifications, and users
| Username | Role | Created | |
|---|---|---|---|
| { u.Username } | { string(u.Role) } | { u.CreatedAt.Format("2006-01-02") } |