<div class="centering" style="width:900px;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="20%">
                <col width="80%">
                <tbody>
                    <tr>
                        <td colspan="2" style="background:white;border:0px;font-size: 20px;color: #648C03;" align="center">PEMBERITAHUAN PENETAPAN GUGUR</td>
                    </tr>
                </tbody>
            </table>
            <table id='infoPerkara' style="font-size:14px;width:100%;">
                <col width="20%">
                <col width="80%">
                <tbody>
                    <tr>
                        <td id="first-child">Nomor Perkara</td>
                        <td style="padding:0px;padding-left:5px;"><?php echo $nomor_perkara;?></td>
                    </tr>
                    <tr>
                        <td id="first-child">Tanggal Pendaftaran</td>
                        <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($tanggal_pendaftaran); ?></td>
                    </tr>
                    <tr>
                        <td id="first-child">Tanggal Penetapan Gugur</td>
                        <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($tgl_penetapan); ?></td>
                    </tr>
                </tbody>
            </table>
            <form id="frm_pemberitahuan" method="post" action="<?php echo base_url().'penetapan_gugur/validatePemberitahuanInput';?>">
    			<table id='infoPerkara' style="font-size:14px;width:100%;">
    				<col width="20%">
                    <col width="80%">
                        <tbody>
                            
                            <tr>
                                <td id="first-child" style="vertical-align: top;">Tanggal Pemberitahuan<font color="red">*</font></td>
                                <td>
                                <?php
                                if($pihak_pertama!=''){
                                    if($pihak_pertama->num_rows>0){
                                ?>
                                    <div class="cssTable" style="margin:0px;border:0px;">
                                        <table id="tableinfo" style="margin:0px;padding:0px;">
                                            <col width="15%">
                                            <col width="55%">
                                            <col width="30%">
                                            <tbody>
                                                <tr>
                                                    <td>Status</td>
                                                    <td>Nama</td>
                                                    <td>Tanggal Pemberitahuan</td>
                                                </tr>
                                                    <?php
                                                    $i=1;
                                                    foreach ($pihak_pertama->result() as $row) {
                                                        
                                                        $status = $this->nativesession->getStatusPihak(10,$idalurperkara,1);
                                                        $id = 'pem_pihak_1_'.$row->id;
                                                        echo '<tr>';
                                                            echo '<td>'.$status.' '.$row->urutan.'</td>';
                                                            echo '<td>'.$row->nama.'</td>';
                                                            $tgl = (!empty($row->tanggal_pemberitahuan_putusan))? $this->tanggalhelper->convertToInputDate($row->tanggal_pemberitahuan_putusan):'';
                                                            echo '<td><input id="'.$id.'" name="'.$id.'" value="'.$tgl.'" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun"></td>';
                                                            echo '<script type="text/javascript">';
                                                            echo '$("#'.$id.'").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 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();
                                                                            message_error_show(message);
                                                                            $(this).css("background-color", "red");
                                                                        }else{
                                                                            $(this).css("background-color", "#dedbdb");
                                                                        }
                                                                    }
                                                                });';
                                                            echo '</script>';
                                                        echo '</tr>';
                                                    }?>
                                                    </tbody>
                                                </table>
                                            </div>
                                        <?php
                                        }
                                    }
                                    ?>  
                                <br>
                                    <?php
                                    if($pihak_kedua!=''){
                                        if($pihak_kedua->num_rows>0){
                                    ?>
                                        <div class="cssTable" style="margin:0px;border:0px;">
                                            <table id="tableinfo" style="margin:0px;padding:0px;">
                                                <col width="15%">
                                                <col width="55%">
                                                <col width="30%">
                                                <tbody>
                                                    <tr>
                                                        <td>Status</td>
                                                        <td>Nama</td>
                                                        <td>Tanggal Pemberitahuan</td>
                                                    </tr>
                                                    <?php
                                                    $i=1;
                                                    foreach ($pihak_kedua->result() as $row) {
                                                        $status = $this->nativesession->getStatusPihak(10,$idalurperkara,2);
                                                        $id = 'pem_pihak_2_'.$row->id;
                                                        echo '<tr>';
                                                            echo '<td>'.$status.' '.$row->urutan.'</td>';
                                                            echo '<td>'.$row->nama.'</td>';
                                                            $tgl = (!empty($row->tanggal_pemberitahuan_putusan))? $this->tanggalhelper->convertToInputDate($row->tanggal_pemberitahuan_putusan):'';
                                                            echo '<td><input id="'.$id.'" name="'.$id.'" value="'.$tgl.'" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun"></td>';
                                                        echo '<script type="text/javascript">';
                                                            echo '$("#'.$id.'").datepicker({
                                                                    inline: true,
                                                                    showOtherMonths: true,
                                                                    dateFormat: "dd/mm/yy",
                                                                    dayNamesMin: ["Ming", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"],
                                                                    onSelect: function(dateText, inst) {
                                                                        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();
                                                                            message_error_show(message);
                                                                            $(this).css("background-color", "red");
                                                                        }else{
                                                                            $(this).css("background-color", "#dedbdb");
                                                                        }
                                                                    }
                                                                });';
                                                            echo '</script>';
                                                        echo '</tr>';
                                                    }?>
                                                    </tbody>
                                            </table>
                                        </div>
                                    <?php
                                        }
                                    }
                                    ?>
                                </td>
                            </tr>
                            <tr>
                                <td id="first-child">Tanggal Minutasi<font color="red">*</font></td>
                                <td style="padding:0px;padding-left:5px;">
                                    <input id="tgl_minutasi" name="tgl_minutasi" value="<?php echo (!empty($tgl_minutasi) ? $this->tanggalhelper->convertToInputDate($tgl_minutasi) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="background:white;" align="center">
                                <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_penetapan' value="Batal" class="btn">
                                <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_minutasi').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,
});

$('#close_form_penetapan').closingFormWin();

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

</script>