diff --git a/GeoClient/GeoClient/Models/Geobroker/GeobrokerConstants.cs b/GeoClient/GeoClient/Models/Geobroker/GeobrokerConstants.cs index b392891..d849798 100644 --- a/GeoClient/GeoClient/Models/Geobroker/GeobrokerConstants.cs +++ b/GeoClient/GeoClient/Models/Geobroker/GeobrokerConstants.cs @@ -11,6 +11,7 @@ public static class GeobrokerConstants public const string IncidentPriorityProperty = "priority"; public const string IncidentBlueProperty = "blue"; public const string IncidentLocationProperty = "location"; + public const string IncidentDestinationProperty = "destination"; public const string IncidentAssignedUnitsProperty = "assignedUnits"; public const string UnitIdProperty = "id"; diff --git a/GeoClient/GeoClient/Models/IncidentItem.cs b/GeoClient/GeoClient/Models/IncidentItem.cs index 399b81f..8a2b6fa 100644 --- a/GeoClient/GeoClient/Models/IncidentItem.cs +++ b/GeoClient/GeoClient/Models/IncidentItem.cs @@ -16,6 +16,7 @@ public class IncidentItem : IComparable public bool Priority { get; } public bool Blue { get; } public GeoPoint Location { get; } + public GeoPoint Destination { get; } public List Units { get; } @@ -36,6 +37,7 @@ public IncidentItem( bool priority = false, bool blue = false, GeoPoint location = null, + GeoPoint destination = null, List units = null) { Id = id; @@ -44,6 +46,7 @@ public IncidentItem( Priority = priority; Blue = blue; Location = location; + Destination = destination; Units = units ?? new List(); } @@ -55,6 +58,7 @@ protected bool Equals(IncidentItem other) && Priority == other.Priority && Blue == other.Blue && Equals(Location, other.Location) + && Equals(Destination, other.Destination) && ListEquals(Units, other.Units); } @@ -85,6 +89,7 @@ public override int GetHashCode() hashCode = (hashCode * 397) ^ Priority.GetHashCode(); hashCode = (hashCode * 397) ^ Blue.GetHashCode(); hashCode = (hashCode * 397) ^ (Location != null ? Location.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (Destination != null ? Destination.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Units != null ? Units.GetHashCode() : 0); return hashCode; } @@ -93,7 +98,7 @@ public override int GetHashCode() public override string ToString() { return - $"{nameof(Id)}: {Id}, {nameof(Type)}: {Type}, {nameof(Info)}: {Info}, {nameof(Priority)}: {Priority}, {nameof(Blue)}: {Blue}, {nameof(Location)}: {Location}, Units.Count: {Units.Count}"; + $"{nameof(Id)}: {Id}, {nameof(Type)}: {Type}, {nameof(Info)}: {Info}, {nameof(Priority)}: {Priority}, {nameof(Blue)}: {Blue}, {nameof(Location)}: {Location}, {nameof(Destination)}: {Destination}, Units.Count: {Units.Count}"; } private string GetDescriptiveType() @@ -128,12 +133,10 @@ private IncidentTaskState GetOwnTaskState() var registrationInfo = _registrationService.GetRegistrationInfo(); if (registrationInfo?.Id != null) { - foreach (UnitOfIncident unit in Units) + foreach (var unit in Units) { if (unit.Id == registrationInfo.Id) - { return unit.State; - } } } else diff --git a/GeoClient/GeoClient/Services/IncidentItemFactory.cs b/GeoClient/GeoClient/Services/IncidentItemFactory.cs index 215051b..4e33d39 100644 --- a/GeoClient/GeoClient/Services/IncidentItemFactory.cs +++ b/GeoClient/GeoClient/Services/IncidentItemFactory.cs @@ -48,6 +48,7 @@ private static IncidentItem CreateIncidentItem(JObject incident, List u incident.Value(GeobrokerConstants.IncidentPriorityProperty), incident.Value(GeobrokerConstants.IncidentBlueProperty), CreateGeoPoint(incident[GeobrokerConstants.IncidentLocationProperty]), + CreateGeoPoint(incident[GeobrokerConstants.IncidentDestinationProperty]), unitList); } diff --git a/GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs b/GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs index a0a76a3..4ad5010 100644 --- a/GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs +++ b/GeoClient/GeoClient/ViewModels/ItemDetailViewModel.cs @@ -13,6 +13,9 @@ public class ItemDetailViewModel : BaseViewModel public Color OpenLocationButtonColor => GetOpenLocationButtonColor(); public string OpenLocationButtonText => GetOpenLocationButtonText(); + public Color OpenDestinationButtonColor => GetOpenDestinationButtonColor(); + public string OpenDestinationButtonText => GetOpenDestinationButtonText(); + public ItemDetailViewModel(IncidentItem incidentItem = null) { Title = incidentItem?.DescriptiveType; @@ -26,12 +29,27 @@ private Color GetOpenLocationButtonColor() private string GetOpenLocationButtonText() { - return IsLocationAvailable() ? "Berufungsort auf Karte anzeigen" : "Berufungsort ist nicht verortet"; + return IsLocationAvailable() ? "Berufungsort auf Karte anzeigen" : "Berufungsort nicht verfügbar"; } private bool IsLocationAvailable() { return IncidentItem?.Location != null; } + + private Color GetOpenDestinationButtonColor() + { + return IsDestinationAvailable() ? ActiveButtonColor : DisableButtonColor; + } + + private string GetOpenDestinationButtonText() + { + return IsDestinationAvailable() ? "Zielort auf Karte anzeigen" : "Zielort nicht verfügbar"; + } + + private bool IsDestinationAvailable() + { + return IncidentItem?.Destination != null; + } } } \ No newline at end of file diff --git a/GeoClient/GeoClient/Views/ItemDetailPage.xaml b/GeoClient/GeoClient/Views/ItemDetailPage.xaml index 5a4121d..8bd88c7 100644 --- a/GeoClient/GeoClient/Views/ItemDetailPage.xaml +++ b/GeoClient/GeoClient/Views/ItemDetailPage.xaml @@ -60,10 +60,17 @@