|
|
@@ -90,6 +90,8 @@ namespace PRSDesktop
|
|
|
public bool ShowJobFilter { get; set; } = false;
|
|
|
public bool ShowDateFilter { get; set; } = true;
|
|
|
|
|
|
+ public bool ShowIncompleteForms { get; set; } = false;
|
|
|
+
|
|
|
public bool UseIconsForFormTypes { get; set; } = false;
|
|
|
|
|
|
public string? Category { get; set; }
|
|
|
@@ -136,6 +138,8 @@ namespace PRSDesktop
|
|
|
public DigitalFormsDashboard()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
+
|
|
|
+ DataGrid.RowStyleSelector = new RowStyleSelector();
|
|
|
}
|
|
|
|
|
|
public void Setup()
|
|
|
@@ -183,6 +187,7 @@ namespace PRSDesktop
|
|
|
private ComboBox CategoryBox;
|
|
|
private ComboBox FormBox;
|
|
|
private ComboBox JobBox;
|
|
|
+ private ComboBox IncompleteFormsBox;
|
|
|
|
|
|
private ComboBox DateTypeBox;
|
|
|
|
|
|
@@ -340,6 +345,22 @@ namespace PRSDesktop
|
|
|
};
|
|
|
ToPicker.SelectedDateChanged += ToPicker_SelectedDateChanged;
|
|
|
|
|
|
+ IncompleteFormsBox = new ComboBox
|
|
|
+ {
|
|
|
+ Width = 130,
|
|
|
+ Margin = new Thickness(0, 0, 5, 0),
|
|
|
+ VerticalContentAlignment = VerticalAlignment.Center
|
|
|
+ };
|
|
|
+ IncompleteFormsBox.ItemsSource = new List<Tuple<string, bool>>
|
|
|
+ {
|
|
|
+ new Tuple<string, bool>("Completed Forms", false),
|
|
|
+ new Tuple<string, bool>("All Forms", true)
|
|
|
+ };
|
|
|
+ IncompleteFormsBox.DisplayMemberPath = "Item1";
|
|
|
+ IncompleteFormsBox.SelectedValuePath = "Item2";
|
|
|
+ IncompleteFormsBox.SelectedValue = Properties.ShowIncompleteForms;
|
|
|
+ IncompleteFormsBox.SelectionChanged += IncompleteFormsBox_SelectionChanged;
|
|
|
+
|
|
|
Print = new Button
|
|
|
{
|
|
|
Width = 25,
|
|
|
@@ -368,6 +389,7 @@ namespace PRSDesktop
|
|
|
.Add(FromPicker)
|
|
|
.Add(ToLabel)
|
|
|
.Add(ToPicker)
|
|
|
+ .Add(IncompleteFormsBox)
|
|
|
.AddRight(FilterBtn)
|
|
|
.AddRight(Print)
|
|
|
.EndUpdate();
|
|
|
@@ -375,6 +397,12 @@ namespace PRSDesktop
|
|
|
UpdateCategory(Properties.Category);
|
|
|
}
|
|
|
|
|
|
+ private void IncompleteFormsBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
+ {
|
|
|
+ Properties.ShowIncompleteForms = (bool)IncompleteFormsBox.SelectedValue;
|
|
|
+ Refresh();
|
|
|
+ }
|
|
|
+
|
|
|
private void Filter_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
var menu = new ContextMenu();
|
|
|
@@ -1096,10 +1124,16 @@ namespace PRSDesktop
|
|
|
|
|
|
var jobLink = GetJobLink<T>();
|
|
|
|
|
|
- var filter = new Filter<T>(x => x.FormCompleted).IsGreaterThanOrEqualTo(From)
|
|
|
- .And(x => x.FormCompleted).IsLessThan(To.AddDays(1))
|
|
|
- .And(x => x.Form.ID).IsEqualTo(Form!.ID)
|
|
|
- .And(x => x.FormCancelled).IsEqualTo(DateTime.MinValue);
|
|
|
+ var completedFilter = new Filter<T>(x => x.FormCompleted).IsGreaterThanOrEqualTo(From)
|
|
|
+ .And(x => x.FormCompleted).IsLessThan(To.AddDays(1));
|
|
|
+ if (Properties.ShowIncompleteForms)
|
|
|
+ {
|
|
|
+ completedFilter.Or(x => x.FormCompleted).IsEqualTo(FilterConstant.NoDateProvided);
|
|
|
+ }
|
|
|
+
|
|
|
+ var filter = new Filter<T>(x => x.Form.ID).IsEqualTo(Form!.ID)
|
|
|
+ .And(x => x.FormCancelled).IsEqualTo(DateTime.MinValue)
|
|
|
+ .And(completedFilter);
|
|
|
|
|
|
if (Properties.JobID != Guid.Empty && Properties.ShowJobFilter)
|
|
|
{
|
|
|
@@ -1379,6 +1413,32 @@ namespace PRSDesktop
|
|
|
|
|
|
#region DataGrid Configuration
|
|
|
|
|
|
+ private class RowStyleSelector : StyleSelector
|
|
|
+ {
|
|
|
+ private Style NormalStyle;
|
|
|
+
|
|
|
+ private Style IncompleteStyle;
|
|
|
+
|
|
|
+ public RowStyleSelector()
|
|
|
+ {
|
|
|
+ NormalStyle = new Style();
|
|
|
+ NormalStyle.Setters.Add(new Setter(VirtualizingCellsControl.BackgroundProperty, new SolidColorBrush(Colors.White)));
|
|
|
+
|
|
|
+ IncompleteStyle = new Style();
|
|
|
+ IncompleteStyle.Setters.Add(new Setter(VirtualizingCellsControl.BackgroundProperty, new SolidColorBrush(Colors.LightSalmon)));
|
|
|
+ }
|
|
|
+
|
|
|
+ public override Style SelectStyle(object item, DependencyObject container)
|
|
|
+ {
|
|
|
+ var row = (item as DataRowBase)?.RowData as DataRowView;
|
|
|
+ if (row is null) return NormalStyle;
|
|
|
+
|
|
|
+ return (DateTime)row["Completed"] == DateTime.MinValue
|
|
|
+ ? IncompleteStyle
|
|
|
+ : NormalStyle;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void DataGrid_AutoGeneratingColumn(object sender, Syncfusion.UI.Xaml.Grid.AutoGeneratingColumnArgs e)
|
|
|
{
|
|
|
e.Column.TextAlignment = TextAlignment.Center;
|
|
|
@@ -1442,8 +1502,10 @@ namespace PRSDesktop
|
|
|
{
|
|
|
e.Column.Width = 100;
|
|
|
e.Column.HeaderStyle = Application.Current.Resources["TemplateHeaderStyle"] as Style;
|
|
|
- (e.Column as GridDateTimeColumn)!.Pattern = DateTimePattern.CustomPattern;
|
|
|
- (e.Column as GridDateTimeColumn)!.CustomPattern = "dd MMM yy hh:mm";
|
|
|
+ (e.Column as GridDateTimeColumn)!.DisplayBinding = new Binding {
|
|
|
+ Path = new PropertyPath(value.Path.Path),
|
|
|
+ Converter = new DateTimeToStringConverter("dd MMM yy hh:mm")
|
|
|
+ };
|
|
|
}
|
|
|
else if (value.Path.Path.Equals("Completed By"))
|
|
|
{
|
|
|
@@ -1464,8 +1526,10 @@ namespace PRSDesktop
|
|
|
{
|
|
|
e.Column.Width = 100;
|
|
|
e.Column.HeaderStyle = Application.Current.Resources["TemplateHeaderStyle"] as Style;
|
|
|
- (e.Column as GridDateTimeColumn).Pattern = DateTimePattern.CustomPattern;
|
|
|
- (e.Column as GridDateTimeColumn).CustomPattern = "dd MMM yy hh:mm";
|
|
|
+ (e.Column as GridDateTimeColumn)!.DisplayBinding = new Binding {
|
|
|
+ Path = new PropertyPath(value.Path.Path),
|
|
|
+ Converter = new DateTimeToStringConverter("dd MMM yy hh:mm")
|
|
|
+ };
|
|
|
}
|
|
|
else
|
|
|
{
|