<?php
defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;

$wa = $this->document->getWebAssetManager();
$wa->useScript('table.columns');
$wa->useScript('table.header');

$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>

<form action="<?php echo Route::_('index.php?option=com_grafik_keuangan&view=items'); ?>" method="post" name="adminForm"
	id="adminForm">
	<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>

	<div class="table-responsive">
		<table class="table table-striped" id="itemList">
			<thead>
				<tr>
					<th class="w-1 text-center">
						<?php echo HTMLHelper::_('grid.checkall'); ?>
					</th>
					<th scope="col" class="w-1 text-center d-none d-md-table-cell">
						<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
					</th>
					<th scope="col">
						<?php echo HTMLHelper::_('searchtools.sort', 'COM_GRAFIK_KEUANGAN_FIELD_CASE_TYPE_LABEL', 'a.case_type', $listDirn, $listOrder); ?>
					</th>
					<th scope="col" class="w-10">
						<?php echo HTMLHelper::_('searchtools.sort', 'COM_GRAFIK_KEUANGAN_FIELD_YEAR_LABEL', 'a.year', $listDirn, $listOrder); ?>
					</th>
					<th scope="col" class="w-10">
						<?php echo HTMLHelper::_('searchtools.sort', 'COM_GRAFIK_KEUANGAN_FIELD_COUNT_LABEL', 'a.count', $listDirn, $listOrder); ?>
					</th>
					<th scope="col" class="w-5 d-none d-md-table-cell">
						<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
					</th>
				</tr>
			</thead>
			<tbody>
				<?php foreach ($this->items as $i => $item): ?>
					<tr class="row<?php echo $i % 2; ?>">
						<td class="text-center">
							<?php echo HTMLHelper::_('grid.id', $i, $item->id); ?>
						</td>
						<td class="text-center d-none d-md-table-cell">
							<?php echo HTMLHelper::_('jgrid.published', $item->state, $i, 'items.', true); ?>
						</td>
						<td>
							<?php echo HTMLHelper::_('grid.link', Route::_('index.php?option=com_grafik_keuangan&task=item.edit&id=' . $item->id), $this->escape($item->case_type)); ?>
						</td>
						<td>
							<?php echo $this->escape($item->year); ?>
						</td>
						<td>
							<?php echo $this->escape($item->count); ?>
						</td>
						<td class="d-none d-md-table-cell">
							<?php echo $item->id; ?>
						</td>
					</tr>
				<?php endforeach; ?>
			</tbody>
		</table>
	</div>

	<?php echo $this->pagination->getListFooter(); ?>

	<input type="hidden" name="task" value="">
	<input type="hidden" name="boxchecked" value="0">
	<?php echo HTMLHelper::_('form.token'); ?>
</form>