Subversion Repositories SmartDukaan

Rev

Rev 9478 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
9242 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>
6
<link type="image/x-icon" href="/Support/images/favicon_alt.ico" rel="shortcut icon">
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;}
17
td{background-color:gainsboro};
18
</style>
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>
29
<script type="text/javascript">
30
		$(function(){
31
jQuery.ajax({
32
        type : "GET",
33
        url : "/Support/snapdeal-list!fetchItems?searchText="+"&next=0",
34
		beforeSend: function(){
35
        $('#ajax-spinner').show();
36
        },
37
        complete: function(){
38
        $('#ajax-spinner').hide();
39
        },
40
        success : function(response) {
41
        $('#' + 'snapdeal-table').html(response);
42
		$(".previous").css("display", "none");
43
		var temp = $('.totalValue').text();
44
		$('.total').text(temp);
45
        }
46
    });  
47
});
48
</script>
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/snapdeal-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/snapdeal-list!fetchItems?searchText="+searchText+"&next="+end,
80
		beforeSend: function(){
81
        $('#ajax-spinner').show();
82
        },
83
        complete: function(){
84
        $('#ajax-spinner').hide();
85
        },
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
            $('#' + 'snapdeal-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/snapdeal-list!fetchItems?searchText="+searchText+"&next="+pre,
106
		beforeSend: function(){
107
        $('#ajax-spinner').show();
108
        },
109
        complete: function(){
110
        $('#ajax-spinner').hide();
111
        },
112
        success : function(response) {
113
			$('.valueEnd').text(+end - +10);
114
			$('.valueStart').text(+start - +10);
115
            $('#' + 'snapdeal-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",
131
        url : "/Support/snapdeal-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
        },
143
        success : function(response) {
144
            $('#' + 'snapdeal-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,
174
		beforeSend: function(){
175
        $('#ajax-spinner').show();
176
        },
177
        complete: function(){
178
        $('#ajax-spinner').hide();
179
        },
180
        success : function(response) {
181
            $('#' + 'snapdealitem-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
$("#snapdeal-form").live('submit', function(){
192
	var itemWeight=document.forms["snapdeal-form"]["itemWeight"].value;
193
	var warehouseId=document.forms["snapdeal-form"]["warehouseId"].value;
194
	var transferPrice=document.forms["snapdeal-form"]["transferPrice"].value;
195
 
196
	if (warehouseId=="" || isNaN(warehouseId)){
197
		jAlert('Illegal Entry In Warehouse Id', 'ERROR');
198
		return false;
199
	}
200
 
201
	if (transferPrice==0 || transferPrice=="" || isNaN(transferPrice)){
202
		jAlert('Illegal Entry In Transfer Price', 'ERROR');
203
		return false;
204
	}
205
 
206
	var data = $(this).serialize() 
207
 
208
    jQuery.ajax({
209
        url: "/Support/snapdeal-list!update",
210
        type: 'POST',
211
        data: data,
212
        async: false,
213
		beforeSend: function(){
214
        $('#ajax-spinner').show();
215
        },
216
        complete: function(){
217
        $('#ajax-spinner').hide();
218
        },
219
        success: function (data) {
220
            alert("Changes propagated successfully");
221
        },
222
		 error : function() {
223
		 	alert("OOPS!!!Failed to do changes.Try Again.");
224
		 },
225
        cache: false,
226
        contentType: "application/x-www-form-urlencoded",
227
        processData: false
228
    });
229
 
230
    return false;
231
});
232
});
233
</script>
234
<script type="text/javascript">
235
$(function(){	
236
$("#add-new-item").live('submit', function(){
237
	var itemWeight=document.forms["add-new-item"]["itemWeight"].value;
238
	var transferPrice=document.forms["add-new-item"]["transferPrice"].value;
239
	var warehouseId=document.forms["add-new-item"]["warehouseId"].value;
240
	var itemId=document.forms["add-new-item"]["itemId"].value;
241
 
242
	if (itemId==0 || itemId=="" || isNaN(itemId)){
243
		jAlert('Illegal Entry In Item Id ', 'ERROR');
244
		return false;
245
	}
246
 
247
	if (warehouseId=="" || isNaN(warehouseId)){
248
		jAlert('Illegal Entry In Warehouse Id ', 'ERROR');
249
		return false;
250
	}
251
 
252
	if (transferPrice==0 || transferPrice=="" || isNaN(transferPrice)){
253
		jAlert('Illegal Entry In Transfer Price ', 'ERROR');
254
		return false;
255
	}
256
 
257
    var data = $(this).serialize() 
258
 
259
    jQuery.ajax({
260
        url: "/Support/snapdeal-list!addNewItem",
261
        type: 'POST',
262
        data: data,
263
        async: false,
264
		beforeSend: function(){
265
        $('#ajax-spinner').show();
266
        },
267
        complete: function(){
268
        $('#ajax-spinner').hide();
269
        },
270
        success: function (data) {
271
            alert("Changes propagated successfully");
272
        },
273
		 error : function() {
274
		 	alert("OOPS!!!Failed to do changes.Try Again.");
275
		 },
276
        cache: false,
277
        contentType: "application/x-www-form-urlencoded",
278
        processData: false
279
    });
280
 
281
    return false;
282
});
283
});
284
</script>
285
<script type="text/javascript">
286
$('#addNewItem').live('click', function(){
287
	jQuery.ajax({
288
        type : "GET",
289
        url : "/Support/snapdeal-list!getAddNewItemForm",
290
		beforeSend: function(){
291
        $('#ajax-spinner').show();
292
        },
293
        complete: function(){
294
        $('#ajax-spinner').hide();
295
        },
296
        success : function(response) {
297
            $('#' + 'snapdealitem-details').html(response);
298
        },
299
		error : function() {
300
			alert("Unable to get add new item form.");
301
		 },
302
    });
303
});
304
</script>
305
<title>SnapDeal Listed Items</title>
306
</head>
307
<body>
308
	<div style="padding: 20px 0px;">
309
       <a style="padding-left: 10px;" href="/Support/logout">Logout</a>
310
	   <input type="button" style="padding-left: 5px; margin-left: 10px;width: 15%;float:right;" id="addNewItem" name="addNewItem" value="Add New Item">
311
	   <input type="submit" id="search_item" value="Search" style="float: right;width:8%;">
312
	   <input id="search_text" style="float: right;width:10%;">
313
 
314
</div>
315
<div>
316
    <div style="color:blue;">
317
    #sactionmessage()
318
    </div>
319
    <div style="color:red;">
320
    #sactionerror()
321
    </div>
322
		<div id="ajax-spinner" style="display:none;">
323
		<img src="/Support/images/ajax_loader_blue.gif" class="loading-image">
324
		</div>
325
	   <div id="snapdeal-table">
326
	   </div>
327
	<br>
328
        <div class="display" style="float: left;">
329
		Showing&nbsp;<span class="valueStart">1</span>&nbsp;to&nbsp;<span class="valueEnd">10</span>&nbsp;of&nbsp;
330
		<span class="total"></span>&nbsp;entries
331
	</div>
332
	<div class="paginate" style="float: right;">
333
		<a class="previous" href="#" style="margin: 20px;">Previous</a>
334
		<a class="next" href="#" style="margin: 0px;">Next</a>
335
	</div>
336
	<div id="snapdealitem-details" style="padding-top: 30px;">
337
	</div>
338
 
339
 
340
</div>
341
 
342
</body>
343
</html>