<?php



$kegiatan_id = $id_page;
$classsimakomRKAS = new simakom_rkas;
$form = new form;

$db = database::getInstance();
$show = $db->runQuery("SELECT * FROM   {$tb_kegiatan}  WHERE id = '{$kegiatan_id}'");
$akun = $show->fetch(PDO::FETCH_OBJ);
$kategori_kode = $akun->kategori;
$kegiatan_kode = $akun->kegiatan;


$class = new simakom_rkas();
$kegiatan_custome = $class->kodeCustome('simakom_ref_kegiatan', 'kegiatan', $kegiatan_kode, 'kegiatan_custome');

$uraian_kategori = $class->uraianRKAS('simakom_ref_kategori', 'kategori', $kategori_kode, 'uraian');
$uraian_kegiatan = $class->uraianRKAS('simakom_ref_kegiatan', 'kegiatan', $kegiatan_kode, 'uraian'); ?>
<div class="content-wrapper">
    <?php require('./layout/headerpage.php'); ?>
    <div class="container col-12 mb-4 pb-5">
        <div class="row">
            <div class="col-12">
                <div class="col-12">
                    <div class="card  mx-3">
                        <div class="timeline-header bg-primary py-2 pl-2">
                            <b class="text-light judul"><span class="bi bi-trash"></span> Hapus Komponen</b>
                        </div>
                        <!-- /.card-header -->
                        <div class="card-body my-4 mx-4">
                            <form action="" method="post">
                                <input type="text" name="id_kegiatan" value="<?php echo $kegiatan_id;
                                                                                ?>" hidden>
                                <input type="text" name="kategori" value="<?php echo $kategori_kode;
                                                                            ?>" hidden>
                                <input type="text" name="kegiatan" value="<?php echo $kegiatan_kode;
                                                                            ?>" hidden>

                                <div class="info-box-content">
                                    <dl class="row">
                                        <dt class="col-sm-3 pt-0">KATEGORI</dt>
                                        <dd class="col-sm-9  pt-0"><b>: <?php echo $kategori_kode . ' - ' . $uraian_kategori; ?></b></dd>
                                        <dt class="col-sm-3">KEGIATAN</dt>
                                        <dd class="col-sm-9"><b>: <?php echo $kegiatan_kode . ' - ' . $uraian_kegiatan; ?></b></dd>

                                    </dl>
                                </div>

                                <div class="col-md-12 mt-3">
                                    <p class="text-danger"><strong>Menghapus Komponen akan menghapus Seluruh Akun dan Rincian/Detail pada Komponen ini. Yakin akan menghapus?</strong></p>
                                </div>
                                <div class="div d-inline">
                                    <button type="submit" name="deleteKegiatan" class="btn btn-danger btn-xs mb-2 btn-rounded small px-2 ml-1"> <i class="bi bi-trash"></i> YA, HAPUS KEGIATAN <?php echo $kegiatan_kode; ?></button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
if (isset($_POST['deleteKegiatan'])) {

    $kategori = htmlspecialchars($_POST['kategori']);
    $kegiatan = htmlspecialchars($_POST['kegiatan']);
    $id_kegiatan = htmlspecialchars($_POST['id_kegiatan']);

    $class = new simakom_rkas();
    $save = $class->deleteRKASKkegiatan($tb_kegiatan, $tb_komponen, $tb_akun, $tb_detail, $id_kegiatan, $tb_revisi);
} else {
    echo "";
};
