Subversion Repositories SmartDukaan

Rev

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