<style type="text/css">
.col-md-2, .col-md-4, .col-md-6, .col-md-8{padding: 0px}
.panel-body{padding: 0px}
.form-inline{padding-bottom: 25px}
.form-inline .form-control{width: 100%}
</style>

<div class="row" id="portlet-content">
    <div class="col-md-12">
        <div class="portlet light" style="position:relative">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-credit-card-alt"></i><?=$title?>
                </div>
            </div>
            <div class="portlet-body" id="page-content" style="display:nonee">
               
                <?= form_open('send_request_note/save', array('class'=>"form-horizontal") ) ?>
                <div class="panel-body">
                  <div class="col-md-12">
                    <div class="form-group ">
    
                    <div class="form-group">

                      <label class="col-md-2 control-label"><br>Tanggal</label>
                      <div class="col-sm-2">
                        <span style="font-size:9px">Tanggal Pengajuan</span><br>
                        <div class="input-group">    

                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>         
                        <?= form_input('tanggal', date('Y-m-d'), array('class'=>'form-control datepicker', 'autocomplete'=>'off')); ?>          
                        </div>
                      </div>

                      <div class="col-sm-2">
                        <span style="font-size:9px">Nama Unit / Divisi</span><br>
                        <div class="input-group">    

                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>         
                        <select class="form-control sel2_unit unit_change" requireds autocomplete="off" name="id_unit">
                          <option value=""></option>
                          <?php foreach ($this->M_general->select_db('bbmc_re_unit')->result() as $key ) { ?>
                            <option value="<?=$key->id_unit?>" <?=$this->session->userdata('id_unit')==$key->id_unit?'selected':''?>><?=$key->unit?></option>
                          <?php }?>
                        </select>     
                        </div>
                      </div>
                      
                    </div>

                    <!--
                    <div class="form-group">
                      <label class="col-md-2 control-label"><br>Nama Unit / Divisi</label>
                      <div class="col-sm-3">
                         <span style="font-size:9px">Unit BBMC</span><br>
                        <select class="form-control sel2_unit unit_change" requireds autocomplete="off" name="id_unit">
                          <option value=""></option>
                          <?php foreach ($this->M_general->select_db('siak_re_unit_bbmc')->result() as $key ) { ?>
                            <option value="<?=$key->id_unit_bbmc?>"><?=$key->nama_unit?></option>
                          <?php }?>
                        </select>
                      </div>
                    </div>
                    -->

                    <?php for ($i1=0; $i1 <= 5; $i1++) { ?>
                     <div class="form-group request_note_detail<?=$i1?>" style="<?=$i1==0?'display: block':'display: none'?>">
                     
                      <label class="col-md-2 control-label"><br> <?php if($i1 == 0){echo "Deskripsi";}?></label>

                      <div class="col-sm-5">
                        <span style="font-size:9px">BHP</span><br>
                        <select class="form-control select2 sel2_kebutuhan kebutuhan<?=$i1?>" data-id="<?=$i1?>" requireds autocomplete="off" name="id_bhp[]" style="width:100%">
                          <option value=""></option>
                          <?php foreach ($this->M_general->select_db('bbmc_re_bahan_habis_pakai')->result() as $key ) { ?>
                            <option value="<?=$key->id_re_bahan_habis_pakai?>"><?=$key->nama_item?></option>
                          <?php }?>
                        </select>

                      </div>
                      <div class="col-sm-1" style="padding-left: 0px">
                       <span style="font-size:9px">Qty</span><br>
                        <!--
                        <select class="form-control select2 sel2_qty qty<?=$i1?>" data-id="<?=$i1?>" requireds autocomplete="off" name="qty[]" style="width:100%">
                          <option value=""></option>
                          <?php for ($i=1; $i < 30; $i++) { ?>
                           <option value="<?=$i?>"><?=$i?></option>
                          <?php }?>
                        </select>
                        -->
                         <input type="number" name="qty[]" value="" class="form-control" placeholder="Qty">
                      </div>
                      <!--
                      <div class="col-sm-1" style="padding-left: 0px">
                        <span style="font-size:9px">Satuan</span><br>
                        <select class="form-control sel2_satuan satuan<?=$i1?>" data-id="<?=$i1?>" requireds autocomplete="off" name="satuan[]">
                          <option value=""></option>
                          <option value="Pcs">Pcs</option>
                          <option value="Buah">Buah</option>
                        </select>
                      </div>

                      <div class="col-sm-2" style="padding-left: 0px; padding-right: 10px">
                        <span style="font-size:9px">Biaya</span><br>
                        <?= form_input('biaya[]', '', array('class'=>'formatWhileTypingJournalEntryDebit form-control biaya'.$i1, 'autocomplete'=>'off','placeholder'=>'Biaya', 'data-id'=>$i1)); ?>
                          
                      </div>
                      -->

                      <?php if($i1 != 0){ ?>
                      <div class="col-sm-1" style="padding-left: 0px; ">
                        <span style="font-size:9px"></span><br>
                        <div style="border:0px solid black; padding-top: 7px">
                        <a href="javascript:;" class="del" data-id="<?=$i1?>" style="background: red; color:#fff; padding:5px 10px; "><i class="fa fa-times"></i></a>
                        </div>
                      </div>
                      <?php }?>

                    </div>
                    <?php }?>
                    
                    
                    

                    <div class="form-group">
                      <label class="col-md-2 control-label"><br></label>
                      <div class="col-sm-2" style="">
                          <a href="javascript:;" class="add" style="background: green; color:#fff; padding:5px 10px; "><i class="fa fa-plus"></i></a>
                          <br><br><br>
                          <button type="submit" class="btn btn-primary">Create</button>
                      </div>
                    </div>

                    
                    
                  </div>
                </div>
                
                <?= form_close() ?>
             
            </div>
           
        </div>
    </div>
</div>

<script>
$( "#loading-content,#loading" ).fadeOut( "fast", function() {
    $( "#page-content" ).fadeIn("fast");
});

 $(".select2").select2({
    placeholder: "Pilih ..",
    
    language: "id"
  });

var c=1;
$(".add").click(function(){
  //alert(1);
  $(".request_note_detail"+c).css('display','block');
  c++;

  if(c >= 7){
    //alert("Maksimal 6 Entry");
  }
});


$(".del").click(function(){
  var ID=$(this).attr('data-id');
  $(".request_note_detail"+ID).css('display','none');
  
});


</script>





