From 34c91497f352dc1a9752b38059d5e74bdb923e53 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 1 Oct 2024 08:36:30 +0200 Subject: [PATCH] Only allow harbours to be selected where the current user is assigned to --- src/BreCalClient/EditShipcallControl.xaml.cs | 3 ++- src/BreCalClient/MainWindow.xaml.cs | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs index fbce9ab..8aaa4bf 100644 --- a/src/BreCalClient/EditShipcallControl.xaml.cs +++ b/src/BreCalClient/EditShipcallControl.xaml.cs @@ -6,6 +6,7 @@ using BreCalClient.misc.Api; using BreCalClient.misc.Model; using System; using System.Collections.Generic; +using System.Linq; using System.Windows; using System.Windows.Controls; using static BreCalClient.Extensions; @@ -63,7 +64,7 @@ namespace BreCalClient this.comboBoxDepartureBerth.ItemsSource = BreCalLists.Berths; this.comboBoxTimeRef.ItemsSource = BreCalLists.TimeRefs; - this.comboBoxHarbour.ItemsSource = BreCalLists.Ports; + this.comboBoxHarbour.ItemsSource = BreCalLists.Ports.Where(x => App.Participant.Ports.Contains(x.Id)); this.integerUpDownShiftingCount.Value = this.ShipcallModel.ShiftSequence; diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index 7fa3882..bd31192 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -25,6 +25,7 @@ using System.Net; using System.Windows.Input; using System.Text.RegularExpressions; using Newtonsoft.Json.Linq; +using System.Linq; namespace BreCalClient @@ -425,8 +426,7 @@ namespace BreCalClient BreCalLists.InitializeShips(await _shipApi.ShipsGetAsync()); BreCalLists.InitializeParticipants(await _staticApi.ParticipantsGetAsync()); - this.searchFilterControl.SetBerths(BreCalLists.Berths); - this.comboBoxPorts.ItemsSource = BreCalLists.AllPorts; + this.searchFilterControl.SetBerths(BreCalLists.Berths); foreach (Participant participant in BreCalLists.Participants) { @@ -1135,6 +1135,8 @@ namespace BreCalClient { if (App.Participant.IsTypeFlagSet(Extensions.ParticipantType.BSMD)) this.buttonNew.Visibility = Visibility.Visible; + + this.comboBoxPorts.ItemsSource = BreCalLists.AllPorts.Where(x => App.Participant.Ports.Contains(x.Id)); } private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)