Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
507 rajveer 1
  <!-- Add Shipping Detail Start-->
2
 
3
  <script type="text/javascript">
4
      $(document).ready(function(){
5
         $('#addAdrBtn').click(function(){
6
			 $('#newShipAdr').show();			 
7
			 scrollWin();
8
	     });
9
		 function scrollWin(){
10
			$('html, body').animate({
11
			scrollTop: $("#newShipAdr").offset().top
12
			}, 2000);
13
			}
14
 
15
      });
16
 
17
 
18
	  function addNewAdress()
19
	  {	
20
 
21
		var shipName = document.getElementById('shipName');
22
		var shipAddress1 = document.getElementById('shipAddress1');
23
		var shipAddress2 = document.getElementById('shipAddress2');
24
		var shipState = document.getElementById('shipState');
25
		var shipCity = document.getElementById('shipCity');
26
		var shipPin = document.getElementById('shipPin');
27
		var shipMobile = document.getElementById('shipMobile');
28
		var shipAreaCode = document.getElementById('shipAreaCode');
29
		var shipPhoneNumber = document.getElementById('shipPhoneNumber');
30
		var shipEmail = document.getElementById('shipEmail');
31
 
32
		var error = "";
33
 
34
		if(!isEmpty(shipName)){
35
			alert("Please enter your shipping name");
36
		    return false;	
37
		}
38
		else  if(!isEmpty(shipAddress1)){
39
			alert("Please enter your shipping address");
40
		    return false;	
41
		}
42
		else  if(shipState.value == '0'){
43
			alert("Please select your shipping state");
44
		    return false;	
45
		}
46
		else if(shipCity.value == '0'){
47
			alert("Please select your shipping city");
48
		    return false;	
49
		}
50
		else  if(!isEmpty(shipPin)){
51
			alert("Please enter your shipping pincode");
52
		    return false;	
53
		}
54
		else  if(!isNumeric(shipPin)){
55
			alert("Please enter numeric pincode number");
56
		    return false;	
57
		}
58
		else  if(!isEmpty(shipMobile)){
59
			alert("Please enter your shipping mobile number");
60
		    return false;	
61
		}
62
		else  if(!isEmpty(shipAreaCode)){
63
			alert("Please enter your shipping area code");
64
		    return false;	
65
		}
66
		else  if(!isEmpty(shipPhoneNumber)){
67
			alert("Please enter your shipping phone number.");
68
		    return false;	
69
		}
70
		else  if(!isNumeric(shipPhoneNumber)){
71
			alert("Please enter numeric digits");
72
		    return false;	
73
		}
74
		else if(!isEmpty(shipEmail)){
75
		    alert("Please enter your shipping Email");	
76
			return false;	    
77
		}
78
		else if(!emailValidator(shipEmail)){
79
			alert("please enter valid Email");
80
			return false;
81
		}
82
		else {
83
			alert("AJAX request to add shipping address. "); 
84
			var addressString = '';
85
			addressString = '<label>'+shipName.value+'</label><br />'+
86
			'<label>'+shipAddress1.value+'</label><br />'+
87
			'<label>'+shipAddress2.value+'</label><br />'+
88
			'<label>'+shipCity.value+'</label><br />'+
89
			'<label>'+shipState.value+'</label><br />'+
90
			'<label>Pin: '+shipPin.value+'</label><br />'+
91
			'<label>Mob: '+shipMobile.value+' </label><br />'+
92
			'<label>Landline: '+shipAreaCode.value+' - '+shipPhoneNumber.value+'</label><br />'+
93
			'<label>Email: '+shipEmail.value+' </label>';
94
			document.getElementById('shipAddressContainer').innerHTML = '';
95
			document.getElementById('shipAddressContainer').innerHTML = addressString;
96
			document.getElementById('newShipAdr').style.display = 'none';
97
 
98
			 alert("AJAX request to add shipping address. "); 
99
			 jQuery.ajax({
100
				  type: "POST",
101
				  url: "./shipping",
102
				  data: "customername="+shipName.value+"&line1="+shipAddress1.value+"&line2="+shipAddress2.value+"&city="+shipCity.value
103
				  +"&state="+shipState.value+"&pincode="+shipPin.value+"&mobilenumber="+shipMobile.value+"&country=India",
104
				  success: function(msg){
105
					   alert( "Data Saved: " + msg );
106
				  }
107
			 });
108
 
109
			return false;
110
		}	
111
 
112
	}	
