front driver availabilities
This commit is contained in:
		
							parent
							
								
									50e939c455
								
							
						
					
					
						commit
						726584b0fb
					
				
							
								
								
									
										5
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										5
									
								
								go.mod
								
								
								
								
							| 
						 | 
					@ -38,7 +38,6 @@ require (
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
	git.coopgo.io/coopgo-apps/silvermobi v0.0.0-20241101002634-41ff83d23274
 | 
					 | 
				
			||||||
	git.coopgo.io/coopgo-platform/agenda v0.0.0-20230310121901-ef3add576f86
 | 
						git.coopgo.io/coopgo-platform/agenda v0.0.0-20230310121901-ef3add576f86
 | 
				
			||||||
	git.coopgo.io/coopgo-platform/emailing v0.0.0-20221017030337-c71888d90c15
 | 
						git.coopgo.io/coopgo-platform/emailing v0.0.0-20221017030337-c71888d90c15
 | 
				
			||||||
	git.coopgo.io/coopgo-platform/fleets v0.0.0-20230310144446-feb935f8bf4e
 | 
						git.coopgo.io/coopgo-platform/fleets v0.0.0-20230310144446-feb935f8bf4e
 | 
				
			||||||
| 
						 | 
					@ -48,7 +47,7 @@ require (
 | 
				
			||||||
	git.coopgo.io/sbouaram/solidarity-service v0.0.0-00010101000000-000000000000
 | 
						git.coopgo.io/sbouaram/solidarity-service v0.0.0-00010101000000-000000000000
 | 
				
			||||||
	github.com/gorilla/securecookie v1.1.1
 | 
						github.com/gorilla/securecookie v1.1.1
 | 
				
			||||||
	github.com/minio/minio-go/v7 v7.0.43
 | 
						github.com/minio/minio-go/v7 v7.0.43
 | 
				
			||||||
	github.com/rs/zerolog v1.32.0
 | 
						github.com/rs/zerolog v1.33.0
 | 
				
			||||||
	github.com/xuri/excelize/v2 v2.7.1
 | 
						github.com/xuri/excelize/v2 v2.7.1
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -122,7 +121,7 @@ require (
 | 
				
			||||||
	golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
 | 
						golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
 | 
				
			||||||
	golang.org/x/net v0.29.0 // indirect
 | 
						golang.org/x/net v0.29.0 // indirect
 | 
				
			||||||
	golang.org/x/sync v0.8.0 // indirect
 | 
						golang.org/x/sync v0.8.0 // indirect
 | 
				
			||||||
	golang.org/x/sys v0.25.0 // indirect
 | 
						golang.org/x/sys v0.28.0 // indirect
 | 
				
			||||||
	golang.org/x/text v0.18.0 // indirect
 | 
						golang.org/x/text v0.18.0 // indirect
 | 
				
			||||||
	google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
 | 
						google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
 | 
				
			||||||
	google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
 | 
						google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										8
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										8
									
								
								go.sum
								
								
								
								
							| 
						 | 
					@ -186,8 +186,8 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV
 | 
				
			||||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
 | 
					github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
 | 
				
			||||||
github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
 | 
					github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
 | 
				
			||||||
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
 | 
					github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
 | 
				
			||||||
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
 | 
					github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
 | 
				
			||||||
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
 | 
					github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
 | 
				
			||||||
github.com/rwtodd/Go.Sed v0.0.0-20210816025313-55464686f9ef/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ=
 | 
					github.com/rwtodd/Go.Sed v0.0.0-20210816025313-55464686f9ef/go.mod h1:8AEUvGVi2uQ5b24BIhcr0GCcpd/RNAFWaN2CJFrWIIQ=
 | 
				
			||||||
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
 | 
					github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
 | 
				
			||||||
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
 | 
					github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
 | 
				
			||||||
| 
						 | 
					@ -351,8 +351,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
				
			||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
					golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
				
			||||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
					golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
				
			||||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
					golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
				
			||||||
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
 | 
					golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
 | 
				
			||||||
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 | 
					golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 | 
				
			||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 | 
					golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 | 
				
			||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 | 
					golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 | 
				
			||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
 | 
					golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,7 @@ type Booking struct {
 | 
				
			||||||
	bookingData  solidarity_service.CreateBookingSolidarityRequest 
 | 
						bookingData  solidarity_service.CreateBookingSolidarityRequest 
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//List les conducteurs disponibles + Créer une réservation
 | 
				
			||||||
func (h *ApplicationHandler) DriversJourney(w http.ResponseWriter, r *http.Request) {
 | 
					func (h *ApplicationHandler) DriversJourney(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if r.Method == "GET" && r.FormValue("date") != ""{
 | 
						if r.Method == "GET" && r.FormValue("date") != ""{
 | 
				
			||||||
| 
						 | 
					@ -130,21 +131,8 @@ func (h *ApplicationHandler) DriversJourney(w http.ResponseWriter, r *http.Reque
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}else {
 | 
						}else {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		accounts, err := h.services.GRPC.SolidarityService.GetAllPassengers(context.TODO(), &emptypb.Empty{})
 | 
					 | 
				
			||||||
		drivers, err := h.services.GRPC.SolidarityService.GetAllDrivers(context.TODO(), &emptypb.Empty{})
 | 
					 | 
				
			||||||
		bookings, err := h.services.GRPC.SolidarityService.GetAllBookingsSolidarity(context.TODO(), &emptypb.Empty{})
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							h.Renderer.CreateBookingHome(w, r)
 | 
				
			||||||
		parcourmobAccounts, err := h.beneficiaries(r)
 | 
					 | 
				
			||||||
		if err != nil {
 | 
					 | 
				
			||||||
			fmt.Println(err)
 | 
					 | 
				
			||||||
			w.WriteHeader(http.StatusBadRequest)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		cacheid := uuid.NewString()
 | 
					 | 
				
			||||||
		h.cache.PutWithTTL(cacheid, accounts, 1*time.Hour)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		h.Renderer.SolidarityService(w, r, accounts, drivers, parcourmobAccounts, bookings, cacheid)
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,12 +13,12 @@ const solidarityserviceMenu = "solidarity_service"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type SolidarityListState struct {
 | 
					type SolidarityListState struct {
 | 
				
			||||||
	Count         int                               `json:"count"`
 | 
						Count                     int                               `json:"count"`
 | 
				
			||||||
  	CacheId                string                            `json:"cache_id"`
 | 
					  	CacheId                   string                            `json:"cache_id"`
 | 
				
			||||||
	BeneficiariesSolidarity         *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"`
 | 
						BeneficiariesSolidarity   *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"`
 | 
				
			||||||
	Drivers *solidarity_service.DriverJourneysResponse `json:"drivers"`
 | 
						Drivers                   *solidarity_service.DriverJourneysResponse `json:"drivers"`
 | 
				
			||||||
	Bookings *solidarity_service.GetAllBookingsSolidarityResponse `json:"bookings"`
 | 
						Bookings                  *solidarity_service.GetAllBookingsSolidarityResponse `json:"bookings"`
 | 
				
			||||||
	Beneficiaries []mobilityaccountsstorage.Account   `json:"beneficiaries"`
 | 
						Beneficiaries              []mobilityaccountsstorage.Account   `json:"beneficiaries"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,9 +26,10 @@ type BeneficiariesSolidarityListState struct {
 | 
				
			||||||
	Count                      int                               `json:"count"`
 | 
						Count                      int                               `json:"count"`
 | 
				
			||||||
  	CacheId                    string                            `json:"cache_id"`
 | 
					  	CacheId                    string                            `json:"cache_id"`
 | 
				
			||||||
	BeneficiariesSolidarity    *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"`
 | 
						BeneficiariesSolidarity    *solidarity_service.GetAllPassengersResponse `json:"beneficiariessolidarity"`
 | 
				
			||||||
	Beneficiaries              []mobilityaccountsstorage.Account   `json:"beneficiaries"`
 | 
					 | 
				
			||||||
	Drivers                    *solidarity_service.GetAllDriversResponse `json:"drivers"`
 | 
						Drivers                    *solidarity_service.GetAllDriversResponse `json:"drivers"`
 | 
				
			||||||
	Bookings                    *solidarity_service.GetAllBookingsSolidarityResponse `json:"bookings"`
 | 
						Bookings                    *solidarity_service.GetAllBookingsSolidarityResponse `json:"bookings"`
 | 
				
			||||||
 | 
						Beneficiaries              []mobilityaccountsstorage.Account   `json:"beneficiaries"`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -91,6 +92,13 @@ func (renderer *Renderer) SolidarityService(w http.ResponseWriter, r *http.Reque
 | 
				
			||||||
	renderer.Render("solidarity_service", w, r, files, state)
 | 
						renderer.Render("solidarity_service", w, r, files, state)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (renderer *Renderer) CreateBookingHome(w http.ResponseWriter, r *http.Request ) {
 | 
				
			||||||
 | 
						files := renderer.ThemeConfig.GetStringSlice("views.solidarity_service.create.files")
 | 
				
			||||||
 | 
						state := NewState(r, renderer.ThemeConfig, solidarityserviceMenu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						renderer.Render("solidarity_service", w, r, files, state)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (renderer *Renderer) SolidarityServiceBooking(w http.ResponseWriter, r *http.Request, bookings *solidarity_service.CreateBookingSolidarityResponse) {
 | 
					func (renderer *Renderer) SolidarityServiceBooking(w http.ResponseWriter, r *http.Request, bookings *solidarity_service.CreateBookingSolidarityResponse) {
 | 
				
			||||||
	files := renderer.ThemeConfig.GetStringSlice("views.solidarity_service.create.files")
 | 
						files := renderer.ThemeConfig.GetStringSlice("views.solidarity_service.create.files")
 | 
				
			||||||
	state := NewState(r, renderer.ThemeConfig, solidarityserviceMenu)
 | 
						state := NewState(r, renderer.ThemeConfig, solidarityserviceMenu)
 | 
				
			||||||
| 
						 | 
					@ -104,7 +112,7 @@ func (renderer *Renderer) SolidarityServiceBooking(w http.ResponseWriter, r *htt
 | 
				
			||||||
func (renderer *Renderer) SolidarityServiceListAvailableDrivers(w http.ResponseWriter, r *http.Request, drivers *solidarity_service.DriverJourneysResponse, booking *solidarity_service.CreateBookingSolidarityRequest) {
 | 
					func (renderer *Renderer) SolidarityServiceListAvailableDrivers(w http.ResponseWriter, r *http.Request, drivers *solidarity_service.DriverJourneysResponse, booking *solidarity_service.CreateBookingSolidarityRequest) {
 | 
				
			||||||
	files := renderer.ThemeConfig.GetStringSlice("views.solidarity_service.create.files")
 | 
						files := renderer.ThemeConfig.GetStringSlice("views.solidarity_service.create.files")
 | 
				
			||||||
	state := NewState(r, renderer.ThemeConfig, solidarityserviceMenu)
 | 
						state := NewState(r, renderer.ThemeConfig, solidarityserviceMenu)
 | 
				
			||||||
	state.ViewState = SolidarityListState {
 | 
						state.ViewState = SolidarityListState{
 | 
				
			||||||
		Drivers: drivers,
 | 
							Drivers: drivers,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue