<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/LICENSE-M1.txt
 *
 * @category   AW
 * @package    AW_Mobile
 * @copyright  Copyright (c) 2010-2011 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/LICENSE-M1.txt
 */
?>
<div class="in-page">
    
    <div class="page-head">
        <h3><?php echo $this->__('Review Order') ?></h3>
    </div>
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>

    <?php if ($this->getShippingAddress()): ?>
    <div class="count-head">
        <h4><?php echo $this->__('Shipping Information') ?></h4>
    </div>       
    <div class="multishipping-shipping-container">
        <div class="shipping-to">
            <?php echo $this->__('Shipping Address') ?>&nbsp;<?php if ($this->getCanEditShippingAddress()):?>(<a href="<?php echo $this->getEditUrl() ?>"><?php echo $this->__('Change') ?></a>)<?php endif;?>
        </div>
        <div class="box-content">
            <address><?php echo $this->renderAddress($this->getShippingAddress())?></address>
        </div>
        <div class="shipping-header">
            <?php echo $this->__('Shipping Method') ?>
        </div>            

        <div class="box-content">

            <div class="box-content">
            <?php if ($this->getCanEditShippingMethod() || !$this->getCurrentShippingRate()):?>
                <?php if ($groups = $this->getShippingRateGroups()):?>
                    <?php $currentRate = $this->getCurrentShippingRate(); ?>
                    <form method="post" id="shipping_method_form" action="<?php echo $this->escapeHtml($this->getShippingMethodSubmitUrl()) ?>">
                        <fieldset>
                            <select name="shipping_method" id="shipping_method" style="width:250px;" class="required-entry">
                            <?php if (!$currentRate):?>
                                <option value=""><?php echo $this->__('Please select a shipping method...') ?></option>
                            <?php endif;?>
                            <?php foreach ($groups as $code => $rates):?>
                                <optgroup label="<?php echo $this->getCarrierName($code) ?>" style="font-style:normal;">
                                <?php foreach ($rates as $rate):?>
                                    <option value="<?php echo $this->renderShippingRateValue($rate)?>"<?php echo ($currentRate === $rate) ? ' selected="selected"' : '' ;?>>
                                        <?php echo $this->renderShippingRateOption($rate)?>
                                    </option>
                                <?php endforeach;?>
                                </optgroup>
                            <?php endforeach;?>
                            </select>
                        </fieldset>
                        <p class="actions">
                            <button id="update_shipping_method_submit" type="submit" class="button"><span><span><?php echo $this->__('Update Shipping Method') ?></span></span></button>
                        </p>
                    </form>
                <?php else: ?>
                    <p><strong><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></strong></p>
                <?php endif;?>
            <?php else: ?>
                <p><strong><?php echo $this->renderShippingRateOption($this->getCurrentShippingRate())?></strong></p>
            <?php endif; ?>
            </div>
        </div>            
    </div>  
    <?php endif; ?>
    <div class="count-head">
        <h4><?php echo $this->__('Billing Information') ?></h4>
    </div> 
    <div class="multishipping-shipping-container">
        <div class="shipping-to">
            <?php echo $this->__('Payment Method') ?>(<a href="<?php echo $this->getEditUrl() ?>"><?php echo $this->__('Change') ?></a>)
        </div>    
        
            <div class="box-content">
                <?php echo $this->escapeHtml($this->getPaymentMethodTitle()) ?>
            </div>       
            <div class="shipping-header">
                <h3><?php echo $this->__('Billing Address') ?></h3>
            </div>
            <div class="box-content">
                <address>
                    <?php echo $this->renderAddress($this->getBillingAddress()) ?>
                </address>
                <?php echo $this->__('Payer Email: %s', $this->getBillingAddress()->getEmail()) ?>
            </div>        
    </div> 
    <div class="page-head">
        <h3><?php echo $this->__('Items in Your Shopping Cart') ?></h3>
    </div>
    <div class="multishipping-container cart">
        <div class="top-header">
            <?php echo $this->__('Items') ?><span class="separator"> | </span><a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit') ?></a>
        </div>                
        <div id="details-reload">
            <?php echo $this->getChildHtml('details') ?>
        </div>                                
    </div>
    <form method="post" id="order_review_form" action="<?php echo $this->getPlaceOrderUrl() ?>">
        
        
        
        <div class="a-center button-space" id="review-buttons-container">
            <button id="review_button" value="<?php echo $this->__('Place Order') ?>" class="form-button"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
            <button type="submit" id="review_submit" value="<?php echo $this->__('Place Order') ?>" class="form-button"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
            <span class="please-wait" id="review-please-wait" style="display:none;">
                <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Submitting order information...') ?>" title="<?php echo $this->__('Submitting order information...') ?>" class="v-middle" /> <?php echo $this->__('Submitting order information...') ?>
            </span>
        </div>
    </form>
    <script type="text/javascript">
    //<![CDATA[
    // submit buttons are not needed when submitting with ajax
    $('review_submit').hide();
    if ($('update_shipping_method_submit')) {
        $('update_shipping_method_submit').hide();
    }

    PayPalExpressAjax = new OrderReviewController($('order_review_form'), $('review_button'),
        $('shipping_method'), $('shipping_method_form'), 'details-reload'
    );
    PayPalExpressAjax.addPleaseWait($('review-please-wait'));
    //]]>
    </script>
</div>