<?php
namespace JetApplicationModule\Admin\Content\Articles;

use Jet\UI;

use Jet\Tr;
use Jet\MVC_View;

/**
 * @var MVC_View $this
 * @var Listing $listing
 */
$listing = $this->getRaw( 'listing' );
$grid = $listing->getGrid();
$filter_form = $listing->getFilterForm();

$router = $this->getController()->getControllerRouter();

$delete_uri = $router->action( 'delete' )->URI();

$grid->getColumn( 'date_time' )->addCustomCssStyle( 'width:200px;' );
$grid->getColumn( '_edit_' )->addCustomCssStyle( 'width:30px;' );


$grid->footer()->setPrepend( $this->render('list/footer') );


?>
<?= $filter_form->start() ?>
<div class="row toolbar" id="main-toolbar">
	<div class="col-xs-5 col-md-2">
		<?php if( ($add_uri = $router->action( 'add' )->URI()) ): ?>
			<?= UI::button_create( Tr::_( 'Create a new Article' ) )->setUrl( $add_uri ) ?>
		<?php endif; ?>
	</div>

	<div class="col-xs-7 col-md-3">
		<?=$listing->filter(Listing_Filter_Search::KEY)->renderForm()?>
	</div>
</div>
<?= $filter_form->end() ?>


<div class="row main-row">
	<div class="col-md-12 main-col">
		<form action="<?= $delete_uri ?>" method="post">
			<?= $grid->render() ?>
		</form>
	</div>
</div>
