<script src="<?php echo base_url();?>resources/js/autoNumeric.js"></script>
<hr class="thick-line" style="clear:both;">
	<div class="detil" style="font-size:14px;margin-top:10px;width: 80%;margin: 0 auto;border-color: #FFFFFF; " >
			<table id="infoPerkara" style="font-size:14px;" width="100%" border="0">
				<col width="25%">
				<col width="75%">
				<tbody >
						<tr><td style="background-color:white">
						  <a style="color:#259FD3;text-decoration: none;" href="<?php echo $main_history;?>" class="btn btn-default btn-sm">Kembali</a> 
                        <?php 
                            if ($this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==10 OR $this->session->userdata('idgroup')==410 OR $this->session->userdata('idgroup')==414 OR $this->session->userdata('idgroup')==1000 OR $this->session->userdata('idgroup')==1003){
                                echo '<a style="color:#259FD3;text-decoration: none;" href="'.base_url('edit_eksekusi_ht/'.$ht_id).'" class="btn btn-default btn-sm">Edit</a>';
                                echo '<a style="color:#259FD3;margin-left:3px" href="#" onClick="popup_form(\''.base_url('detil_eksekusi_ht/cabut/'.$ht_id).'\')" class="btn btn-default btn-sm">Cabut</a>';
						    } 
                        ?>
                        </td><td style="text-align:right;" colspan="">
						<?php 
                            if ($this->authorization->HasRuleHapusDataBanding(1)){
						      echo '<a style="color:white;;text-decoration: none;" href="#" onclick="popup_form(\''.base_url("hapus_perkara_eksekusi_ht/".$ht_id).'\')" class="btn btn-danger btn-sm">Hapus</a>';
						    } 
                        ?>
						</td></tr>
                        <tr><td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong> Data Umum</td></tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Permohonan</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($tgl_permohonan_eksekusi);?></td>
                        </tr>

                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Nomor Eksekusi Hak Tanggungan</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $eksekusi_nomor_perkara;?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Jenis Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $jenis_ht_text;?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Sertifikat</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($tgl_sertifikat);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>No. Sertifikat</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $no_sertifikat;?></td>
                        </tr>
                        <tr><td colspan="2" style='background:white;'></td></tr>
                        <tr><td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong> Data Pihak</td></tr>
                        <tr>
                            <td id="first-child" style="vertical-align: top;"><font color='#fff'>Pemohon</font></td>
                            <td>
                                <div class="cssTable" style="padding:5px;">
                                <?php
                                if($pemohon!=''){
                                    if($pemohon->num_rows>0){
                                ?>
                                        <table id="tableinfo" style="margin:0px;padding:0px;">
                                            <col width="5%">
                                            <col width="30%">
                                            <col width="55%">
                                            <col width="10%">
                                            <tbody>
                                                <tr>
                                                    <td>No</td>
                                                    <td>Nama</td>
                                                    <td>Alamat</td>
                                                    <td></td>
                                                </tr>
                                <?php
                                        $i=1;
                                        foreach ($pemohon->result() as $row) {
                                            echo "<tr>";
                                                echo "<td>".$i."</td>";
                                                echo "<td>".$row->nama."</td>";
                                                echo "<td>".$row->alamat."</td>";
                                                $idpihak = base64_encode($this->encrypt->encode($row->pihak_id));
                                                $enc_id = base64_encode($this->encrypt->encode($row->id));
                                                ?>
                                                <td colspan="2" align='center'>
                                                <?php if ($this->session->userdata('idgroup')==410 OR $this->session->userdata('idgroup')==414 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==2 OR $this->session->userdata('idgroup')==1000 OR $this->session->userdata('idgroup')==10 OR $this->session->userdata('idgroup')==1003){ ?>
                                                [<a href="#" onClick="popup_form('<?php echo base_url('detil_pihak_ht/'.$ht_id.'/'.$idpihak);?>')">Detil</a>]
                                                <?php } ?>
                                                </td></td>
                                                <?php

                                            echo "</tr>";
                                            $i++;

                                        }?>
                                            </tbody>
                                        </table>
                                    <?php
                                    }
                                }
                                ?> 
                                </div>
                                <?php if ($this->session->userdata('idgroup')==410 OR $this->session->userdata('idgroup')==414 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==2 OR $this->session->userdata('idgroup')==1000 OR $this->session->userdata('idgroup')==10 OR $this->session->userdata('idgroup')==1003){ ?>
                                [<a href="#" onClick="tambah_pemohon()">Tambah Pemohon</a>]
                                <?php } ?>
                            </td>
                        </tr>     
                        <form id="frm_add_pemohon" style="background:white;margin:0;" method="post" action="<?php echo base_url().'detil_eksekusi_ht/validateInputPemohon';?>">
                        <tr id="tr_pemohon" class="pemohon_hide">
                            <td bgcolor='#008C4B'><font color='#fff'>Nama Pemohon</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="hidden" id='enc_pemohon' name='enc_pemohon' value="">
                                <input type="text" id='nama_pemohon' name='nama_pemohon' value="" class="standard-input" style="width: 34%;" maxlength="200" readonly="readonly">
                                <input type="button" onClick="popup_form('<?php echo base_url('pihak_list_up');?>')" style="padding-top: 6px;padding-bottom: 6px;" value="Cari" class='btn'>
                            </td>
                        </tr>
                         <tr id="tr_pemohon" class="pemohon_hide">                            
                            <td bgcolor='#008C4B'><font color='#fff'>Pekerjaan Pemohon</td>
                            <td style="padding:0px;padding-left:5px;">
                                    <input type="text" id='pekerjaan_pemohon' name='pekerjaan_pemohon' value="" class="standard-input" style="width: 42%;" maxlength="200" readonly="readonly">
                            </td>
                        </tr>
                         <tr id="tr_pemohon" class="pemohon_hide">                            
                            <td bgcolor='#008C4B'><font color='#fff'>Alamat Pemohon</td>
                            <td style="padding:0px;padding-left:5px;">
                                <textarea type="text" id='alamat_pemohon' name='alamat_pemohon' class="standard-input" style="width: 42%;resize: none;height: 100px;"  readonly="readonly"><?php //echo $alamat?></textarea>
                            </td>
                        </tr>
                        <tr id="tr_pemohon" class="pemohon_hide">
                            <td colspan="2" style="background:white;" align="center">
                            <?php
                            
                            ?>
                            <input type="hidden" id="ht_id" name="ht_id" value="<?php echo $ht_id?>">
                            <input type="hidden" id="permohonan_eksekusi" name="permohonan_eksekusi" value="<?php echo $tgl_permohonan_eksekusi;?>">
                            <input type="hidden" id="alurperkaraid" name="alurperkaraid" value="0">
                            <input type="button" onClick='batalpemohon();' value="Batal" class="btn">
                                <input type="submit" id="simpan" value="Simpan" class="btn">
                        </td>
                        </tr> 
                        </form>                           
                        <tr>
                            <td id="first-child" style="vertical-align: top;"><font color='#fff'>Termohon</font></td>
                            <td>
                                <div class="cssTable" style="padding:5px;">
                                <?php
                                if($termohon!=''){
                                    if($termohon->num_rows>0){
                                ?>
                                        <table id="tableinfo" style="margin:0px;padding:0px;">
                                            <col width="5%">
                                            <col width="30%">
                                            <col width="55%">
                                            <col width="10%">
                                            <tbody>
                                                <tr>
                                                    <td>No</td>
                                                    <td>Nama</td>
                                                    <td>Alamat</td>
                                                    <td></td>
                                                </tr>
                                <?php
                                        $i=1;
                                        foreach ($termohon->result() as $row1) {
                                            echo "<tr>";
                                                echo "<td>".$i."</td>";
                                                echo "<td>".$row1->nama."</td>";
                                                echo "<td>".$row1->alamat."</td>";
                                                $idpihak = base64_encode($this->encrypt->encode($row1->pihak_id));
                                                $enc_id = base64_encode($this->encrypt->encode($row1->id));
                                                ?>
                                                <td colspan="2" align='center'>
                                                <?php if ($this->session->userdata('idgroup')==410 OR $this->session->userdata('idgroup')==414 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==2 OR $this->session->userdata('idgroup')==1000 OR $this->session->userdata('idgroup')==10 OR $this->session->userdata('idgroup')==1003){ ?>
                                                [<a href="#" onClick="popup_form('<?php echo base_url('detil_pihak_ht/'.$ht_id.'/'.$idpihak);?>')">Detil</a>]
                                                <?php } ?>
                                                </td></td>
                                                <?php
                                            echo "</tr>";
                                            $i++;

                                        }?>
                                            </tbody>
                                        </table>
                                    <?php
                                    }
                                }
                                ?>
                                </div>
                                <?php if ($this->session->userdata('idgroup')==410 OR $this->session->userdata('idgroup')==414 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==2 OR $this->session->userdata('idgroup')==1000 OR $this->session->userdata('idgroup')==10 OR $this->session->userdata('idgroup')==1003){ ?>
                                [<a href="#" onClick="tambah_termohon()">Tambah Termohon</a>]
                                <?php } ?>
                            </td>
                        </tr>     
                        </tr>     
                        <form id="frm_add_termohon" style="background:white;margin:0;" method="post" action="<?php echo base_url().'detil_eksekusi_ht/validateInputTermohon';?>">
                            <tr id="tr_termohon" class="termohon_hide">
                                <td bgcolor='#008C4B'><font color='#fff'>Nama Termohon</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <input type="hidden" id='enc_termohon' name='enc_termohon' value="">
                                    <input type="text" id='nama_termohon' name='nama_termohon' value="" class="standard-input" style="width: 34%;" maxlength="200" readonly="readonly">
                                    <input type="button" onClick="popup_form('<?php echo base_url('pihak_list_up_ht_termohon');?>')" style="padding-top: 6px;padding-bottom: 6px;" value="Cari" class='btn'>
                                </td>
                            </tr>
                             <tr id="tr_termohon" class="termohon_hide">                            
                                <td bgcolor='#008C4B'><font color='#fff'>Pekerjaan Termohon</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <input type="text" id='pekerjaan_termohon' name='pekerjaan_termohon' value="" class="standard-input" style="width: 42%;" maxlength="200" readonly="readonly">
                                </td>
                            </tr>
                            <tr id="tr_termohon" class="termohon_hide">                            
                                <td bgcolor='#008C4B'><font color='#fff'>Alamat Termohon</td>
                                <td style="padding:0px;padding-left:5px;">
                                    <textarea type="text" id='alamat_termohon' name='alamat_termohon' class="standard-input" style="width: 42%;resize: none;height: 100px;"  readonly="readonly"><?php //echo $alamat?></textarea>
                                </td>
                            </tr>
                            <tr id="tr_termohon" class="termohon_hide">
                                <td colspan="2" style="background:white;" align="center">
                                    <input type="hidden" id="ht_id" name="ht_id" value="<?php echo $ht_id?>">
                                    <input type="hidden" id="permohonan_eksekusi" name="permohonan_eksekusi" value="<?php echo $tgl_permohonan_eksekusi;?>">
                                    <input type="hidden" id="alurperkaraid" name="alurperkaraid" value="0">
                                    <input type="button" onClick='bataltermohon();' value="Batal" class="btn">
                                    <input type="submit" id="simpan" value="Simpan" class="btn">
                                </td>
                            </tr>                            
                        </form>
                        <tr><td colspan="2" style='background:white;'></td></tr>
                        <tr><td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong> Detil Eksekusi Hak Tanggungan</td></tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Penetapan Teguran Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($penetapan_teguran_eksekusi);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Nomor Penetapan Teguran Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $nomor_penetapan_teguran_eksekusi;?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Pelaksanaan Teguran Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($pelaksanaan_teguran_eksekusi);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Penetapan Sita Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($penetapan_sita_eksekusi);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Nomor Penetapan Sita Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $nomor_penetapan_sita_eksekusi;?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Pelaksanaan Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($pelaksanaan_sita_eksekusi);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Jurusita</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $jurusita_nama;?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Penetapan Perintah Eksekusi Lelang</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($penetapan_perintah_eksekusi_lelang);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Pelaksanaan Eksekusi Lelang</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($pelaksanaan_eksekusi_lelang);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Penyerahan Hasil Lelang</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($penyerahan_hasil_lelang);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Penetapan Perintah Eksekusi Riil</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($penetapan_perintah_eksekusi_rill);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Pelaksanaan Eksekusi Riil</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($pelaksanaan_eksekusi_rill);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Tanggal Penetapan Non-Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($penetapan_noneksekusi);?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Alasan Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $alasan_eksekusi;?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#008C4B'><font color='#fff'>Keterangan Lain</td>
                            <td style="padding:0px;padding-left:5px;"><?php echo $catatan_eksekusi;?></td>
                        </tr>
                        <tr>
                            <td colspan="2" style="background:white;" align="center">
                            <input type="hidden" id="idperkara" name="idperkara" value="">
                            <input type="hidden" id="alurperkaraid" name="alurperkaraid" value="">
                            <input type='hidden' id="refresh" name="refresh" value="refresh">
                            <input type='hidden' id="backlist" name="backlist" value="">
                            
                        </td>
                        </tr>
				</tbody>
			</table>
	</div>
