<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Portal Pulsa / Java H2H</title>
    <?php include_once(VIEWPATH.'includes/head.php'); ?>
  </head>
  <body>
    <?php include_once(VIEWPATH. 'admin/_navbar.php'); ?>
    <div class="container">
      <ul class="breadcrumb">
        <li><a href="<?php echo site_url();?>"><i class="fa fa-home"></i></a></li>
        <li><a href="<?php echo site_url('admin');?>">Admin Panel</a></li>
        <li class="active"><span>Portal Pulsa / Java H2H</span></li>
      </ul>
      <div class="row">
        <div class="col-sm-12 col-md-12">
          <div class="alert alert-info"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>Portal Pulsa API adalah layanan transaksi yang diberikan kepada member Portal Pulsa, jika kamu ingin menggunakan modul ini silakan <a class="alert-link" href="http://portalpulsa.com/?reff=P23369" target="_blank">klik di sini</a> untuk mendaftar.<br />Modul ini juga bisa digunakan untuk server <a href="http://javah2h.com" class="alert-link" target="_blank">JavaH2H.com</a>.</div>
          <?php if (!$servers):?>
          <div class="alert alert-warning">Belum ada daftar Server.</div>
          <?php else:?>
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3><i class="fa fa-server"></i> Server</h3>
            </div>
              <div class="table-responsive">
                <table class="table table-bordered table-hover" style="margin-bottom: 0;">
                  <thead>
                    <tr>
                      <th>Nama Server</th>
                      <th>Jalur Transaksi</th>
                      <th>API Server</th>
                      <th>User ID</th>
                      <th style="text-align: center; width: 54px;">Status</th>
                      <th style="text-align: center; width: 73px;">Tindakan</th>
                    </tr>
                  </thead>
                  <tbody>
                    <?php
                    foreach ($servers as $server):
                    $sv_data = json_decode($server->sv_data, true);
                    ?>
                    <tr>
                      <td><a href="<?php echo site_url('admin/pengaturan/server/edit/'.$server->sv_id);?>"><?php echo html_escape($server->sv_nama)?></a></td>
                      <td><?php echo $this->server_model->gateway_label($server->sv_gateway);?></td>
                      <td><?php echo (isset($sv_data['portalpulsa']) && $sv_data['portalpulsa']['server'] != '' ? ($sv_data['portalpulsa']['server'] == 'javah2h' ? 'Java H2H' : 'Portal Pulsa') : '');?></td></td>
                      <td><?php echo isset($sv_data['portalpulsa']) ? $sv_data['portalpulsa']['userid'] : '';?></td>
                      <td style="text-align: center; width: 54px;"><?php echo (isset($sv_data['portalpulsa']) ? ($sv_data['portalpulsa']['status'] == 1 ? '<span class="text-success" data-toggle="tooltip" data-title="Aktif"><i class="fa fa-check"></i></span>' : '<span class="text-danger" data-toggle="tooltip" data-title="Tidak aktif"><i class="fa fa-times"></i></span>') : '');?></td>
                      <td style="text-align: center; width: 73px;"><a style="margin-right: 4px;" class="btn btn-default btn-xs" href="<?php echo site_url('admin/modules/portalpulsa/login/'.$server->sv_id);?>" title="Masuk"><i class="fa fa-sign-in"></i></a><a style="margin-left: 4px;" class="btn btn-danger btn-xs" data-toggle="modal" data-target="#myModal" href="<?php echo site_url('admin/modules/portalpulsa/delete-data/'.$server->sv_id);?>" title="Hapus Data"><i class="fa fa-times"></i></a></td>
                    </tr>
                    <?php endforeach;?>
                  </tbody>
                </table>
              </div>
          </div>
          <?php endif;?>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
  </body>
</html>