required fields reworked

This commit is contained in:
Meik
2025-11-13 15:59:31 +01:00
parent 7f14de43ce
commit 27425f5dde
2 changed files with 87 additions and 63 deletions

View File

@@ -59,16 +59,49 @@
</Style>
<ControlTemplate x:Key="ValidationErrorTemplate">
<Border BorderBrush="Red"
BorderThickness="1"
CornerRadius="7.5">
<TextBlock Text="{Binding ErrorContent}"
Foreground="White"
Padding="2" />
</Border>
</ControlTemplate>
</UserControl.Resources>
<ControlTemplate x:Key="ValidationErrorTemplate">
<Border BorderBrush="Red"
BorderThickness="1"
CornerRadius="7.5">
<TextBlock Text="{Binding ErrorContent}"
Foreground="White"
Padding="2" />
</Border>
</ControlTemplate>
<Style x:Key="MandatoryFieldLabelStyle"
TargetType="TextBlock">
<Setter Property="FontWeight"
Value="Bold" />
<Setter Property="Margin"
Value="0 10 0 0" />
<Setter Property="Foreground"
Value="{DynamicResource FontColor.Menu.Categories}" />
</Style>
<Style x:Key="MandatoryFieldBorderStyle"
TargetType="Border">
<Setter Property="Margin"
Value="0 5 0 0" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Padding"
Value="1" />
<Setter Property="CornerRadius"
Value="7.5" />
<Setter Property="Background"
Value="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}" />
<Setter Property="BorderBrush"
Value="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}" />
</Style>
<Style x:Key="MandatoryEditableTextBoxStyle"
TargetType="TextBox"
BasedOn="{StaticResource Customizable.Editable.TextBox.EditOnly}">
<Setter Property="AutomationProperties.IsRequiredForForm"
Value="True" />
</Style>
</UserControl.Resources>
<ScrollViewer Height="570"
Padding="0 0 5 0"
@@ -154,19 +187,12 @@
</Popup>
</StackPanel>
<StackPanel x:Name="MainStack">
<StackPanel x:Name="CategoryLabelPanel">
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Category}"
FontWeight="Bold"
Margin="0 10 0 0"
Foreground="{DynamicResource FontColor.Menu.Categories}" />
</StackPanel>
<StackPanel x:Name="CategoryLabelPanel">
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Category}"
Style="{StaticResource MandatoryFieldLabelStyle}" />
</StackPanel>
<Border x:Name="CategoryValidationBorder"
Margin="0 5 0 0"
BorderThickness="1"
Padding="1"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}">
Style="{StaticResource MandatoryFieldBorderStyle}">
<local:HierarchicalSelectionControl x:Name="CategorySelectionControl"
SelectedItem="{Binding SelectedCategory, ElementName=CloseCaseDialogUc, Mode=TwoWay}"
ComboBoxBackground="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
@@ -174,21 +200,16 @@
SearchPlaceholderText="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Searchbar.Placeholder}"
DropDownOpened="DropDownOpened"
DropDownClosed="DropDownClosed"
PreviewKeyDown="Combobox_PreviewKeyDown" />
PreviewKeyDown="Combobox_PreviewKeyDown"
AutomationProperties.IsRequiredForForm="True"
AutomationProperties.HelpText="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ValidationErrorCategoryEmpty}" />
</Border>
<StackPanel>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Template}"
FontWeight="Bold"
Margin="0 10 0 0"
Foreground="{DynamicResource FontColor.Menu.Categories}" />
Style="{StaticResource MandatoryFieldLabelStyle}" />
<Border x:Name="QuickTicketValidationBorder"
Margin="0 5 0 0"
BorderThickness="1"
Padding="1"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}">
Style="{StaticResource MandatoryFieldBorderStyle}">
<ComboBox x:Name="QuickTicketSelection"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
BorderBrush="Transparent"
@@ -197,7 +218,9 @@
SelectionChanged="QuickTicketSelection_SelectionChanged"
PreviewKeyDown="Combobox_PreviewKeyDown"
DropDownOpened="DropDownOpened"
DropDownClosed="DropDownClosed">
DropDownClosed="DropDownClosed"
AutomationProperties.IsRequiredForForm="True"
AutomationProperties.HelpText="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ValidationErrorQuickCallEmpty}">
</ComboBox>
</Border>
</StackPanel>
@@ -272,17 +295,16 @@
</StackPanel>
<StackPanel>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Summary}"
FontWeight="Bold"
Margin="0 10 0 0"
Foreground="{DynamicResource FontColor.Menu.Categories}" />
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Summary}"
Style="{StaticResource MandatoryFieldLabelStyle}" />
<TextBox x:Name="TicketSummaryTextBox"
Margin="0 5 0 10"
Style="{DynamicResource Customizable.Editable.TextBox.EditOnly}"
Padding="7.5 5"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
TextChanged="TicketSummaryTextBox_TextChanged" />
<TextBox x:Name="TicketSummaryTextBox"
Margin="0 5 0 10"
Style="{StaticResource MandatoryEditableTextBoxStyle}"
Padding="7.5 5"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
TextChanged="TicketSummaryTextBox_TextChanged"
AutomationProperties.HelpText="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ValidationErrorSummaryEmpty}" />
</StackPanel>
</StackPanel>
@@ -295,9 +317,9 @@
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.TitleColumn}">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Status}"
FontWeight="Bold"
Foreground="{DynamicResource FontColor.Menu.Categories}" />
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Status}"
Style="{StaticResource MandatoryFieldLabelStyle}"
Margin="0" />
<ico:AdaptableIcon x:Name="WarningTicketAction"
Visibility="{Binding ShowAssetWarningTicketAction, ElementName=CloseCaseDialogUc, Converter={StaticResource BooleanToVisibility}}"
ToolTip=""
@@ -308,12 +330,7 @@
VerticalAlignment="Bottom" />
</StackPanel>
<Border x:Name="TicketStatusValidationBorder"
Margin="0 5 0 0"
BorderThickness="1"
Padding="1"
CornerRadius="7.5"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
BorderBrush="{DynamicResource BackgroundColor.Menu.SubCategory.Hover}">
Style="{StaticResource MandatoryFieldBorderStyle}">
<ComboBox x:Name="TicketStatusCombobox"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
BorderBrush="Transparent"
@@ -322,7 +339,9 @@
DropDownClosed="DropDownClosed"
PreviewKeyDown="Combobox_PreviewKeyDown"
SelectionChanged="TicketStatusCombobox_SelectionChanged"
SelectedIndex="0">
SelectedIndex="0"
AutomationProperties.IsRequiredForForm="True"
AutomationProperties.HelpText="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ValidationErrorTicketActionEmpty}">
<ComboBoxItem Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Status.Select}" />
<ComboBoxItem Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Status.Close}"
Visibility="{Binding EnableCloseTicketAction, ElementName=CloseCaseDialogUc, Converter={StaticResource BooleanToVisibility}}"
@@ -414,16 +433,18 @@
BorderThickness="0.9"
Background="{DynamicResource BackgroundColor.DetailsPage.DataHistory.ValueColumn}"
MaxHeight="45">
<TextBlock x:Name="CaseNotesPreview"
MaxWidth="420"
MaxHeight="20"
Margin="-35 -5 -25 5"
Padding="5 3 0 0"
Foreground="{DynamicResource FontColor.Menu.Categories}"
FontSize="13"
Cursor="Pen"
MouseLeftButtonUp="EditCaseNotesButton_MouseLeftButtonUp"
TouchDown="EditCaseNotesButton_TouchDown"/>
<TextBlock x:Name="CaseNotesPreview"
MaxWidth="420"
MaxHeight="20"
Margin="-35 -5 -25 5"
Padding="5 3 0 0"
Foreground="{DynamicResource FontColor.Menu.Categories}"
FontSize="13"
Cursor="Pen"
AutomationProperties.IsRequiredForForm="{Binding AreCaseNotesMandatory, ElementName=CloseCaseDialogUc}"
AutomationProperties.HelpText="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.ValidationErrorCaseNoteEmpty}"
MouseLeftButtonUp="EditCaseNotesButton_MouseLeftButtonUp"
TouchDown="EditCaseNotesButton_TouchDown"/>
</Border>
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Dialog.CloseCase.Transfer.CopyTemplates}"

View File

@@ -87,6 +87,9 @@ namespace FasdDesktopUi.Basics.UserControls
private Brush defaultQuickTicketBorderBrush;
private readonly Brush validationErrorBrush = SharedValidationBorderBrush;
private Brush defaultTicketStatusBorderBrush;
public bool AreCaseNotesMandatory =>
cFasdCockpitConfig.Instance?.Global?.TicketConfiguration?.NotesMandatory ?? false;
public bool IsTicket
{