<?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_default
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>

<script type="text/javascript">
//<![CDATA[
function changeDiagramsPeriod(periodObj) {
    periodParam = periodObj.value ? 'period/' + periodObj.value + '/' : '';
<?php foreach ($this->getChild('diagrams')->getTabsIds() as $tabId): ?>
    ajaxBlockParam = 'block/tab_<?php echo $tabId ?>/';
    ajaxBlockUrl = '<?php echo $this->getUrl('*/*/ajaxBlock', array('_current' => true, 'block' => '', 'period' => '')) ?>' + ajaxBlockParam + periodParam;
    tabContentElementId = '<?php echo $this->getChild('diagrams')->getId() ?>_<?php echo $tabId ?>_content';
    new Ajax.Updater(tabContentElementId, ajaxBlockUrl, {
        method: 'post',
        parameters: {isAjax: 'true', form_key: FORM_KEY}
    });
<?php endforeach; ?>
}

function toggleCal(id) {
    $('dashboard_'+id+'_cal_div').toggle();
    $('dashboard_'+id+'_range_div').toggle();
}
//]]>
</script>
<div class="content-header">
    <table cellspacing="0">
        <tr>
            <td><h3 class="head-dashboard"><?php echo $this->__('Dashboard') ?></h3></td>
        </tr>
    </table>
</div>
<div class="dashboard-container">
    <?php echo $this->getChildHtml('store_switcher') ?>
    <table cellspacing="25" width="100%">
        <tr>
            <td><?php echo $this->getChildHtml('sales') ?>
                <div class="entry-edit">
                    <div class="entry-edit-head"><h4><?php echo $this->__('Last 5 Orders') ?></h4></div>
                    <fieldset class="np"><?php echo $this->getChildHtml('lastOrders'); ?></fieldset>
                </div>
                <div class="entry-edit">
                    <div class="entry-edit-head"><h4><?php echo $this->__('Last 5 Search Terms') ?></h4></div>
                    <fieldset class="np"><?php echo $this->getChildHtml('lastSearches'); ?></fieldset>
                </div>
                <div class="entry-edit">
                    <div class="entry-edit-head"><h4><?php echo $this->__('Top 5 Search Terms') ?></h4></div>
                    <fieldset class="np"><?php echo $this->getChildHtml('topSearches'); ?></fieldset>
                </div>
            </td>
            <td>
                <div class="entry-edit" style="border:1px solid #ccc;">
                    <?php echo $this->getChildHtml('diagrams') ?>
                        <div id="diagram_tab_content"></div>
                    <div style="margin:20px;">
                        <?php echo $this->getChildHtml('totals') ?>
                    </div>
                    <div style="margin:20px;">
                        <?php echo $this->getChildHtml('grids') ?>
                        <div id="grid_tab_content"></div>
                    </div>
                </div>
            </td>
        </tr>
    </table>
</div>
