Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
11015 kshitij.so 1
function loadCompetitionDetails(getUrl){
2
	jQuery.ajax({
3
		type : "GET",
4
		url : getUrl,
5
		beforeSend: function(){
6
			$('#ajax-spinner').show();
7
		},
8
		complete: function(){
9
			$('#ajax-spinner').hide();
10
		},
11
		success : function(response) {
12
			$('#' + 'competition-details').html(response);
13
		},
14
		error : function() {
15
			alert("Unable to get competition history.Please try again.");
16
		},
17
	});  
18
}
19
 
20
function getNextItems(start,end,itemId){
21
	jQuery.ajax({
22
		type : "GET",
23
		url : "/Support/snapdeal-list!fetchCompetitionData?next="+end+"&itemId="+itemId,
24
		beforeSend: function(){
25
			$('#ajax-spinner').show();
26
		},
27
		complete: function(){
28
			$('#ajax-spinner').hide();
29
		},
30
		success : function(response) {
31
			$('.valueEnd').text(+end + +10);
32
			$('.valueStart').text(+start + +10);
33
			var last = $('.valueEnd').text();
34
			var temp = $('.totalItems').text();
35
			if (parseInt(last) >= parseInt(temp)){
36
				$(".next").css("display", "none");
37
			}
38
			$('#' + 'competition-details').html(response);
39
			$(".previous").css("display", "");
40
		},
41
		error : function() {
42
			alert("Unable to fetch items");
43
		},
44
	});  
45
}
46
function getPreviousItems(start,end,pre,itemId){
47
	jQuery.ajax({
48
		type : "GET",
49
		url : "/Support/snapdeal-list!fetchCompetitionData?next="+pre+"&itemId="+itemId,
50
		beforeSend: function(){
51
			$('#ajax-spinner').show();
52
		},
53
		complete: function(){
54
			$('#ajax-spinner').hide();
55
		},
56
		success : function(response) {
57
			$('.valueEnd').text(+end - +10);
58
			$('.valueStart').text(+start - +10);
59
			$('#' + 'competition-details').html(response);
60
			$(".next").css("display", "");	
61
			if (parseInt(start)==11)
62
			{
63
				$(".previous").css("display", "none");	
64
			}
65
 
66
		},
67
		error : function() {
68
			alert("Unable to fetch items");
69
		},
70
	});
71
}
72
 
73
function getDuplicateRecords(startDate, endDate, itemId, row){
74
	jQuery.ajax({
75
		type : "GET",
76
		url : "/Support/snapdeal-list!fetchCompetitionDataTest?startDate="+startDate+"&endDate="+endDate+"&itemId="+itemId,
77
		beforeSend: function(){
78
			$('#ajax-spinner').show();
79
		},
80
		complete: function(){
81
			$('#ajax-spinner').hide();
82
		},
83
		success : function(response) {
84
			$(response).insertAfter(row).slideDown("slow");
85
			$('tr.diffColor').children('td').css('backgroundColor', '#7F98FA');
86
 
87
		},
88
		error : function() {
89
			alert("Unable to fetch items");
90
			return false;
91
		},
92
	});
93
}
11110 kshitij.so 94
 
95
function showData(supc){
96
	jQuery.ajax({
97
		type : "GET",
98
		url : "/Support/snapdeal-scraper?supc="+supc,
99
		beforeSend: function(){
100
			$('#ajax-spinner').show();
101
		},
102
		complete: function(){
103
			$('#ajax-spinner').hide();
104
		},
105
		success : function(json) {
106
			var parsedData = JSON.parse(json);
107
			$('#scraping-data td').eq(0).html(parsedData.saholicSp);
108
			$('#scraping-data td').eq(1).html(parsedData.saholicOfferPrice);
11122 kshitij.so 109
			$('#scraping-data td').eq(2).html(parsedData.saholicRank);
110
			$('#scraping-data td').eq(3).html(parsedData.saholicInventory);
111
			$('#scraping-data td').eq(4).html(parsedData.competitorName);
112
			$('#scraping-data td').eq(5).html(parsedData.competitorType);
113
			$('#scraping-data td').eq(6).html(parsedData.competitorSp);
114
			$('#scraping-data td').eq(7).html(parsedData.competitorOfferPrice);
115
			$('#scraping-data td').eq(8).html(parsedData.competitorInventory);
116
			$('#scraping-data td').eq(9).html(parsedData.totalSeller);
11110 kshitij.so 117
			$('#hidden-data').show();
118
		},
119
		error : function() {
120
			alert("Unable to fetch details.");
121
			return false;
122
		},
123
	});
124
}