113
 
114
	function resetShipForm(){
115
		document.getElementById('shipName').value = '';
116
		document.getElementById('shipAddress1').value = '';
117
		document.getElementById('shipAddress2').value = '';
118
		document.getElementById('shipState').value = '0';
119
		document.getElementById('shipCity').value = '0';
120
		document.getElementById('shipPin').value = '';
121
		document.getElementById('shipMobile').value = '';
122
		document.getElementById('shipAreaCode').value = '';
123
		document.getElementById('shipPhoneNumber').value = '';
124
		document.getElementById('shipEmail').value = '';
125
	}
126
 
127
	function changeShipAddress(id){
128
		 document.getElementById('shipAddressContainer').innerHTML = document.getElementById(id).innerHTML;
129
		 //document.getElementById('newShipAdr').style.display = 'none';
130
		 $('#newShipAdr').hide();
131
 
132
	}
133
 
134
	 </script>
135
 
136
  <div id="registration">
137
    <div class="top">
138
      <div class="left">
139
        <div class="right"> &nbsp; </div>
140
      </div>
141
    </div>
142
    <div class="middle">
143
      <div class="mid-inner">
144
      		<!-- Block 1 -->
145
      		<div class="padding-top17">
146
            	<!-- Block-1 Right-->
147
      			<div class="shipping-block1-R" style="height:225px; overflow-y:auto;">
148
            		<table cellpadding="0" cellspacing="0" width="100%" class="estimate-table" >
149
            			<thead>
150
                        	<tr>
151
                        		<th width="36%">Item</th>
152
                                <th width="29%">Delivery Estimate</th>
153
                                <th width="10%" class="quantity">Qty.</th>
154
                                <th width="25%" class="last">Total Price</th>
155
                        	</tr>
156
            			</thead>
157
                        <tbody>
158
							#foreach($item in $items)
159
                        	<tr>
160
                        		<td>$item.get("ITEM_NAME")</td>
161
                        		<td>within $item.get("SHIPPING_TIME") hours</td>
162
                                <td class="quantity">$item.get("ITEM_QUANTITY")</td>
163
                                <td>Rs. $item.get("TOTAL_PRICE")</td>
164
                        	</tr>
165
							#end
166
                            <tr align="right">
167
                            	<td colspan="4" class="total-amount">Total Amount: Rs. $totalamount</td>
168
                            </tr>
169
                        </tbody>
170
            		</table>
171
                   <div align="right" class="proceed-bttn">
172
                   		<label class="floatLeft" style="margin-top: 3px;">We accept all major credit cards and debit cards &nbsp;</label>
173
                          <div class="bigImgButton floatLeft">
174
                            <div class="left">
175
                              <div class="right">
176
                                <div class="center">
177
                                  <input type="submit" name="btnSearch"  id="" value="Proceed to Pay" class="button" />
178
                                </div>
179
                              </div>
180
                            </div>
181
                            <div class="clearBoth"></div>
182
             			  </div>
183
                          <div class="clearBoth"></div>
184
                   </div> 
185
            	</div><!-- Block-1 Right End-->
186
                <!-- Block-1 Left-->
187
                <div class="shipping-block1-L">
188
					#foreach($address in $addresses)
189
					#if($velocityCount == 1)
190
                	<div class="ship-address-block">	
191
                		<h2>Shipping Address</h2>
192
                        <div class="ship-address-inner" style="height:200px; overflow-y:auto;">
193
							<div id="shipAddressContainer">
194
								<label>$address.getName()</label><br />
195
								<label>$address.getLine1() </label><br />
196
								<label>$address.getLine2()</label><br />
197
								<label>$address.getCity()</label><br />
198
								<label>$address.getState()</label><br />
199
								<label>Pin: $address.getPin()</label><br />
200
								<label>Mob: $address.getPhone() </label><br />
201
 
202
							</div>
203
 
204
                            <div class="ship-address-bttn" style="margin-top: 20px;">
205
                                <div class="bigImgButton">
206
                                <div class="left">
207
                                  <div class="right">
208
                                    <div class="center">
