<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<?= $this->include('templates/admin/header'); ?>
<div style="padding-top:5px; padding-bottom:5px;">
    <?= form_open(current_url(), array("method" => "get")) ?>
    <span>조건검색:<?php foreach ($fieldFilters as $field) : ?><?= getFieldForm_DdosHelper($field,$$field,$fieldFormOptions) ?><?php endforeach; ?></span>
    <span style="padding-left:30px;">검색어:<?= form_input('word',$word) ?></span>
    <span style="padding-left:30px;">검색일:<?= form_input('start',$start,array("class" => "calender")) ?><?= form_input('end',$end,array("class" => "calender")) ?></span>
    <span style="padding-left:10px;"><?= form_submit('', '검색', array("class" => "btn btn-outline btn-primary")); ?></span>
    <span style="padding-left:10px;"><?= anchor(current_url().'/excel?'.$uri->getQuery(),ICONS['EXCEL'],["class"=>"btn btn-sm btn-danger btn-circle","target" => "_self"]) ?></span>
    <div style="float:right;">
      <div style="text-align:right;">총계:<?=$total_count?> page:<?=$page?></div>
      <div style="text-align:right;"><?= form_dropdown('per_page', $pageOptions, $per_page, array('onChange' => 'this.form.submit()')) ?></div>
    </div>
    <?= form_close(); ?>
</div>
<?= 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_DdosHelper($field,$order_field,$order_value,$uri) ?></td><?php endforeach; ?>
    <td>작업</td>
  </tr>
  <?php $i = 0; ?>
  <?php $old_account_uid = ''?>
  <?php foreach ($rows as $row) : ?>
    <tr id="<?=$row['uid']?>" <?= $row['status'] != 'active' ? 'style="color:red;" rowcolor="red"' : 'style="color:black;" rowcolor="black"' ?>>
      <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_DdosHelper($field,$row,$fieldFilters,$fieldFormOptions,array(),$old_account_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_account_uid=$row['account_uid']; ?>
  <?php endforeach; ?>
</table>
<div style="text-align:center;">
  <span style="margin-right:30px;"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</span>
  <?php foreach ($fieldFilters as $field) : ?><span style="margin-right:30px;"><?= getFieldForm_DdosHelper($field,DEFAULT_EMPTY,$fieldFormOptions) ?></span><?php endforeach; ?>
  <span style="margin-right:130px;"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")); ?></span>
</div>
<?= form_close(); ?>
<div class="pagenation"><?= $pagenation ?></div>
<?= $this->include('admin/Cloudflare/zone/insert'); ?>
<?= $this->include('templates/admin/footer'); ?>
<?= $this->endSection() ?>