fix
This commit is contained in:
parent
efaa4f9f0d
commit
4f1cc21aeb
|
@ -369,15 +369,19 @@ func (h *ApplicationHandler) BeneficiarySolidarityDisplay(w http.ResponseWriter,
|
||||||
|
|
||||||
solidarity_bookings_list, err := h.services.GRPC.SolidarityService.GetBookingsByStatus(context.TODO(), solidarity_booking)
|
solidarity_bookings_list, err := h.services.GRPC.SolidarityService.GetBookingsByStatus(context.TODO(), solidarity_booking)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var bookings []any
|
var bookings []any
|
||||||
|
|
||||||
for _, o := range solidarity_bookings_list.Booking {
|
for _, o := range solidarity_bookings_list.Booking {
|
||||||
bookings = append(bookings, o)
|
if(o.PickupDate != nil){
|
||||||
}
|
bookings = append(bookings, o)
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
}
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h.Renderer.BeneficiarySolidarityDisplay(w, r , accountssolidarity , bookings)
|
h.Renderer.BeneficiarySolidarityDisplay(w, r , accountssolidarity , bookings)
|
||||||
|
|
|
@ -99,7 +99,6 @@ func (renderer *Renderer) BeneficiarySolidarityDisplay(w http.ResponseWriter, r
|
||||||
state.ViewState = map[string]any{
|
state.ViewState = map[string]any{
|
||||||
"beneficiary": beneficiary,
|
"beneficiary": beneficiary,
|
||||||
"bookingSolidarity" : solidarity_bookings_list,
|
"bookingSolidarity" : solidarity_bookings_list,
|
||||||
|
|
||||||
}
|
}
|
||||||
fmt.Println(solidarity_bookings_list)
|
fmt.Println(solidarity_bookings_list)
|
||||||
renderer.Render("beneficiaries_display", w, r, files, state)
|
renderer.Render("beneficiaries_display", w, r, files, state)
|
||||||
|
|
|
@ -25,6 +25,20 @@ func TimeFrom(d any) *time.Time {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TimestampFrom(d any) *time.Time {
|
||||||
|
|
||||||
|
if date, ok := d.(time.Time); ok {
|
||||||
|
return &date
|
||||||
|
} else if date, ok := d.(string); ok {
|
||||||
|
datetime, err := time.Parse("2006-01-02T15:04:05Z", date)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return &datetime
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func TimeFormat(d any, f string) string {
|
func TimeFormat(d any, f string) string {
|
||||||
date := TimeFrom(d)
|
date := TimeFrom(d)
|
||||||
if date == nil {
|
if date == nil {
|
||||||
|
|
Loading…
Reference in New Issue