From 4eacb4197b77f24f31beff7b51e97f2f51345126 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Wed, 27 Jul 2016 13:22:05 +0000 Subject: [PATCH] SSDM-2732 : Ordering System, sample extensions for more friendly ordering. SVN: 36844 --- .../html/js/config/StandardProfile.js | 13 ++++++++--- .../views/SampleForm/SampleFormController.js | 3 +-- .../SampleForm/widgets/LinksController.js | 23 +++++++++++++++++++ 3 files changed, 34 insertions(+), 5 deletions(-) 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 142a6c852da..c1a5e739557 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 @@ -276,7 +276,7 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { "LABEL" : "Products", "TYPE": "PRODUCT", "MIN_COUNT" : 0, - "ANNOTATION_PROPERTIES" : [{"TYPE" : "QUANTITY", "MANDATORY" : false }, {"TYPE" : "COMMENTS", "MANDATORY" : false }] + "ANNOTATION_PROPERTIES" : [{"TYPE" : "QUANTITY", "MANDATORY" : true }, {"TYPE" : "COMMENTS", "MANDATORY" : false }] }] }, "ORDER" : { @@ -287,7 +287,7 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { "LABEL" : "Requests", "TYPE": "REQUEST", "MIN_COUNT" : 0, - "ANNOTATION_PROPERTIES" : [{"TYPE" : "QUANTITY", "MANDATORY" : false }, {"TYPE" : "COMMENTS", "MANDATORY" : false }] + "ANNOTATION_PROPERTIES" : [] }] }, "SUPPLIER" : { @@ -296,7 +296,14 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { }, "PRODUCT" : { "SAMPLE_CHILDREN_DISABLED" : true, - "SAMPLE_PARENTS_DISABLED" : true, + "SAMPLE_PARENTS_TITLE" : "Suppliers", + "SAMPLE_PARENTS_ANY_TYPE_DISABLED" : true, + "SAMPLE_PARENTS_HINT" : [{ + "LABEL" : "Suppliers", + "TYPE": "SUPPLIER", + "MIN_COUNT" : 1, + "ANNOTATION_PROPERTIES" : [] + }] }, "EXPERIMENTAL_STEP" : { "SAMPLE_PARENTS_HINT" : [ 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 6574545cdbc..8a0a9e163a9 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 @@ -112,16 +112,15 @@ function SampleFormController(mainController, mode, sample) { // Parents/Children Links // if(!this._sampleFormModel.sampleLinksParents.isValid()) { - Util.showError("Missing Parents."); return; } var sampleParentsFinal = this._sampleFormModel.sampleLinksParents.getSamplesIdentifiers(); if(!this._sampleFormModel.sampleLinksChildren.isValid()) { - Util.showError("Missing Children."); return; } var sampleChildrenFinal = this._sampleFormModel.sampleLinksChildren.getSamplesIdentifiers(); + var sampleChildrenRemovedFinal = this._sampleFormModel.sampleLinksChildren.getSamplesRemovedIdentifiers(); // 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 ccf8fe3629a..f1a6d272128 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 @@ -38,6 +38,29 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show // API - Used by Sample Form // this.isValid = function() { + if(sampleTypeHints) { + for(var typeIdx = 0; typeIdx < sampleTypeHints.length; typeIdx++) { + var sampleTypeHint = sampleTypeHints[typeIdx]; + var sampleTypeCode = sampleTypeHint["TYPE"]; + var sampleTypeMinCount = sampleTypeHint["MIN_COUNT"]; + var sampleTypeAnnotations = sampleTypeHint["ANNOTATION_PROPERTIES"]; + var sampleTypeCount = (linksModel.samplesByType[sampleTypeCode])?linksModel.samplesByType[sampleTypeCode].length:0; + if(sampleTypeCount < sampleTypeMinCount) { + Util.showError("Currently you only have " + sampleTypeCount + " of the " + sampleTypeMinCount + " required " + sampleTypeCode + "."); + return false; + } + + if(sampleTypeCount > 0) { + for(var sampleIdx = 0; sampleIdx < linksModel.samplesByType[sampleTypeCode].length; sampleIdx++) { + var sampleWithAnnotations = linksModel.samplesByType[sampleTypeCode][sampleIdx]; + for(var annotIdx = 0; annotIdx < sampleTypeAnnotations.length; annotIdx++) { + //TO-DO, Not enough information to validate required annotations here + } + } + } + } + } + return true; } -- GitLab