<?php require admin_view('static/header') ?>
<div class="container-fluid">
   <div class="row">
      <div class="col-lg-12">
         <a href="
            <?= admin_url('logs') ?>" class="btn btn-default">Kullanıcı Logları
         </a>
         <a href="
            <?= admin_url('logs/provider') ?>" class="btn btn-default">Sağlayıcı Logları
         </a>
         <a href="
            <?= admin_url('logs/automation') ?>" class="btn btn-default">Otomasyon Logları
         </a>
         <a href="
            <?= admin_url('logs/crons') ?>" class="btn btn-default">Cron Logları
         </a>
         <?php if (!route(2)) : ?>
            <div class="pull-right">
               <form class="form-inline" action="" method="get">
                  <div class="input-group">
                     <input type="text" name="search" class="form-control" value="" placeholder="Üye ara...">
                     <span class="input-group-btn">
                        <select class="form-control" style="border-radius:0;" name="search_type">
                           <option value="username">Kullanıcı Adı</option>
                        </select>
                        <button type="submit" class="btn btn-default">
                           <span class="fa fa-search" aria-hidden="true"></span>
                        </button>
                     </span>
                  </div>
               </form>
            </div>
            <div class="panel panel-default" style="margin-top:20px;margin-bottom:0;border-bottom-left-radius: 0;border-bottom-right-radius: 0;">
               <div class="panel-body">
                  <small>
                     <b>Seçili Logları:</b>
                  </small>
                  <button onclick="log_multiple_delete();" class="btn btn-default btn-xs">Sil</button>
                  <button onclick="toplusec();" class="btn btn-default btn-xs pull-right">Tüm Logları Seç</button>
               </div>
            </div>
            <div class="panel panel-default" style="border-radius:0;margin:0;">
               <table id="table" class="table order-table table-grey" style="margin-bottom:0;">
                  <thead>
                     <tr>
                        <th></th>
                        <th>ID</th>
                        <th>Kullanıcı</th>
                        <th>Detay</th>
                        <th>IP Adress</th>
                        <th>Tarih</th>
                        <th></th>
                     </tr>
                  </thead>
                  <tbody>
                     <?php $i = 0; ?>
                     <?php foreach ($logs as $log) : ?>
                        <tr>
                           <td>
                              <input type="checkbox" id="checkbox<?= $i; ?>" name="checkbox<?= $log['log_id'] ?>" value='<?= $log['log_id'] ?>'>
                           </td>
                           <td>
                              <?= $log['log_id'] ?>
                           </td>
                           <td>
                              <a href="/admin/users?search=<?= $log['user_username'] ?>&search_type=username"><?= $log['user_username'] ?></a>
                           </td>
                           <td>
                              <?= $log['log_content'] ?>
                           </td>
                           <td>
                              <?= $log['log_ip'] ?>
                           </td>
                           <td>
                              <?= str_date(date('Y-m-d H:i:s', $log['log_time'])) ?>
                           </td>
                        </tr>
                        <?php $i++; ?>
                     <?php endforeach; ?>
                  </tbody>
               </table>
               <input type="hidden" id="totalcheckbox" name="totalcheckbox" value="<?= $i ?>">
            </div>
            <ul class="pagination">
               <?= $db->showPagination(admin_url(route(1) . '?' . $pageParam . '=[page]')); ?>
            </ul>
         <?php elseif (route(2) == "provider") : ?>
            <div class="panel panel-default" style="margin-top:20px;margin-bottom:0;border-bottom-left-radius: 0;border-bottom-right-radius: 0;">
               <div class="panel-body">
                  <small>
                     <b>Seçili Logları:</b>
                  </small>
                  <button onclick="provider_multiple_delete();" class="btn btn-default btn-xs">Sil</button>
                  <button onclick="toplusec();" class="btn btn-default btn-xs pull-right">Tüm Logları Seç</button>
               </div>
            </div>
            <div class="panel panel-default" style="border-radius:0;margin:0;">
               <table id="table" class="table order-table table-grey" style="margin-bottom:0;">
                  <thead>
                     <tr>
                        <th></th>
                        <th>ID</th>
                        <th>Servis ID</th>
                        <th>Detay</th>
                        <th>Tarih</th>
                        <th></th>
                     </tr>
                  </thead>
                  <tbody>
                     <?php $i = 0; ?>
                     <?php foreach ($logs as $log) : ?>
                        <tr>
                           <td>
                              <input type="checkbox" id="checkbox<?= $i; ?>" name="checkbox<?= $log['report_id'] ?>" value='<?= $log['report_id'] ?>'>
                           </td>
                           <td>
                              <?= $log['report_id'] ?>
                           </td>
                           <td>
                              <?= $log['report_service_id'] ?>
                           </td>
                           <td>
                              <?= $log['report_detail'] ?>
                           </td>
                           <td>
                              <?= str_date($log['report_date']) ?>
                           </td>
                        </tr>
                        <?php $i++; ?>
                     <?php endforeach; ?>
                  </tbody>
               </table>
               <input type="hidden" id="totalcheckbox" name="totalcheckbox" value="<?= $i ?>">
            </div>
            <ul class="pagination">
               <?= $db->showPagination(admin_url(route(1) . '/' . route(2) . '?' . $pageParam . '=[page]')); ?>
            </ul>
         <?php elseif (route(2) == "automation") : ?>
            <div class="panel panel-default" style="margin-top:20px;margin-bottom:0;border-bottom-left-radius: 0;border-bottom-right-radius: 0;">
               <div class="panel-body">
                  <small>
                     <b>Seçili Logları:</b>
                  </small>
                  <button onclick="automation_multiple_delete();" class="btn btn-default btn-xs">Sil</button>
                  <button onclick="toplusec();" class="btn btn-default btn-xs pull-right">Tüm Logları Seç</button>
               </div>
            </div>
            <div class="panel panel-default" style="border-radius:0;margin:0;">
               <table id="table" class="table order-table table-grey" style="margin-bottom:0;">
                  <thead>
                     <tr>
                        <th></th>
                        <th>ID</th>
                        <th>Servis ID</th>
                        <th>Detay</th>
                        <th>Tarih</th>
                        <th></th>
                     </tr>
                  </thead>
                  <tbody>
                     <?php $i = 0; ?>
                     <?php foreach ($logs as $log) : ?>
                        <tr>
                           <td>
                              <input type="checkbox" id="checkbox<?= $i; ?>" name="checkbox<?= $log['report_id'] ?>" value='<?= $log['report_id'] ?>'>
                           </td>
                           <td>
                              <?= $log['report_id'] ?>
                           </td>
                           <td>
                              <?= $log['report_service_id'] ?>
                           </td>
                           <td>
                              <?= $log['report_detail'] ?>
                           </td>
                           <td>
                              <?= str_date($log['report_date']) ?>
                           </td>
                        </tr>
                        <?php $i++; ?>
                     <?php endforeach; ?>
                  </tbody>
               </table>
               <input type="hidden" id="totalcheckbox" name="totalcheckbox" value="<?= $i ?>">
            </div>
            <ul class="pagination">
               <?= $db->showPagination(admin_url(route(1) . '/' . route(2) . '?' . $pageParam . '=[page]')); ?>
            </ul>

         <?php elseif (route(2) == "crons") : ?>
            <div class="panel panel-default" style="margin-top:20px;margin-bottom:0;border-bottom-left-radius: 0;border-bottom-right-radius: 0;">
               <div class="panel-body">
                  <small>
                     <b>Seçili Logları:</b>
                  </small>
                  <button onclick="crons_multiple_delete();" class="btn btn-default btn-xs">Sil</button>
                  <button onclick="toplusec();" class="btn btn-default btn-xs pull-right">Tüm Logları Seç</button>
               </div>
            </div>
            <div class="panel panel-default" style="border-radius:0;margin:0;">
               <table id="table" class="table order-table table-grey" style="margin-bottom:0;">
                  <thead>
                     <tr>
                        <th></th>
                        <th>ID</th>
                        <th>Cron Adı</th>
                        <th>Detay</th>
                        <th>Tarih</th>
                        <th></th>
                     </tr>
                  </thead>
                  <tbody>
                     <?php $i = 0; ?>
                     <?php foreach ($logs as $log) : ?>
                        <tr>
                           <td>
                              <input type="checkbox" id="checkbox<?= $i; ?>" name="checkbox<?= $log['crons_id'] ?>" value='<?= $log['crons_id'] ?>'>
                           </td>
                           <td>
                              <?= $log['crons_id'] ?>
                           </td>
                           <td>
                              <?= $log['crons_service_name'] ?>
                           </td>
                           <td>
                              <?= $log['crons_detail'] ?>
                           </td>
                           <td>
                              <?= str_date($log['crons_date']) ?>
                           </td>
                        </tr>
                        <?php $i++; ?>
                     <?php endforeach; ?>
                  </tbody>
               </table>
               <input type="hidden" id="totalcheckbox" name="totalcheckbox" value="<?= $i ?>">
            </div>
            <ul class="pagination">
               <?= $db->showPagination(admin_url(route(1) . '/' . route(2) . '?' . $pageParam . '=[page]')); ?>
            </ul>
         <?php endif; ?>
         
         
         
         
      </div>
   </div>
</div>
<?php require admin_view('static/footer') ?>