<!-- // 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-cogs"></i><b> Nilai KKM Kelas & Bobot Penilaian</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 id="flashinfo" data-flash="<?= $this->session->flashdata('messageInfo'); ?>"></div>
                                    <div id="flashinfo2" data-flash="<?= $this->session->flashdata('messageInfo2'); ?>"></div>
                                    <div id="TambahGurMapel" class="modal modal-adminpro-general default-popup-PrimaryModal fade" role="dialog">
                                        <form action="<?= base_url('admin/tambahDataGurMapel'); ?>" 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 Guru Bidang Study</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">Nama Teacher</label>
                                                                </div>
                                                                <div class="col-lg-12">
                                                                    <select data-placeholder="Teacher" class="chosen-select" tabindex="-1" name='kd_teachers' id='kd_teachers'>
                                                                        <option value=""></option>
                                                                        <?php foreach ($teachers as $study) : if ($nmUser['kd_user'] == $study['kd_lembaga']) { ?>
                                                                                <option value='<?= $study['id_teachers'] ?>'><?= $study['nuptk_teachers'] . ' : ' . $study['nm_teachers'] ?></option>
                                                                        <?php }
                                                                        endforeach; ?>
                                                                        <?= form_error('kd_teachers', '<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">Nama Rombel</label>
                                                                </div>
                                                                <div class="col-lg-12">
                                                                    <select data-placeholder="Rombel" class="chosen-select" tabindex="-1" name='kd_kelas' id='kd_kelas'>
                                                                        <option value=""></option>
                                                                        <?php foreach ($kelas as $study) : if ($nmUser['kd_user'] == $study['kd_lembaga'] && $kdTapel == $study['kd_tapel']) { ?>
                                                                                <option value='<?= $study['id_kelas'] ?>'><?= $study['nm_rombel'] ?></option>
                                                                        <?php }
                                                                        endforeach; ?>
                                                                        <?= form_error('kd_kelas', '<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">Nama Bidang Study</label>
                                                                </div>
                                                                <div class="col-lg-12">
                                                                    <select data-placeholder="Bidang Study" class="chosen-select" tabindex="-1" name='kd_bidstudy' id='kd_bidstudy'>
                                                                        <option value=""></option>
                                                                        <?php foreach ($mapel as $study) : if ($nmUser['kd_user'] == $study['kd_lembaga'] && $kdTapel == $study['kd_tapel']) { ?>
                                                                                <option value='<?= $study['id_bidstudy'] ?>'><?= $study['nm_kdbidstudy'] . ' : ' . $study['nm_nmbidstudy'] ?></option>
                                                                        <?php }
                                                                        endforeach; ?>
                                                                        <?= form_error('kd_bidstudy', '<small class="text-danger">', '</small>'); ?>
                                                                    </select>
                                                                </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-12">
                                                                        <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="Kode">Rombel</th>
                                                    <th data-field="tp">Bidang Study</th>
                                                    <th data-field="tgl">KKM</th>
                                                    <th data-field="hph">Bobot HPH</th>
                                                    <th data-field="hpts">Bobot HPTS</th>
                                                    <?php foreach ($nmTapel as $tp) :
                                                        if ($tp['sts_tapel'] == 1 && $tp['kd_lembaga'] == $nmUser['kd_user']) {
                                                            if ($tp['kd_smstr'] == 'Ganjil') {
                                                    ?>
                                                                <th data-field="hpas">Bobot HPAS</th>
                                                            <?php } else { ?>
                                                                <th data-field="hpas">Bobot HPAT</th>
                                                    <?php }
                                                        }
                                                    endforeach;
                                                    ?>
                                                    <th data-field="jp">Jam Pelajaran (JP)</th>
                                                    <th data-field="Edit">Aksi</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                $i = 1;
                                                foreach ($dtKkm as $study) :
                                                    if ($study['kdl'] == $nmLembaga['id_lembaga']) {
                                                        if ($study['kdt'] == $kdTapel) {
                                                            if ($study['kdguru'] == $nmUser['kd_teachers']) { ?>
                                                                <tr>
                                                                    <td></td>
                                                                    <td align="center"><?= $i;
                                                                                        $i++; ?></td>
                                                                    <td><?= $study['kelas']; ?></td>
                                                                    <td><?= $study['mapel']; ?></td>
                                                                    <td>
                                                                        <?php foreach ($kkm as $tp) :
                                                                            if ($tp['kd_gmapel'] == $study['idm'] && $tp['kd_tapel'] == $kdTapel && $tp['kd_lembaga'] == $nmUser['kd_user']) :
                                                                                echo $tp['n_kkmkls'];
                                                                            endif;
                                                                        endforeach;
                                                                        ?>
                                                                    </td>
                                                                    <td>
                                                                        <?php foreach ($kkm as $tp) :
                                                                            if ($tp['kd_gmapel'] == $study['idm'] && $tp['kd_tapel'] == $kdTapel && $tp['kd_lembaga'] == $nmUser['kd_user']) :
                                                                                echo $tp['b_hph'] . ' %';
                                                                            endif;
                                                                        endforeach;
                                                                        ?>
                                                                    </td>
                                                                    <td>
                                                                        <?php foreach ($kkm as $tp) :
                                                                            if ($tp['kd_gmapel'] == $study['idm'] && $tp['kd_tapel'] == $kdTapel && $tp['kd_lembaga'] == $nmUser['kd_user']) :
                                                                                echo $tp['b_hpts'] . ' %';
                                                                            endif;
                                                                        endforeach;
                                                                        ?>
                                                                    </td>
                                                                    <td>
                                                                        <?php foreach ($kkm as $tp) :
                                                                            if ($tp['kd_gmapel'] == $study['idm'] && $tp['kd_tapel'] == $kdTapel && $tp['kd_lembaga'] == $nmUser['kd_user']) :
                                                                                echo $tp['b_hpas'] . ' %';
                                                                            endif;
                                                                        endforeach;
                                                                        ?>
                                                                    </td>
                                                                    <td>
                                                                        <?php foreach ($kkm as $tp) :
                                                                            if ($tp['kd_gmapel'] == $study['idm'] && $tp['kd_tapel'] == $kdTapel && $tp['kd_lembaga'] == $nmUser['kd_user']) :
                                                                                echo $tp['jp_mapel'] . ' JP';
                                                                            endif;
                                                                        endforeach;
                                                                        ?>
                                                                    </td>
                                                                    <td align="center">
                                                                        <a href="#" data-toggle="modal" data-target="#EditMapel<?= $study['idm']; ?>">
                                                                            <div class="label label-success"><i class=" fa fa-plus"></i> Input</div>
                                                                        </a>
                                                                    </td>
                                                                </tr>
                                                    <?php }
                                                        }
                                                    }
                                                    ?>
                                                    <div id="EditMapel<?= $study['idm']; ?>" class="modal modal-adminpro-general FullColor-popup-AlertModal fade" role="dialog">
                                                        <form action="<?= base_url('guru/updateDataNilaiKkm'); ?>" method="post" name="autoSumForm">
                                                            <div class="modal-dialog">
                                                                <div class="modal-content">
                                                                    <div class="modal-header header-color-modal bg-color-5">
                                                                        <h4 class="modal-title">Form Input Nilai KKM & Bobot Penilaian</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">
                                                                        <?php
                                                                        $tes = $this->db->get_where('t_gmapel', ['id_gmapel' => $study['idm'], 'kd_lembaga' => $nmUser['kd_user'], 'kd_tapel' => $kdTapel])->result();
                                                                        foreach ($tes as $edit) : ?>
                                                                            <div class="row">
                                                                                <div class="col-lg-3"></div>
                                                                                <div class="col-lg-9">
                                                                                    <input type="hidden" class="form-control" id="id_kkm" name="id_kkm" placeholder="Id Bidang Study" value='<?= $study['idm']; ?>'>
                                                                                </div>
                                                                            </div>
                                                                            <div class="sparkline11-graph">
                                                                                <div class="row">
                                                                                    <div class="col-lg-12">
                                                                                        <input type="text" class="form-control" id="id_gmapel" name="id_gmapel" placeholder="Id Bidang Study" value='<?= $study['mapel'] . ' / ' . $study['kelas']; ?>' readonly>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                            <div class="sparkline11-graph">
                                                                                <div class="row">
                                                                                    <div class="col-lg-6">
                                                                                        <label class="login2 pull-right pull-right-pro">Nilai KKM</label>
                                                                                    </div>
                                                                                    <div class="col-lg-6">
                                                                                        <input type="number" class="form-control" maxlength="3" id="n_kkmkls" name="n_kkmkls" min="0" max="100" placeholder="Nilai KKM Kelas" value='<?php
                                                                                                                                                                                                                                        foreach ($kkm as $km) :
                                                                                                                                                                                                                                            if ($study['idm'] == $km['kd_gmapel'] && $km['kd_tapel'] == $kdTapel && $km['kd_lembaga'] == $nmUser['kd_user']) {
                                                                                                                                                                                                                                                echo $km['n_kkmkls'];
                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                        endforeach;
                                                                                                                                                                                                                                        ?>' required>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                            <div class="sparkline11-graph">
                                                                                <div class="row">
                                                                                    <div class="col-lg-6">
                                                                                        <label class="login2 pull-right pull-right-pro">Bobot HPH (%)</label>
                                                                                    </div>
                                                                                    <div class="col-lg-6">
                                                                                        <input type="number" class="form-control" maxlength="3" id="b_hph" name="b_hph" min="0" max="100" placeholder="Bobot HPH" value='<?php
                                                                                                                                                                                                                            foreach ($kkm as $km) :
                                                                                                                                                                                                                                if ($study['idm'] == $km['kd_gmapel'] && $km['kd_tapel'] == $kdTapel && $km['kd_lembaga'] == $nmUser['kd_user']) {
                                                                                                                                                                                                                                    echo $km['b_hph'];
                                                                                                                                                                                                                                }
                                                                                                                                                                                                                            endforeach;
                                                                                                                                                                                                                            ?>' required>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                            <div class="sparkline11-graph">
                                                                                <div class="row">
                                                                                    <div class="col-lg-6">
                                                                                        <label class="login2 pull-right pull-right-pro">Bobot HPTS (%)</label>
                                                                                    </div>
                                                                                    <div class="col-lg-6">
                                                                                        <input type="number" class="form-control" maxlength="3" id="b_hpts" name="b_hpts" min="0" max="100" placeholder="Bobot HPTS" value='<?php
                                                                                                                                                                                                                            foreach ($kkm as $km) :
                                                                                                                                                                                                                                if ($study['idm'] == $km['kd_gmapel'] && $km['kd_tapel'] == $kdTapel && $km['kd_lembaga'] == $nmUser['kd_user']) {
                                                                                                                                                                                                                                    echo $km['b_hpts'];
                                                                                                                                                                                                                                }
                                                                                                                                                                                                                            endforeach;
                                                                                                                                                                                                                            ?>' required>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                            <div class="sparkline11-graph">
                                                                                <div class="row">
                                                                                    <div class="col-lg-6">
                                                                                        <?php foreach ($nmTapel as $tp) :
                                                                                            if ($tp['sts_tapel'] == 1) {
                                                                                                if ($tp['kd_smstr'] == 'Ganjil') {
                                                                                        ?>
                                                                                                    <label class="login2 pull-right pull-right-pro">Bobot HPAS (%)</label>
                                                                                                <?php } else { ?>
                                                                                                    <label class="login2 pull-right pull-right-pro">Bobot HPAT (%)</label>
                                                                                        <?php }
                                                                                            }
                                                                                        endforeach;
                                                                                        ?>
                                                                                    </div>
                                                                                    <div class="col-lg-6">
                                                                                        <input type="number" class="form-control" maxlength="3" id="b_hpas" name="b_hpas" min="0" max="100" placeholder="Bobot HPAS" value='<?php
                                                                                                                                                                                                                            foreach ($kkm as $km) :
                                                                                                                                                                                                                                if ($study['idm'] == $km['kd_gmapel'] && $km['kd_tapel'] == $kdTapel && $km['kd_lembaga'] == $nmUser['kd_user']) {
                                                                                                                                                                                                                                    echo $km['b_hpas'];
                                                                                                                                                                                                                                }
                                                                                                                                                                                                                            endforeach;
                                                                                                                                                                                                                            ?>' required>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                            <div class="sparkline11-graph">
                                                                                <div class="row">
                                                                                    <div class="col-lg-6">
                                                                                        <label class="login2 pull-right pull-right-pro">Jam Pelajaran (JP)</label>
                                                                                    </div>
                                                                                    <div class="col-lg-6">
                                                                                        <input type="number" class="form-control" maxlength="3" id="jp_mapel" name="jp_mapel" min="0" max="100" placeholder="Jam Pelajaran" value='<?php
                                                                                                                                                                                                                                    foreach ($kkm as $km) :
                                                                                                                                                                                                                                        if ($study['idm'] == $km['kd_gmapel'] && $km['kd_tapel'] == $kdTapel && $km['kd_lembaga'] == $nmUser['kd_user']) {
                                                                                                                                                                                                                                            echo $km['jp_mapel'];
                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                    endforeach;
                                                                                                                                                                                                                                    ?>' required>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        <?php endforeach; ?>
                                                                    </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-danger" type="submit">Input</button>
                                                                                        </div>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </form>
                                                    </div>
                                                <?php
                                                endforeach;
                                                ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>