|
@@ -704,7 +704,7 @@ namespace PRSDesktop
|
|
|
|
|
|
private void SaveToFolder_Click()
|
|
|
{
|
|
|
- if(Form is null || FormType is null)
|
|
|
+ if (Form is null || FormType is null)
|
|
|
{
|
|
|
MessageWindow.ShowMessage("Please select a form first.", "Select form");
|
|
|
return;
|
|
@@ -715,23 +715,21 @@ namespace PRSDesktop
|
|
|
|
|
|
var method = typeof(DigitalFormsDashboard).GetMethod("SaveToFolder", BindingFlags.Instance | BindingFlags.NonPublic)!.MakeGenericMethod(FormType);
|
|
|
|
|
|
- var menu = new ContextMenu();
|
|
|
- if(reports.Count == 1)
|
|
|
+ if (reports.Count == 0)
|
|
|
{
|
|
|
- method.Invoke(this, new object[] { reports[0] });
|
|
|
+ MessageWindow.ShowMessage("No reports are currently defined for this Digital Form!", "No report found");
|
|
|
return;
|
|
|
}
|
|
|
- else if(reports.Count > 1)
|
|
|
- {
|
|
|
- foreach (var report in reports)
|
|
|
- {
|
|
|
- menu.AddItem(report.Name, null, report, r => method.Invoke(this, new[] { r }));
|
|
|
- }
|
|
|
- }
|
|
|
- if(menu.Items.Count == 0)
|
|
|
+
|
|
|
+ if(reports.Count == 1)
|
|
|
{
|
|
|
- menu.AddItem("No reports", null, null, enabled: false);
|
|
|
+ method.Invoke(this, new object[] { reports[0] });
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
+ var menu = new ContextMenu();
|
|
|
+ foreach (var report in reports)
|
|
|
+ menu.AddItem(report.Name, null, report, r => method.Invoke(this, new[] { r }));
|
|
|
menu.IsOpen = true;
|
|
|
}
|
|
|
|
|
@@ -1114,10 +1112,12 @@ namespace PRSDesktop
|
|
|
|
|
|
var columns = new Columns<T>(x => x.ID)
|
|
|
.Add(x => x.Number)
|
|
|
+ .Add(x => x.Description)
|
|
|
.Add(x => x.CreatedBy)
|
|
|
.Add(x => x.Created)
|
|
|
.Add(x => x.Form.ID)
|
|
|
.Add(x => x.FormData)
|
|
|
+ .Add(x => x.FormStarted)
|
|
|
.Add(x => x.FormCompleted)
|
|
|
.Add(x => x.FormCompletedBy.UserID)
|
|
|
.Add(x => x.Location.Timestamp)
|
|
@@ -1157,12 +1157,8 @@ namespace PRSDesktop
|
|
|
data.Columns.Add("Location_Longitude", typeof(double));
|
|
|
data.Columns.Add("FormData", typeof(string));
|
|
|
data.Columns.Add("Number", typeof(string));
|
|
|
-
|
|
|
- if (IsEntityForm)
|
|
|
- {
|
|
|
- data.Columns.Add("Description", typeof(string));
|
|
|
- }
|
|
|
-
|
|
|
+ data.Columns.Add("Description", typeof(string));
|
|
|
+
|
|
|
if (ParentType == typeof(JobITP))
|
|
|
{
|
|
|
data.Columns.Add("Job No", typeof(string));
|
|
@@ -1236,10 +1232,8 @@ namespace PRSDesktop
|
|
|
dataRow["Location_Longitude"] = form.Location.Longitude;
|
|
|
dataRow["FormData"] = form.FormData;
|
|
|
dataRow["Number"] = form.Number;
|
|
|
- if (IsEntityForm && form is IEntityForm eForm)
|
|
|
- {
|
|
|
- dataRow["Description"] = eForm.Description;
|
|
|
- }
|
|
|
+ dataRow["Description"] = form.Description;
|
|
|
+
|
|
|
|
|
|
var desc = new List<string>();
|
|
|
foreach (var col in additionalColumns)
|
|
@@ -1251,7 +1245,9 @@ namespace PRSDesktop
|
|
|
|
|
|
dataRow["Parent_Description"] = string.Join(" : ", desc);
|
|
|
|
|
|
- dataRow["Created"] = (form as Entity)!.Created;
|
|
|
+ dataRow["Created"] = (form as Entity)!.Created.IsEmpty()
|
|
|
+ ? form.FormStarted
|
|
|
+ : (form as Entity)!.Created;
|
|
|
dataRow["Created By"] = (form as Entity)!.CreatedBy;
|
|
|
dataRow["Completed"] = form.FormCompleted;
|
|
|
dataRow["Completed By"] = form.FormCompletedBy.UserID;
|
|
@@ -1405,7 +1401,7 @@ namespace PRSDesktop
|
|
|
}
|
|
|
else if (value.Path.Path.Equals("Description"))
|
|
|
{
|
|
|
- e.Column.Width = 100;
|
|
|
+ e.Column.Width = 250;
|
|
|
e.Column.HeaderStyle = Application.Current.Resources["TemplateHeaderStyle"] as Style;
|
|
|
e.Column.TextAlignment = TextAlignment.Left;
|
|
|
e.Column.HorizontalHeaderContentAlignment = HorizontalAlignment.Left;
|
|
@@ -1439,7 +1435,7 @@ namespace PRSDesktop
|
|
|
e.Column.HeaderText = Categories.FirstOrDefault(x => x.Item2 == FormType)?.Item3 ?? "Parent";
|
|
|
e.Column.TextAlignment = TextAlignment.Left;
|
|
|
e.Column.HorizontalHeaderContentAlignment = HorizontalAlignment.Left;
|
|
|
- e.Column.Width = 450;
|
|
|
+ e.Column.Width = 250;
|
|
|
e.Column.HeaderStyle = Application.Current.Resources["TemplateHeaderStyle"] as Style;
|
|
|
}
|
|
|
else if (value.Path.Path.Equals("Completed"))
|