Add conditional service request row to ticket overview

This commit is contained in:
Meik
2026-07-17 18:48:48 +02:00
parent 0fef3ad49c
commit 62a5c97cbd
9 changed files with 338 additions and 5 deletions

View File

@@ -84,6 +84,8 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition x:Name="ServiceRequestsRow"
Height="0" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@@ -269,15 +271,87 @@
HorizontalAlignment="Center"
Cursor="Hand" />
<!-- Unassigned -->
<!-- Service Requests -->
<Label Grid.Row="4"
Grid.Column="0"
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.ServiceRequests}"
FontWeight="Bold"
FontSize="12" />
<Label Grid.Row="4"
Grid.Column="1"
Content="{Binding ServiceRequestsNew}"
Style="{StaticResource RoundedSelectedLabelStyle}"
local:TicketOverview.IsSelected="{Binding ServiceRequestsNewSelected, Mode=TwoWay}"
local:TicketOverview.IsHighlighted="{Binding ServiceRequestsNewHighlighted}"
ToolTip="{Binding ServiceRequestsNewChangeHint}"
Tag="ServiceRequestsNewSelected"
MouseLeftButtonUp="Label_MouseLeftButtonUp"
FontWeight="Medium"
Foreground="{DynamicResource Color.Green}"
FontSize="12"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Cursor="Hand" />
<Label Grid.Row="4"
Grid.Column="2"
Content="{Binding ServiceRequestsActive}"
Style="{StaticResource RoundedSelectedLabelStyle}"
local:TicketOverview.IsSelected="{Binding ServiceRequestsActiveSelected, Mode=TwoWay}"
local:TicketOverview.IsHighlighted="{Binding ServiceRequestsActiveHighlighted}"
ToolTip="{Binding ServiceRequestsActiveChangeHint}"
Tag="ServiceRequestsActiveSelected"
MouseLeftButtonUp="Label_MouseLeftButtonUp"
FontWeight="Medium"
Foreground="{DynamicResource Color.Green}"
FontSize="12"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Cursor="Hand" />
<Label Grid.Row="4"
Grid.Column="3"
Content="{Binding ServiceRequestsCritical}"
Style="{StaticResource RoundedSelectedLabelStyle}"
local:TicketOverview.IsSelected="{Binding ServiceRequestsCriticalSelected, Mode=TwoWay}"
local:TicketOverview.IsHighlighted="{Binding ServiceRequestsCriticalHighlighted}"
ToolTip="{Binding ServiceRequestsCriticalChangeHint}"
Tag="ServiceRequestsCriticalSelected"
MouseLeftButtonUp="Label_MouseLeftButtonUp"
FontWeight="Medium"
Foreground="{DynamicResource Color.Red}"
FontSize="12"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Cursor="Hand" />
<Label Grid.Row="4"
Grid.Column="4"
Content="{Binding ServiceRequestsNewInfo}"
Style="{StaticResource RoundedSelectedLabelStyle}"
local:TicketOverview.IsSelected="{Binding ServiceRequestsNewInfoSelected, Mode=TwoWay}"
local:TicketOverview.IsHighlighted="{Binding ServiceRequestsNewInfoHighlighted}"
ToolTip="{Binding ServiceRequestsNewInfoChangeHint}"
Tag="ServiceRequestsNewInfoSelected"
MouseLeftButtonUp="Label_MouseLeftButtonUp"
FontWeight="Medium"
Foreground="{DynamicResource Color.Orange}"
FontSize="12"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Cursor="Hand" />
<!-- Unassigned -->
<Label Grid.Row="5"
Grid.Column="0"
Foreground="{DynamicResource FontColor.DetailsPage.TitleSection.Header}"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Row.Heading.UnassignedTickets}"
FontWeight="Bold"
FontSize="12" />
<Label Grid.Row="4"
<Label Grid.Row="5"
Grid.Column="1"
Content="{Binding UnassignedTickets}"
Style="{StaticResource RoundedSelectedLabelStyle}"
@@ -293,7 +367,7 @@
HorizontalAlignment="Center"
Cursor="Hand" />
<Label Grid.Row="4"
<Label Grid.Row="5"
Grid.Column="3"
Content="{Binding UnassignedTicketsCritical}"
Style="{StaticResource RoundedSelectedLabelStyle}"

View File

