<!-- // created by : KuduSinau_Hendrik_081275532220 (TERIMAKASIH UNTUK MENDAPATKAN KEBERKAHAN, DENGAN TIDAK MERUBAH NAMA HAK CIPTA, PLAGIAT, DAN TIDAK MEMPERJUALBELIKAN APLIKASI INI, SEMOGA KITA SEMUA MENDAPAT MANFAAT DAN KEBERKAHAN DARI APLIKASI INI)
// created by : KuduSinau_Hendrik_081275532220 (UNTUK MASUKAN DAN SARAN SERTA PENGEMBANGAN BISA MENGHUBUNGI NOMOR) -->

<body class="materialdesign" onload="hide_loading();">
    <div class="loading overlay">
        <div class="lds-spinner">
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
            <div></div>
        </div>
    </div>
    <div class="wrapper-pro">
        <div class="content-inner-all">
            <div class="breadcome-area mg-b-30 small-dn">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="breadcome-list map-mg-t-40-gl shadow-reset">
                                <div class="row">
                                    <div class="col-lg-6">
                                        <font size="4">
                                            <strong><?= $Lembaga['sgkt_jenjang'] . ' ' . $Lembaga['nm_status'] . ' ' . ucwords(strtolower($Lembaga['nm_lembaga'])); ?></strong>
                                        </font>
                                    </div>
                                    <div class="col-lg-6 text-right">
                                        <?php foreach ($nmTapel as $tp) :
                                            if ($tp['sts_tapel'] == 1) {
                                        ?>
                                                <font size="4">
                                                    <span class="bread-blod">Semester <?= $tp['kd_smstr']; ?> | <?php if ($tp['kd_smstr'] == 'Ganjil') {
                                                                                                                    echo $tp['kd_tahun'] . '/' . ($tp['kd_tahun'] + 1);
                                                                                                                } elseif ($tp['kd_smstr'] == 'Genap') {
                                                                                                                    echo ($tp['kd_tahun'] - 1) . '/' . $tp['kd_tahun'];
                                                                                                                }; ?></span>
                                                </font>
                                        <?php }
                                        endforeach;
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="breadcome-area des-none mg-b-30">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                            <div class="breadcome-list map-mg-t-40-gl shadow-reset">
                                <div class="row">
                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
                                        <font size="1">
                                            <strong><?= $Lembaga['sgkt_jenjang'] . ' ' . $Lembaga['nm_status'] . ' ' . ucwords(strtolower($Lembaga['nm_lembaga'])); ?></strong>
                                        </font>
                                    </div>
                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right">
                                        <?php foreach ($nmTapel as $tp) :
                                            if ($tp['sts_tapel'] == 1) {
                                        ?>
                                                <font size="1">
                                                    <span class="bread-blod">Semester <?= $tp['kd_smstr']; ?> | <?php if ($tp['kd_smstr'] == 'Ganjil') {
                                                                                                                    echo $tp['kd_tahun'] . '/' . ($tp['kd_tahun'] + 1);
                                                                                                                } elseif ($tp['kd_smstr'] == 'Genap') {
                                                                                                                    echo ($tp['kd_tahun'] - 1) . '/' . $tp['kd_tahun'];
                                                                                                                }; ?></span>
                                                </font>
                                        <?php }
                                        endforeach;
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="data-table-area mg-b-15">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="sparkline13-list shadow-reset">
                                <div class="sparkline13-hd">
                                    <div class="main-sparkline13-hd">
                                        <h1><i class="fa fa-cube"></i><b> Kompetensi Dasar Pengetahuan</b></h1>
                                        <div class="sparkline13-outline-icon">
                                            <span class="sparkline13-collapse-link"><i class="fa fa-chevron-up"></i></span>
                                            <span><i class="fa fa-wrench"></i></span>
                                            <span class="sparkline13-collapse-close"><i class="fa fa-times"></i></span>
                                        </div>
                                    </div>
                                </div>
                                <div class="sparkline13-graph">
                                    <div id="flashsucces" data-flash="<?= $this->session->flashdata('messageSuccess'); ?>"></div>
                                    <div id="flashwarning" data-flash="<?= $this->session->flashdata('messageWarning'); ?>"></div>
                                    <div id="flashupdate" data-flash="<?= $this->session->flashdata('messageUpdate'); ?>"></div>
                                    <div id="flasherror" data-flash="<?= $this->session->flashdata('messageError'); ?>"></div>
                                    <div id="flashsave" data-flash="<?= $this->session->flashdata('messageSave'); ?>"></div>
                                    <div class="mail-title inbox-bt-mg">
                                        <div class="view-mail-action view-mail-ov-d-n">
                                            <a class="compose-discard-bt" href="#" data-toggle="modal" data-target="#TambahExcel"><i class="fa fa-plus-circle"></i> Input Excel</a>
                                            <a class="compose-draft-bt" href="#" data-toggle="modal" data-target="#TambahKdp"><i class="fa fa-plus-circle"></i> Input KD</a>
                                        </div>
                                    </div>
                                    <div id="TambahKdp" class="modal modal-adminpro-general default-popup-PrimaryModal fade" role="dialog">
                                        <form action="<?= base_url('admin/tambahDataKdp'); ?>" method="post">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header header-color-modal bg-color-1">
                                                        <h4 class="modal-title">Form Tambah Data KD Pengetahuan</h4>
                                                        <div class="modal-close-area modal-close-df">
                                                            <a class="close" data-dismiss="modal" href="#"><i class="fa fa-close"></i></a>
                                                        </div>
                                                    </div>
                                                    <div class="modal-body">
                                                        <input type="hidden" class="form-control" id="nm_jenjang" name="nm_jenjang" placeholder="NIP Teacher" value='<?= $nmUser['kd_jenjang']; ?>' required>
                                                        <div class="sparkline11-graph">
                                                            <div class="row">
                                                                <div class="col-lg-6">
                                                                    <label class="login2 pull-right pull-right-pro">Kelas</label>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    <select data-placeholder="Pilih Kelas" class="chosen-select" tabindex="-1" name='nm_kelas' id='nm_kelas'>
                                                                        <option disabled selected>Pilih Kelas</option>
                                                                        <?php foreach ($kls as $study) :
                                                                            if ($nmUser['kd_jenjang'] == $study['no_kls']) { ?>
                                                                                <option value='<?= $study['nm_kls']; ?>'><?= $study['nm_kls']; ?></option>
                                                                        <?php }
                                                                        endforeach; ?>
                                                                        <?= form_error('nm_kelas', '<small class="text-danger">', '</small>'); ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="sparkline11-graph">
                                                            <div class="row">
                                                                <div class="col-lg-6">
                                                                    <label class="login2 pull-right pull-right-pro">Kode Bidang Study</label>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    <select data-placeholder="Pilih Kode Bid Study" class="chosen-select" tabindex="-1" name='nm_mapel' id='nm_mapel'>
                                                                        <option disabled selected>Pilih Kode Bid Study</option>
                                                                        <?php foreach ($mapel as $study) : ?>
                                                                            <option value='<?= $study['nm_kdbidstudy']; ?>'><?= $study['nm_kdbidstudy']; ?></option>
                                                                        <?php endforeach; ?>
                                                                        <?= form_error('nm_mapel', '<small class="text-danger">', '</small>'); ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="sparkline11-graph">
                                                            <div class="row">
                                                                <div class="col-lg-6">
                                                                    <label class="login2 pull-right pull-right-pro">Nomor KD</label>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    <select data-placeholder="Pilih Nomor KD" class="chosen-select" tabindex="-1" name='kd_kdp' id='kd_kdp'>
                                                                        <option disabled selected>Pilih Nomor KD</option>
                                                                        <?php foreach ($nokdp as $study) : ?>
                                                                            <option value='<?= $study['nm_nokdp']; ?>'><?= $study['nm_nokdp']; ?></option>
                                                                        <?php endforeach; ?>
                                                                        <?= form_error('kd_kdp', '<small class="text-danger">', '</small>'); ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="sparkline11-graph">
                                                            <div class="row">
                                                                <div class="col-lg-12">
                                                                    <label class="login2 pull-left pull-left-pro">Kompetensi Dasar</label>
                                                                </div>
                                                                <div class="col-lg-12">
                                                                    <textarea rows="5" id="nm_kdp" name="nm_kdp" class="form-control" placeholder="isi deskripsi lengkap" required></textarea>
                                                                </div>
                                                            </div>
                                                            <?= form_error('nm_kdp', '<small class="text-danger">', '</small>'); ?>
                                                        </div>
                                                        <div class="sparkline11-graph">
                                                            <div class="row">
                                                                <div class="col-lg-12">
                                                                    <label class="login2 pull-left pull-left-pro">Deskripsi KD</label>
                                                                </div>
                                                                <div class="col-lg-12">
                                                                    <textarea id="nm_deskripsi" name="nm_deskripsi" class="form-control" placeholder="isi deskripsi singkat dengan huruf kecil semua" required></textarea>
                                                                </div>
                                                            </div>
                                                            <?= form_error('nm_deskripsi', '<small class="text-danger">', '</small>'); ?>
                                                        </div>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <div class="form-group-inner">
                                                            <div class="login-btn-inner">
                                                                <div class="row">
                                                                    <div class="col-lg-3"></div>
                                                                    <div class="col-lg-9">
                                                                        <div class="login-horizental cancel-wp pull-right">
                                                                            <button type='reset' data-dismiss='modal' class="btn btn-sm btn-white">Cancel</button>
                                                                            <button class="btn btn-sm btn-primary" type="submit">Add New</button>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                    <div id="TambahExcel" class="modal modal-adminpro-general default-popup-PrimaryModal fade" role="dialog">
                                        <form action="<?= base_url('admin/tambahDataKdpExcel'); ?>" method="post" enctype="multipart/form-data">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header header-color-modal bg-color-1">
                                                        <h4 class="modal-title">Form Tambah Data KD Pengetahuan (Excel)</h4>
                                                        <div class="modal-close-area modal-close-df">
                                                            <a class="close" data-dismiss="modal" href="#"><i class="fa fa-close"></i></a>
                                                        </div>
                                                    </div>
                                                    <div class="modal-body">
                                                        <div class="sparkline11-graph">
                                                            <div class="row">
                                                                <div class="col-lg-12">
                                                                    <label class="login2 pull-left pull-left-pro">Download Template</label>
                                                                </div>
                                                                <div class="col-lg-12">
                                                                    <a class="compose-discard-bt" href="<?= base_url('assets/rapor/template/data_kd_pengetahuan.xlsx') ?>"><i class="fa fa-plus-circle"></i> Template KD Pengetahuan</a>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="sparkline11-graph">
                                                            <div class="row">
                                                                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                                                    <label class="login2 pull-left pull-left-pro">Upload File Excel</label>
                                                                </div>
                                                                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                                                    <div class="file-upload-inner ts-forms">
                                                                        <div class="input prepend-small-btn">
                                                                            <label class="icon-right" for="prepend-small-btn">
                                                                                <i class="fa fa-download"></i>
                                                                            </label>
                                                                            <div class="file-button">
                                                                                Browse
                                                                                <input type="file" name='file_excel' onchange="document.getElementById('prepend-small-btn').value = this.value;">
                                                                            </div>
                                                                            <input type="text" id="prepend-small-btn" placeholder="tidak ada file yang dipilih">
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="modal-footer">
                                                        <div class="form-group-inner">
                                                            <div class="login-btn-inner">
                                                                <div class="row">
                                                                    <div class="col-lg-3"></div>
                                                                    <div class="col-lg-9">
                                                                        <div class="login-horizental cancel-wp pull-right">
                                                                            <button type='reset' data-dismiss='modal' class="btn btn-sm btn-white">Cancel</button>
                                                                            <button class="btn btn-sm btn-primary" type="submit">Add New</button>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                    <div class=" datatable-dashv1-list custom-datatable-overright">
                                        <div id="toolbar">
                                        </div>
                                        <table id="table" data-toggle="table" data-pagination="true" data-search="true" data-show-columns="false" data-show-pagination-switch="true" data-show-refresh="true" data-key-events="true" data-show-toggle="true" data-resizable="true" data-cookie="true" data-cookie-id-table="saveId" data-show-export="false" data-click-to-select="true" data-toolbar="#toolbar">
                                            <thead>
                                                <tr>
                                                    <th data-field="state" data-checkbox="true"></th>
                                                    <th data-field="Nomor">No.</th>
                                                    <th data-field="NIP">Jenjang</th>
                                                    <th data-field="NUPTK">Kelas</th>
                                                    <th data-field="Mapel">Kode Mapel</th>
                                                    <th data-field="Kdp">No. KD</th>
                                                    <th data-field="Kompetensi">Kompetensi Dasar</th>
                                                    <th data-field="Deskripsi">Deskripsi</th>
                                                    <th data-field="Edit"></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php $i = 1;
                                                foreach ($kdp as $study) :
                                                    if ($study['id_jenjang'] == $nmUser['kd_jenjang']) { ?>
                                                        <tr>
                                                            <td></td>
                                                            <td align="center"><?= $i;
                                                                                $i++; ?></td>
                                                            <td><?= $study['sgkt_jenjang']; ?></td>
                                                            <td><?= $study['nm_kelas']; ?></td>
                                                            <td><?= $study['nm_mapel']; ?></td>
                                                            <td><?= $study['kd_kdp']; ?></td>
                                                            <td><?= $study['nm_kdp']; ?></td>
                                                            <td><?= $study['nm_deskripsi']; ?></td>
                                                            <td align="center">
                                                                <a href="#" data-toggle="modal" data-target="#EditKdp<?= $study['id_nmkdp']; ?>">
                                                                    <div class="label label-warning"><i class=" fa fa-edit"></i> Edit</div>
                                                                </a>
                                                                <a href='<?= base_url('admin/hapusDataKdp/' . $study['id_nmkdp']); ?>' id='btn-hapus'>
                                                                    <div class="label label-danger"><i class=" fa fa-trash"></i> Delete</div>
                                                                </a>
                                                        </tr>
                                                    <?php } ?>
                                                    <div id="EditKdp<?= $study['id_nmkdp']; ?>" class="modal modal-adminpro-general Customwidth-popup-WarningModal fade" role="dialog">
                                                        <form action="<?= base_url('admin/updateDataKdp'); ?>" method="post">
                                                            <div class="modal-dialog">
                                                                <div class="modal-content">
                                                                    <div class="modal-header header-color-modal bg-color-3">
                                                                        <h4 class="modal-title">Form Update Data KD Pengetahuan</h4>
                                                                        <div class="modal-close-area modal-close-df">
                                                                            <a class="close" data-dismiss="modal" href="#"><i class="fa fa-close"></i></a>
                                                                        </div>
                                                                    </div>
                                                                    <div class="modal-body">
                                                                        <input type="hidden" class="form-control" id="id_nmkdp" name="id_nmkdp" placeholder="Id Teacher" value='<?= $study['id_nmkdp']; ?>' required>
                                                                        <input type="hidden" class="form-control" id="nm_jenjang" name="nm_jenjang" placeholder="Id Teacher" value='<?= $nmUser['kd_jenjang']; ?>' required>
                                                                        <div class="sparkline11-graph">
                                                                            <div class="row">
                                                                                <div class="col-lg-6">
                                                                                    <label class="login2 pull-right pull-right-pro">Kelas</label>
                                                                                </div>
                                                                                <div class="col-lg-6">
                                                                                    <select data-placeholder="Pilih Kelas" class="chosen-select" tabindex="-1" name='nm_kelas' id='nm_kelas'>
                                                                                        <option disabled selected>Pilih Kelas</option>
                                                                                        <?php
                                                                                        foreach ($kls as $km) : {
                                                                                                if ($km['no_kls'] == $nmUser['kd_jenjang']) {
                                                                                                    if ($km['angka_kls'] == $study['nm_kelas']) {
                                                                                                        $select = "selected";
                                                                                                    } else {
                                                                                                        $select = "";
                                                                                                    }
                                                                                                    echo "<option $select>" . $km['nm_kls'] . "</option>";
                                                                                                }
                                                                                            }
                                                                                        endforeach;
                                                                                        form_error('nm_kelas', '<small class="text-danger">', '</small>'); ?>
                                                                                    </select>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                        <div class="sparkline11-graph">
                                                                            <div class="row">
                                                                                <div class="col-lg-6">
                                                                                    <label class="login2 pull-right pull-right-pro">Kode Bidang Study</label>
                                                                                </div>
                                                                                <div class="col-lg-6">
                                                                                    <select data-placeholder="Pilih Kode Bid Study" class="chosen-select" tabindex="-1" name='nm_mapel' id='nm_mapel'>
                                                                                        <option disabled selected>Pilih Kode Bid Study</option>
                                                                                        <?php
                                                                                        foreach ($mapel as $km) : {
                                                                                                if ($km['nm_kdbidstudy'] == $study['nm_mapel']) {
                                                                                                    $select = "selected";
                                                                                                } else {
                                                                                                    $select = "";
                                                                                                }
                                                                                                echo "<option $select>" . $km['nm_kdbidstudy'] . "</option>";
                                                                                            }
                                                                                        endforeach;
                                                                                        form_error('nm_mapel', '<small class="text-danger">', '</small>'); ?>
                                                                                    </select>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                        <div class="sparkline11-graph">
                                                                            <div class="row">
                                                                                <div class="col-lg-6">
                                                                                    <label class="login2 pull-right pull-right-pro">Nomor KD</label>
                                                                                </div>
                                                                                <div class="col-lg-6">
                                                                                    <select data-placeholder="Pilih Nomor KD" class="chosen-select" tabindex="-1" name='kd_kdp' id='kd_kdp'>
                                                                                        <option disabled selected>Pilih Nomor KD</option>
                                                                                        <?php
                                                                                        foreach ($nokdp as $km) : {
                                                                                                if ($km['nm_nokdp'] == $study['kd_kdp']) {
                                                                                                    $select = "selected";
                                                                                                } else {
                                                                                                    $select = "";
                                                                                                }
                                                                                                echo "<option $select>" . $km['nm_nokdp'] . "</option>";
                                                                                            }
                                                                                        endforeach;
                                                                                        form_error('kd_kdp', '<small class="text-danger">', '</small>'); ?>
                                                                                    </select>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                        <div class="sparkline11-graph">
                                                                            <div class="row">
                                                                                <div class="col-lg-12">
                                                                                    <label class="login2 pull-left pull-left-pro">Kompetensi Dasar</label>
                                                                                </div>
                                                                                <div class="col-lg-12">
                                                                                    <textarea rows="5" id="nm_kdp" name="nm_kdp" class="form-control" placeholder="isi deskripsi lengkap" required><?= $study['nm_kdp']; ?></textarea>
                                                                                </div>
                                                                            </div>
                                                                            <?= form_error('nm_kdp', '<small class="text-danger">', '</small>'); ?>
                                                                        </div>
                                                                        <div class="sparkline11-graph">
                                                                            <div class="row">
                                                                                <div class="col-lg-12">
                                                                                    <label class="login2 pull-left pull-left-pro">Deskripsi KD</label>
                                                                                </div>
                                                                                <div class="col-lg-12">
                                                                                    <textarea id="nm_deskripsi" name="nm_deskripsi" class="form-control" placeholder="isi deskripsi singkat dengan huruf kecil semua" required><?= $study['nm_deskripsi']; ?></textarea>
                                                                                </div>
                                                                            </div>
                                                                            <?= form_error('nm_deskripsi', '<small class="text-danger">', '</small>'); ?>
                                                                        </div>
                                                                    </div>
                                                                    <div class="modal-footer">
                                                                        <div class="form-group-inner">
                                                                            <div class="login-btn-inner">
                                                                                <div class="row">
                                                                                    <div class="col-lg-3"></div>
                                                                                    <div class="col-lg-9">
                                                                                        <div class="login-horizental cancel-wp pull-right">
                                                                                            <button type='reset' data-dismiss='modal' class="btn btn-sm btn-white">Cancel</button>
                                                                                            <button class="btn btn-sm btn-warning" type="submit">Update</button>
                                                                                        </div>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </form>
                                                    </div>
                                                <?php endforeach;
                                                ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>