From a9b5317e797d03e2d5eec5df5bc399f839489bdd Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Mon, 15 Sep 2025 11:28:57 +0200 Subject: [PATCH] DeliveryAdminWindow: Make GerebeltGewogenInput required in Matzen --- Elwig/Windows/AdministrationWindow.cs | 6 ++++-- Elwig/Windows/DeliveryAdminWindow.xaml.cs | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Elwig/Windows/AdministrationWindow.cs b/Elwig/Windows/AdministrationWindow.cs index 0c4b1a3..09efc36 100644 --- a/Elwig/Windows/AdministrationWindow.cs +++ b/Elwig/Windows/AdministrationWindow.cs @@ -13,8 +13,8 @@ using System.Windows.Input; namespace Elwig.Windows { public abstract class AdministrationWindow : ContextWindow { - protected Control[] ExemptInputs { private get; set; } - protected Control[] RequiredInputs { private get; set; } + protected Control[] ExemptInputs { get; set; } + protected Control[] RequiredInputs { get; set; } private bool _isEditing; private bool _isCreating; @@ -166,8 +166,10 @@ namespace Elwig.Windows { Valid[input] = false; } else if (input is ComboBox cb && cb.SelectedItem == null && cb.ItemsSource != null && cb.ItemsSource.Cast().Any()) { ControlUtils.SetInputInvalid(input); + Valid[input] = false; } else if (input is ListBox lb && lb.SelectedItem == null && lb.ItemsSource != null && lb.ItemsSource.Cast().Any()) { ControlUtils.SetInputInvalid(input); + Valid[input] = false; } else if (input is CheckBox ckb && ((ckb.IsThreeState && ckb.IsChecked == null) || (!ckb.IsThreeState && ckb.IsChecked != true))) { ControlUtils.SetInputInvalid(input); Valid[input] = false; diff --git a/Elwig/Windows/DeliveryAdminWindow.xaml.cs b/Elwig/Windows/DeliveryAdminWindow.xaml.cs index eb262c2..253eb86 100644 --- a/Elwig/Windows/DeliveryAdminWindow.xaml.cs +++ b/Elwig/Windows/DeliveryAdminWindow.xaml.cs @@ -89,6 +89,9 @@ namespace Elwig.Windows { foreach (var s in App.EventScales) { s.WeighingEvent += Scale_Weighing; } + if (App.Client.IsMatzen) { + RequiredInputs = [.. RequiredInputs, ModifiersInput]; + } } else { WeighingManualButton.Visibility = Visibility.Hidden; WeighingAButton.Visibility = Visibility.Hidden; @@ -278,6 +281,7 @@ namespace Elwig.Windows { DateInput.IsReadOnly = false; TimeInput.IsReadOnly = false; BranchInput.IsEnabled = true; + GerebeltGewogenInput.IsEnabled = true; if (IsCreating) ViewModel.Time = ""; OnSecondPassed(null, null); } @@ -287,6 +291,7 @@ namespace Elwig.Windows { DateInput.IsReadOnly = true; TimeInput.IsReadOnly = true; BranchInput.IsEnabled = false; + GerebeltGewogenInput.IsEnabled = !App.Client.HasNetWeighing(ViewModel.Branch); OnSecondPassed(null, null); } @@ -1139,6 +1144,7 @@ namespace Elwig.Windows { DateInput.IsReadOnly = !Menu_Settings_EnableFreeEditing.IsChecked; TimeInput.IsReadOnly = !Menu_Settings_EnableFreeEditing.IsChecked; BranchInput.IsEnabled = Menu_Settings_EnableFreeEditing.IsChecked; + GerebeltGewogenInput.IsEnabled = App.Client.HasNetWeighing(ViewModel.Branch) || Menu_Settings_EnableFreeEditing.IsChecked; } private void DisableWeighingButtons() {