@@ -31,6 +31,10 @@ namespace FasdDesktopUi.Basics.UserControls
("IncidentActive", new Action<TicketOverviewModel, int>((vm, value) => { vm.IncidentActive = value; })),
("IncidentCritical", new Action<TicketOverviewModel, int>((vm, value) => { vm.IncidentCritical = value; })),
("IncidentNewInfo", new Action<TicketOverviewModel, int>((vm, value) => { vm.IncidentNewInfo = value; })),
("ServiceRequestsNew", new Action<TicketOverviewModel, int>((vm, value) => { vm.ServiceRequestsNew = value; })),
("ServiceRequestsActive", new Action<TicketOverviewModel, int>((vm, value) => { vm.ServiceRequestsActive = value; })),
("ServiceRequestsCritical", new Action<TicketOverviewModel, int>((vm, value) => { vm.ServiceRequestsCritical = value; })),
("ServiceRequestsNewInfo", new Action<TicketOverviewModel, int>((vm, value) => { vm.ServiceRequestsNewInfo = value; })),
("UnassignedTickets", new Action<TicketOverviewModel, int>((vm, value) => { vm.UnassignedTickets = value; })),
("UnassignedTicketsCritical", new Action<TicketOverviewModel, int>((vm, value) => { vm.UnassignedTicketsCritical = value; }))
};
@@ -44,6 +48,10 @@ namespace FasdDesktopUi.Basics.UserControls
("IncidentActive", new Action<TicketOverviewModel, bool>((vm, value) => { vm.IncidentActiveHighlighted = value; })),
("IncidentCritical", new Action<TicketOverviewModel, bool>((vm, value) => { vm.IncidentCriticalHighlighted = value; })),
("IncidentNewInfo", new Action<TicketOverviewModel, bool>((vm, value) => { vm.IncidentNewInfoHighlighted = value; })),
("ServiceRequestsNew", new Action<TicketOverviewModel, bool>((vm, value) => { vm.ServiceRequestsNewHighlighted = value; })),
("ServiceRequestsActive", new Action<TicketOverviewModel, bool>((vm, value) => { vm.ServiceRequestsActiveHighlighted = value; })),
("ServiceRequestsCritical", new Action<TicketOverviewModel, bool>((vm, value) => { vm.ServiceRequestsCriticalHighlighted = value; })),
("ServiceRequestsNewInfo", new Action<TicketOverviewModel, bool>((vm, value) => { vm.ServiceRequestsNewInfoHighlighted = value; })),
("UnassignedTickets", new Action<TicketOverviewModel, bool>((vm, value) => { vm.UnassignedTicketsHighlighted = value; })),
("UnassignedTicketsCritical", new Action<TicketOverviewModel, bool>((vm, value) => { vm.UnassignedTicketsCriticalHighlighted = value; }))
};
@@ -57,6 +65,10 @@ namespace FasdDesktopUi.Basics.UserControls
("IncidentActive", new Action<TicketOverviewModel, string>((vm, value) => { vm.IncidentActiveChangeHint = value; })),
("IncidentCritical", new Action<TicketOverviewModel, string>((vm, value) => { vm.IncidentCriticalChangeHint = value; })),
("IncidentNewInfo", new Action<TicketOverviewModel, string>((vm, value) => { vm.IncidentNewInfoChangeHint = value; })),
("ServiceRequestsNew", new Action<TicketOverviewModel, string>((vm, value) => { vm.ServiceRequestsNewChangeHint = value; })),
("ServiceRequestsActive", new Action<TicketOverviewModel, string>((vm, value) => { vm.ServiceRequestsActiveChangeHint = value; })),
("ServiceRequestsCritical", new Action<TicketOverviewModel, string>((vm, value) => { vm.ServiceRequestsCriticalChangeHint = value; })),
("ServiceRequestsNewInfo", new Action<TicketOverviewModel, string>((vm, value) => { vm.ServiceRequestsNewInfoChangeHint = value; })),
("UnassignedTickets", new Action<TicketOverviewModel, string>((vm, value) => { vm.UnassignedTicketsChangeHint = value; })),
("UnassignedTicketsCritical", new Action<TicketOverviewModel, string>((vm, value) => { vm.UnassignedTicketsCriticalChangeHint = value; }))
};
@@ -225,6 +237,14 @@ namespace FasdDesktopUi.Basics.UserControls
if (DataContext is TicketOverviewModel vm)
vm.ResetSelection();
}
public void SetServiceRequestsVisibility(bool isVisible)
{
Dispatcher.Invoke(() =>
{
ServiceRequestsRow.Height = isVisible ? GridLength.Auto : new GridLength(0);
});
}
/// <summary>
/// Prüft welche Daten für die Ansicht geladen werden sollen
/// Wenn UseRoledTickets = true dann Rolebased Tickets und Incidents laden
@@ -268,6 +288,8 @@ namespace FasdDesktopUi.Basics.UserControls
if (counts == null || counts.Count == 0)
counts = await LoadCountsFallbackAsync(useRoleTickets).ConfigureAwait(false);
SetServiceRequestsVisibility(TicketOverviewUpdateService.Instance?.ServiceRequestsEnabled == true);
await Dispatcher.InvokeAsync(() =>
{
foreach (var (key, setter) in CategorySetters)