<div class='ref_pihak' style='display:none;'>
    <input type='hidden' id="refresh">
</div>
<div class='ref_pihak_t' style='display:none;'>
    <input type='hidden' id="refresh">
</div>


<script type="text/javascript">

$(".ref_pihak #refresh").change(function(){
    refreshPihakList()
});
function refreshPihakList(){
    $("#popup_form").remove();
    popup_form('<?php echo base_url("pihak_list_up");?>');
}

$(".ref_pihak_t #refresh").change(function(){
    refreshPihakList_t()
});
function refreshPihakList_t(){
    $("#popup_form").remove();
    popup_form('<?php echo base_url("pihak_list_up_ht_termohon");?>');
}

$('#backlist').click(function(){
    window.open("<?php echo $main_history;?>","_self");
});

$('.pemohon_hide').hide();
$('.termohon_hide').hide();
function tambah_pemohon(){
$('.pemohon_hide').show();
}

function tambah_termohon(){
$('.termohon_hide').show();
}

function batalpemohon(){
$('.pemohon_hide').hide();
$('#enc_pemohon').val('');
$('#nama_pemohon').val('');
$('#pekerjaan_pemohon').val('');
$('#alamat_pemohon').val('');
}

function bataltermohon(){
$('.termohon_hide').hide();
$('#enc_termohon').val('');
$('#nama_termohon').val('');
$('#pekerjaan_termohon').val('');
$('#alamat_termohon').val('');
}

$('#refresh').click(function(){
    window.open("<?php echo $refresh;?>","_self");
});


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


});

$('#tgl_permohonan_eksekusi').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 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_surat_kuasa').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 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_add_pemohon').SubmitHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#konten',
    clicked:1,
    btnClicked:'#refresh',
    whenStatus:1,
});
$('#frm_add_termohon').SubmitHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#konten',
    clicked:1,
    btnClicked:'#refresh',
    whenStatus:1,
});



</script>