userhandling #16
@@ -227,68 +227,6 @@ func (rc *UserController) TagView(c *gin.Context) {
|
||||
c.HTML(http.StatusOK, "index.html", data)
|
||||
}
|
||||
|
||||
type booking struct {
|
||||
Booked bool
|
||||
}
|
||||
|
||||
type calendarbooking struct {
|
||||
Time string
|
||||
Bookings []booking
|
||||
}
|
||||
|
||||
func (rc *UserController) CalendarView(c *gin.Context) {
|
||||
shopItems, _ := repositories.ShopItems.GetAll()
|
||||
fmt.Println(len(shopItems))
|
||||
|
||||
generateBookings := func(amountShopItems int) []calendarbooking {
|
||||
var result []calendarbooking
|
||||
time := 6
|
||||
for _ = range 18 {
|
||||
book := calendarbooking{
|
||||
Time: fmt.Sprintf("%d:00", time),
|
||||
Bookings: []booking{},
|
||||
}
|
||||
for _ = range amountShopItems {
|
||||
book.Bookings = append(book.Bookings, booking{Booked: rand.Float32() < 0.5})
|
||||
}
|
||||
|
||||
time += 1
|
||||
result = append(result, book)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
bookings := gin.H{
|
||||
"head": []string{
|
||||
"malobeo",
|
||||
"hole of fame",
|
||||
"BK",
|
||||
"AZ Conni",
|
||||
},
|
||||
"bookings": generateBookings(4),
|
||||
//"bookings": []calendarbooking{
|
||||
// {
|
||||
// Time: "10:00",
|
||||
// Bookings: []booking{
|
||||
// { Booked: true },
|
||||
// { Booked: false },
|
||||
// },
|
||||
// },
|
||||
//},
|
||||
}
|
||||
|
||||
data := CreateSessionData(c, gin.H{
|
||||
"title": "shopItem Page",
|
||||
"bookings": bookings,
|
||||
"shopItemcount": len(bookings["head"].([]string)) + 1,
|
||||
})
|
||||
|
||||
fmt.Println(data)
|
||||
|
||||
c.HTML(http.StatusOK, "calendar.html", data)
|
||||
}
|
||||
|
||||
func (rc *UserController) Logout(c *gin.Context) {
|
||||
c.SetCookie("Authorization", "", -1, "", "", false, true)
|
||||
c.HTML(http.StatusOK, "index.html", gin.H{})
|
||||
|
||||
Reference in New Issue
Block a user