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

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;

HTMLHelper::_('behavior.core');

$items = $this->items ?? [];
?>
<form action="<?php echo Route::_('index.php?option=com_agenda_pimpinan&view=items'); ?>"
      method="post"
      name="adminForm"
      id="adminForm">

  <div class="alert alert-info">
    <?php echo Text::_('COM_AGENDA_PIMPINAN_ITEMS_INFO'); ?>
  </div>

  <?php if (empty($items)) : ?>
    <div class="alert alert-warning"><?php echo Text::_('COM_AGENDA_PIMPINAN_NO_ITEMS'); ?></div>
  <?php else : ?>
    <table class="table table-striped">
      <thead>
        <tr>
          <th style="width:1%"><?php echo Text::_('JGRID_HEADING_ID'); ?></th>
          <th><?php echo Text::_('COM_AGENDA_PIMPINAN_FIELD_TITLE'); ?></th>
          <th><?php echo Text::_('COM_AGENDA_PIMPINAN_FIELD_TANGGAL'); ?></th>
          <th><?php echo Text::_('COM_AGENDA_PIMPINAN_FIELD_LOKASI'); ?></th>
          <th><?php echo Text::_('COM_AGENDA_PIMPINAN_FIELD_JENIS'); ?></th>
        </tr>
      </thead>
      <tbody>
        <?php foreach ($items as $item) : ?>
        <tr>
          <td><?php echo (int) $item->id; ?></td>
          <td><?php echo htmlspecialchars((string) $item->title, ENT_QUOTES, 'UTF-8'); ?></td>
          <td><?php echo htmlspecialchars((string) $item->tanggal, ENT_QUOTES, 'UTF-8'); ?></td>
          <td><?php echo htmlspecialchars((string) $item->lokasi, ENT_QUOTES, 'UTF-8'); ?></td>
          <td><?php echo htmlspecialchars((string) $item->jenis_acara, ENT_QUOTES, 'UTF-8'); ?></td>
        </tr>
        <?php endforeach; ?>
      </tbody>
    </table>
  <?php endif; ?>

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