diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py index 23b9f3388b5d498c7416f6e797ff779ec9708c31..f79717cb8d8b9679d7652904c4a989cbe4961c75 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/elnTypes.py @@ -936,7 +936,8 @@ ORDER = ["ORDER", "", [ ["NAME", "General", "Name", DataType.VARCHAR, None, "Name", None, None], ["ORDER_MANAGER", "General", "Order Manager", DataType.VARCHAR, None, "Order Manager", None, None], ["ORDER_MANAGER_CONTACT_DETAILS", "General", "Order Manager Contact Details", DataType.VARCHAR, None, "Order Manager Contact Details", None, None], - ["ORDER_STATUS", "General", "Order Status", DataType.CONTROLLEDVOCABULARY, "ORDER_STATUS", "Order Status", None, None], - ["ADDITIONAL_INFORMATION", "General", "Additional Information", DataType.VARCHAR, None, "Additional Information", None, None], - ["ANNOTATIONS_STATE", "Comments", "Annotations State", DataType.XML, None, "Annotations State", None, None] + ["ORDER_STATUS", "General", "Order Status", DataType.CONTROLLEDVOCABULARY, "ORDER_STATUS", "Order Status", None, None, True], + ["ADDITIONAL_INFORMATION", "General", "Additional Information", DataType.VARCHAR, None, "Additional Information", None, None], + ["ANNOTATIONS_STATE", "Comments", "Annotations State", DataType.XML, None, "Annotations State", None, None], + ["ORDER_STATE", "Comments", "Order State", DataType.VARCHAR, None, "Order State", None, None] ]]; \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js index f9fff2dfc58260d624c6256b7623070c3fe56731..76fcd0da24921050eaf4e2f128e8ceff409905c3 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js @@ -382,6 +382,12 @@ $.extend(DefaultProfile.prototype, { return html; } + /* + * Modifies sample before submit + */ + this.sampleFormOnSubmit = function(sample) { + } + /* * Returns a Jquery component that is appended at the end of the form before the data set viewer */ diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js index a6c8709f2f4956d198582d262efc233706c63eea..ac8fe174a4195707d2b46bf740bc1fa891f9a5be 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/StandardProfile.js @@ -404,6 +404,16 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { } + this.sampleFormOnSubmit = function(sample) { + if(sample.sampleTypeCode === "ORDER") { + var orderStatus = sample.properties["ORDER_STATUS"]; + if(orderStatus === "ORDERED") { + delete sample.properties["ORDER_STATE"]; + sample.properties["ORDER_STATE"] = window.btoa(JSON.stringify(sample)); + } + } + } + this.sampleFormContentExtra = function(sampleTypeCode, sample, containerId) { if(sampleTypeCode === "EXPERIMENTAL_STEP") { var isEnabled = mainController.currentView._sampleFormModel.mode !== FormMode.VIEW; @@ -411,11 +421,17 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { freeFormTableController.init($("#" + containerId)); } else if(sampleTypeCode === "ORDER") { var isExisting = mainController.currentView._sampleFormModel.mode === FormMode.VIEW; + var isFromState = false; if(isExisting) { // // Data Structures to Help the reports functionality // var order = mainController.currentView._sampleFormModel.sample; + if(order.properties["ORDER_STATE"]) { + isFromState = true; + order = JSON.parse(window.atob(order.properties["ORDER_STATE"])); + } + var requests = order.parents; var providerByPermId = {}; var productsByProviderPermId = {}; @@ -617,7 +633,12 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { }; var orderSummaryContainer = $("<div>"); - var orderSummary = new DataGridController("Order Summary", columns, getDataRows, null, false, "ORDER_SUMMARY"); + var repTitle = "Order Summary"; + if(isFromState) { + repTitle += " (as saved when ordered)" + } + + var orderSummary = new DataGridController(repTitle, columns, getDataRows, null, false, "ORDER_SUMMARY"); orderSummary.init(orderSummaryContainer); var totalsByCurrencyContainer = $("<div>").append($("<br>")).append($("<legend>").append("Total:")); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormController.js index 65e8966e98c47bd38f8e03058d8b45659d74baef..24da4d8311f2be1b9b0054a79ed8274f3f71a453 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormController.js @@ -153,6 +153,10 @@ function SampleFormController(mainController, mode, sample) { return; } + //On Submit + sample.parents = this._sampleFormModel.sampleLinksParents.getSamples(); + profile.sampleFormOnSubmit(sample); + // //Identification Info // diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js index cf0c23c61d7d17abc40b5e6c2553b18b7378d79e..2502054fba74f919d7400c49ca8c0d3308f32cf6 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js @@ -478,7 +478,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { continue; } - if(propertyType.code === "ANNOTATIONS_STATE" || propertyType.code === "FREEFORM_TABLE_STATE") { + if(propertyType.code === "ANNOTATIONS_STATE" || propertyType.code === "FREEFORM_TABLE_STATE" || propertyType.code === "ORDER_STATE" ) { continue; } else if(propertyType.code === "XMLCOMMENTS") { var $commentsContainer = $("<div>"); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js index 88aec145d59afef319f1e23ae023139121add4bd..0733d6de01a96c80503ef4abff64b9879755c80e 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js @@ -87,7 +87,13 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show } this.addSample = function(sample) { - linksView.updateSample(sample, true); + Util.blockUI(); + mainController.serverFacade.searchWithIdentifiers([sample.identifier], function(results) { + if(results.length > 0) { + linksView.updateSample(results[0], true); + Util.unblockUI(); + } + }); } this.getSamples = function() {