<div class="centering" style="width:1100px;margin-top: 1%;">
    <div id='dismissal' style="border: 1px solid #ffffff;">
       <div class="detil" style="padding: 2px;background-color: white;">
            <table id='infoPerkara' style="font-size:14px;width:100%;">
                <col width="20%">
                <col width="80%">
                <tbody>
                    <tr>
                        <td colspan="2" style="background:white;border:0px;font-size: 20px;color: #648C03;" align="center">PENETAPAN DISMISSAL</td>
                    </tr>
                </tbody>
            </table>
            <form id="frm_dismissal" style="background:white;margin:0;" method="post" action="<?php echo base_url().'dismissal_c/validateInputTun';?>">
                <table id="tableDetilPerkara" style="font-size:14px;">
                    <col class="first_col" width="20%">
                    <col class="second_col" width="80%">
                        <tbody>
                            <tr>
                                <td>Nomor Perkara</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <?php echo $nomor_perkara;?>
                                </td>
                            </tr>
                            <tr>
                                <td>Tanggal Pendaftaran</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <?php echo $this->tanggalhelper->convertDayDate($tanggal_pendaftaran); ?>
                                </td>
                            </tr> 
                        <?php if($hasil_dismissal=='' || $tgl_dismissal=='' AND $idpanggilan==''){ ?>
                            <tr>
                                <td>Tanggal Panggilan</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <input id="tgl_panggilan" name="tgl_panggilan" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                                </td>
                            </tr>
                        <?php } ?>
                             <tr>
                                <td>Tanggal Penetapan Dismissal</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <input id="tgl_dismissal" name="tgl_dismissal" value="<?php echo $this->tanggalhelper->convertToInputDate($tgl_dismissal);?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                                </td>
                            </tr>
                            <tr>
                                <td>Hasil Penetapan Dismissal</td>
                                <td style="padding:0px;padding-left:5px;">
                                     <span class="custom-dropdown custom-dropdown--emerald">
                                        <select style='width:125px;' name="hasil" id="hasil" class="custom-dropdown__select custom-dropdown__select--white">                                                                                                                        
                                            <option value=''>Pilih Hasil</option>
                                            <option value='1' <?php echo ($hasil_dismissal=='1')? 'selected':'' ?>  >Lolos</option>
                                            <option value='2' <?php echo ($hasil_dismissal=='2')? 'selected':'' ?>  >Tidak Lolos</option>                                                                                   
                                        </select>
                                    </span>
                                </td>
                            </tr>
                            <tr id='tr_amar'>
                                <td valign="top" style="vertical-align:top">Pertimbangan Hukum dan Amar</td>
                                <td style="background:white;" id="isi_dismissal_text">
                                    <?php echo $this->ckeditor->editor("isi_dismissal",$isi_dismissal);?>
                                </td>
                            </tr>                            
                            <!--<tr>
                                <td>E-Doc Penetapan (L3)</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <input type="file" id="dok_dismissal" name="dok_dismissal" value="<?php $dok_akta_perdamaian=''; echo (!empty($dok_akta_perdamaian) ? $dok_akta_perdamaian : '');?>" >
                                </td>
                            </tr>-->
                            <tr>
                                <td colspan="2" style="background:white;" align="center">
                                    <input type="hidden" id="status" name="status" value="<?php echo $status; ?>">
                                    <input type="hidden" id="enc" name="enc" value="<?php echo $enc; ?>">
                                    <input type="hidden" id="curr_date" name="curr_date" value="<?php echo $tgl_sekarang;?>">
                                    <input type="button" id='close_form_dismissal' value="Kembali" class="btn">
                                    <input type="submit" id="simpan_btn" value="Simpan" class="btn">
                                </td>
                            </tr>
                        </tbody>

                </table>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">

$('#tgl_dismissal').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.';
                    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;
            }
        });

$('#tgl_panggilan').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.';
                    error = 1;
                }

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

$('#frm_dismissal').SubmitHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#konten',
    clicked:1,
    btnClicked:'#close_form_dismissal',
    whenStatus:1,
    next_step:1,
    isCKEdit:1,
    tdID:'isi_dismissal_text',
    textID:'isi_dismissal',
});
$('#hapus').ButtonClickHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#konten',
    clicked:1,
    btnClicked:'#close_form_dismissal',
    whenStatus:1,
    actions:'<?php echo base_url("del_dismissal/del");?>',
    formName:'#frm_dismissal',
    actionName:'Hapus Data Penetapan Dismissal'
});

// $('#close_form_dismissal').closingFormWin();
$('#close_form_dismissal').click(function(){
    window.open("<?php echo base_url('perkara_detil_tun/'.$enc.'/20');?>","_self");    
});

$('.datepicker').ValidateDateInput();
$('#hasil').change(function(e){
    if($(this).val()==2){
        $('#tr_amar').show();
        $('.centering').css({'width':'1100px'});
        $('.first_col').css({'width':'20%'});
        $('.second_col').css({'width':'80%'});
    }else{
        $('#tr_amar').hide();
        $('.centering').css({'width':'500px'});
        $('.first_col').css({'width':'45%'});
        $('.second_col').css({'width':'55%'});
    }
});

$(document).ready(function() {
    if($('#hasil').val()==1){
        $('#tr_amar').hide();
        $('.centering').css({'width':'500px'});
        $('.first_col').css({'width':'45%'});
        $('.second_col').css({'width':'55%'});
    }

});

closeLoading();
</script>