<script src="<?php echo base_url();?>resources/js/jquery.ui.timepicker.js"></script>
<div class="centering" style="width:470px;margin-top: 5%;">
    <div id='pemberitahuan_gugur' 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="40%">
                <col width="60%">
                <tbody>
                <?php if($infos=='tambah'){ ?>
                    <tr>
                        <td colspan="2" style="background:white;border:0px;font-size: 20px;color: #648C03;" align="center">TAMBAH PANGGILAN PARA PIHAK</td>
                    </tr>
                <?php }elseif($infos=='edit'){ ?>
                    <tr>
                        <td colspan="2" style="background:white;border:0px;font-size: 20px;color: #648C03;" align="center">EDIT PANGGILAN PARA PIHAK</td>
                    </tr>
                <?php } ?>
                </tbody>
            </table>
           
            <form id="frm_pemberitahuan" method="post" action="<?php echo base_url().'dismissal_c/validateInputPanggilTun';?>">
    			<table id='infoPerkara' style="font-size:14px;width:100%;">
    				<col width="30%">
                    <col width="70%">
                        <tbody>
                        <?php if($infos=='tambah' AND !empty($info_panggil)){ ?>
                            <tr>
                                <td colspan="2" style="background-color:#A3DBA8;padding:5px;">Panggilan Sebelumnya</td>
                            </tr>
                            <tr>
                                <td id="first-child">Tanggal Panggilan</td>
                                <td style="padding:0px;padding-left:10px;">
                                    <?php echo (!empty($info_panggil) ? $this->tanggalhelper->convertDayDate($info_panggil) : '');?>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Waktu</td>
                                <td style="padding:0px;padding-left:10px;">
                                    <?php echo (!empty($waktu) ? $waktu : '');?>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Dihadiri Oleh</td>
                                <td style="padding:0px;padding-left:10px;" id="hadir" name="hadir">
								<input type="hidden" id="info_status" name="info_status" value="<?php echo $info_status; ?>">
                                    <?php 
                                        if ($info_status==1) {
                                            $hadir = 'Semua Pihak';
                                        }elseif($info_status==2){
                                            $hadir = 'Penggugat Saja';
                                        }elseif($info_status==3){
                                            $hadir = 'Tergugat Saja';
                                        }elseif($info_status==4){
                                            $hadir = 'Para Pihak Tidak Hadir';
                                        }
                                    ?>
                                    <?php echo (!empty($hadir))? $hadir:'-'; ?>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="background-color:#A3DBA8;padding:5px;">Panggilan Selanjutnya</td>
                            </tr>
                        <?php } ?>                                                
                            <tr>
                                <td id="first-child">Tanggal Panggilan</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <input id="tgl_panggil" name="tgl_panggil" value="<?php echo (!empty($tgl_dismissal) ? $this->tanggalhelper->convertToInputDate($tgl_dismissal) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Waktu</td>
                                <td><input id="waktu_pelaksanaan" name="waktu_pelaksanaan" value="<?php echo (!empty($waktuku) ? $waktuku : ''); ?>" class="timepicker" maxlength="4" placeholder="HH:mm"></td>
                            </tr>
							<?php if($infos=='edit'){ ?>
                            <tr>
                                <td id="first-child">Dihadiri Oleh</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <span class="custom-dropdown custom-dropdown--emerald">
                                        <select style='width:165px;'  name="dihadiri" id="dihadiri"  class="custom-dropdown__select custom-dropdown__select--white">                                                                                                                        
                                            <option value=''>Pilih Pihak Yang Hadir</option>
                                            <option value='1' <?php echo ($status=='1')? 'selected':'' ?>  >Semua Pihak</option>
                                            <option value='2' <?php echo ($status=='2')? 'selected':'' ?>  >Penggugat Saja</option>                                                                                   
                                            <option value='3' <?php echo ($status=='3')? 'selected':'' ?>  >Tergugat Saja</option>
                                            <option value='4' <?php echo ($status=='4')? 'selected':'' ?>  >Para Pihak Tidak Hadir</option>
                                        </select>
                                    </span>
                                </td>
                            </tr>     
							<?php } ?>
                            <tr>
                                <td colspan="2" style="background:white;" align="center">
								<br>
                                <input type="hidden" id="enc" name="enc" value="<?php echo $enc; ?>">
                                <input type="hidden" id="encid" name="encid" value="<?php echo $encid; ?>">
                                <input type="hidden" id="infos" name="infos" value="<?php echo $infos; ?>">
                                <input type="hidden" id="curr_date" name="curr_date" value="<?php echo $tgl_sekarang;?>">
                                <input type="button" id='close_form_penetapan' value="Batal" class="btn">
                                <?php
                                if($infos=='edit'){
                                    echo '<input type="submit" id="hapus" value="Hapus" class="btn btn-danger" onclick="return false;">';
                                }
                                ?>
                                <input type="submit" id="simpan_btn" value="Simpan" class="btn">
                            </td>
                            </tr>
                        </tbody>
    			</table>
                <div style="padding:3px;"></div>
    		</form>
    	</div>
    </div>
</div>
<script type="text/javascript">
$('#tgl_panggil').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 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;
            }
        });


$('#frm_pemberitahuan').SubmitHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#konten',
    clicked:1,
	btnClicked:'#close_form_penetapan',
	whenStatus:1
});
$('#hapus').ButtonClickHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#konten',
    clicked:1,
    btnClicked:'#close_form_dismissal',
    whenStatus:1,
    actions:'<?php echo base_url("del_panggil_dismissal/del");?>',
    formName:'#frm_pemberitahuan',
    actionName:'Hapus Data Panggilan Dismissal'
});

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


</script>