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

SP-909 / BIS-524 : ELN UI - Bug Fixes.

SVN: 29862
parent 51eaea66
No related branches found
No related tags found
No related merge requests found
...@@ -73,7 +73,7 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i ...@@ -73,7 +73,7 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i
return $component; return $component;
} }
this._getInputField = function(type, step, id, alt, isRequired, isHidden) { this._getInputField = function(type, step, id, alt, isRequired, isHidden, pattern) {
var $component = $("<input>"); var $component = $("<input>");
$component.attr('type', type); $component.attr('type', type);
$component.attr('id', id); $component.attr('id', id);
...@@ -87,6 +87,10 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i ...@@ -87,6 +87,10 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i
$component.attr('required', ''); $component.attr('required', '');
} }
if(pattern) {
$component.attr('pattern', pattern);
}
if(isHidden) { if(isHidden) {
$component.attr('class', 'hiddenInput'); $component.attr('class', 'hiddenInput');
} }
...@@ -94,13 +98,13 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i ...@@ -94,13 +98,13 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i
return $component; return $component;
} }
this._getComponent = function(propertyType, isHidden) { this._getComponent = function(propertyType, isHidden, pattern) {
var $propertyTypeComponent = null; var $propertyTypeComponent = null;
if (propertyType.dataType === "INTEGER") { if (propertyType.dataType === "INTEGER") {
$propertyTypeComponent = this._getInputField("number", "1", propertyType.code, propertyType.description, propertyType.mandatory, isHidden); $propertyTypeComponent = this._getInputField("number", "1", propertyType.code, propertyType.description, propertyType.mandatory, isHidden, pattern);
} else if (propertyType.dataType === "VARCHAR") { } else if (propertyType.dataType === "VARCHAR") {
$propertyTypeComponent = this._getInputField("text", null, propertyType.code, propertyType.description, propertyType.mandatory, isHidden); $propertyTypeComponent = this._getInputField("text", null, propertyType.code, propertyType.description, propertyType.mandatory, isHidden, pattern);
} else if (propertyType.dataType === "CONTROLLEDVOCABULARY") { } else if (propertyType.dataType === "CONTROLLEDVOCABULARY") {
var vocabulary = null; var vocabulary = null;
if(isNaN(propertyType.vocabulary)) { if(isNaN(propertyType.vocabulary)) {
...@@ -289,7 +293,7 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i ...@@ -289,7 +293,7 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i
//Drop Down //Drop Down
//Create and set the field //Create and set the field
var $freezerNameDropDown = this._getComponent(this._getPropertyFromType(freezerNamePropertyCode), false); var $freezerNameDropDown = this._getComponent(this._getPropertyFromType(freezerNamePropertyCode), false, null);
$freezerNameDropDown.val(selectedFreezer); $freezerNameDropDown.val(selectedFreezer);
$freezerNameDropDown.change( $freezerNameDropDown.change(
...@@ -314,8 +318,8 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i ...@@ -314,8 +318,8 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i
// //
//Attach row and column hidden fields //Attach row and column hidden fields
var $propertyTypeRowComponent = this._getComponent(this._getPropertyFromType(freezerRowPropertyCode), true); var $propertyTypeRowComponent = this._getComponent(this._getPropertyFromType(freezerRowPropertyCode), true, null);
var $propertyTypeColComponent = this._getComponent(this._getPropertyFromType(freezerColPropertyCode), true); var $propertyTypeColComponent = this._getComponent(this._getPropertyFromType(freezerColPropertyCode), true, null);
$container $container
.append($propertyTypeRowComponent) .append($propertyTypeRowComponent)
.append($propertyTypeColComponent); .append($propertyTypeColComponent);
...@@ -461,7 +465,7 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i ...@@ -461,7 +465,7 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i
// //
if($virtualFreezer && selectedRow && selectedCol) { if($virtualFreezer && selectedRow && selectedCol) {
//Create and set the field //Create and set the field
var $propertyTypeBoxComponent = this._getComponent(this._getPropertyFromType(freezerBoxPropertyCode), false); var $propertyTypeBoxComponent = this._getComponent(this._getPropertyFromType(freezerBoxPropertyCode), false, '[A-Z0-9_]+');
$propertyTypeBoxComponent.change( $propertyTypeBoxComponent.change(
function() { function() {
$(this).val($(this).val().toUpperCase()); //Box Names can only be upper case $(this).val($(this).val().toUpperCase()); //Box Names can only be upper case
...@@ -478,7 +482,7 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i ...@@ -478,7 +482,7 @@ function Freezer(mainController, containerId, profile, sampleTypeCode, sample, i
.append($propertyTypeBoxComponent) .append($propertyTypeBoxComponent)
); );
} else { } else {
var $propertyTypeBoxComponent = this._getComponent(this._getPropertyFromType(freezerBoxPropertyCode), true); var $propertyTypeBoxComponent = this._getComponent(this._getPropertyFromType(freezerBoxPropertyCode), true, null);
$container.append($propertyTypeBoxComponent); $container.append($propertyTypeBoxComponent);
} }
......
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