feat: auto-fill vehicle booking end date (default 90 days, configurable)

This commit is contained in:
Arnaud Delcasse
2026-02-26 14:32:09 +01:00
parent 8d89306a90
commit bb525f174d
2 changed files with 8 additions and 4 deletions

View File

@@ -232,6 +232,7 @@ func ReadConfig() (*viper.Viper, error) {
},
"vehicles": map[string]any{
"enabled": true,
"default_booking_duration_days": 90,
},
"vehicles_management": map[string]any{
"enabled": true,

View File

@@ -26,10 +26,13 @@ func selectDocumentsDefaults(beneficiarydocuments []filestorage.FileInfo, mandat
func (renderer *Renderer) VehiclesSearch(w http.ResponseWriter, r *http.Request, beneficiaries []mobilityaccountsstorage.Account, searched bool, vehicles []fleetsstorage.Vehicle, beneficiary any, startdate any, enddate any, mandatory_documents []string, file_types_map map[string]string, beneficiarydocuments []filestorage.FileInfo, selected_type string, automatic bool, vehicles_types []string, admingroups map[string]any) {
files := renderer.ThemeConfig.GetStringSlice("views.vehicles.search.files")
state := NewState(r, renderer.ThemeConfig, vehiclesMenu)
defaultBookingDurationDays := renderer.GlobalConfig.GetInt("modules.vehicles.default_booking_duration_days")
viewstate := map[string]any{
"beneficiaries": beneficiaries,
"searched": searched,
"vehicles_types": vehicles_types,
"default_booking_duration_days": defaultBookingDurationDays,
}
if searched {