<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     default_default
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php /* @var $this Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract */ ?>
<div class="create-order-sidebar-block" id="sidebar_data_<?php echo $this->getDataId() ?>">
    <div class="head">
        <h5><?php echo $this->getHeaderText() ?> <span class="normal">(<?php echo $this->getItemCount() ?>)</span></h5>
        <a href="#" title="<?php echo Mage::helper('sales')->__('Refresh') ?>" onclick="order.loadArea('sidebar_<?php echo $this->getDataId() ?>', 'sidebar_data_<?php echo $this->getDataId() ?>');return false;">
            <img src="<?php echo $this->getSkinUrl('images/fam_refresh.gif') ?>" alt="<?php echo Mage::helper('sales')->__('Refresh') ?>" width="16" height="16"/>
        </a>
    </div>
    <div class="content">
        <div class="auto-scroll">
        <?php if($this->getItemCount()): ?>
        <table style="width:100%">
            <col />
            <?php if ($this->canDisplayItemQty()): ?>
            <col width="20" />
            <?php endif; ?>
            <?php if($this->canDisplayPrice()): ?>
            <col width="60" />
            <?php endif; ?>
            <?php if($this->canRemoveItems()): ?>
            <col width="16" />
            <?php endif; ?>
            <col width="16" />
            <tr>
                <th><?php echo Mage::helper('sales')->__('Item') ?></th>
                <?php if ($this->canDisplayItemQty()): ?>
                <th class="a-center"><?php echo Mage::helper('sales')->__('Qty') ?></th>
                <?php endif; ?>
                <?php if($this->canDisplayPrice()): ?>
                <th><?php echo Mage::helper('sales')->__('Price') ?></th>
                <?php endif; ?>
                <?php if($this->canRemoveItems()): ?>
                <th class="a-center"><img src="<?php echo $this->getSkinUrl('images/fam_bin.gif') ?>" alt="<?php echo Mage::helper('sales')->__('Remove') ?>" title="<?php echo Mage::helper('sales')->__('Remove') ?>" width="16" height="16"/></th>
                <?php endif; ?>
                <th class="a-center"><img src="<?php echo $this->getSkinUrl('images/fam_package_go.gif') ?>" alt="<?php echo Mage::helper('sales')->__('Add To Order') ?>" title="<?php echo Mage::helper('sales')->__('Add To Order') ?>" width="16" height="16"/></th>
            </tr>
            <?php foreach ($this->getItems() as $_item): ?>
            <tr>
                <td><?php echo $this->htmlEscape($_item->getName()) ?></td>
                <?php if ($this->canDisplayItemQty()): ?>
                <td class="a-center">
                    <?php if ($_item->getProduct()->getTypeId() != Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE): ?>
                        <?php echo $_item->getQty()*1 ? $_item->getQty()*1 : 1 ?>
                    <?php endif; ?>
                </td>
                <?php endif; ?>
                <?php if($this->canDisplayPrice()): ?>
                <td><?php echo $this->convertPrice($_item->getPrice()) ?></td>
                <?php endif; ?>
                <?php if($this->canRemoveItems()): ?>
                <td class="a-center"><input type="checkbox" name="sidebar[remove][<?php echo $this->getItemId($_item) ?>]" value="<?php echo $this->getDataId() ?>" title="<?php echo Mage::helper('sales')->__('Remove') ?>"/></td>
                <?php endif; ?>
                <td class="a-center">
                    <?php if ($_item->getTypeId() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE && $this->getDataId() == 'wishlist'): ?>
                        <a href="#" onclick="order.sidebarConfigureProduct('<?php echo 'sidebar_wishlist' ?>', <?php echo $this->getProductId($_item) ?>, <?php echo $this->getItemId($_item) ?>); return false;"><img src="<?php echo $this->getSkinUrl('images/grouped_to_order_icon.png') ?>" class="v-middle" alt="<?php echo Mage::helper('sales')->__('Configure and Add to Order') ?>" title="<?php echo Mage::helper('sales')->__('Configure and Add to Order') ?>" width="16" height="16"/></a>
                    <?php elseif ($_item->getTypeId() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE): ?>
                        <a href="#" onclick="order.sidebarConfigureProduct('<?php echo 'sidebar' ?>', <?php echo $this->getProductId($_item) ?>); return false;"><img src="<?php echo $this->getSkinUrl('images/grouped_to_order_icon.png') ?>" class="v-middle" alt="<?php echo Mage::helper('sales')->__('Configure and Add to Order') ?>" title="<?php echo Mage::helper('sales')->__('Configure and Add to Order') ?>" width="16" height="16"/></a>
                    <?php else: ?>
                        <input type="checkbox" name="sidebar[<?php echo $this->getSidebarStorageAction() ?>][<?php echo $this->getIdentifierId($_item) ?>]" value="<?php echo $this->canDisplayItemQty() ? $_item->getQty()*1 : 1 ?>" title="<?php echo Mage::helper('sales')->__('Add To Order') ?>"/>
                    <?php endif; ?>
                </td>
            </tr>
            <?php endforeach; ?>
        </table>
        <?php else: ?>
            <p class="center"><?php echo Mage::helper('sales')->__('No items') ?></p>
        <?php endif ?>
        </div>
        <?php if ($this->getItemCount() && $this->canRemoveItems()): ?>
        <?php echo $this->getChildHtml('empty_customer_cart_button'); ?>
        <?php endif; ?>
    </div>
</div>
