Subversion Repositories SmartDukaan

Rev

Rev 22245 | Rev 22660 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22245 Rev 22354
Line 11... Line 11...
11
				required:true
11
				required:true
12
			},
12
			},
13
			email:{
13
			email:{
14
				required:true,
14
				required:true,
15
				email:true
15
				email:true
16
				
-
 
17
			},
16
			},
18
			line1:{
17
			line1:{
19
				required:true
18
				required:true
20
			},
19
			},
21
			state:{
20
			state:{
Line 92... Line 91...
92
    
91
    
93
	$( "input.unitPrice").blur(function() {
92
	$( "input.unitPrice").blur(function() {
94
		console.log("unitPrice blur called");
93
		console.log("unitPrice blur called");
95
		var $element = $(this);
94
		var $element = $(this);
96
		var unitPrice = $element.val();
95
		var unitPrice = $element.val();
-
 
96
		var mopPrice = parseFloat($(this).attr('mopPrice'));
-
 
97
		if(parseFloat(unitPrice) < mopPrice){
-
 
98
			//error = true;
-
 
99
			alert("sellingPrice must be greater than equal to mop")
-
 
100
			$element.addClass("border-highlight");
-
 
101
		}else{
-
 
102
			$element.removeClass("border-highlight")
97
		if(unitPrice != ''){
103
			if(unitPrice != ''){
98
		    $.ajax({
104
			    $.ajax({
99
		         type: "GET",
105
			         type: "GET",
100
		         url: "insurancePrices?price="+unitPrice,
106
			         url: "insurancePrices?price="+unitPrice,
101
		         //data: payload,
107
			         //data: payload,
102
		         //contentType:'application/json',
108
			         //contentType:'application/json',
103
				async: false,
109
					async: false,
104
				success: function (data) {
110
					success: function (data) {
105
					console.log("response : "+JSON.stringify(data));
111
						console.log("response : "+JSON.stringify(data));
106
					var insurancePriceMap = data.response;
112
						var insurancePriceMap = data.response;
107
					for(key in insurancePriceMap){
113
						for(key in insurancePriceMap){
108
						var dealerPrice = insurancePriceMap[key].dealerPrice;
114
							var dealerPrice = insurancePriceMap[key].dealerPrice;
109
						var sellingPrice = insurancePriceMap[key].sellingPrice;
115
							var sellingPrice = insurancePriceMap[key].sellingPrice;
110
						$element.closest('tr').find('.insuranceAmount').attr("placeholder", dealerPrice + "-" + sellingPrice);
116
							$element.closest('tr').find('.insuranceAmount').attr("placeholder", dealerPrice + "-" + sellingPrice);
111
						break;
117
							break;
112
					}
118
						}
113
				},
119
					},
114
				error : function() {
120
					error : function() {
115
					alert("OOPS!!!Failed to do changes.Try Again.",'ERROR');
121
						alert("OOPS!!!Failed to do changes.Try Again.",'ERROR');
116
				},
122
					},
117
				cache: false,
123
					cache: false,
118
				processData: false
124
					processData: false
119
		    });
125
			    });
120
	    }
126
		    }
-
 
127
		}
121
	}).focus(function(){
128
	}).focus(function(){
122
		console.log("unitPrice focus called");
129
		console.log("unitPrice focus called");
123
		var $element = $(this);
130
		var $element = $(this);
124
		$element.closest('tr').find('.insuranceAmount').attr("placeholder", "");
131
		$element.closest('tr').find('.insuranceAmount').attr("placeholder", "");
125
	});
132
	});
-
 
133
	
-
 
134
	$( "input.phone").blur(function() {
-
 
135
		console.log("phone blur called");
-
 
136
		var mobileNumber = $(this).val();
-
 
137
		writeOldCustomerDetailsByMobileNumber(mobileNumber);
-
 
138
	});
126
  
139
  
127
});
140
});
128
141