<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<?= $this->include('templates/admin/header'); ?>
<div class="indexTable_wrapper">
  <div class="indexTable_head">
    <?= form_open(current_url(), array("method" => "get")) ?>
    <ul class="nav">
      조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldForm_FirewallHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
    <?= $this->include('templates/admin/index_head'); ?>
    </ul>
    <?= form_close(); ?>
  </div>
  <div class="indexTable_body">
    <?= form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
    <table class="table table-bordered table-hover table-striped indexTable ">
      <tr>
        <td>번호</td>
        <?php foreach ($fields as $field) : ?><td><?= getFieldIndex_Column_FirewallHelper($field, $order_field, $order_value) ?></td><?php endforeach; ?>
        <td>작업</td>
      </tr>
      <?php $i = 0; ?>
      <?php $old_zone_uid = '' ?>
      <?php foreach ($rows as $row) : ?>
        <tr id="<?= $row['uid'] ?>" <?= $row['paused'] != 'on' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
          <td>
            <?= form_checkbox(["id" => "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?>
            <?= anchor(current_url() . '/sync/' . $row['uid'], $total_count - (($page - 1) * $per_page + $i)) ?>
          </td>
          <?php foreach ($fields as $field) : ?>
            <td nowrap><?= getFieldIndex_Row_FirewallHelper($field, $row, $fieldFilters, $fieldFormOptions, array(), $old_zone_uid) ?></td>
          <?php endforeach; ?>
          <td><?= anchor(current_url() . '/delete/' . $row['uid'], ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
        </tr>
        <?php $i++; ?>
        <?php $old_zone_uid = $row['zone_uid']; ?>
      <?php endforeach; ?>
    </table>
    <ul class="nav justify-content-center">
      <li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
      <?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldForm_FirewallHelper($field, DEFAULT_EMPTY, $fieldFormOptions) ?></li><?php endforeach; ?>
      <li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?></li>
    </ul>
    <?= form_close(); ?>
  </div>
  <div class="indexTable_tail">
    <?= $pagination ?>
  </div>
</div>
<?= $this->include('templates/admin/footer'); ?>
<?= $this->include('templates/admin/cloudflare/select2.php'); ?>
<?= $this->endSection() ?>