|
|
@@ -379,6 +379,10 @@ public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
column.AddItem("Import Components", PRSDesktop.Resources.doc_xls, ImportComponents);
|
|
|
column.AddSeparator();
|
|
|
Guid designID = row.Get<StagingSetout, Guid>(x => x.ID);
|
|
|
+ if(PanelSettings.DefaultForm.ID != Guid.Empty)
|
|
|
+ {
|
|
|
+ column.AddItem("Request Site Measure", null, RequestSiteMeasure);
|
|
|
+ }
|
|
|
var formsItem = column.AddItem("Digital Forms", PRSDesktop.Resources.quality, null);
|
|
|
DynamicGridUtils.PopulateFormMenu<StagingSetoutForm, StagingSetout, StagingSetoutLink>(
|
|
|
formsItem,
|
|
|
@@ -387,7 +391,42 @@ public class StagingSetoutGrid : DynamicDataGrid<StagingSetout>
|
|
|
Filter<StagingSetout>.Where(x => x.ID).IsEqualTo(designID),
|
|
|
Columns.Required<StagingSetout>()).ToObjects<StagingSetout>()
|
|
|
.FirstOrDefault() ?? new StagingSetout(),
|
|
|
- customiseNewForm: CustomiseNewForm);
|
|
|
+ customiseNewForm: CustomiseNewForm,
|
|
|
+ nonModalHost: ISubPanelHost.Global);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void RequestSiteMeasure(CoreRow? row)
|
|
|
+ {
|
|
|
+ if (row is null || PanelSettings.DefaultForm.ID == Guid.Empty) return;
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var entity = row.ToObject<StagingSetout>();
|
|
|
+ var digitalForm = Client.Query(
|
|
|
+ Filter<DigitalForm>.Where(x => x.ID).IsEqualTo(PanelSettings.DefaultForm.ID),
|
|
|
+ LookupFactory.DefineLookupColumns<StagingSetoutForm, DigitalForm, DigitalFormLink>(x => x.Form).Add(x => x.Description))
|
|
|
+ .ToObjects<DigitalForm>().FirstOrDefault();
|
|
|
+ if(digitalForm is null)
|
|
|
+ {
|
|
|
+ MessageWindow.ShowError("Could not add form.", $"No form with ID {PanelSettings.DefaultForm.ID} was found in the database");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var form = new StagingSetoutForm
|
|
|
+ {
|
|
|
+ Description = digitalForm.Description
|
|
|
+ };
|
|
|
+ form.Parent.ID = entity.ID;
|
|
|
+ form.Form.ID = digitalForm.ID;
|
|
|
+ CustomiseNewForm(entity, form);
|
|
|
+ Client.Save(form, "Added by user");
|
|
|
+
|
|
|
+ MessageWindow.ShowMessage("Site measurement form created.", "Success");
|
|
|
+ }
|
|
|
+ catch(Exception exception)
|
|
|
+ {
|
|
|
+ MessageWindow.ShowError("Error adding form.", exception);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void CustomiseNewForm(StagingSetout setout, StagingSetoutForm form)
|