feat: gestion manuelle des statuts de réservation véhicule
This commit is contained in:
@@ -210,6 +210,29 @@ func (h *ApplicationHandler) BookVehicle(ctx context.Context, vehicleID, benefic
|
||||
Data: datapb,
|
||||
}
|
||||
|
||||
if h.config.GetString("modules.vehicles.status_management") == "manual" {
|
||||
options := getStatusOptions(h.config.Get("modules.vehicles.status_options"))
|
||||
for _, opt := range options {
|
||||
if initial, ok := opt["initial"].(bool); ok && initial {
|
||||
if name, ok := opt["name"].(string); ok {
|
||||
booking.ManualStatus = name
|
||||
booking.StatusHistory = []*fleets.StatusHistoryEntry{
|
||||
{
|
||||
ToStatus: name,
|
||||
UserId: currentUserID,
|
||||
UserName: fmt.Sprintf("%s %s", currentUserClaims["first_name"], currentUserClaims["last_name"]),
|
||||
GroupId: group.ID,
|
||||
GroupName: fmt.Sprintf("%s", group.Data["name"]),
|
||||
Date: timestamppb.Now(),
|
||||
Comment: "Création de la réservation",
|
||||
},
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
request := &fleets.CreateBookingRequest{
|
||||
Booking: booking,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user