Subversion Repositories SmartDukaan

Rev

Rev 8639 | Rev 12661 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7283 kshitij.so 1
<!DOCTYPE html PUBLIC 
2
    "-//W3C//DTD XHTML 1.1 Transitional//EN"
3
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<head>
7420 kshitij.so 6
<link type="image/x-icon" href="/Support/images/favicon_alt.ico" rel="shortcut icon">
7283 kshitij.so 7
<link href="/Support/css/demo_page_amazon.css" type="text/css" rel="stylesheet">
8
<link href="/Support/css/demo_table_amazon.css" type="text/css" rel="stylesheet">
9
<script type="text/javascript" src="/Support/js/jquery-1.4.2.js"></script>
10
<style type="text/css">   
11
* { font-family: Verdana; font-size: 96%; }
12
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
13
p { clear: both; }
14
.submit { margin-left: 12em; }
15
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
16
ul { padding-left: 13px;}
8620 kshitij.so 17
td{background-color:#B0BED9};
10922 kshitij.so 18
.diffColor {
19
    background: grey;
20
}
7283 kshitij.so 21
</style>
8639 kshitij.so 22
<style>
23
.loading-image {
24
position: fixed;
25
top: 50%;
26
left: 50%;
27
margin-top: -50px;
28
margin-left: -100px;
29
z-index: 100;
30
}
31
</style>
7283 kshitij.so 32
<script type="text/javascript">
8620 kshitij.so 33
		$(function(){
34
jQuery.ajax({
35
        type : "GET",
36
        url : "/Support/amazon-list!fetchItems?searchText="+"&next=0",
8639 kshitij.so 37
		beforeSend: function(){
38
        $('#ajax-spinner').show();
39
        },
40
        complete: function(){
41
        $('#ajax-spinner').hide();
42
        },
8620 kshitij.so 43
        success : function(response) {
44
        $('#' + 'amazon-table').html(response);
45
		$(".previous").css("display", "none");
46
		var temp = $('.totalValue').text();
47
		$('.total').text(temp);
48
        }
49
    });  
50
});
7283 kshitij.so 51
</script>
8620 kshitij.so 52
 
53
<script type="text/javascript">
54
  $(function(){	
55
	$(".next").live('click', function() {
56
		var start = $( ".valueStart" ).text();
57
		var end = $( ".valueEnd" ).text();
58
		var searchText = $('#search_text').val();
59
		getNextItems(start,end,searchText);
60
    });
61
	$(".previous").live('click', function() {
62
		var start = $( ".valueStart" ).text();
63
		var end = $( ".valueEnd" ).text();
64
		var pre = end - 20;
65
		var searchText = $('#search_text').val();
66
		getPreviousItems(start,end,pre,searchText);
67
    });
68
	$("#search_item").live('click', function() {
69
		var searchText = $('#search_text').val();
70
		loadSearchInfo(searchText);
71
    });
10922 kshitij.so 72
 
73
	$("#search_text").keyup(function(event){
74
    	if(event.keyCode == 13){
75
        	$("#search_item").click();
76
    	}
77
	});
78
 
8620 kshitij.so 79
	$(".editItem").live('click', function() {
10922 kshitij.so 80
		$("tr").removeClass("diffColor");
81
		$("td").css("background-color","")
82
        $(this).parents("tr").addClass("diffColor");
83
		$('tr.diffColor').children('td').css('backgroundColor', '#7F98FA');
8620 kshitij.so 84
		var itemId = $(this).attr('itemid')
85
		loadItemDetails("/Support/amazon-list/"+ itemId +"/edit");
86
    });
87
});
88
</script>
89
<script type="text/javascript">
90
function getNextItems(start,end,searchText){
91
jQuery.ajax({
92
        type : "GET",
93
        url : "/Support/amazon-list!fetchItems?searchText="+searchText+"&next="+end,
8639 kshitij.so 94
		beforeSend: function(){
95
        $('#ajax-spinner').show();
96
        },
97
        complete: function(){
98
        $('#ajax-spinner').hide();
99
        },
8620 kshitij.so 100
        success : function(response) {
101
			$('.valueEnd').text(+end + +10);
102
			$('.valueStart').text(+start + +10);
103
			var last = $('.valueEnd').text();
104
			var temp = $('.total').text();
105
			if (parseInt(last) >= parseInt(temp)){
106
				$(".next").css("display", "none");
107
			}
108
            $('#' + 'amazon-table').html(response);
109
			$(".previous").css("display", "");
110
        },
111
		error : function() {
112
			alert("Unable to fetch items");
113
		 },
114
    });  
115
}
116
function getPreviousItems(start,end,pre,searchText){
117
jQuery.ajax({
118
        type : "GET",
119
        url : "/Support/amazon-list!fetchItems?searchText="+searchText+"&next="+pre,
8639 kshitij.so 120
		beforeSend: function(){
121
        $('#ajax-spinner').show();
122
        },
123
        complete: function(){
124
        $('#ajax-spinner').hide();
125
        },
8620 kshitij.so 126
        success : function(response) {
127
			$('.valueEnd').text(+end - +10);
128
			$('.valueStart').text(+start - +10);
129
            $('#' + 'amazon-table').html(response);
130
			$(".next").css("display", "");	
131
			if (parseInt(start)==11)
132
			{
133
			  $(".previous").css("display", "none");	
134
			}
135
 
136
        },
137
		error : function() {
138
			alert("Unable to fetch items");
139
		 },
140
    });
141
}
142
function loadSearchInfo(searchText){
143
jQuery.ajax({
144
        type : "GET",
8639 kshitij.so 145
        url : "/Support/amazon-list!fetchItems?searchText="+searchText+"&next=0",beforeSend: function(){
146
        $('#ajax-spinner').show();
147
        },
148
        complete: function(){
149
        $('#ajax-spinner').hide();
150
        },
151
		beforeSend: function(){
152
        $('#ajax-spinner').show();
153
        },
154
        complete: function(){
155
        $('#ajax-spinner').hide();
156
        },
8620 kshitij.so 157
        success : function(response) {
158
            $('#' + 'amazon-table').html(response);
10922 kshitij.so 159
			$('#' + 'item-details').html('');
8620 kshitij.so 160
			$('.valueEnd').text(10);
161
			$('.valueStart').text(1);
162
			$(".previous").css("display", "none");
163
			$(".next").css("display", "");
164
			var temp = $('.totalValue').text();
165
			var end = $('.valueEnd').text();
166
			$('.total').text(temp);
167
			if(parseInt(temp)<=10){
168
				$(".previous").css("display", "none");
169
				$(".next").css("display", "none");
170
				$('.valueEnd').text(temp);
171
			}
172
 
173
			if(searchText==""){
174
				$(".previous").css("display", "none");
175
				$(".next").css("display", "");
176
				$('.valueEnd').text(10);
177
			}
178
 
179
        },
180
		error : function() {
181
		 	alert("Unable to search given item.Please try again.");
182
		 },
183
    });  
184
}
185
function loadItemDetails(getUrl){
186
jQuery.ajax({
187
        type : "GET",
188
        url : getUrl,
8639 kshitij.so 189
		beforeSend: function(){
190
        $('#ajax-spinner').show();
191
        },
192
        complete: function(){
193
        $('#ajax-spinner').hide();
194
        },
8620 kshitij.so 195
        success : function(response) {
196
            $('#' + 'item-details').html(response);
197
        },
198
		error : function() {
199
		 	alert("Unable to get Item details.Please try again.");
200
		 },
201
    });  
202
}
203
</script>
204
<script type="text/javascript">
205
$(function(){	
206
$("#amazon-form").live('submit', function(){
207
    var data = $(this).serialize() 
208
 
209
    jQuery.ajax({
210
        url: "/Support/amazon-list!update",
211
        type: 'POST',
212
        data: data,
213
        async: false,
8639 kshitij.so 214
		beforeSend: function(){
215
        $('#ajax-spinner').show();
216
        },
217
        complete: function(){
218
        $('#ajax-spinner').hide();
219
        },
8620 kshitij.so 220
        success: function (data) {
221
            alert("Changes propagated successfully");
222
        },
223
		 error : function() {
224
		 	alert("OOPS!!!Failed to do changes.Try Again.");
225
		 },
226
        cache: false,
227
        contentType: "application/x-www-form-urlencoded",
228
        processData: false
229
    });
230
 
231
    return false;
232
});
233
});
234
</script>
7283 kshitij.so 235
<title>Amazon Listed Items</title>
236
</head>
237
<body>
8620 kshitij.so 238
	<div style="padding: 20px 0px;">
10922 kshitij.so 239
	   <a style="padding-left: 10px;" href="/Support/amazon-list/options">Back</a>
7603 kshitij.so 240
       <a style="padding-left: 10px;" href="/Support/logout">Logout</a>
8620 kshitij.so 241
	   <input type="submit" id="search_item" value="Search" style="float: right;width:8%;">
242
	   <input id="search_text" style="float: right;width:10%;">
7591 kshitij.so 243
</div>
7283 kshitij.so 244
<div>
245
    <div style="color:blue;">
246
    #sactionmessage()
247
    </div>
248
    <div style="color:red;">
249
    #sactionerror()
250
    </div>
8639 kshitij.so 251
		<div id="ajax-spinner" style="display:none;">
252
		<img src="/Support/images/ajax_loader_blue.gif" class="loading-image">
253
		</div>
8620 kshitij.so 254
	   <div id="amazon-table">
255
	   </div>
256
	<br>
257
        <div class="display" style="float: left;">
258
		Showing&nbsp;<span class="valueStart">1</span>&nbsp;to&nbsp;<span class="valueEnd">10</span>&nbsp;of&nbsp;
259
		<span class="total"></span>&nbsp;entries
260
	</div>
261
	<div class="paginate" style="float: right;">
262
		<a class="previous" href="#" style="margin: 20px;">Previous</a>
263
		<a class="next" href="#" style="margin: 0px;">Next</a>
264
	</div>
265
	<div id="item-details" style="padding-top: 30px;">
266
	</div>
7283 kshitij.so 267
 
8620 kshitij.so 268
 
7283 kshitij.so 269
</div>
270
 
271
</body>
272
</html>