Subversion Repositories SmartDukaan

Rev

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

Rev 22594 Rev 22655
Line 747... Line 747...
747
	
747
	
748
	// checking input discountAmount is not greater than maxDiscountAmount
748
	// checking input discountAmount is not greater than maxDiscountAmount
749
	$("form#cd input.discountAmount").each(function(){
749
	$("form#cd input.discountAmount").each(function(){
750
		var input = $(this).val().trim();
750
		var input = $(this).val().trim();
751
		var mop = $(this).attr("mop");
751
		var mop = $(this).attr("mop");
752
		var maxDiscountPrice = parseFloat($(this).attr("placeholder").substring(5));
752
		var maxDiscountPrice = parseFloat($(this).attr("placeholder").substring(6));
753
		if(mop){
753
		if(mop){
754
			$(this).removeClass("border-highlight");
754
			$(this).removeClass("border-highlight");
755
			if (!input || parseFloat(input)<0 || isNaN(input)){
755
			if (!input || parseFloat(input)<0 || isNaN(input)){
756
				alert("DiscountAmount value can not be lesser than 0 or invalid value");
756
				alert("DiscountAmount value can not be lesser than 0 or invalid value");
757
				error=true;
757
				error=true;
758
				$(this).addClass("border-highlight");
758
				$(this).addClass("border-highlight");
759
			}
759
			}
760
			if(parseFloat(input) > maxDiscountPrice){
760
			if(parseFloat(input) > maxDiscountPrice){
761
				alert("DiscountAmount value can not be greater than the suggested maxDiscountPrice");
761
				alert("DiscountAmount [" + parseFloat(input) + "] value can not be greater than the suggested maxDiscountPrice [" + maxDiscountPrice + "]");
762
				error=true;
762
				error=true;
763
				$(this).addClass("border-highlight");
763
				$(this).addClass("border-highlight");
764
			}
764
			}
765
		}
765
		}
766
	});
766
	});