<?php defined('BASEPATH') or exit('No direct script access allowed');?>
<?php echo form_open(current_url(), 'class="form-horizontal"');?>
  <div class="form-group">
    <label class="col-sm-3 control-label">Server <span class="text-danger">*</span></label>
    <div class="col-sm-9">
      <select class="form-control input-sm" name="server">
        <option value="" <?php echo set_select('server', '', true);?>>-- Pilih --</option>
        <?php foreach ($daftar_server as $server):?>
        <option value="<?php echo $server->sv_id?>" <?php echo set_select('server', $server->sv_id);?>><?php echo html_escape($server->sv_nama)?></option>
        <?php endforeach;?>
      </select>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-3 control-label">Kode server <span class="text-danger">*</span></label>
    <div class="col-sm-9">
      <input type="text" class="form-control" onkeyup="updateKodeTrx(value)" name="kode" value="<?php echo set_value('kode');?>" placeholder="Contoh; <?php echo html_escape($provider->op_kode);?>5" maxlength="32" required="required"/>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-3 control-label">Kode Trx <span class="text-danger">*</span></label>
    <div class="col-sm-9">
      <input type="text" class="form-control" id="kode_trx" name="kode_trx" value="<?php echo set_value('kode_trx');?>" placeholder="Contoh; <?php echo html_escape($provider->op_kode);?>5" maxlength="32" required="required"/>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-3 control-label">Nama <span class="text-danger">*</span></label>
    <div class="col-sm-9">
      <input type="text" class="form-control" name="nominal" value="<?php echo set_value('nominal');?>" placeholder="Contoh; <?php echo html_escape($provider->op_nama);?> 5.000" maxlength="120" required="required"/>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-3 control-label">Harga Beli</label>
    <div class="col-sm-9">
      <input type="number" class="form-control" name="harga_beli" value="<?php echo set_value('harga_beli');?>" placeholder="Contoh; 5500"/>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-3 control-label">Harga Jual Umum <span class="text-danger">*</span></label>
    <div class="col-sm-9">
      <input type="number" class="form-control" onkeyup="updateHargaReseller(value)" name="harga" value="<?php echo set_value('harga');?>" placeholder="Contoh; 6500" required="required"/>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-3 control-label">Harga Jual Reseller<span class="text-danger">*</span></label>
    <div class="col-sm-9">
      <input type="number" class="form-control" id="harga_reseller" name="harga_reseller" value="<?php echo set_value('harga_reseller');?>" placeholder="Contoh; 6300" required="required"/>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-3 control-label">Status<span class="text-danger">*</span></label>
    <div class="col-sm-9">
      <select class="form-control" name="status">
        <option value="1"<?php echo  set_select('status', '1'); ?>>Tersedia</option>
        <option value="0"<?php echo  set_select('status', '0'); ?>>Tidak tersedia</option>
      </select>
    </div>
  </div>
  <div class="form-group" style="margin-bottom:0">
    <div class="col-sm-offset-3 col-sm-9">
      <button type="submit" class="btn btn-primary" name="save" value="advanced"><i class="fa fa-check"></i> Simpan</button>
      &nbsp;
      <a href="<?php echo site_url('admin/produk/browse/' . $provider->op_produk.'/'.$provider->op_slug);?>" class="btn btn-default" data-dismiss="modal"><i class="fa fa-remove"></i> Batal</a>
    </div>
  </div>
<?php echo form_close();?>
<script type="text/javascript">
function updateKodeTrx(val) {
  document.getElementById("kode_trx").value = val;
}
function updateHargaReseller(val) {
  document.getElementById("harga_reseller").value = val;
}
</script>