<?php

use Jet\UI_dataGrid_column;
use Jet\UI;
use Jet\UI_icon;
use Jet\MVC_View;

/**
 * @var MVC_View $this
 * @var UI_dataGrid_column $column
 */
$column = $this->getRaw( 'element' );
$grid = $column->getGrid();

$column->setCustomTagAttribute('nowrap', 'nowrap');
?>
<th <?=$column->renderTagAttributes()?>>
	<?php if( $column->getAllowSort() ):
		if( $column->isSortByAsc() ):
			echo UI::icon( 'sort-amount-down-alt' )->setSize( UI_icon::SIZE_EXTRA_SMALL );
		else: ?>
			<a href="<?= $grid->getSortURL( $column->getName() ); ?>">
				<?= UI::icon( 'sort-amount-down-alt' )->setSize( UI_icon::SIZE_EXTRA_SMALL ) ?>
			</a>
		<?php endif;
	endif;
	
	echo $column->getTitle();
	
	if( $column->getAllowSort() ):
		if( $column->isSortByDesc() ):
			echo UI::icon( 'sort-amount-down' )->setSize( UI_icon::SIZE_EXTRA_SMALL );
		else: ?>
			<a href="<?= $grid->getSortURL( $column->getName(), true ); ?>">
				<?= UI::icon( 'sort-amount-down' )->setSize( UI_icon::SIZE_EXTRA_SMALL ) ?>
			</a>
		<?php endif;
	endif; ?>
</th>