209
                                      <input type="button" name="addAdrBtn"  id="addAdrBtn" value="Ship to Another Address" class="button" />
210
                                    </div>
211
                                  </div>
212
                                </div>
213
                              </div>
214
                         	</div>
215
                             <div class="clearBoth"></div>     
216
                        </div>
217
						#end
218
						#end
219
                	</div>
220
                </div><!-- Block-1 Left End-->
221
                <div class="clearBoth"></div>
222
            </div><!-- Block 1 End-->
223
             <div class="clearBoth"></div>
224
             <!-- Block 2 -->	
225
             <div class="padding-top17" style="display: none;" id="newShipAdr">
226
             	<!-- Block 2 Right -->
227
             	<div class="shipping-block2-L" style="margin-right:15px; ">
228
                	<h2 class="mid-innerHeading">Other Addresses on Record</h2>
229
					<div style="height:355px; overflow-y:auto">
230
 
231
					#foreach($address in $addresses)
232
					#if($velocityCount != 1)
233
					<div class="ship-address-block">
234
                        <div class="ship-address-inner">
235
							<div id="shipAddressContainer$address.getId()">
236
								<label>$address.getName()</label><br />
237
								<label>$address.getLine1() </label><br />
238
								<label>$address.getLine2()</label><br />
239
								<label>$address.getCity()</label><br />
240
								<label>$address.getState()</label><br />
241
								<label>Pin: $address.getPin()</label><br />
242
								<label>Mob: $address.getPhone() </label><br />
243
 
244
 
245
							</div>	
246
                            <div class="ship-address-bttn">
247
                                <div class="bigImgButton">
248
                                <div class="left">
249
                                  <div class="right">
250
                                    <div class="center">
251
                                      <input type="submit" name="btnSearch" onclick="changeShipAddress('shipAddressContainer$address.getId()')"  id="" value="Ship to this Address" class="button" />
252
                                    </div>
253
                                  </div>
254
                                </div>
255
                              </div>
256
                         	</div>
257
                             <div class="clearBoth"></div>     
258
                        </div>
259
                	</div>
260
					#end
261
					#end
262
 
263
 
264
				 </div>	
265
                </div>
266
 
267
 
268
 
269
				<div class="" style="width:424px; float:left;">
270
             			<div class="ship-address-block">
271
                		<h2>Specify a New Address</h2>
272
                        <div class="ship-address-form">
273
                        	<form name="newAdrFrm" method="post" onsubmit="return addNewAdress();">
274
                            	 <div class="register-row">
275
                                      <label><sup>*</sup><span> Name:</span></label>
276
                                      <div class="imgTextBox">
277
                                        <div class="left">
278
                                          <div class="right">
279
                                            <div class="center">
280
                                              <input type="text" id="shipName" name="" value="" class="textbox" />
281
                                            </div>
282
                                          </div>
283
                                        </div>
284
                                      </div>
285
                                      <div class="clearBoth"></div>
286
                                 </div>
287
                            	 <div class="register-row">
288
                                      <label><sup>*</sup><span> Address:</span></label>
289
                                      <div class="imgTextBox">
290
                                        <div class="left">
291
                                          <div class="right">
292
                                            <div class="center">
293
                                              <input type="text" id="shipAddress1" name="" value="" class="textbox" />
294
                                            </div>
295
                                          </div>
296
                                        </div>
297
                                      </div>
298
                                      <div class="clearBoth"></div>
299
                                 </div>
300
                            	 <div class="register-row">
301
                                      <label>&nbsp;</label>
302
                                      <div class="imgTextBox">
303
                                        <div class="left">
304
                                          <div class="right">
305
                                            <div class="center">
306
                                              <input type="text" id="shipAddress2" name="" value="" class="textbox" />
307
                                            </div>
308
                                          </div>
309
                                        </div>
310
                                      </div>
311
                                      <div class="clearBoth"></div>
312
                                 </div>
313
                            	<div class="register-row">
314
                                  <label><sup>*</sup><span>State</span></label>
315
                                  <select class="select_state" id="shipState">
316
                                    <option value="0">Select State</option>
317
									 <option value="delhi">Delhi</option>
318
                                  </select>
319
                                  <div class="clearBoth"></div>
320
                                </div>
321
                                <div class="register-row">
322
                                  <label><sup>*</sup><span>City:</span></label>
