<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Akun Saya &gt; Transaksi Via Jabber</title>
    <?php include_once(VIEWPATH.'includes/head.php'); ?>
  </head>
  <body>
    <?php include_once(VIEWPATH.'includes/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('akun/profil');?>">Akun Saya</a></li>
        <li class="active"><span>Transaksi Via Jabber</span></li>
      </ul>
      <div class="row">
        <div class="col-sm-4 col-md-3">
          <?php include(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-comment-o"></i> Transaksi Via Jabber</h3>
            </div>
            <div class="panel-body">
              <?php if ($set['user'] == 'none'):?>
              <div class="alert alert-warning">Fitur transaksi melalui Jabber saat ini tidak tersedia.</div>
              <?php elseif ($set['user'] == 'verified' && !$this->user->verified):?>
              <div class="alert alert-warning">Fitur transaksi melalui Jabber hanya diperbolehkan untuk member terverifikasi.</div>
              <?php elseif ($set['user'] == 'reseller' && !$this->user->is_reseller):?>
              <div class="alert alert-warning">Fitur transaksi melalui Jabber hanya diperbolehkan untuk reseller.</div>
              <?php else:?>
              <div>
                <ul class="nav nav-tabs nav-justified" role="tablist">
                  <li role="presentation" class="active"><a href="#pengirim" aria-controls="pengirim" role="tab" data-toggle="tab">Daftar Pengirim</a></li>
                  <li role="presentation"><a href="#format_trx" aria-controls="format_trx" role="tab" data-toggle="tab">Format Transaksi</a></li>
                </ul>
                <div class="tab-content">
                  <div role="tabpanel" class="tab-pane fade in active" id="pengirim">
                    <?php if (count($senders) < $set['max']):?>
                    <div class="row" style="margin-top: 15px;">
                      <div class="col-sm-offset-6 col-sm-6 col-md-offset-9 col-md-3">
                        <a data-toggle="modal" data-target="#myModal" href="<?php echo site_url('akun/jabbertrx/tambah-pengirim');?>" class="btn btn-default btn-block"><i class="fa fa-plus"></i> Menambahkan</a>
                      </div>
                    </div>
                    <?php endif;?>
                    <?php if (!$senders):?>
                    <div class="alert alert-warning" style="margin-top: 15px;margin-bottom: 0;">Kamu belum memiliki daftar pengirim.</div>
                    <?php else:?>
                    <div class="list-group" style="margin-top: 15px;margin-bottom: 0;">
                      <?php foreach ($senders as $sender):?>
                      <a id="sender-<?php echo $sender->ct_id;?>" data-toggle="modal" data-target="#myModal" class="list-group-item" href="<?php echo site_url('akun/jabbertrx/view/'.$sender->ct_id);?>"><?php echo $sender->ct_blocked ? '<span class="text-danger"><i data-toggle="tooltip" title="Diblokir" class="fa fa-ban"></i></span>' : ($sender->ct_verified ? '<span class="text-success"><i data-toggle="tooltip" title="Terverifikasi" class="fa fa-check"></i></span>' : '<span class="text-muted"><i data-toggle="tooltip" title="Belum terverifikasi" class="fa fa-times"></i></span>');?> <?php echo html_escape($sender->ct_sender);?></a>
                      <?php endforeach;?>
                    </div>
                    <?php endif;?>
                  </div>
                  <div role="tabpanel" class="tab-pane fade" id="format_trx">
                    <div class="table-responsive" style="margin-top: 15px;">
                      <table class="table table-bordered">
                        <thead>
                          <tr>
                            <th>Jenis Transaksi</th>
                            <th>Format Transaksi</th>
                          </tr>
                        </thead>
                        <tbody>
                          <?php
                          foreach ($this->system->produk as $pr_k=>$pr_val) {
                            if ($pr_val->status == 'off')
                                continue;
                          ?>
                          <tr><td>Order <?php echo $pr_val->nama;?></td><td><?php echo (property_exists($pr_val->form,'id_plgn')) ? "KODE".html_escape($set['pemisah'])."".str_replace(' ','', strtoupper($pr_val->form->id_plgn->label))."".html_escape($set['pemisah'])."PIN".html_escape($set['pemisah'])."NOHPTUJUAN" : "KODE".html_escape($set['pemisah'])."NOHPTUJUAN".html_escape($set['pemisah'])."PIN";?></td></tr>
                          <?php } ?>
                          <?php if ($set['cek_saldo']):?>
                          <tr><td>Cek Saldo</td><td>S<?php echo html_escape($set['pemisah']);?>PIN</td></tr>
                          <?php endif;?>
                          <?php if ($set['deposit']):?>
                          <tr><td>Tambah Saldo</td><td>DEPOSIT<?php echo html_escape($set['pemisah']);?>JUMLAH<?php echo html_escape($set['pemisah']);?>PEMBAYARAN<?php echo html_escape($set['pemisah']);?>PIN</td></tr>
                          <?php endif;?>
                          <?php if ($set['history']):?>
                          <tr><td>Cek Riwayat Transaksi</td><td>LAP<?php echo html_escape($set['pemisah']);?>TANGGAL<?php echo html_escape($set['pemisah']);?>PIN</td></tr>
                          <?php endif;?>
                          <tr><td>Komplain</td><td>K<?php echo html_escape($set['pemisah']);?>PESAN</td></tr>
                        </tbody>
                      </table>
                    </div>
                    <ul class="list-unstyled" style="margin-bottom: 0;">
                      <li style="margin-bottom: 15px;">Untuk melihat kode - kode voucher / nominal yang tersedia silakan <a href="<?php echo site_url('harga');?>">kunjungi daftar harga</a>.</li>
                      <?php if ($set['deposit']):?>
                      <li style="margin-bottom: 15px;">Kode pembayaran deposit yang tersedia:
                        <ol><?php
                          $payments = array();
                          $deposit = json_decode($this->system->get_set('deposit'),true);
                          foreach($this->payment->get() as $payment) {
                            if ($payment->key != 'balance' && $payment->status == 'on' && in_array($payment->key, $deposit['payments'])) {
                              echo '<li>'.strtoupper(str_replace('_','', $payment->key)).'</> ('.html_escape($payment->nama).')</li>';
                            }
                          }
                        ?></ol>
                      </li>
                      <?php endif;?>
                      <li>Transaksi dikimkan ke salah satu Jabber Center berikut:
                        <ol><?php
                          foreach ($set['center'] as $center) {
                            echo '<li>'.$center.'</li>';
                          } ?></ol>
                      </li>
                    </ul>
                  </div>
                </div>
              </div>
              <?php endif;?>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
    <?php if ($id):?>
    <script type="text/javascript">$("#sender-<?php echo $id;?>").click();</script>
    <?php endif;?>
  </body>
</html>