diff --git a/src/app/controller/attendies_controller.go b/src/app/controller/attendies_controller.go index 8b8fb26..4281d29 100644 --- a/src/app/controller/attendies_controller.go +++ b/src/app/controller/attendies_controller.go @@ -1,6 +1,8 @@ package controller import ( + "fmt" + "github.com/gofiber/fiber/v2" "ulmer-furs.de/pretix-proxy/v2/app/service" ) @@ -19,3 +21,19 @@ func GetAttendiesByEventPublic(c *fiber.Ctx) error { c.JSON(attendies) return c.SendStatus(fiber.StatusOK) } + +func GetAttendiesByEventPublicTable(c *fiber.Ctx) error { + name := c.Params("name") + event, err := service.Get_db_event_by_event(name) + if err != nil { + return c.Status(fiber.ErrNotFound.Code).SendString("event not found") + } + attendies, err := service.GetAttendiesByEventPrivacy(event, false) + if err != nil { + return c.Status(fiber.ErrNotFound.Code).SendString("attendies not found") + } + return c.Render("app/views/index", fiber.Map{ + "Title": fmt.Sprintf("%s Attendies", *event.Event), + "Attendies": attendies, + }) +} diff --git a/src/app/routes/public_routes.go b/src/app/routes/public_routes.go index f389766..ef263d5 100644 --- a/src/app/routes/public_routes.go +++ b/src/app/routes/public_routes.go @@ -6,6 +6,9 @@ import ( ) func PublicRoutes(app *fiber.App) { + ui := app.Group("/ui") + attendiesUi := ui.Group("/attendies") + attendiesUi.Get("/:name", controller.GetAttendiesByEventPublicTable) apiv1 := app.Group("/api/v1/public") attendies := apiv1.Group("/attendies") webhooks := apiv1.Group("/webhooks") diff --git a/src/app/static/styles/style.css b/src/app/static/styles/style.css new file mode 100644 index 0000000..8db6b2b --- /dev/null +++ b/src/app/static/styles/style.css @@ -0,0 +1,35 @@ +body { + font-family: Arial, Helvetica, sans-serif; + display: flex; + justify-content: center; + background-color: #151719; +} + +main { + min-width: 60vw; +} + +h1 { + color: #ffffff; +} + +table { + border-collapse: collapse; +} + +.tableHeading { + background-color: #fae4b9; +} + +th, td { + border-style: hidden; + padding: 15px; +} + +tbody>tr:nth-child(even) { + background-color: #f6f6f6; +} + +tbody>tr:nth-child(odd) { + background-color: #e9e9e9; +} \ No newline at end of file diff --git a/src/app/views/index.html b/src/app/views/index.html index 2121800..a411dfa 100644 --- a/src/app/views/index.html +++ b/src/app/views/index.html @@ -4,14 +4,12 @@
Events count: {{.Count}}
- - {{template "table" .}} +