Booking forms + Scheduler adaptation
This commit is contained in:
@@ -330,6 +330,7 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||
Tooltip( message: "check booking",
|
||||
child: InkWell( mouseCursor: SystemMouseCursors.click,
|
||||
onTap: () {
|
||||
if (dash.scheduleActive) { return; }
|
||||
if (dash.scheduler["start"] == null ) {
|
||||
DateTime now = DateTime.now().add(const Duration(minutes: 5));
|
||||
dash.scheduler["start"] = now.toUtc().toIso8601String();
|
||||
@@ -359,10 +360,11 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||
);
|
||||
}, child: Container( margin: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(color: widget.booking == null ? Colors.black : (widget.booking == true ? Colors.green : Colors.red), width: 1)),
|
||||
border: Border.all(color: widget.booking == null && !dash.scheduleActive ? Colors.grey : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red), width: 1)),
|
||||
width: 140, height: 30,
|
||||
child: Icon(
|
||||
Icons.verified_outlined, color:widget.booking == null ? Colors.black : (widget.booking == true? Colors.green : Colors.red)),
|
||||
Icons.verified_outlined,
|
||||
color: widget.booking == null && !dash.scheduleActive ? Colors.grey : (widget.booking == true || dash.scheduleActive ? Colors.green : Colors.red)),
|
||||
))
|
||||
),
|
||||
Tooltip( message: dash.scheduleActive ? "unbook" : "book",
|
||||
@@ -376,9 +378,12 @@ class SchedulerFormsWidgetState extends State<SchedulerFormsWidget> {
|
||||
} else { k.currentState!.save();}
|
||||
}
|
||||
}
|
||||
if (dash.scheduler["start"] == null ) {
|
||||
DateTime now = DateTime.now().add(const Duration(minutes: 5));
|
||||
DateTime now = DateTime.now().add(const Duration(minutes: 5));
|
||||
if (dash.scheduler["start"] == null || DateTime.parse(dash.scheduler["start"]!).isBefore(now)) {
|
||||
dash.scheduler["start"] = now.toUtc().toIso8601String();
|
||||
if (dash.scheduler["end"] != null) {
|
||||
dash.scheduler["end"] = now.add(const Duration(minutes: 1)).toUtc().toIso8601String();
|
||||
}
|
||||
}
|
||||
widget.item.save!(widget.item.id);
|
||||
setState(() { });
|
||||
|
||||
Reference in New Issue
Block a user