<?php
defined('BASEPATH') or exit('No direct script access allowed');
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
    $is_modal = true;
else
    $is_modal = false;
?>
<?php if ($is_modal):?>
<div class="modal-header">
  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
  </button>
  <h4 class="modal-title"><?php echo html_escape($server->sv_nama);?></h4>
</div>
<div class="modal-body">
<?php else:?>
<!DOCTYPE html>
<html>
  <head>
    <title>Login <?php echo html_escape($server->sv_nama);?> | OtomaX API</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><a href="<?php echo site_url('admin/modules/otomax');?>">OtomaX</a></li>
        <li class="active"><span><?php echo html_escape($server->sv_nama);?></span></li>
      </ul>
      <div class="row">
        <div class="col-sm-4 col-md-3">
          <?php include_once(dirname(__FILE__).'/_sidebar.php');?>
        </div>
        <div class="col-sm-8 col-md-9">
          <div class="panel panel-default">
            <div class="panel-heading">
              <h3><i class="fa fa-sign-in"></i> Login</h3>
            </div>
            <div class="panel-body">
              <?php endif;?>
              <?php echo form_open();?>
                <div class="alert alert-info">
                  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  Silakan tonton video tutorial cara untuk mendapatkan data API di <a class="alert-link" href="https://youtu.be/Ri_6--mLWbw" target="_blank">https://youtu.be/Ri_6--mLWbw</a>.
                  <br/>
                  Pada video tersebut terdapat dua aplikasi yang digunakan yaitu aplikasi Server Pulsa dan aplikasi SSL Capture, silakan download aplikasi SLL capture di <a href="https://play.google.com/store/apps/details?id=com.minhui.networkcapture" target="_blank" class="alert-link">https://play.google.com/store/apps/details?id=com.minhui.networkcapture</a>.
                </div>
                <?php if ($validation_required):?>
                <div class="alert alert-warning">
                  <h4><i class="fa fa-exclamation-triangle"></i> Dibutuhkan Verifikasi</h4>
                  <p style="margin-bottom: 10px;">Silakan kirim SMS ke nomor SMS Center server pulsa kamu, berikut adalah isi pesannya:</p>
                  <textarea class="form-control" style="margin-bottom: 10px;" readonly="readonly"><?php echo $validation_required;?></textarea>
                  <p>Nomor HP yang mengirim SMS harus nomor <?php echo $this->otomax_api->decrypt($set['otomax_api']['data']['F1011']);?>, setelah mendapat balasan / konfirmasi bahwa pendaftaran aplikasi sukses silakan login kembali di sini.</p>
                </div>
                <?php endif;?>
                <div class="form-group">
                  <label>API URL</span></label>
                  <input type="url" class="form-control" name="url" value="<?php echo set_value('url', isset($set['otomax_api']) ? $set['otomax_api']['url'] : '');?>" maxlength="255" required="required"/>
                </div>
                <div class="form-group">
                  <label>Post Data <span class="text-muted">(Request Body)</span></label>
                  <textarea class="form-control" name="data" required="required" rows="10"><?php echo set_value('data', isset($set['otomax_api']) ? http_build_query($set['otomax_api']['data']) : '');?></textarea>
                </div>
                <?php if ($is_modal):?>
                <div class="row">
                  <div class="col-xs-6 col-sm-8">
                    <select class="form-control" name="jump">
                      <option value="" selected="selected">-- Lompat ke Menu --</option>
                      <option value="messenger">Messenger</option>
                      <option value="produk">Daftar Harga</option>
                      <option value="history-trx">History Transaksi</option>
                      <option value="history-mutasi">History Mutasi</option>
                      <option value="news">News</option>
                      <option value="akun">Info Akun</option>
                    </select>
                  </div>
                  <div class="col-xs-6 col-sm-4">
                    <button type="submit" class="btn btn-primary btn-block" name="submit" value="login">Login</button>
                  </div>
                </div>
                <?php else:?>
                <div>
                  <button type="submit" class="btn btn-primary" name="submit" value="login">Login</button>
                </div>
                <?php endif;?>
              <?php echo form_close();?>
              <?php if ($is_modal):?>
              </div>
              <?php else:?>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
  </body>
</html>
<?php endif;?>