mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +00:00
get booking by id
This commit is contained in:
parent
f3bf9b3caf
commit
92f8085537
2 changed files with 9 additions and 3 deletions
|
|
@ -37,6 +37,12 @@ func (bs Service) Create(From time.Time, To time.Time, Name string, PhoneNumber
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bs Service) One(id int) *Booking {
|
||||||
|
b := &Booking{Id: id}
|
||||||
|
bs.db.Preload("Items").First(b)
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
type Line struct {
|
type Line struct {
|
||||||
From time.Time
|
From time.Time
|
||||||
To time.Time
|
To time.Time
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@ func handleBookingPage(bs *booking.Service) echo.HandlerFunc {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
b := &booking.Booking{Id: id}
|
|
||||||
bs.db.Preload("Items").First(b)
|
b := bs.One(id)
|
||||||
|
|
||||||
bvm := &views.BookingViewModel{
|
bvm := &views.BookingViewModel{
|
||||||
Id: fmt.Sprintf("%04s", strconv.Itoa(b.Id)),
|
Id: fmt.Sprintf("%04s", strconv.Itoa(b.Id)),
|
||||||
|
|
@ -111,7 +111,7 @@ func handleBookingPage(bs *booking.Service) echo.HandlerFunc {
|
||||||
PaymentMethods: constants.PaymentMethods,
|
PaymentMethods: constants.PaymentMethods,
|
||||||
}
|
}
|
||||||
component := views.BookingById(bvm)
|
component := views.BookingById(bvm)
|
||||||
return s.renderTempl(c, http.StatusOK, component)
|
return renderTempl(c, http.StatusOK, component)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue