DeliveryAdminWindow: Force user to input gerebelt gewogen input
All checks were successful
Test / Run tests (push) Successful in 2m2s
All checks were successful
Test / Run tests (push) Successful in 2m2s
This commit is contained in:
@ -116,7 +116,11 @@ namespace Elwig.ViewModels {
|
|||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool _isManualWeighing;
|
private bool _isManualWeighing;
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool _isNetWeight;
|
private bool? _isNetWeightValue = false;
|
||||||
|
public bool IsNetWeight {
|
||||||
|
get => IsNetWeightValue ?? false;
|
||||||
|
set => IsNetWeightValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private WineOrigin? _wineOrigin;
|
private WineOrigin? _wineOrigin;
|
||||||
|
@ -109,7 +109,7 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
private void OnClosing(object? sender, CancelEventArgs evt) {
|
private void OnClosing(object? sender, CancelEventArgs evt) {
|
||||||
if ((IsCreating || IsEditing) && HasChanged) {
|
if ((IsCreating || IsEditing) && HasChanged) {
|
||||||
var r = System.Windows.MessageBox.Show("Soll das Fenster wirklich geschlossen werden?", "Schließen bestätigen",
|
var r = MessageBox.Show("Soll das Fenster wirklich geschlossen werden?", "Schließen bestätigen",
|
||||||
MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
|
MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
|
||||||
if (r != MessageBoxResult.Yes) {
|
if (r != MessageBoxResult.Yes) {
|
||||||
evt.Cancel = true;
|
evt.Cancel = true;
|
||||||
@ -166,7 +166,7 @@ namespace Elwig.Windows {
|
|||||||
ControlUtils.SetInputInvalid(input);
|
ControlUtils.SetInputInvalid(input);
|
||||||
} else if (input is ListBox lb && lb.SelectedItem == null && lb.ItemsSource != null && lb.ItemsSource.Cast<object>().Any()) {
|
} else if (input is ListBox lb && lb.SelectedItem == null && lb.ItemsSource != null && lb.ItemsSource.Cast<object>().Any()) {
|
||||||
ControlUtils.SetInputInvalid(input);
|
ControlUtils.SetInputInvalid(input);
|
||||||
} else if (input is CheckBox ckb && ckb.IsChecked != true) {
|
} else if (input is CheckBox ckb && ((ckb.IsThreeState && ckb.IsChecked == null) || (!ckb.IsThreeState && ckb.IsChecked != true))) {
|
||||||
ControlUtils.SetInputInvalid(input);
|
ControlUtils.SetInputInvalid(input);
|
||||||
Valid[input] = false;
|
Valid[input] = false;
|
||||||
} else if (input is RadioButton rb && rb.IsChecked != true) {
|
} else if (input is RadioButton rb && rb.IsChecked != true) {
|
||||||
@ -402,20 +402,24 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
protected bool InputLostFocus(TextBox input, ValidationResult res, string? msg = null) {
|
protected bool InputLostFocus(TextBox input, ValidationResult res, string? msg = null) {
|
||||||
if (DoShowWarningWindows && !res.IsValid && !IsClosing && (IsEditing || IsCreating))
|
if (DoShowWarningWindows && !res.IsValid && !IsClosing && (IsEditing || IsCreating))
|
||||||
System.Windows.MessageBox.Show(res.ErrorContent.ToString(), msg ?? res.ErrorContent.ToString(), MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show(res.ErrorContent.ToString(), msg ?? res.ErrorContent.ToString(), MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
return res.IsValid;
|
return res.IsValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void CheckBox_Changed(object sender, RoutedEventArgs evt) {
|
protected void CheckBox_Changed(object sender, RoutedEventArgs evt) {
|
||||||
var input = (CheckBox)sender;
|
var input = (CheckBox)sender;
|
||||||
if (SenderIsRequired(input) && input.IsChecked != true) {
|
if (SenderIsRequired(input) && ((input.IsThreeState && input.IsChecked == null) || (!input.IsThreeState && input.IsChecked != true))) {
|
||||||
|
ValidateInput(input, false);
|
||||||
ControlUtils.SetInputInvalid(input);
|
ControlUtils.SetInputInvalid(input);
|
||||||
} else if (InputHasChanged(input)) {
|
|
||||||
ControlUtils.SetInputChanged(input);
|
|
||||||
} else if (InputIsNotDefault(input)) {
|
|
||||||
ControlUtils.SetInputNotDefault(input);
|
|
||||||
} else {
|
} else {
|
||||||
ControlUtils.ClearInputState(input);
|
ValidateInput(input, true);
|
||||||
|
if (InputHasChanged(input)) {
|
||||||
|
ControlUtils.SetInputChanged(input);
|
||||||
|
} else if (InputIsNotDefault(input)) {
|
||||||
|
ControlUtils.SetInputNotDefault(input);
|
||||||
|
} else {
|
||||||
|
ControlUtils.ClearInputState(input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
UpdateButtons();
|
UpdateButtons();
|
||||||
}
|
}
|
||||||
@ -423,13 +427,17 @@ namespace Elwig.Windows {
|
|||||||
protected void RadioButton_Changed(object sender, RoutedEventArgs evt) {
|
protected void RadioButton_Changed(object sender, RoutedEventArgs evt) {
|
||||||
var input = (RadioButton)sender;
|
var input = (RadioButton)sender;
|
||||||
if (SenderIsRequired(input) && input.IsChecked != true) {
|
if (SenderIsRequired(input) && input.IsChecked != true) {
|
||||||
|
ValidateInput(input, false);
|
||||||
ControlUtils.SetInputInvalid(input);
|
ControlUtils.SetInputInvalid(input);
|
||||||
} else if (InputHasChanged(input)) {
|
|
||||||
ControlUtils.SetInputChanged(input);
|
|
||||||
} else if (InputIsNotDefault(input)) {
|
|
||||||
ControlUtils.SetInputNotDefault(input);
|
|
||||||
} else {
|
} else {
|
||||||
ControlUtils.ClearInputState(input);
|
ValidateInput(input, true);
|
||||||
|
if (InputHasChanged(input)) {
|
||||||
|
ControlUtils.SetInputChanged(input);
|
||||||
|
} else if (InputIsNotDefault(input)) {
|
||||||
|
ControlUtils.SetInputNotDefault(input);
|
||||||
|
} else {
|
||||||
|
ControlUtils.ClearInputState(input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
UpdateButtons();
|
UpdateButtons();
|
||||||
}
|
}
|
||||||
|
@ -468,10 +468,10 @@
|
|||||||
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,45,10,10" Grid.Column="0" Grid.ColumnSpan="2"
|
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,45,10,10" Grid.Column="0" Grid.ColumnSpan="2"
|
||||||
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
|
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
|
||||||
|
|
||||||
<CheckBox x:Name="GerebeltGewogenInput" IsChecked="{Binding IsNetWeight, Mode=TwoWay}"
|
<CheckBox x:Name="GerebeltGewogenInput" IsChecked="{Binding IsNetWeightValue, Mode=TwoWay}"
|
||||||
Content="Gerebelt gewogen"
|
Content="Gerebelt gewogen" IsThreeState="True"
|
||||||
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,75,10,10" Grid.Column="0" Grid.ColumnSpan="2"
|
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,75,10,10" Grid.Column="0" Grid.ColumnSpan="2"
|
||||||
Checked="GerebeltGewogenInput_Changed" Unchecked="GerebeltGewogenInput_Changed"/>
|
Checked="GerebeltGewogenInput_Changed" Unchecked="GerebeltGewogenInput_Changed" Indeterminate="GerebeltGewogenInput_Changed"/>
|
||||||
|
|
||||||
<Button x:Name="WeighingAButton" Content="Wiegen A" Width="120"
|
<Button x:Name="WeighingAButton" Content="Wiegen A" Width="120"
|
||||||
Click="WeighingButton_Click"
|
Click="WeighingButton_Click"
|
||||||
|
@ -50,7 +50,7 @@ namespace Elwig.Windows {
|
|||||||
SortIdInput, WineVarietyInput,
|
SortIdInput, WineVarietyInput,
|
||||||
GradationOeInput, GradationKmwInput, WineQualityLevelInput,
|
GradationOeInput, GradationKmwInput, WineQualityLevelInput,
|
||||||
WineOriginInput, WineKgInput,
|
WineOriginInput, WineKgInput,
|
||||||
WeightInput
|
WeightInput, GerebeltGewogenInput,
|
||||||
];
|
];
|
||||||
ExemptInputs = [
|
ExemptInputs = [
|
||||||
SearchInput, SeasonInput, TodayOnlyInput, AllSeasonsInput,
|
SearchInput, SeasonInput, TodayOnlyInput, AllSeasonsInput,
|
||||||
@ -257,6 +257,7 @@ namespace Elwig.Windows {
|
|||||||
SetDefaultValue(GerebeltGewogenInput, true);
|
SetDefaultValue(GerebeltGewogenInput, true);
|
||||||
} else {
|
} else {
|
||||||
GerebeltGewogenInput.IsEnabled = true;
|
GerebeltGewogenInput.IsEnabled = true;
|
||||||
|
GerebeltGewogenInput.IsChecked = null;
|
||||||
UnsetDefaultValue(GerebeltGewogenInput);
|
UnsetDefaultValue(GerebeltGewogenInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1380,6 +1381,9 @@ namespace Elwig.Windows {
|
|||||||
if (!App.Client.HasNetWeighing(ViewModel.Branch)) {
|
if (!App.Client.HasNetWeighing(ViewModel.Branch)) {
|
||||||
HandPickedInput.IsChecked = !GerebeltGewogenInput.IsChecked;
|
HandPickedInput.IsChecked = !GerebeltGewogenInput.IsChecked;
|
||||||
}
|
}
|
||||||
|
if (!ViewModel.IsReceipt || App.Client.HasNetWeighing(ViewModel.Branch)) {
|
||||||
|
GerebeltGewogenInput.IsChecked ??= false;
|
||||||
|
}
|
||||||
CheckBox_Changed(sender, evt);
|
CheckBox_Changed(sender, evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@ namespace Tests.E2ETests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void FinishDeliveryNote(WindowsDriver<WindowsElement> window) {
|
private void FinishDeliveryNote(WindowsDriver<WindowsElement> window) {
|
||||||
|
var gerebeltGewogen = window.FindElement(By.WpfId("GerebeltGewogenInput"));
|
||||||
|
gerebeltGewogen.Click();
|
||||||
|
gerebeltGewogen.Click();
|
||||||
|
Thread.Sleep(500);
|
||||||
window.FindElement(By.Name("Abschließen")).Click();
|
window.FindElement(By.Name("Abschließen")).Click();
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
var doc = Session.CreateWindowDriver("DocumentViewerWindow");
|
var doc = Session.CreateWindowDriver("DocumentViewerWindow");
|
||||||
@ -53,7 +57,6 @@ namespace Tests.E2ETests {
|
|||||||
public void Test_1_Minimal() {
|
public void Test_1_Minimal() {
|
||||||
var window = OpenReceiptWindow();
|
var window = OpenReceiptWindow();
|
||||||
window.FindElement(By.WpfId("MgNrInput")).SendKeys("101" + Keys.Enter + "GV" + Keys.Enter + "73" + Keys.Enter + Keys.Enter);
|
window.FindElement(By.WpfId("MgNrInput")).SendKeys("101" + Keys.Enter + "GV" + Keys.Enter + "73" + Keys.Enter + Keys.Enter);
|
||||||
Thread.Sleep(500);
|
|
||||||
FinishDeliveryNote(window);
|
FinishDeliveryNote(window);
|
||||||
window.Close();
|
window.Close();
|
||||||
}
|
}
|
||||||
@ -65,7 +68,6 @@ namespace Tests.E2ETests {
|
|||||||
window.FindElement(By.WpfId("WineVarietyInput")).SelectItem("Zweigelt");
|
window.FindElement(By.WpfId("WineVarietyInput")).SelectItem("Zweigelt");
|
||||||
window.FindElement(By.WpfId("GradationKmwInput")).SendKeys("18");
|
window.FindElement(By.WpfId("GradationKmwInput")).SendKeys("18");
|
||||||
window.FindElement(By.Name("Wiegen")).Click();
|
window.FindElement(By.Name("Wiegen")).Click();
|
||||||
Thread.Sleep(500);
|
|
||||||
FinishDeliveryNote(window);
|
FinishDeliveryNote(window);
|
||||||
window.Close();
|
window.Close();
|
||||||
}
|
}
|
||||||
@ -76,8 +78,6 @@ namespace Tests.E2ETests {
|
|||||||
window.FindElement(By.WpfId("MgNrInput")).SendKeys("102" + Keys.Enter + "GVK");
|
window.FindElement(By.WpfId("MgNrInput")).SendKeys("102" + Keys.Enter + "GVK");
|
||||||
window.FindElement(By.WpfId("CultivationInput")).SelectItem("Bio");
|
window.FindElement(By.WpfId("CultivationInput")).SelectItem("Bio");
|
||||||
window.FindElement(By.WpfId("GradationOeInput")).SendKeys("73" + Keys.Enter + Keys.Enter);
|
window.FindElement(By.WpfId("GradationOeInput")).SendKeys("73" + Keys.Enter + Keys.Enter);
|
||||||
|
|
||||||
Thread.Sleep(500);
|
|
||||||
FinishDeliveryNote(window);
|
FinishDeliveryNote(window);
|
||||||
window.Close();
|
window.Close();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user