323
                                  <select class="select_state" id="shipCity">
324
                                    <option value="0">Select City</option>
325
									<option value="dehradun">Dehradun</option>
326
                                  </select>
327
                                  <div class="clearBoth"></div>
328
                                </div>
329
                                 <div class="register-row">
330
                                      <label><sup>*</sup><span>Pin Code:</span></label>
331
                                      <div class="imgTextBox" style="width: 65px;">
332
                                        <div class="left">
333
                                          <div class="right">
334
                                            <div class="center">
335
                                              <input type="text" id="shipPin" name="" value="" class="textbox textbox-pincode" style="width: 60px;" />
336
                                            </div>
337
                                          </div>
338
                                        </div>
339
                                      </div>
340
                                      <div class="clearBoth"></div>
341
                                 </div>
342
                            	 <div class="register-row">
343
                                  <label><sup>*</sup><span>Mobile Number:</span></label>
344
                                  <div class="imgTextBox">
345
                                    <div class="left">
346
                                      <div class="right">
347
                                        <div class="center">
348
                                          <input type="text" id="shipMobile" name="" value="" class="textbox" />
349
                                        </div>
350
                                      </div>
351
                                    </div>
352
                                  </div>
353
                                  <div class="clearBoth"></div>
354
                                </div>
355
                                <div class="register-row">
356
                                  <label><sup>*</sup><span>Landline:</span></label>
357
                                  <div class="imgTextBox" style="width: 66px;">
358
                                    <div class="left">
359
                                      <div class="right">
360
                                        <div class="center">
361
                                          <input type="text" id="shipAreaCode" name="" value="" class="textbox" style="width: 60px;" />
362
                                        </div>
363
                                      </div>
364
                                    </div>
365
                                  </div>
366
                                  <div class="imgTextBox" style="width: 140px;">
367
                                    <div class="left">
368
                                      <div class="right">
369
                                        <div class="center">
370
                                          <input type="text" id="shipPhoneNumber" name="" value="" class="textbox" style="width: 130px;"/>
371
                                        </div>
372
                                      </div>
373
                                    </div>
374
                                  </div>
375
                                  <div class="clearBoth"></div>
376
                                </div>
377
                            	<div class="register-row">
378
                                  <label><sup>*</sup><span>Email:</span></label>
379
                                  <div class="imgTextBox">
380
                                    <div class="left">
381
                                      <div class="right">
382
                                        <div class="center">
383
                                          <input type="text" id="shipEmail" name="" value="" class="textbox" />
384
                                        </div>
385
                                      </div>
386
                                    </div>
387
                                  </div>
388
                                  <div class="clearBoth"></div>
389
                            	</div>
390
                                <div class="ship-address-bttn">
391
                                    <div class="bigImgButton floatLeft">
392
                                    <div class="left">
393
                                      <div class="right">
394
                                        <div class="center">
395
                                          	 <input type="submit" name="submitAddress"  id="submitAddress" value="Ship to this Address" class="button" />
396
                                        </div>
397
                                      </div>
398
                                    </div>
399
                                  </div>
400
                                    <div class="bigImgButton floatLeft" style="margin: 0 17px 0 5px;" >
401
                                    <div class="left">
402
                                      <div class="right">
403
                                        <div class="center">
404
                                          <input type="button" name="btnSearch" onclick="resetShipForm();" id="" value="Cancel" class="button button1" />
405
                                        </div>
406
                                      </div>
407
                                    </div>
408
                                  </div>
409
                                <div class="clearBoth"></div>
410
 
411
 
412
                                </div>
413
                                 <div class="clearBoth"></div>
414
                            </form>
415
                        </div>
416
                	</div>
417
             	</div><!-- Block 2 Right End-->
418
 
419
				<div class="clearBoth"></div>
420
             </div><!-- Block 2 End-->	
421
           	 <div class="clearBoth"></div>
422
             <div class="padding-top17">
423
             		<a href="#"><img src="images/secured.png" alt="" width="105" height="52" /></a>
424
             </div>	<br />
425
      </div><!-- mid inner end-->
426
    </div>
427
    <div class="bottom">
428
      <div class="left">
429
        <div class="right"> &nbsp; </div>
430
      </div>
431
    </div>
432
  </div>
433
  <!-- /Add Shipping Detail End-->