Skip to content
Snippets Groups Projects
Commit bfae8a6e authored by juanf's avatar juanf
Browse files

SSDM-18: Support initial D-BIOL Workflow - Polishing 1

SVN: 31246
parent 91a01fe0
No related branches found
No related tags found
No related merge requests found
...@@ -86,24 +86,28 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType ...@@ -86,24 +86,28 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
var _this = this; var _this = this;
var tableId = id + "-table"; var tableId = id + "-table";
var sampleId = id + "-sample"; var sampleId = id + "-sample";
var labelId = id + "-label";
var $component = $("<div>", {"id" : id , "class" : "control-group", "sample-type-code" : sampleTypeHint["TYPE"]} ); var $component = $("<div>", {"id" : id , "class" : "control-group", "sample-type-code" : sampleTypeHint["TYPE"]} );
var $label = $("<label>", { "class" : "control-label"}).text(sampleTypeHint["LABEL"] + ":"); var $label = $("<label>", { "class" : "control-label", "id" : labelId}).text(sampleTypeHint["LABEL"] + ":");
var $controls = $("<div>", { "class" : "controls"}); var $controls = $("<div>", { "class" : "controls"});
var $textField = $("<input>", {"type" : "text", "id" : sampleId, "disabled" : ""}); var $textField = $("<a>", {"class" : "btn", "type" : "button", "id" : sampleId, "disabled" : ""});
$textField.css({ $textField.css({
"width" : "650px" "max-width" : "90%",
"text-align" : "left"
}); });
if(sampleTypeHint["REQUIRED"]) { if(sampleTypeHint["REQUIRED"]) {
$textField.attr("required", ""); $textField.attr("required", "");
} }
$controls.append($textField); $controls.append($textField);
$controls.append(" "); $controls.append(" ");
var $buttonSelect = $("<input>", {"class" : "btn", "type" : "button", "value" : "Select"}); var $buttonSelect = $("<a>", {"class" : "btn" });
$buttonSelect.append("Select");
$controls.append($buttonSelect); $controls.append($buttonSelect);
$controls.append(" "); $controls.append(" ");
var $buttonDelete = $("<input>", {"class" : "btn", "type" : "button", "value" : "Delete"}); var $buttonDelete = $("<a>", {"class" : "btn" });
$buttonDelete.append("Delete");
$controls.append($buttonDelete); $controls.append($buttonDelete);
if(this.isDisabled) { if(this.isDisabled) {
...@@ -150,6 +154,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType ...@@ -150,6 +154,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
this._getPlus = function() { this._getPlus = function() {
var id = this.containerId + "-plus-button"; var id = this.containerId + "-plus-button";
var tableId = id + "-table";
var $component = $("<div>", { "id" : id, "class" : "control-group"} ); var $component = $("<div>", { "id" : id, "class" : "control-group"} );
var $controls = $("<div>", { "class" : "controls"}); var $controls = $("<div>", { "class" : "controls"});
...@@ -164,11 +169,12 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType ...@@ -164,11 +169,12 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
var _this = this; var _this = this;
var onClick = function(elem) { var onClick = function(elem) {
_this.addOneSlot(); _this._addAny(id, tableId, null);
}; };
$buttonPlus.click(onClick); $buttonPlus.click(onClick);
$component.append($controls); $component.append($controls);
$component.append($("<div>", { "id" : tableId}));
return $component; return $component;
} }
...@@ -233,6 +239,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType ...@@ -233,6 +239,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
} }
//Check for a non predefined slot that is free //Check for a non predefined slot that is free
var labelId = null;
if(!freePredefinedSampleId) { if(!freePredefinedSampleId) {
for(var i = 0; i < this._lastIndex; i++) { for(var i = 0; i < this._lastIndex; i++) {
var predefinedSampleId = this.containerId + "-" + i + "-sample"; var predefinedSampleId = this.containerId + "-" + i + "-sample";
...@@ -240,6 +247,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType ...@@ -240,6 +247,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
var containerId = this.containerId + "-" + i; var containerId = this.containerId + "-" + i;
var freePredefinedTypeCodeAux = $("#" + containerId).attr("sample-type-code"); var freePredefinedTypeCodeAux = $("#" + containerId).attr("sample-type-code");
if("null" === freePredefinedTypeCodeAux) { if("null" === freePredefinedTypeCodeAux) {
labelId = this.containerId + "-" + i + "-label";
freePredefinedSampleId = predefinedSampleId; freePredefinedSampleId = predefinedSampleId;
break; break;
} }
...@@ -250,6 +258,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType ...@@ -250,6 +258,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
//Create a new slot if nothing is found //Create a new slot if nothing is found
if(!freePredefinedSampleId) { //Create a new slot if not found if(!freePredefinedSampleId) { //Create a new slot if not found
var sampleId = this.containerId + "-" + this._lastIndex + "-sample"; var sampleId = this.containerId + "-" + this._lastIndex + "-sample";
labelId = this.containerId + "-" + this._lastIndex + "-label";
freePredefinedSampleId = sampleId; freePredefinedSampleId = sampleId;
this.addOneSlot(); this.addOneSlot();
} }
...@@ -264,8 +273,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType ...@@ -264,8 +273,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
} }
var propertiesToShowDisplayNames = this.profile.getPropertiesDisplayNamesForTypeCode(sampleToAdd.sampleTypeCode, propertiesToShow); var propertiesToShowDisplayNames = this.profile.getPropertiesDisplayNamesForTypeCode(sampleToAdd.sampleTypeCode, propertiesToShow);
var meaningfulInfo = {}; var meaningfulInfo = "<b>Code: </b>" + sampleToAdd.code + " ";
meaningfulInfo["CODE"] = sampleToAdd.code;
var max3Length = (propertiesToShow.length > 3)?3:propertiesToShow.length; var max3Length = (propertiesToShow.length > 3)?3:propertiesToShow.length;
for(var j = 0; j < max3Length; j++) { for(var j = 0; j < max3Length; j++) {
...@@ -275,15 +283,23 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType ...@@ -275,15 +283,23 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType
} }
var propertyToShowDisplayName = propertiesToShowDisplayNames[j]; var propertyToShowDisplayName = propertiesToShowDisplayNames[j];
meaningfulInfo[propertyToShowDisplayName] = Util.getEmptyIfNull(propertyToShow); meaningfulInfo += "<b>" + propertyToShowDisplayName + ": </b>" + Util.getEmptyIfNull(propertyToShow) + " ";
}
var $input = $("#" +freePredefinedSampleId);
if(labelId) {
$("#"+labelId).text(sampleToAdd.sampleTypeCode +":");
}
if(meaningfulInfo.length > 200) {
meaningfulInfo = meaningfulInfo.substring(0, 200) + "...";
} }
$("#" +freePredefinedSampleId).val(JSON.stringify(meaningfulInfo)); $input.empty();
$input.append(meaningfulInfo);
} }
} }
this.removeSample = function(sampleId) { this.removeSample = function(sampleId) {
if(this.samples[sampleId]) { if(this.samples[sampleId]) {
$('#'+sampleId).val(""); $('#'+sampleId).empty();
this.samples[sampleId] = null; this.samples[sampleId] = null;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment