add settings and edit feature to bookable spaces

This commit is contained in:
Rafeek-Khoudare
2025-07-15 15:17:43 +03:00
parent a9895f5462
commit e9b4d35f97
22 changed files with 255 additions and 55 deletions

View File

@ -0,0 +1,41 @@
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
import 'package:syncrow_web/utils/string_utils.dart';
class SendBookableSpacesToApiParams {
List<String> spaceUuids;
List<String> daysAvailable;
String startTime;
String endTime;
int points;
SendBookableSpacesToApiParams({
required this.spaceUuids,
required this.daysAvailable,
required this.startTime,
required this.endTime,
required this.points,
});
static SendBookableSpacesToApiParams fromBookableSpacesModel(
List<BookableSpacemodel> bookableSpaces) {
return SendBookableSpacesToApiParams(
spaceUuids: bookableSpaces.map((space) => space.spaceUuid).toList(),
daysAvailable: bookableSpaces
.expand((space) => space.spaceConfig!.bookableDays)
.toSet()
.toList(),
startTime: formatTimeOfDayTo24HourString(
bookableSpaces.first.spaceConfig!.bookingStartTime!),
endTime: formatTimeOfDayTo24HourString(
bookableSpaces.first.spaceConfig!.bookingEndTime!),
points: bookableSpaces.first.spaceConfig!.cost,
);
}
Map<String, dynamic> toJson() => {
'spaceUuids': spaceUuids,
'daysAvailable': daysAvailable,
'startTime': startTime,
'endTime': endTime,
'points': points
};
}

View File

@ -1,3 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
import 'package:syncrow_web/utils/string_utils.dart';
class UpdateBookableSpaceParam {
String spaceUuid;
@ -14,6 +18,20 @@ class UpdateBookableSpaceParam {
this.availability,
this.cost,
});
factory UpdateBookableSpaceParam.fromBookableModel(
BookableSpacemodel bookableSpace) {
return UpdateBookableSpaceParam(
spaceUuid: bookableSpace.spaceUuid,
availability: bookableSpace.spaceConfig!.availability,
bookableDays: bookableSpace.spaceConfig!.bookableDays,
cost: bookableSpace.spaceConfig!.cost,
bookingStartTime: formatTimeOfDayTo24HourString(
bookableSpace.spaceConfig!.bookingStartTime!),
bookingEndTime: formatTimeOfDayTo24HourString(
bookableSpace.spaceConfig!.bookingEndTime!),
);
}
Map<String, dynamic> toJson() => {
if (bookableDays != null) 'daysAvailable': bookableDays,
if (bookingStartTime != null) 'startTime': bookingStartTime,