      
<?php
include '../../../../config/koneksi.php';
session_start();
?>

       <?php
       echo  $_GET['kode_sub_skpd'];
       echo  $_GET['kode_program'];
       $kode_sub_skpd=$_GET['kode_sub_skpd'];
       $kode_program=$_GET['kode_program'];


$sqlie  = mysqli_query($koneksi, "SELECT 
    distinct a.kode_program,a.program,
    pr.indikator_program,
    pr.k_target_program_renstra,
    pr.k_realisasi_program_renstra,
    pr.target_program_renja,
    pr.t_program1,
    pr.t_program2,
    pr.t_program3,
    pr.t_program4,
    pr.satuan_program

    from(( renja as a)
    left join
    (
     SELECT a.kode_sub_skpd,a.kode_program,a.tahun,a.indikator_program,
    a.k_target_program_renstra,
    a.k_realisasi_program_renstra,
    a.target_program_renja,
    a.t_program1,
    a.t_program2,
    a.t_program3,
    a.t_program4,
    a.satuan_program

    from evprogram as a where a.kode_sub_skpd='$kode_sub_skpd' and a.kode_program='$kode_program' and a.tahun='$_SESSION[tahun]'
    ) as pr on pr.kode_sub_skpd=a.kode_sub_skpd and pr.kode_program=a.kode_program)


    where 
    a.kode_sub_skpd='$kode_sub_skpd' and a.kode_program='$kode_program' 

    ");
foreach ($sqlie as $rowe) {

    ?>
              <p><label>Indikator Program</label>
                <textarea id="indikator_program" class="form-control"><?php echo $rowe['indikator_program'] ?></textarea>
              
              </p>
              
                <table class="table">
                    <tr>
                        <td style="text-align:center; vertical-align: middle;width:20px">
                            <label>Target Renstra SKPD pada Tahun 2026<br> (Kondisi Akhir Periode Rencana)</label>
                        </td>
                        <td style="width:10px"></td>
                        <td style="text-align:center; vertical-align: middle;width:20px">
                            <label>Realisasi  Capaian Program Renstra SKPD <br> sampai dengan Renja SKPD Tahun <?php  echo ($_SESSION['tahun'])-1;?></label>
                        </td>
                        <td style="width:10px"></td>
                        <td style="text-align:center; vertical-align: middle;width:20px">
                            <label>Target Kinerja dan Anggaran Renja SKPD Tahun Berjalan yang dievaluasi (<?php  echo $_SESSION['tahun'];?>)</label>
                        </td>
                        <td style="width:10px"></td>
                        <td style="text-align:center; vertical-align: middle;width:20px">
                            <label>Satuan</label>
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: top;">
                             <table>
                                <tr><td>Kinerja&nbsp(K)</td><td><input type="text" id="k_target_program_renstra" class="form-control" value="<?php echo $rowe['k_target_program_renstra'] ?>" ></td></tr>
                            </table>
                           
                        </td>
                        <td style="width:50px"></td>
                        <td  style="vertical-align: top;">
                                <table>
                                    <tr><td>Kinerja&nbsp(K)</td><td><input type="text" id="k_realisasi_program_renstra" value="<?php echo $rowe['k_realisasi_program_renstra'] ?>" class="form-control" ></td></tr>
                                </table>
                        </td>
                        <td style="width:50px"></td>
                         <td style="vertical-align: top;">
                             <table>
                                <tr><td>Target&nbsp(K)</td><td><input type="text" id="target_program_renja" class="form-control" value="<?php echo $rowe['target_program_renja'] ?>"></td></tr>
                            </table>
                         </td>
                        <td style="width:50px"></td>
                         <td style="vertical-align: top;">
                             <table>
                                <tr><td>Satuan</td><td><input type="text" id="satuan_program" class="form-control" value="<?php echo $rowe['satuan_program'] ?>"></td></tr>
                            </table>
                         </td>

                    </tr>
                </table>
             
              <table class="table">
                  <tr><th colspan="8" style="text-align: center;">Realisasi  Triwulan</th></tr>
                  <tr>
                    <th colspan="2" style="text-align: center;">I</th>
                    <th colspan="2" style="text-align: center;">II</th>
                    <th colspan="2" style="text-align: center;">III</th>
                    <th colspan="2" style="text-align: center;">IV</th>
                </tr>
                  <tr>
                    <td>Kinerja(K)</td>
                    <td><input type="text" id="t_program1" class="form-control" value="<?php echo $rowe['t_program1'] ?>"></td>
                    <td>Kinerja(K)</td>
                    <td><input type="text" id="t_program2" class="form-control" value="<?php echo $rowe['t_program2'] ?>"></td>
                    <td>Kinerja(K)</td>
                    <td><input type="text" id="t_program3" class="form-control" value="<?php echo $rowe['t_program3'] ?>"></td>
                    <td>Kinerja(K)</td>
                    <td><input type="text" id="t_program4" class="form-control" value="<?php echo $rowe['t_program4'] ?>"></td></tr>
              </table>

               <div class="modal-footer justify-content-between" style="background-image: linear-gradient(white,lightblue); border-radius: 18px;">
                <button style="float:right" class="btn btn-warning" data-dismiss="modal" >Batal</button>
            <?php
            if(empty($rowe['indikator_program']))
            {

           ?>

             
             <button style="float:left" class="btn btn-success " data-dismiss="modal" onclick="inputprogram()">Simpan</button>
         <?php }
         else
         {
            ?>
            <button style="float:left" class="btn btn-success " data-dismiss="modal" onclick="ubahprogram()">Ubah</button>

            <?php
         }
         ?>
            </div>


              
             <?php }

mysqli_close($koneksi);
         ?>