Subversion Repositories SmartDukaan

Rev

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