package templates import ( "fmt" "git.preston-baxter.com/Preston_PLB/capstone/frontend-service/db/models" ) type TableData [][]string templ EventsPage(user *models.User) { @Head("Events")
@DashboardNav(user) @EventContent(user)
@DashboardFooter() @DashboardScript() @toggleDropdown() @updateSearchScript() } var sampleData = [][]string{{"head 1", "head 2"}, {"row 1", "row 1"}, {"row 2", "row 2"}} var blankData = [][]string{{"head 1", "head 2"}} templ EventContent(user *models.User) {
@DashboardContentNav(user)
@EventTableWidget("Events", "events_for_user")
@EventTableWidget("Actions", "actions_for_user")
} templ EventTableWidget(title, table_name string) {

{ title }

@EventTableDataLoader(table_name)
} templ EventTableDataLoader(table_name string) {
@EventTableDataLazy(table_name) @spinnerCentered()
} //hx-get={ fmt.Sprintf("/dashboard/events/components/table_data?table_name=%s", table_name) } templ EventTableDataLazy(table_name string) {
Lorem Ipsum Lorem Ipsum
No Data Available No Data Available
} templ EventTableData(data TableData, table_name string) { for _, header := range data[0] { } if len(data) <= 1 { } else { for _, row := range data[1:] { for _, item := range row { } } }
{ header }
No Data Available
{ item }
} templ updateSearchScript() { }