Subversion Repositories SmartDukaan

Rev

Rev 572 | Rev 637 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#set($Integer = 0)
#if($defaultAddressId)
        #set($defaultid = $Integer.parseInt($defaultAddressId))
#else
        #set($defaultid = 0)
#end

<!-- Add Shipping Detail Start-->
  <script type="text/javascript">
      $(document).ready(function(){
         $('#addAdrBtn').click(function(){
                         $('#newShipAdr').show();                        
                         scrollWin();
             });
                 function scrollWin(){
                        $('html, body').animate({
                        scrollTop: $("#newShipAdr").offset().top
                        }, 2000);
                        }
                 
      });
          
          
          function addNewAdress()
          {     
                
                var shipName = document.getElementById('shipName');
                var shipAddress1 = document.getElementById('shipAddress1');
                var shipAddress2 = document.getElementById('shipAddress2');
                var shipState = document.getElementById('shipState');
                var shipCity = document.getElementById('shipCity');
                var shipPin = document.getElementById('shipPin');
                var shipPhone = document.getElementById('shipPhone');
                var shipEmail = document.getElementById('shipEmail');
                        
                var error = "";
                
                if(!isEmpty(shipName)){
                        alert("Please enter your shipping name");
                    return false;       
                }
                else  if(!isEmpty(shipAddress1)){
                        alert("Please enter your shipping address");
                    return false;       
                }
                else  if(shipState.value == '0'){
                        alert("Please select your shipping state");
                    return false;       
                }
                else  if(!isEmpty(shipCity)){
                        alert("Please select your shipping city");
                    return false;       
                }
                else  if(!isEmpty(shipPin)){
                        alert("Please enter your shipping pincode");
                    return false;       
                }
                else  if(!isNumeric(shipPin)){
                        alert("Please enter numeric pincode number");
                    return false;       
                }
                else  if(!isEmpty(shipPhone)){
                        alert("Please enter your shipping phone");
                    return false;       
                }
                else  if(!isNumeric(shipPhone)){
                        alert("Please enter numeric digits");
                    return false;       
                }
                else if(!isEmpty(shipEmail)){
                    alert("Please enter your shipping Email");  
                        return false;       
                }
                else {
                        //alert("AJAX request to add shipping address. "); 
                        var addressString = '';
                        addressString = '<label>'+shipName.value+'</label><br />'+
                        '<label>'+shipAddress1.value+'</label><br />'+
                        '<label>'+shipAddress2.value+'</label><br />'+
                        '<label>'+shipCity.value+'</label><br />'+
                        '<label>'+shipState.value+'</label><br />'+
                        '<label>Pin: '+shipPin.value+'</label><br />'+
                        '<label>Phone: '+shipPhone.value+' </label><br />'+
                        '<label>Email: '+shipEmail.value+' </label>';
                        document.getElementById('shipAddressContainer').innerHTML = '';
                        document.getElementById('shipAddressContainer').innerHTML = addressString;
                        document.getElementById('newShipAdr').style.display = 'none';
                        
                         // alert("AJAX request to add shipping address. ");
                         
                         jQuery.ajax({
                                  type: "POST",
                                  url: "./shipping",
                                  data: "action=addnew&customername="+shipName.value+"&line1="+shipAddress1.value+"&line2="+shipAddress2.value+"&city="+shipCity.value
                                  +"&state="+shipState.value+"&pincode="+shipPin.value+"&mobilenumber="+shipPhone.value+"&country=India",
                                  success: function(msg){
                                //         alert( "Data Saved: " + msg );
                                        $("#addressid").val(msg);
                                  }
                         });

                        return false;
                }       
                        
        }       
        
        function resetShipForm(){
                document.getElementById('shipName').value = '';
                document.getElementById('shipAddress1').value = '';
                document.getElementById('shipAddress2').value = '';
                document.getElementById('shipState').value = '0';
                document.getElementById('shipCity').value = '0';
                document.getElementById('shipPin').value = '';
                document.getElementById('shipPhone').value = '';
                document.getElementById('shipEmail').value = '';
        }
        
        function changeShipAddress(id){
                 addressId = id.substring(20);
                 /*
                 alert("TODO AJAX request to change shipping address. " + addressId);
                         jQuery.ajax({
                                  type: "POST",
                                  url: "./shipping",
                                  data: "action=change&addressid="+addressId,
                                  success: function(msg){
                                           alert( "Data Saved: " + msg );
                                        $("#addressid").val(msg);
                                  }
                         });
                */
                 $("#addressid").val(addressId);
                 document.getElementById('shipAddressContainer').innerHTML = document.getElementById(id).innerHTML;
                 //document.getElementById('newShipAdr').style.display = 'none';
                 $('#newShipAdr').hide();
                 
        }
         
         </script>
         
  <div id="registration">
    <div class="top">
      <div class="left">
        <div class="right"> &nbsp; </div>
      </div>
    </div>
    <div class="middle">
      <div class="mid-inner">
      
      <p style="color:red;" align="center">$errorMsg</p>
                <!-- Block 1 -->
                <div class="padding-top17">
                <!-- Block-1 Right-->
                                #if($items)
                        <div class="shipping-block1-R" style="height:225px; overflow-y:auto;">
                        <table cellpadding="0" cellspacing="0" width="100%" class="estimate-table" >
                                <thead>
                                <tr>
                                        <th width="36%">Item</th>
                                <th width="29%">Delivery Estimate</th>
                                <th width="10%" class="quantity">Qty.</th>
                                <th width="25%" class="last">Total Price</th>
                                </tr>
                                </thead>
                        <tbody>
                                                        #foreach($item in $items)
                                <tr>
                                        <td>$item.get("ITEM_NAME")</td>
                                        <td>within $item.get("SHIPPING_TIME") hours</td>
                                <td class="quantity">$item.get("ITEM_QUANTITY")</td>
                                <td>Rs. $item.get("TOTAL_PRICE")</td>
                                </tr>
                                                        #end
                                                        <tr align="right">
                                <td colspan="4" class="total-amount">Total Amount: Rs. $totalamount</td>
                            </tr>
                        </tbody>
                        </table>
                   <div align="right" class="proceed-bttn">
                                <label class="floatLeft" style="margin-top: 3px;">We accept all major credit cards and debit cards &nbsp;</label>
                          <div class="bigImgButton floatLeft">
                            <div class="left">
                              <div class="right">
                                <div class="center">
                                                                  <form action="./order" method="post">
                                                                        <input type="hidden" id="addressid" name="addressid" value="$defaultid" >
                                                                        <input type="submit" name="btnSearch"  id="" value="Proceed to Pay" class="button" />
                                                                  </form>
                                </div>
                              </div>
                            </div>
                            <div class="clearBoth"></div>
                                  </div>
                          <div class="clearBoth"></div>
                   </div> 
                </div><!-- Block-1 Right End-->
                                #else
                                <div class="shipping-block1-R" style="height:225px; overflow-y:auto;">
                                        <label class="floatLeft" style="margin-top: 3px;">Your cart is empty. &nbsp;</label>
                                </div>  
                                #end    
                <!-- Block-1 Left-->
                <div class="shipping-block1-L">
                        <div class="ship-address-block">        
                                <h2>Shipping Address</h2>
                        <div class="ship-address-inner" style="height:200px; overflow-y:auto;">
                                                        <div id="shipAddressContainer">
                                                        #foreach($address in $addresses)
                                                        #if($defaultid == $address.getId())
                                                                #if($address.getName())
                                                                        <label>$address.getName()</label><br />
                                                                #end
                                                                #if($address.getLine1())
                                                                        <label>$address.getLine1() </label><br />
                                                                #end    
                                                                #if($address.getLine2())
                                                                        <label>$address.getLine2()</label><br />
                                                                #end
                                                                #if($address.getCity()) 
                                                                        <label>$address.getCity()</label><br />
                                                                #end
                                                                #if($address.getState())
                                                                        <label>$address.getState()</label><br />
                                                                #end
                                                                #if($address.getPin())  
                                                                        <label>Pin: $address.getPin()</label><br />
                                                                #end
                                                                #if($address.getPhone())
                                                                        <label>Mob: $address.getPhone() </label><br />
                                                                #end                    
                                                        #end
                                                        #end
                                                        </div>
                                                          <div class="ship-address-bttn" style="margin-top: 20px;">
                                <div class="bigImgButton">
                                <div class="left">
                                  <div class="right">
                                    <div class="center">
                                      <input type="button" name="addAdrBtn"  id="addAdrBtn" value="Ship to Another Address" class="button" />
                                    </div>
                                  </div>
                                </div>
                              </div>
                                </div>
                             <div class="clearBoth"></div>     
                        </div>

                        </div>
                </div><!-- Block-1 Left End-->
                <div class="clearBoth"></div>
            </div><!-- Block 1 End-->
             <div class="clearBoth"></div>
             <!-- Block 2 -->   
             <div class="padding-top17" style="display: none;" id="newShipAdr">
                <!-- Block 2 Right -->
                <div class="shipping-block2-L" style="margin-right:15px; ">
                        <h2 class="mid-innerHeading">Other Addresses on Record</h2>
                                        <div style="height:355px; overflow-y:auto">
                                        
                                        #foreach($address in $addresses)
                                        #if($defaultid != $address.getId())     
                                        <div class="ship-address-block">
                        <div class="ship-address-inner">
                                                        <div id="shipAddressContainer$address.getId()">
                                                                #if($address.getName())
                                                                        <label>$address.getName()</label><br />
                                                                #end
                                                                #if($address.getLine1())
                                                                        <label>$address.getLine1() </label><br />
                                                                #end    
                                                                #if($address.getLine1())
                                                                        <label>$address.getLine2()</label><br />
                                                                #end
                                                                #if($address.getCity()) 
                                                                        <label>$address.getCity()</label><br />
                                                                #end
                                                                #if($address.getState())
                                                                        <label>$address.getState()</label><br />
                                                                #end
                                                                #if($address.getPin())  
                                                                        <label>Pin: $address.getPin()</label><br />
                                                                #end
                                                                #if($address.getPhone())
                                                                        <label>Mob: $address.getPhone() </label><br />
                                                                #end                    
                        
                                                        </div>  
                            <div class="ship-address-bttn">
                                <div class="bigImgButton">
                                <div class="left">
                                  <div class="right">
                                    <div class="center">
                                      <input type="submit" name="btnSearch" onclick="changeShipAddress('shipAddressContainer$address.getId()')"  id="" value="Ship to this Address" class="button" />
                                    </div>
                                  </div>
                                </div>
                              </div>
                                </div>
                             <div class="clearBoth"></div>     
                        </div>
                        </div>
                                        #end
                                        #end
                                        
                                 </div> 
                </div>
                                
                                
                                
                                <div class="" style="width:424px; float:left;">
                                <div class="ship-address-block">
                                <h2>Specify a New Address</h2>
                        <div class="ship-address-form">
                                <form name="newAdrFrm" method="post" onsubmit="return addNewAdress();">
                                 <div class="register-row">
                                      <label><sup>*</sup><span> Name:</span></label>
                                      <div class="imgTextBox">
                                        <div class="left">
                                          <div class="right">
                                            <div class="center">
                                              <input type="text" id="shipName" name="" value="" class="textbox" />
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                      <div class="clearBoth"></div>
                                 </div>
                                 <div class="register-row">
                                      <label><sup>*</sup><span> Address:</span></label>
                                      <div class="imgTextBox">
                                        <div class="left">
                                          <div class="right">
                                            <div class="center">
                                              <input type="text" id="shipAddress1" name="" value="" class="textbox" />
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                      <div class="clearBoth"></div>
                                 </div>
                                 <div class="register-row">
                                      <label>&nbsp;</label>
                                      <div class="imgTextBox">
                                        <div class="left">
                                          <div class="right">
                                            <div class="center">
                                              <input type="text" id="shipAddress2" name="" value="" class="textbox" />
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                      <div class="clearBoth"></div>
                                 </div>
                                <div class="register-row">
                                  <label><sup>*</sup><span>State</span></label>
                                  <select class="select_state" id="shipState">
                                    <option value="0">Select State</option>
                                                                         <option value="delhi">Delhi</option>
                                  </select>
                                  <div class="clearBoth"></div>
                                </div>
                                 <div class="register-row">
                                      <label><sup>*</sup><span>City:</span></label>
                                      <div class="imgTextBox" style="width: 65px;">
                                        <div class="left">
                                          <div class="right">
                                            <div class="center">
                                              <input type="text" id="shipCity" name="" value="" class="textbox" style="width: 60px;" />
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                      <div class="clearBoth"></div>
                                 </div>
                                 <div class="register-row">
                                      <label><sup>*</sup><span>Pin Code:</span></label>
                                      <div class="imgTextBox" style="width: 65px;">
                                        <div class="left">
                                          <div class="right">
                                            <div class="center">
                                              <input type="text" id="shipPin" name="" value="" class="textbox textbox-pincode" style="width: 60px;" />
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                      <div class="clearBoth"></div>
                                 </div>
                                 <div class="register-row">
                                  <label><sup>*</sup><span>Phone:</span></label>
                                  <div class="imgTextBox">
                                    <div class="left">
                                      <div class="right">
                                        <div class="center">
                                          <input type="text" id="shipPhone" name="" value="" class="textbox" />
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                  <div class="clearBoth"></div>
                                </div>
                                <div class="register-row">
                                  <label><span>Email:</span></label>
                                  <div class="imgTextBox">
                                    <div class="left">
                                      <div class="right">
                                        <div class="center">
                                          <input type="text" id="shipEmail" name="" value="" class="textbox" />
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                  <div class="clearBoth"></div>
                                </div>
                                <div class="ship-address-bttn">
                                    <div class="bigImgButton floatLeft">
                                    <div class="left">
                                      <div class="right">
                                        <div class="center">
                                                 <input type="submit" name="submitAddress"  id="submitAddress" value="Ship to this Address" class="button" />
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                    <div class="bigImgButton floatLeft" style="margin: 0 17px 0 5px;" >
                                    <div class="left">
                                      <div class="right">
                                        <div class="center">
                                          <input type="button" name="btnSearch" onclick="resetShipForm();" id="" value="Cancel" class="button button1" />
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                <div class="clearBoth"></div>
                                    
                                    
                                </div>
                                 <div class="clearBoth"></div>
                            </form>
                        </div>
                        </div>
                </div><!-- Block 2 Right End-->
                
                                <div class="clearBoth"></div>
             </div><!-- Block 2 End-->  
                 <div class="clearBoth"></div>
             <div class="padding-top17">
                        <a href="#"><img src="images/secured.png" alt="" width="105" height="52" /></a>
             </div>     <br />
      </div><!-- mid inner end-->
    </div>
    <div class="bottom">
      <div class="left">
        <div class="right"> &nbsp; </div>
      </div>
    </div>
  </div>
  <!-- /Add Shipping Detail End-->