goffeetabler/controllers/tablerdemo.go
2026-05-10 19:41:48 -05:00

141 lines
4.7 KiB
Go

package controllers
// FormtablerFormElementsPage is the page-specific struct for the form elements demo.
// Each field is one of the 25 form element groups.
type FormtablerFormElementsPage struct {
TextInputs []FormtablerTextInput
IconInputs []FormtablerIconInput
IconSeparated FormtablerIconSeparated
InputSizing FormtablerInputSizing
FileInput FormtablerFileInput
ColorInput FormtablerColorInput
ColorPicker FormtablerColorPicker
RangeInput FormtablerRangeInput
Datalist FormtablerDatalist
ImageCheck FormtablerImageCheck
ImageRadio FormtablerImageRadio
ImagePerson FormtablerImagePerson
Checkboxes FormtablerCheckboxes
CheckboxesInline FormtablerCheckboxesInline
Radios FormtablerRadios
RadiosInline FormtablerRadiosInline
Toggles FormtablerToggle
ToggleSingle FormtablerToggleSingle
Select FormtablerSelect
Selectgroups []FormtablerSelectGroup
SelectgroupPayments FormtablerSelectgroupPayments
SelectgroupProjectManager FormtablerSelectgroupProjectManager
Fieldset FormtablerFieldset
CheckboxesList FormtablerCheckboxesList
ValidationStates FormtablerValidationStates
}
// FormtablerComponentsPage is the page-specific struct for the combined demo
// showing alerts, toasts, and breadcrumbs.
type FormtablerComponentsPage struct {
Alerts []FormtablerAlert
Breadcrumbs []FormtablerBreadcrumb
Toasts []FormtablerToast
}
// FormtablerUserSettingsSection represents a section in the settings sidebar.
type FormtablerUserSettingsSection struct {
Title string
SubItems []FormtablerUserSettingsNavItem
}
// FormtablerUserSettingsNavItem represents a single navigation item in the settings sidebar.
type FormtablerUserSettingsNavItem struct {
Title string
Link string
Active bool
}
// FormtablerUserSettingsPage holds the data for the user settings page.
type FormtablerUserSettingsPage struct {
SidebarSections []FormtablerUserSettingsSection
ActiveTab string
}
// AdminUserRow represents a single user in the admin users list.
type AdminUserRow struct {
Name string
Email string
Status string // "Active", "Inactive", "Invited"
Roles string // comma-separated role names
EditLink string
}
// AdminUsersPage holds the data for the admin users page.
type AdminUsersPage struct {
Users []AdminUserRow
AddLink string
}
// AdminCustomersPage holds the data for the admin customers listing page.
type AdminCustomersPage struct {
Customers []CustomerTableRow
}
// AuthLockPageData holds the data for the account lock page.
type AuthLockPageData struct {
PersonName string
}
// FormtablerFormFieldOption is an option for select, radio, or checkbox fields.
type FormtablerFormFieldOption struct {
Label string
Value string
Selected bool
Checked bool
Disabled bool
}
// FormtablerFormField represents a single field in a JSON-defined form.
type FormtablerFormField struct {
Name string
Label string
Type string // "text", "email", "phone", "textarea", "password", "select", "checkbox", "radio", "toggle", "file", "number", "url", "date", "datetime-local", "color", "range", "hidden"
Required bool
Placeholder string
MaxLength int
MinLength int
Min float64
Max float64
Step float64
Pattern string
Value string
Options []FormtablerFormFieldOption // for select, radio, checkbox
Autofocus bool
Readonly bool
Disabled bool
Multiple bool
Accept string // file accept attribute
Class string
HelpText string
ErrorText string
Success bool
Error bool
ColSpan int // for grid layout, 1-12
}
// FormtablerFormDefinition is the top-level structure for a JSON-defined form.
type FormtablerFormDefinition struct {
ID string
Title string
SuccessMessage string
Fields []FormtablerFormField
Method string // "GET" or "POST", default "POST"
Action string // form action URL
SubmitText string // button text, default "Submit"
ResetText string // button text for reset
ShowReset bool
Class string // form class
Layout string // "default", "inline", "horizontal", "card"
Columns int // number of columns (1, 2, 3), default 1
Enctype string // form enctype
NoValidate bool
FieldsetTitle string // optional fieldset wrapper
FieldsetDescription string
}