<?php $this->insert('iso_block_panel', $this->arrData); ?>

<div id="tl_buttons">
<?php echo implode(' &nbsp; :: &nbsp ', $this->buttons); ?>
</div>

<h2 class="sub_headline"><?php echo $this->headline; ?></h2>

<?php echo \Message::generate(true); ?>

<div class="tl_listing_container list_view mod_iso_reports <?php echo $this->class; ?>">


<?php $GLOBALS['TL_CSS'][] = \Haste\Util\Debug::uncompressedFile('system/modules/isotope_reports/assets/xcharts/xcharts.min.css'); ?>
<figure style="width:100%; height:300px" id="report-data"></figure>
<script src="<?php echo \Haste\Util\Debug::uncompressedFile('system/modules/isotope_reports/assets/d3.v3/d3.v3.min.js'); ?>"></script>
<script src="<?php echo \Haste\Util\Debug::uncompressedFile('system/modules/isotope_reports/assets/xcharts/xcharts.min.js'); ?>"></script>
<script>
window.addEvent('domready', function() {
    window.xchart_report = new xChart('line-dotted', {
        'xScale':'ordinal',
        'yScale':'linear',
        'main': <?php echo json_encode(array_values($this->chart)); ?>
    }, '#report-data', {
        tickFormatX: <?= $this->periodFormat ?>
    });
});
</script>
<ul class="currencies">
<?php $i=0; foreach ($this->chart as $currency => $data): ?>
    <li class="color<?php echo $i++; ?>"><input type="checkbox" class="checkbox" id="toggle_<?php echo strtolower($currency); ?>" checked="checked" onchange="document.getElement('#report-data <?php echo $data['className']; ?>').setStyle('display', (this.checked ? 'block' : 'none'));"> <label for="toggle_<?php echo strtolower($currency); ?>"><?php echo $currency; ?></label></li>
<?php endforeach; ?>
</ul>


<div class="iso_report_container">
<table class="iso_report tl_listing showColumns">
<?php if($this->data['header']): ?>
<thead>
	<tr>
<?php foreach($this->data['header'] as $col): ?>
		<th<?php if($col['colspan']): ?> colspan="<?php echo $col['colspan']; ?>"<?php endif; ?> class="tl_folder_tlist<?php if($col['class']): ?> <?php echo $col['class']; ?><?php endif; ?>"<?php echo $col['attributes']; ?>><?php echo is_array($col['value']) ? implode('<br>', $col['value']) : $col['value']; ?></th>
<?php endforeach; ?>
	</tr>
</thead>
<?php endif; ?>
<?php if($this->data['footer']): ?>
<tfoot>
	<tr>
<?php foreach($this->data['footer'] as $col): ?>
		<td<?php if($col['colspan']): ?> colspan="<?php echo $col['colspan']; ?>"<?php endif; ?> class="tl_folder_tlist<?php if($col['class']): ?> <?php echo $col['class']; ?><?php endif; ?>"<?php echo $col['attributes']; ?>><?php echo is_array($col['value']) ? implode('<br>', $col['value']) : $col['value']; ?></td>
<?php endforeach; ?>
	</tr>
</tfoot>
<?php endif; ?>
<tbody>
<?php foreach($this->data['rows'] as $row): ?>
	<tr<?php if($row['class']): ?> class="<?php echo $row['class']; ?>"<?php endif; ?><?php echo $row['attributes']; ?> onmouseover="Theme.hoverRow(this,1)" onmouseout="Theme.hoverRow(this,0)">
<?php foreach($row['columns'] as $col): ?>
		<<?php echo $col['header'] ? 'th' : 'td'; ?><?php if($col['colspan']): ?> colspan="<?php echo $col['colspan']; ?>"<?php endif; ?> class="tl_file_list<?php if($col['class']): ?> <?php echo $col['class']; ?><?php endif; ?>"<?php echo $col['attributes']; ?>><?php echo is_array($col['value']) ? implode('<br>', $col['value']) : $col['value']; ?></<?php echo $col['header'] ? 'th' : 'td'; ?>>
<?php endforeach; ?>
	</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>

</div>
