<?php 
$canEditPenetapanHakim=$this->authorization->HasRuleAddPenetapanHakim();
$canEditPenetapanPanitera=$this->authorization->HasRuleAddPenetapanPanitera($idperkara);
$canEditPenetapanJurusita=$this->authorization->HasRuleAddPenetapanJurusita($idalurperkara, $idperkara);
$canEditPenetapanSidangPertama=$this->authorization->HasRuleAddPenetapanSidangPertama($idperkara);
$canedit = TRUE;
?>
<style type="text/css">
#infoPerkara .wrapword li {
  display: list-item !important;
  clear: both;
  float: none !important;
}
</style>
<div style="font-size:14px;margin:0px;border:0px;">
    <?php
    $idalurperkara = $this->tanggalhelper->getIDAlurPerkara($this->encrypt->decode(base64_decode($enc)));
    ?>
    <table id='infoPerkara' style="font-size:14px;width:100%;">
        <col width="15%">
        <col width="85%">
        <tbody>
            <tr>
                <td style="background-color:#A3DBA8;padding:5px;" colspan="2"><strong>DATA IKRAR TALAK</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>
                	<span><?php echo $nomor_perkara;?></span>
                </td>
            </tr>
            <tr>
            	<td id="first-child">Tanggal Putusan</td>
                <td>
                	<span><?php echo $this->tanggalhelper->convertDayDate($tanggal_putusan);?></span>
                </td>
            </tr>
            <tr>
            	<td id="first-child">Tanggal BHT</td>
                <td>
                	<span><?php echo $this->tanggalhelper->convertDayDate($tanggal_bht);?></span>
                </td>
            </tr>
        </tbody>
    </table>
    <div style="padding:3px;"></div>
    <table id='infoPerkara' style="font-size:14px;width:100%;" >
        <col width="15%">
        <col width="85%">
        <tbody>
            <tr>
                <td style="background-color:#A3DBA8;padding:5px;" colspan="2"><strong>DATA PENETAPAN MAJELIS HAKIM</td>
            </tr>
        </tbody>
    </table>
    <table id="infoPerkara" style="font-size:14px;width:100%;" >
        <col width="20%">
        <col width="60%">
        <col width="20%">
        <tbody>
            <?php if($list_hakim->num_rows>3 AND !empty($penetapan_majelis_hakim)){?>
            <tr>
                <td colspan="3">
                    <div class="cssTable">
                        <table id="tableinfo" style="margin:0px;padding:0px;">
                            <colgroup>
                                <col width="20%">
                                <col width="30%">
                                <col width="5%">
                                <col width="15%">
                            </colgroup>
                            <tr>
                                <td>Tanggal Penetapan</td>
                                <td>Nama Hakim/Majelis Hakim</td>
                                <td>Aktif</td>
                                <td>Template</td>
                            </tr>
                            <?php
                            $x = -1;
                            $hakim = array();
                            $aktif = array();
                            $tglPenetapan = array();
                            if(!empty($list_hakim)){
                                if($list_hakim->num_rows>0){
                                    foreach ($list_hakim->result() as $row) {
                                        if(($row->urutan==1 AND $row->jabatan_hakim_id==1) OR ($row->jabatan_hakim_id==3)){
                                            $pindah = False;
                                            $x++;
                                            $hakim[$x] = '';
                                            $tglPenetapan[$x] =$this->tanggalhelper->convertDayDate($row->tanggal_penetapan);
                                            $aktif[$x] =$row->aktif;
                                        }
                                        if($pindah==False){
                                            if (intval($row->urutan)<>1){
                                                $hakim[$x] .= $row->jabatan_hakim_nama." ".(intval($row->urutan)-1).": ".$row->hakim_nama."</br>";
                                            }else{
                                                $hakim[$x] .= $row->jabatan_hakim_nama.": ".$row->hakim_nama."</br>";
                                            }
                                        }
                                    }
                                }
                            }
                            $i = 0;
                            foreach ($hakim as $key => $value) {
                                echo "<tr>";
                                    echo "<td>".$tglPenetapan[$i]."</td>";
                                    echo "<td>".$hakim[$i]."</td>";
                                    echo "<td align='center'>".$aktif[$i]."</td>";
                                    echo "<td align='center'>";
                                    
                                    if ($canEditPenetapanHakim AND $canedit AND $aktif[$i]=='Y'){
                                        echo "<a href=\"#\" onClick=\"popup_form('".base_url("c_template_penetapan_agama/popup_penetapan_majelis_hakim/".$enc."/1/0")."')\"><img src=\"".base_url()."resources/img/nm_icon_doc.gif\"></a>";

                                    }
                                    echo "</td>";
                                echo "</tr>";
                                $i++;
                            }
                            ?>
                        </table>
                    </div>
                    
                </td>
            </tr>
            <?php }else{?>
            <tr>
                <td id="first-child">Tanggal Penetapan Majelis</td>
                <td >
                    <span>
                        <?php echo $this->tanggalhelper->convertDayDate($penetapan_majelis_hakim);?>
                    </span>
                </td>
                <td colspan="2" style="text-align:right;">
                    <?php if($canEditPenetapanHakim AND $canedit){ ?>
                        [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('edit_ikrar_talak_pen_majelis/'.$enc);?>')">Edit Penetapan Majelis</a>]
                    <?php } ?>
                </td>
            </tr>
            
            <tr>
                <td id="first-child">Majelis Hakim</td>
                <td>
                    <span><?php echo $majelis_hakim_text;?></span>
                </td>
                <td colspan="2"></td>
            </tr>
            <?php if ($canEditPenetapanHakim AND $canedit){?>
            <tr>
                <td id="first-child">Template Dokumen</td>
                <td>
                    <a href="#" onClick="popup_form('<?php echo base_url("c_template_penetapan_agama/popup_penetapan_majelis_hakim/".$enc.'/1');?>')"><img src="<?php echo base_url();?>resources/img/nm_icon_doc.gif"></a>
                </td>
                <td colspan="2"></td>
            </tr>
            <?php
                }
            }
            ?>
            <?php if ($canEditPenetapanHakim AND $canedit){?>
            <tr>
                <td colspan="2" style='padding-left:10px;padding-top:0px;'>                   
                    <?php if($list_hakim->num_rows>3 AND !empty($penetapan_majelis_hakim)){?>
                         [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('edit_ikrar_talak_pen_majelis/'.$enc);?>')">Edit Penetapan Majelis</a>]
                   <?php } ?>
                    <?php if(!empty($penetapan_majelis_hakim)){?>
                    [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('add_ikrar_pen_kembali_majelis/'.$enc);?>')">Penetapan Kembali Majelis</a>]
                    <?php } ?>
                </td>
            </tr>
            <?php
                }
            ?>
            <tr><td colspan="2" style='background:white;'></td></tr>
            <tr><td style="background-color:#A3DBA8;padding:5px;" colspan="3"><strong>Data Penetapan Panitera/Panitera Pengganti</td></tr>
            <?php if($list_panitera->num_rows>0 AND !empty($penetapan_panitera_pengganti)){?>
            <tr>
                <td colspan="3">
                    <div class="cssTable">
                        <table id="tableinfo" style="margin:0px;padding:0px;">
                            <colgroup>
                                <col width="20%">
                                <col width="30%">
                                <col width="5%">
                                <col width="15%">
                            </colgroup>
                            <tr>
                                <td>Tanggal Penetapan</td>
                                <td>Nama Hakim/Majelis Hakim</td>
                                <td>Aktif</td>
                                <td>Template</td>
                            </tr>
                            <?php
                            $x = -1;
                            $panitera = array();
                            $aktif = array();
                            $tglPenetapan = array();
                            if(!empty($list_panitera_lama)){
                                if($list_panitera_lama->num_rows>0){
                                    foreach ($list_panitera_lama->result() as $row) {
                                        if($row->urutan==1){
                                            $pindah = False;
                                            $x++;
                                            $panitera[$x] = '';
                                            $tglPenetapan[$x] =$this->tanggalhelper->convertDayDate($row->tanggal_penetapan);
                                            $aktif[$x] ='T';
                                        }
                                        if($pindah==False){
                                            if (intval($row->urutan)<>1){
                                                $panitera[$x] .= "Panitera ".(intval($row->urutan)-1).": ".$row->panitera_nama."</br>";
                                            }else{
                                                $panitera[$x] .= "Panitera: ".$row->panitera_nama."</br>";
                                            }
                                        }
                                    }
                                }
                            }
                            if(!empty($list_panitera)){
                                if($list_panitera->num_rows>0){
                                    foreach ($list_panitera->result() as $row) {
                                        if($row->urutan==1){
                                            $pindah = False;
                                            $x++;
                                            $panitera[$x] = '';
                                            $tglPenetapan[$x] =$this->tanggalhelper->convertDayDate($row->tanggal_penetapan);
                                            $aktif[$x] =$row->aktif;
                                        }
                                        if($pindah==False){
                                            if (intval($row->urutan)<>1){
                                                $panitera[$x] .= "Panitera ".(intval($row->urutan)).": ".$row->panitera_nama."</br>";
                                            }else{
                                                $panitera[$x] .= "Panitera: ".$row->panitera_nama."</br>";
                                            }
                                        }
                                    }
                                }
                            }
                            $i = 0;
                            foreach ($panitera as $key => $value) {
                                echo "<tr>";
                                    echo "<td>".$tglPenetapan[$i]."</td>";
                                    echo "<td>".$panitera[$i]."</td>";
                                    echo "<td align='center'>".$aktif[$i]."</td>";
                                    echo "<td align='center'>";
                                    if ($canEditPenetapanPanitera AND $canedit AND $aktif[$i]=='Y'){
                                        echo "Template Belum Tersedia";
                                        #echo "<a href=\"#\" onClick=\"popup_form('".base_url("c_template_penetapan_agama/popup_penetapan_majelis_hakim/".$enc."1")."')\"><img src=\"".base_url()."resources/img/nm_icon_doc.gif\"></a>";
                                    }
                                    echo "</td>";
                                echo "</tr>";
                                $i++;
                            }
                            ?>
                        </table>
                    </div>
                    
                </td>
            </tr>
            <?php }else{?>            
            <tr>
                <td id="first-child">Tanggal Penunjukan Panitera Pengganti</td>
                <td>
                    <span>
                        <?php echo $this->tanggalhelper->convertDayDate($penetapan_panitera_pengganti);?>
                    </span>
                </td>
                <td colspan="2" style="text-align:right;">
                    <?php if($this->session->userdata('idgroup')==30 AND !empty($penetapan_majelis_hakim) AND $canedit){ ?>
                        [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('edit_ikrar_talak_pen_panitera/'.$enc);?>')">Edit Penunjukan Panitera Pengganti</a>]
                    <?php } ?>
                </td>
            </tr>
            <tr>
                <td id="first-child">Panitera Pengganti</td>
                <td>
                    <span><?php echo $panitera_pengganti_text;?></span>
                </td>
                <td colspan="2"></td>
            </tr>
            <?php if(!empty($penetapan_panitera_pengganti) AND $canEditPenetapanPanitera AND $canedit){?>
                    <tr>
                        <td id="first-child">Template Dokumen</td>
                        <td>
                            <!-- <a href="#" onClick="popup_form('<?php echo base_url("c_template_penetapan_agama/popup_pppp/".$enc.'/1');?>')"><img src="<?php echo base_url();?>resources/img/nm_icon_doc.gif"></a> -->
                            <p>Template belum ada</p>
                        </td>
                        <td colspan="2"></td>
                    </tr>
            <?php 
                }
            }
                if (($this->session->userdata('idgroup')==30 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==10) AND !empty($penetapan_majelis_hakim) AND $canedit){?>
            <tr>
                <td colspan="2"> 
                 <?php if($list_panitera->num_rows>0 AND !empty($penetapan_panitera_pengganti)){?>
                           [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('edit_ikrar_talak_pen_panitera/'.$enc);?>')">Edit Penunjukan Panitera Pengganti</a>]
                 <?php } ?>                                       
                 <?php if(!empty($penetapan_panitera_pengganti)){?>
                        [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('add_ikrar_talak_pen_kembali_panitera/'.$enc);?>')">Penunjukan Kembali Panitera Pengganti</a>]
                 <?php } ?>
                </td>
            </tr>
            <?php
                }
            ?>
            <tr><td colspan="2" style='background:white;'></td></tr>
            <tr><td style="background-color:#A3DBA8;padding:5px;" colspan="3"><strong>Data Penunjukkan Jurusita Pengganti</td></tr>
            <tr>
                <td id="first-child">Tanggal Penunjukan Jurusita</td>
                <td>
                    <span>
                        <?php echo $this->tanggalhelper->convertDayDate($penetapan_jurusita);?>
                    </span>
                </td>
                <td colspan="2" style="text-align:right;">
                    <?php if(($this->session->userdata('idgroup')==30 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==10) AND !empty($penetapan_panitera_pengganti) AND $canedit){ ?>                                      
                            [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('edit_ikrar_talak_pen_jurusita/'.$enc);?>')">Edit Penujukan Jurusita</a>]</br>                                 
                    <?php } ?>
                </td>
            </tr>
            <tr>
                <td id="first-child">Jurusita</td>
                <td>
                    <span><?php echo $jurusita_text;?></span>
                </td>
                <td colspan="2"></td>
            </tr>
            <tr>
                <td id="first-child">Template Dokumen </td>
                        <td>
                            <!-- <a href="#" onClick="popup_form('<?php echo base_url("c_template_penetapan_agama/popup_pjs/".$enc.'/1');?>')"><img src="<?php echo base_url();?>resources/img/nm_icon_doc.gif"></a> -->
                            <p>Template belum ada</p>
                        </td>
                <td colspan="2"></td>
            </tr>            

            <tr><td colspan="2" style='background:white;'></td></tr>
            <tr><td style="background-color:#A3DBA8;padding:5px;" colspan="3"><strong>Data Penetapan Sidang Ikrar Talak</td></tr>
            <tr>
            	<td id="first-child">Tanggal Penetapan Sidang Ikrar Talak</td>
                <td>
	                <span>
	                	<?php echo $this->tanggalhelper->convertDayDate($tanggal_penetapan_sidang_verzet);?>
	                </span>
                </td>
                <td colspan="2" style="text-align:right;">
                    <?php if(($this->session->userdata('idgroup')==20 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==10)  AND $canedit){ ?>
                        [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('edit_ikrar_talak_pen_sidang/'.$enc);?>')">Edit Penetapan Sidang Pertama</a>]</br>
                    <?php } ?>
                </td>
          	</tr>
            
            <tr>
            	<td id="first-child">Tanggal Sidang Pertama Ikrar Talak</td>
                <td>
                	<span><?php echo $this->tanggalhelper->convertDayDate($tanggal_sidang_pertama_verzet);?></span>
               	</td>
                <td colspan="2"></td>
           	</tr>
            <?php if(($this->session->userdata('idgroup')==20 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==10)  AND $canedit){ ?>
            <tr>
                <td id="first-child">Template Dokumen</td>
                <td>
                    <a href="#" onClick="downloadTemplate('<?php echo base_url("c_template_penetapan_agama/cetak_phs_ikrar/".$enc);?>')"><img src="<?php echo base_url();?>resources/img/nm_icon_doc.gif"></a>
                   
                </td>
                <td colspan="2"></td>           
            <?php } ?>
    
    <tr><td colspan="2" style='background:white;'></td></tr>
     <?php if ($this->session->userdata('idgroup')==600 OR $this->session->userdata('idgroup')==1 OR $this->session->userdata('idgroup')==10){ ?>
    <table id='infoPerkara' style="font-size:14px;width:100%;">
        <col width="15%">
        <col width="85%">
        <tbody>
            <tr>
                <td style="background-color:#A3DBA8;padding:5px;" colspan="2"><strong>RELAAS IKRAR TALAK</td>
            </tr>
        </tbody>
    </table>
    
           
    <table id="infoPerkara" style="font-size:14px;width:100%;">
        <col width="20%">
        <col width="">
        <col width="300px">
        <col width="200px" >
        <tbody>
            <tr>
                <td id="first-child">Template Dokumen</td>
                <td>
                    <a href="#" onClick="popup_form('<?php echo base_url("c_template_relaas_agama/popup_relaas_ikrar/".$enc);?>')"><img src="<?php echo base_url();?>resources/img/nm_icon_doc.gif"></a>
                    <?php //echo "Termohon Goib = <a href=\"#\" onClick=\"downloadTemplate('".base_url("c_template_penetapan_agama/cetak_relaas_ikrar_talak_termohon_goib/".$enc."/1")."')\"><img src=\"".base_url()."resources/img/nm_icon_doc.gif\"></a>";?>
                    <?php //echo "Relaas Termohon = <a href=\"#\" onClick=\"downloadTemplate('".base_url("c_template_penetapan_agama/cetak_relaas_ikrar_talak_termohon/".$enc."/1")."')\"><img src=\"".base_url()."resources/img/nm_icon_doc.gif\"></a>";?>
                    <?php //echo "Relaas Pemohon = <a href=\"#\" onClick=\"downloadTemplate('".base_url("c_template_penetapan_agama/cetak_relaas_ikrar_talak_pemohon/".$enc."/1")."')\"><img src=\"".base_url()."resources/img/nm_icon_doc.gif\"></a>";?>
                    <?php //echo "Delegasi = <a href=\"#\" onClick=\"downloadTemplate('".base_url("c_template_penetapan_agama/cetak_relaas_ikrar_talak_termohon_delegasi/".$enc."/1")."')\"><img src=\"".base_url()."resources/img/nm_icon_doc.gif\"></a>";?>
               
                </td>

            </tr>
           </tbody>
    </table>
    <?php } ?>
    
    <tr><td colspan="2" style='background:white;'></td></tr>
    <table id='infoPerkara' style="font-size:14px;width:100%;">
        <col width="15%">
        <col width="85%">
        <tbody>
            <tr>
                <td style="background-color:#A3DBA8;padding:5px;" colspan="2"><strong>DATA PENETAPAN IKRAR TALAK</td>
            </tr>
        </tbody>
    </table>
    <table id="infoPerkara" style="font-size:14px;width:100%;">
        <col width="20%">
        <col width="">
        <col width="60%">
        <col width="20%" >
        <tbody>
            <tr>
            	<td id="first-child">Tanggal Ikrar Talak</td>
                <td colspan="2"><span><?php echo $this->tanggalhelper->convertDayDate($tanggal_ikrar);?></span></td>
                <td style="text-align:right;">
                    <?php if ($this->authorization->HasRuleFormHakimPanitera($idperkara) AND !empty($tanggal_sidang_pertama_verzet) AND $canedit){ ?>
                        [<a style="color:#259FD3;text-decoration: none;" href="#" onClick="popup_form('<?php echo base_url('edit_ikrar_talak_penetapan/'.$enc);?>')">Edit Data Penetapan Ikrar</a>]</br>
                    <?php } ?>
                </td>
            </tr>
            <tr>
                <td id="first-child">Status Penetapan</td>
                <td colspan="3"><?php echo $status_penetapan_ikrar;?></td>
            </tr>
            <tr>
                <td id="first-child">Keadaan Istri</td>
                <td colspan="3"><?php echo $keadaan_istri;?></td>
            </tr>
            <tr>
                <td id="first-child">Amar Penetapan</td>
                <td colspan="3"><?php echo $amar_ikrar_talak;?></td>
            </tr>
            <tr>
                <td id="first-child">E-Doc Penetapan</td>   
                <td colspan="2">
                <?php 
                $baseurl=$ikrar_talak_dok;
                if (($baseurl) and (file_exists($baseurl))){
                    echo "<a target='_new' href=$baseurl>Unduh Dokumen</a>";
                }else{
                    echo "<span style='color:red;font-weight:bold'>Dokumen Belum Ada</span>";
                }
                ?>
                </td>
            <?php if ($this->authorization->HasRuleFormHakimPanitera($idperkara) AND !empty($tanggal_sidang_pertama_verzet) AND $canedit){?>
                <td style="text-align:right;">
                    [ <a href="#" onClick="popup_form('<?php echo base_url("fileupload/".$enc."/penikrar");?>')">Edit E-Doc</a> ]
                </td>
            <?php
                }
            ?>
            </tr>
           
            <tr>
                <td id="first-child">Template Dokumen </td>
                <td>
                    <a href="#" onClick="downloadTemplate('<?php echo base_url("c_template_penetapan_agama/cetak_penetapan_putusan/".$enc);?>')"><img src="<?php echo base_url();?>resources/img/nm_icon_doc.gif"></a>
                   
                </td>
            </tr>                    
        </tbody>
    </table>
    <div style="padding:3px;"></div>
</div>
<script type="text/javascript">
closeLoading();
function downloadTemplate(url){
    window.open(url,'_self');
}
</script>

