From f41780017f993c90aedc1def36918df98b7bbeb7 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Fri, 6 Jun 2014 12:32:01 +0000
Subject: [PATCH] SSDM-312: ELN UI - Alert when choosing the same protein twice
 or more times.

SVN: 31666
---
 .../newbrowser/html/js/widgets/DilutionWidget.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DilutionWidget.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DilutionWidget.js
index f414b928f4a..35e128f16d9 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DilutionWidget.js
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/DilutionWidget.js
@@ -131,6 +131,15 @@ function DilutionWidget(containerId, serverFacade, isEnabled) {
 			if(proteinPermId !== "") {
 				_this._updateConjugatedClone(rowNumber, proteinPermId);
 			}
+			
+			//Alert if needed
+			var proteinsToRowsMap = _this._getProteinRowsMap();
+			var proteinRows = proteinsToRowsMap[proteinPermId];
+			if(proteinRows.length > 1) {
+				Util.showInfo("You have selected " + this[this.selectedIndex].label + ": " + proteinRows.length + " times.");
+			}
+			//Update everything
+			_this._updateCalculatedValues();
 		});
 		if(!_this._isEnabled) {
 			$component.attr('disabled', true)
@@ -275,7 +284,7 @@ function DilutionWidget(containerId, serverFacade, isEnabled) {
 		}
 	}
 	
-	this._updateProteinRowsByAntibody = function() {
+	this._getProteinRowsMap = function() {
 		var proteinsToRowsMap = {};
 		var tBody = $("#" + this._widgetTableId).children()[1];
 		for(var rowNum = 0; rowNum < (tBody.rows.length - 3); rowNum++) {
@@ -295,6 +304,11 @@ function DilutionWidget(containerId, serverFacade, isEnabled) {
 				rows.push(row);
 			}
 		}
+		return proteinsToRowsMap;
+	}
+	
+	this._updateProteinRowsByAntibody = function() {
+		var proteinsToRowsMap = this._getProteinRowsMap();
 		
 		var colours = ["#F0E890", "#B0F0F0", "#90F790", "#F08080", "#B0C0E0", "#00F890", "#D0C0D0", "#FFE0B0", "#90C830", "#B02020"];
 		var coloursUsed = 0;
-- 
GitLab