Subversion Repositories SmartDukaan

Rev

Rev 9464 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9447 manish.sha 1
$(function() {
2
	$('#sendProductFeedForm').live('submit', function() {
3
		var catalogItemId = $("input[name='cataLogItemId']").val();
4
		if(catalogItemId==null || catalogItemId=="")
5
		{
6
			alert("Please enter Catalog Item Id");
7
			$('input[name=cataLogitemId]').focus();
8
			return false;
9
		}
10
		sendProductFeeds($(this).serialize());
11
		return false;
12
	});
13
 
9622 manish.sha 14
	$('#deleteProductFeedForm').live('submit', function() {
15
		var cataLogItemId = $("input[name='catalogItemIdDelete']").val();
16
		if(cataLogItemId==null || cataLogItemId=="")
17
		{
18
			alert("Please enter Catalog Item Id");
19
			$('input[name=catalogItemIdDelete]').focus();
20
			return false;
21
		}
22
		var didConfirm = confirm("Our System entry for product feeds will also be deleted. \nAre you still want to Proceed");
23
		if(didConfirm==false){
24
			return false;
25
		}
26
		deleteProductFeeds($(this).serialize());
27
		return false;
28
	});
29
 
9447 manish.sha 30
	$('#cataLogItemId').keypress(function(e) {
31
		var a = [];
32
            var k = e.which;
33
 
34
            for (i = 48; i < 58; i++){
35
        		{
36
                	a.push(i);
37
        		}
38
        	}
39
 
40
            if (!(a.indexOf(k)>=0)){
41
                e.preventDefault();
42
        	}
43
	});
44
 
9622 manish.sha 45
	$('#catalogItemIdDelete').keypress(function(e) {
46
		var a = [];
47
            var k = e.which;
48
 
49
            for (i = 48; i < 58; i++){
50
        		{
51
                	a.push(i);
52
        		}
53
        	}
54
 
55
            if (!(a.indexOf(k)>=0)){
56
                e.preventDefault();
57
        	}
58
	});
59
 
9447 manish.sha 60
	$('#sendProductFeedLink').live('click', function() {
61
		$("div#sendProductFeedDiv").show();
9464 manish.sha 62
		$('#cataLogItemId').val('');
9447 manish.sha 63
		$.colorbox({
64
            inline : true,
65
            width : "400px",
9622 manish.sha 66
            height : "200px",
9447 manish.sha 67
            href : "div#sendProductFeedDiv",
68
            onClosed : function() {
69
                $("div#sendProductFeedDiv").hide();
70
            }
71
		});
72
	});
73
 
9622 manish.sha 74
	$('#deleteProductFeedLink').live('click', function() {
75
		$("div#deleteProductFeedDiv").show();
76
		$('#catalogItemIdDelete').val('');
77
		$.colorbox({
78
            inline : true,
79
            width : "400px",
80
            height : "200px",
81
            href : "div#deleteProductFeedDiv",
82
            onClosed : function() {
83
                $("div#deleteProductFeedDiv").hide();
84
            }
85
		});
86
	});
87
 
9447 manish.sha 88
});
89
 
90
function sendProductFeeds(params) {
91
	$.ajax({
92
		type : "POST",
93
		url : "/inventory/product-feeds!sendProductFeeds",
94
		data : params,
95
		success : function(response) {
96
			alert(response);
97
			$.colorbox.close();
98
		},
99
		error : function() {
100
			alert("Error in sending products feeds");
101
			$.colorbox.close();
102
		}
103
	});
9622 manish.sha 104
}
105
 
106
function deleteProductFeeds(params) {
107
	$.ajax({
108
		type : "POST",
109
		url : "/inventory/product-feeds!deleteProductFeeds",
110
		data : params,
111
		success : function(response) {
112
			alert(response);
113
			$.colorbox.close();
114
		},
115
		error : function() {
116
			alert("Error in deleting products feeds");
117
			$.colorbox.close();
118
		}
119
	});
9447 manish.sha 120
}