
<script src="<?php echo base_url();?>resources/js/autoNumeric.js"></script>
<div id="popup_add_biaya" class="centering" style="width:890px;margin-top: 1%;">
<div id='add_biaya' style="background:white;padding:5px;">
    <div class="detil" style="font-size:14px;margin-top:10px;width: 100%;margin: 0 auto;border-color: #FFFFFF;">
        <div id="sub_title" style="padding:10px;color:#008C4B;text-align:left;"><h2><strong>Tambah - Penerimaan Hak-hak Kepaniteraan</strong></h2></div>
        <hr class="thick-line" style="clear:both;">
        <div id='content' style="margin: 5px;margin-top:10px; ">

        <p>
        <form id="frm_add_hkk" style="background:white;margin:0;" method="post" action="<?php echo base_url().'add_hkk/validateInput';?>">
            <table id="tableDetilPerkara" style="font-size:14px;">
                <col width="30%">
                <col width="70%">
                    <tbody>

                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Transaksi<font color="red"> *</font></td>
                            <td style="padding:0px;padding-left:5px;">
                                <input id="tgl_transaksi" name="tgl_transaksi" value="<?php echo (!empty($tgl_transaksi) ? $this->tanggalhelper->convertToInputDate($tgl_transaksi) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Jenis Biaya<font color="red"> *</font></td>
                            <td style="padding:0px;padding-left:5px;">
                                <span class="custom-dropdown custom-dropdown--emerald" style="width:300px">
                                    <select name="jenis_biaya" id="jenis_biaya" style='width:300px;' class="custom-dropdown__select custom-dropdown__select--white">
                                        <option value="">Pilih Jenis Biaya</option>
                                        <?php
                                            if($data_jenis_biaya!=''){
                                                if($data_jenis_biaya->num_rows>0){
                                                    foreach ($data_jenis_biaya->result() as $row) {
                                                        echo '<option value="'.$row->id.'" ';echo ($row->id == $id_jenis_biaya) ? 'selected' : ''; echo ' >'.$row->nama.'</option>';
                                                    }
                                                }
                                            }
                                        ?>
                                    </select>
                                </span>

                            </td>
                        </tr>

                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Uraian<font color="red"> *</font></td>
                            <td style="padding:0px;padding-left:5px;">
                                <textarea id="uraian" name="uraian" class="standard-input" style="resize: none;margin: 0px; width: 600px; height: 60px;" ><?php echo (!empty($uraian) ? $uraian : '');?></textarea>
                                
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Jumlah<font color="red"> *</font></td>
                            <td style="padding:0px;padding-left:5px;">
                                <input data-a-sep="." data-a-dec="," type="text" id="jumlah" name="jumlah" value="<?php echo (!empty($jumlah) ? $jumlah : '');?>" class="standard-input" style="width:220px;">

                            </td>
                        </tr>

                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Keterangan</td>
                            <td style="padding:0px;padding-left:5px;">
                                <textarea id="keterangan" name="keterangan" class="standard-input" style="resize: none;margin: 0px; width: 600px; height: 60px;" ><?php echo (!empty($keterangan) ? $keterangan : '');?></textarea>
                                
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="background:white;" align="center">
                            <input type="hidden" id="aksi" name="aksi" value="<?php echo $aksi;?>">
                            <input type="hidden" id="idbiayaperkara" name="idbiayaperkara" value="<?php echo $idbiaya;?>">
                            <input type="hidden" id="curr_date" name="curr_date" value="<?php echo $tgl_sekarang;?>">
                            <input type="button" id="kembali" value="Kembali" class="btn">
                            <input type="submit" id="simpan" value="Simpan" class="btn">
                                <?php
                                if($aksi!=''){
                                    echo '<input type="button" id="hapus" value="Hapus" style="text-decoration:none" class="btn btn-danger">';    
                                }
                                ?>
                        </td>
                        </tr>
                    </tbody>

            </table>
        </form>

        </div>
    </div>
</div>
</div>

<script type="text/javascript">
$('#kembali').click(function(){
    window.open("<?php echo $previous;?>","_self");
});

$(document).ready(function() {
    $('#jumlah').ForceNumericOnly();
    $('#jumlah').autoNumeric('init', {mDec: '0'});

});

$('#jenis_biaya').change(function(e){
  var uraian = $('#jenis_biaya option:selected').text();
  $('#uraian').val(uraian) ;
});


$('#tgl_transaksi').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay:$.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
                var error = 0;
                var date = $(this).datepicker('getDate');
                var dayOfWeek = weekday[date.getDay()];
                var error = 0;
                var message ='';
                if(dayOfWeek=='Sunday' || dayOfWeek=='Saturday'){
                    message ='Tidak Dapat Memilih diluar Hari Kerja (Sabtu & Minggu).';
                    error = 1;
                }
                
                
                var tmp = $(this).val().split("/");
                var tmp2 = $('#curr_date').val().split("/");
                if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
                    message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
                    error = 1
                }

                if(error==1){
                    message_error_show(message);
                    $(this).css("background-color", "red");
                }else{
                    $(this).css("background-color", "#dedbdb");
                }
                error = 0;
            }
        });

$('.datepicker').ValidateDateInput();

$('#frm_add_hkk').SubmitHandling({
        refresh:'1',
        setRefresh:1,
        divRef:'#frm_add_hkk',
        clicked:1,
        btnClicked:'#kembali',
        whenStatus:1
    });


$('#hapus').ButtonClickHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#frm_add_hkk',
    clicked:1,
    btnClicked:'#kembali',
    whenStatus:1,
    actions:'<?php echo base_url()?>detil_biaya/hapus_perkara_biaya/<?php echo $idbiaya; ?>',
    formName:'#frm_add_hkk',
    actionName:'Hapus Data'
});

</script>        