diff --git a/assets/op_darkgreen.png b/assets/op_darkgreen.png new file mode 100644 index 0000000..75ecc3b Binary files /dev/null and b/assets/op_darkgreen.png differ diff --git a/assets/op_lightgreen.png b/assets/op_lightgreen.png new file mode 100644 index 0000000..5a39377 Binary files /dev/null and b/assets/op_lightgreen.png differ diff --git a/assets/op_red.png b/assets/op_red.png new file mode 100644 index 0000000..7247326 Binary files /dev/null and b/assets/op_red.png differ diff --git a/lib/api/map_api.dart b/lib/api/map_api.dart index 44327a5..067ee01 100644 --- a/lib/api/map_api.dart +++ b/lib/api/map_api.dart @@ -100,8 +100,9 @@ Future, StreamGroup>> getAllOperators print("found operator in vicinity with id! ${oper.operatorId!} with ${latlon}"); if(!(await isOperatorBookingAvaliable(oper, date, time))){ - print("unavaliable operator, skipping!"); - continue; + print("unavaliable operator, marking red!"); + // continue; + oper.isOpFree = false; } operatorIdMapOp[oper.operatorId!] = oper; diff --git a/lib/models/operator_model.dart b/lib/models/operator_model.dart index f2579e6..6598150 100644 --- a/lib/models/operator_model.dart +++ b/lib/models/operator_model.dart @@ -13,6 +13,8 @@ class Operator { bool? isOperatorActive; int? timestamp; + bool isOpFree = true; + Operator( {this.operatorId, this.centerLocation, diff --git a/lib/screens/operator_selection.dart b/lib/screens/operator_selection.dart index 87465e3..ede4f1d 100644 --- a/lib/screens/operator_selection.dart +++ b/lib/screens/operator_selection.dart @@ -66,13 +66,19 @@ class _OperatorSelectionScreenState extends State { SymbolOptions createNormalSymbol(LatLng latLng) { return SymbolOptions( - draggable: true, iconImage: "icon", iconSize: 0.5, geometry: latLng); + draggable: true, iconImage: "opgreen", iconSize: 0.5, geometry: latLng); } + SymbolOptions createRedSymbol(LatLng latLng) { + return SymbolOptions( + draggable: true, iconImage: "opred", iconSize: 0.5, geometry: latLng); + } + + SymbolOptions createHighlightSymbol(LatLng latLng) { return SymbolOptions( draggable: true, - iconImage: "iconhigh", + iconImage: "opgreenselec", iconSize: 0.75, geometry: latLng); } @@ -99,7 +105,14 @@ class _OperatorSelectionScreenState extends State { void addOrUpdateOperatorLocation(OperatorData odata) async { LatLng latlng = LatLng(odata.loc!.lat!, odata.loc!.lon!); print("Show op ${odata.operatorId!} with latlon ${latlng.toJson()}"); - SymbolOptions symops = createNormalSymbol(latlng); + Operator operator = idToOperator[odata.operatorId!]!; + + SymbolOptions symops; + if(operator.isOpFree){ + symops = createNormalSymbol(latlng); + } else { + symops = createRedSymbol(latlng); + } if (operatorMapPins.containsKey(odata.operatorId!)) { // Update marker @@ -196,6 +209,8 @@ class _OperatorSelectionScreenState extends State { void symbolCallback(BuildContext context, Symbol symbol) async { if (symbol == location_pin) return; + Operator opclick = idToOperator[symbolIdToOperatorId[symbol.id]]!; + if(opclick.isOpFree == false) return; // if last called not null then dehilight symbol if (lastClicked != null) { utilHighlightOperator(lastClicked!, false); @@ -207,7 +222,6 @@ class _OperatorSelectionScreenState extends State { } utilHighlightOperator(symbol, true); - Operator opclick = idToOperator[symbolIdToOperatorId[symbol.id]]!; Provider.of(context, listen: false).setOperator(opclick); panelController.open(); setState(() { @@ -419,6 +433,13 @@ class _OperatorSelectionScreenState extends State { }); }, onStyleLoadedCallback: () { + addImageFromAsset( + "opgreen", "assets/op_lightgreen.png"); + addImageFromAsset( + "opgreenselec", "assets/op_darkgreen.png"); + addImageFromAsset( + "opred", "assets/op_red.png"); + addImageFromAsset( "icon", "assets/operator_pin_icon.png"); addImageFromAsset(