<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Admin &gt; Pengaturan Transaksi</title>
    <?php include_once(VIEWPATH. 'includes/head.php'); ?>
    <style type="text/css">.checkbox>label,.checkbox-inline>label,.radio>label,.radio-inline>label{font-weight:normal;}</style>
  </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/pengaturan');?>">Pengaturan</a></li>
        <li class="active"><span>Transaksi</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-cog"></i> Transaksi</h3>
            </div>
            <div class="panel-body">
              <?php echo form_open();?>
                <div class="form-group">
                  <label for="range" class="control-label">Range harga unik</label>
                  <input type="text" class="form-control" name="range" id="range" value="<?php echo set_value('range', @$this->system->set['trx_range']);?>" maxlength="12" required="required"/>
                  <p class="help-block">Contoh: 100-199</p>
                </div>
                <?php
                foreach ($this->system->produk as $pr_k => $pr_v):
                $pkey = 'order_'.$pr_k;
                $allow_order = property_exists($this->system->perm, $pkey) ? $this->system->perm->$pkey : 'all';
                ?>
                <div class="form-group">
                  <label>Siapa yang boleh melakukan order <?php echo $pr_v->nama;?>?</label>
                  <div>
                    <div class="radio-inline"><label><input type="radio" name="order_produk[<?php echo $pr_k;?>]" value="all" <?php echo ($allow_order == 'all' ? 'checked="checked"' : '');?>/> Semua orang</label></div>
                    <div class="radio-inline"><label><input type="radio" name="order_produk[<?php echo $pr_k;?>]" value="user" <?php echo ($allow_order == 'user' ? 'checked="checked"' : '');?>/> Semua member</label></div>
                    <div class="radio-inline"><label><input type="radio" name="order_produk[<?php echo $pr_k;?>]" value="user_verified" <?php echo ($allow_order == 'user_verified' ? 'checked="checked"' : '');?>/> Hanya member terverifikasi</label></div>
                    <div class="radio-inline"><label><input type="radio" name="order_produk[<?php echo $pr_k;?>]" value="reseller" <?php echo ($allow_order == 'reseller' ? 'checked="checked"' : '');?>/> Hanya reseller</label></div>
                  </div>
                </div>
                <?php endforeach;?>
                <div class="form-group">
                  <label>Hanya member terverifikasi yang boleh melakukan order apabila harga produk lebih dari atau sama dengan</label>
                  <div class="input-group">
                    <span class="input-group-addon">Rp</span>
                    <input type="number" class="form-control" name="amount_verified" value="<?php echo set_value('amount_verified', (int)@$this->system->perm->amount_verified);?>" placeholder="0"/>
                  </div>
                  <p class="help-block">Isi <strong>0</strong> untuk menonaktifkan filter ini</p>
                </div>
                <div class="form-group">
                  <label>Gunakan Captcha di form order?</label>
                  <div>
                    <div class="radio-inline"><label><input type="radio" name="captcha_order" value="yes" <?php echo ($this->system->perm->captcha_order == 'yes' ? 'checked="checked"' : '');?>/> Ya</label></div>
                    <div class="radio-inline"><label><input type="radio" name="captcha_order" value="no" <?php echo ($this->system->perm->captcha_order == 'no' ? 'checked="checked"' : '');?>/> Tidak</label></div>
                  </div>                    
                </div>
                <div class="form-group">
                  <label>Perbolehkan user memverifikasi kata sandi sebelum melakukan order di web?</label>
                  <div>
                    <div class="radio-inline"><label style="font-weight: normal;"><input type="radio" name="password_verify" value="yes" <?php echo ($this->system->perm->password_verify == 'yes' ? 'checked="checked"' : '');?>/> Ya</label></div>
                    <div class="radio-inline"><label style="font-weight: normal;"><input type="radio" name="password_verify" value="no" <?php echo ($this->system->perm->password_verify == 'no' ? 'checked="checked"' : '');?>/> Tidak</label></div>
                  </div>
                </div>
                <div class="form-group">
                  <label>Berapa maksimal jam pembayaran setelah order disubmit?</label>
                  <div>
                    <?php for ($i = 1; $i <= 12; $i++):?>
                    <div class="radio-inline"><label><input type="radio" name="jam_pembayaran" value="<?php echo $i;?>" <?php echo ($this->system->set['jam_pembayaran'] == $i ? 'checked="checked"' : '');?>/> <?php echo $i;?> Jam</label></div>
                    <?php endfor;?>
                  </div>                    
                </div>
                <div class="form-group">
                  <label>Perbolehkan user untuk melakukan pembayaran masal?</label>
                  <div>
                    <div class="radio-inline"><label><input type="radio" name="bayar_masal" value="yes" <?php echo (@$this->system->perm->bayar_masal == 'yes' ? 'checked="checked"' : '');?>/> Ya</label></div>
                    <div class="radio-inline"><label><input type="radio" name="bayar_masal" value="no" <?php echo (@$this->system->perm->bayar_masal == 'no' ? 'checked="checked"' : '');?>/> Tidak</label></div>
                  </div>                    
                </div>
                <div class="form-group">
                  <label>Perbolehkan user untuk membatalkan transaksi?</label>
                  <div>
                    <div class="radio-inline"><label><input type="radio" name="cancel_order" value="yes" <?php echo ($this->system->perm->cancel_order == 'yes' ? 'checked="checked"' : '');?>/> Ya</label></div>
                    <div class="radio-inline"><label><input type="radio" name="cancel_order" value="no" <?php echo ($this->system->perm->cancel_order == 'no' ? 'checked="checked"' : '');?>/> Tidak</label></div>
                  </div>                    
                </div>
                <div class="form-group">
                  <label>Kirimkan pemberitahuan ke email user?</label>
                  <div>
                    <div class="radio-inline"><label><input type="radio" name="email_order" value="yes" <?php echo ($this->system->perm->email_order == 'yes' ? 'checked="checked"' : '');?>/> Ya</label></div>
                    <div class="radio-inline"><label><input type="radio" name="email_order" value="no" <?php echo ($this->system->perm->email_order == 'no' ? 'checked="checked"' : '');?>/> Tidak</label></div>
                  </div>                    
                </div>
                <div class="form-group">
                  <label>Kirimkan pemberitahuan ke nomor HP pembeli untuk jenis produk</label>
                  <div>
                    <?php foreach ($this->system->produk as $pr_k=>$pr_v):?>
                    <div class="checkbox-inline"><label><input type="checkbox" name="sms_order[]" value="<?php echo $pr_k;?>" <?php echo (in_array($pr_k, $this->system->perm->sms_order) ? 'checked="checked"' : '');?>/> <?php echo $pr_v->nama;?></label></div>
                    <?php endforeach;?>
                  </div>
                </div>
                <div class="form-group">
                  <label for="sms_reminder" class="control-label">Kirim SMS pengingat ke nomor HP pembeli</label>
                  <div class="input-group">
                    <input type="number" class="form-control" name="sms_reminder" id="sms_reminder" value="<?php echo set_value('sms_reminder', property_exists($this->system->perm,'sms_reminder') ? $this->system->perm->sms_reminder : 0);?>" required="required"/>
                    <span class="input-group-addon">menit setelah order</span>
                  </div>
                  <p class="help-block">Mengirim SMS jika status pembayaran masih pending. Isi <strong>0</strong> untuk tidak mengingatkan / menonaktifkan.</p>
                </div>
                <div class="alert alert-info">
                  <h5>Pemberitahuan Administrator</h5>
                  <div class="form-group">
                    <label class="control-label">Email</label>
                    <input type="email" class="form-control" name="email_notification" id="email_notification" value="<?php echo set_value('email_notification', $notifikasi->email);?>" maxlength="64"/>
                  </div>
                  <div class="form-group">
                    <label class="control-label">SMS</label>
                    <input type="number" class="form-control" name="sms_notification" id="sms_notification" value="<?php echo set_value('sms_notification', $notifikasi->sms);?>" maxlength="13"/>
                  </div>
                  <p class="help-block">Pemberitahun untuk Administrator tentang status transaksi.</p>
                </div>
                <div>
                  <button type="submit" class="btn btn-primary" name="submit" value="save">Simpan</button>
                </div>
                <input type="hidden" name="diskon" value="0" style="display: none;" />
                <input type="hidden" name="allow_order" value="all" style="display: none;" />
              <?php echo form_close();?>
            </div>
          </div>
        </div>
      </div>
    </div>
    <?php include_once(VIEWPATH.'includes/foot.php'); ?>
  </body>

</html>