<!-- // 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">
        <?php
        if ($cekTapel > 0) {
            if ($jumlahsts > 0) {
                if ($cekKelas > 0) {
                    if ($cekSiswa > 0) {
        ?>
        <?php
                    } else {
                        $this->session->set_flashdata('messageWarning', 'Silahkan tambahkan data students terlebih dahulu !');
                        redirect('admin/data_siswa');
                    }
                } else {
                    $this->session->set_flashdata('messageWarning', 'Silahkan tambah data kelas - rombel terlebih dahulu !');
                    redirect('admin/data_kelas');
                }
            } else {
                $this->session->set_flashdata('messageWarning', 'Silahkan Aktifkan data tahun pelajaran dan semester terlebih dahulu !');
                redirect('admin/tapel');
            }
        } else {
            $this->session->set_flashdata('messageWarning', 'Silahkan tambah data tahun pelajaran terlebih dahulu !');
            redirect('admin/tapel');
        }
        ?>
        <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="inbox-mailbox-area mg-b-40">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12">
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
                                    <div class="inbox-email-menu-list shadow-reset">
                                        <div class="compose-email">
                                            <a><b>Data Kelas - Rombel</b></a>
                                        </div>
                                        <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>
                                        <ul class="nav nav-tabs">
                                            <li>
                                                <h4 class="Inbox-category-ad"><i class="fa fa-folder-o" aria-hidden="true"></i> Kelas</h4>
                                            </li>
                                            <?php
                                            foreach ($dtKelas as $study) :
                                                if ($study['kd_lembaga'] == $nmLembaga['id_lembaga']) {
                                                    if ($study['kd_tapel'] == $kdTapel) {
                                            ?>
                                                        <?php
                                                        $this->db->where('kd_kelas', $study['id_kelas']);
                                                        $jumlah = $this->db->count_all_results('t_rombelsiswa');
                                                        ?>
                                                        <li><a data-toggle="tab" href='#inbox<?= $study['id_kelas']; ?>'><span class="inbox-icon"><i class="fa fa fa-pencil "></i></span> <?= $study['nm_rombel'] . ' (' . $jumlah . ' Siswa)'; ?></a></li>
                                                <?php
                                                    }
                                                }
                                                ?>
                                            <?php endforeach; ?>
                                        </ul>
                                    </div>
                                </div>
                                <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
                                    <div class="tab-content view-mail-ov-mg-t-30">
                                        <?php
                                        $i = 1;
                                        foreach ($dtKelas as $study) :
                                            if ($study['kd_lembaga'] == $nmLembaga['id_lembaga']) {
                                                if ($study['kd_tapel'] == $kdTapel) {
                                        ?>
                                                    <div id="inbox<?= $study['id_kelas']; ?>" class="tab-pane fade animated zoomInDown shadow-reset custom-inbox-message">
                                                        <div class="mail-title inbox-bt-mg">
                                                            <?php
                                                            $this->db->where('kd_kelas', $study['id_kelas']);
                                                            $jumlah = $this->db->count_all_results('t_rombelsiswa');
                                                            ?>
                                                            <h2>Daftar Siswa Kelas : <b><?= $study['nm_rombel'] . ' (' . $jumlah . ' Siswa)'; ?></b></h2>
                                                            <div class="view-mail-action view-mail-ov-d-n">
                                                                <a class="compose-draft-bt" href="#" data-toggle="modal" data-target="#TambahRombelSiswa<?= $study['id_kelas']; ?>"><i class="fa fa-plus-circle"></i> Input Siswa</a>
                                                            </div>
                                                        </div>
                                                        <div class="datatable-dashv1-list custom-datatable-overright">
                                                            <table id="table1" 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="#toolbar1">
                                                                <thead>
                                                                    <tr>
                                                                        <th data-field="state" data-checkbox="true"></th>
                                                                        <th data-field="id">No</th>
                                                                        <th data-field="nisn">NISN</th>
                                                                        <th data-field="nism">NISM Lokal</th>
                                                                        <th data-field="email">Nama Students</th>
                                                                        <th data-field="company">Aksi</th>
                                                                    </tr>
                                                                </thead>
                                                                <tbody>
                                                                    <?php $i = 1;
                                                                    foreach ($dtRombel as $p) :
                                                                        if ($p['kdkelas'] == $study['id_kelas'] && $p['kdl'] == $nmUser['kd_user'] && $kdTapel == $p['kdt']) {
                                                                    ?>
                                                                            <tr class="new-email">
                                                                                <td></td>
                                                                                <td><?= $i;
                                                                                    $i++; ?></td>
                                                                                <td><?= $p['nisn']; ?></td>
                                                                                <td><?= $p['nism']; ?></td>
                                                                                <td><?= $p['siswa']; ?></td>
                                                                                <td>
                                                                                    <a href='<?= base_url('admin/hapusDataSiswaRombel/' . $p['kdsiswa']); ?>' id='btn-hapus'>
                                                                                        <div class="label label-danger"><i class=" fa fa-trash"></i></div>
                                                                                    </a>
                                                                                </td>
                                                                            </tr>
                                                                        <?php
                                                                        }
                                                                        ?>
                                                                    <?php endforeach;  ?>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                        <div><br></div>
                                                    </div>
                                                    <?php $i = 1;
                                                    foreach ($dtKelas as $study) :
                                                        if ($study['kd_lembaga'] == $nmUser['kd_user'] && $study['kd_tapel'] == $kdTapel) {
                                                    ?>
                                                            <div id="TambahRombelSiswa<?= $study['id_kelas']; ?>" class="modal FullColor-popup-AlertModal fade" role="dialog">
                                                                <form action="<?= base_url('admin/tambahDataSiswaRombel'); ?>" 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 Tambah Data Rombongan Belajar Siswa</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_kelas" name="id_kelas" placeholder="Id Nilai Eskul" value='<?= $study['id_kelas']; ?>'>
                                                                                <div class="sparkline11-graph">
                                                                                    <div class="row">
                                                                                        <div class="col-lg-12">
                                                                                            <input type="text" class="form-control" id="id" name="id" placeholder="Id" value='Kelas - Rombel : <?= $study['nm_rombel']; ?>' readonly>
                                                                                        </div>
                                                                                    </div>
                                                                                </div>
                                                                                <div class="sparkline11-graph">
                                                                                    <div class="row">
                                                                                        <div class="col-lg-12">
                                                                                            <label class="login2 pull-left pull-left-pro">Daftar Nama Students</label>
                                                                                        </div>
                                                                                        <div class="col-lg-12">
                                                                                            <select data-placeholder="Pilih students sesuai rombel" class="chosen-select" multiple="" tabindex="-1" name='kd_students[]' id='kd_students'>
                                                                                                <?php foreach ($siswa as $std) :  if ($nmUser['kd_user'] == $std['kd_lembaga'] && $std['tingkat_kelas'] == $study['angka_kelas'] && $std['rombel_aktif'] == 1 &&  $std['rombel_nonaktif'] == 0) { ?>
                                                                                                        <option value='<?= $std['id_students'] ?>'><?= $std['nisn_students'] . ' : ' . $std['nm_students']; ?></option>
                                                                                                <?php }
                                                                                                endforeach; ?>
                                                                                                <?= form_error('kd_students', '<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-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;  ?>
                                        <?php
                                                }
                                            }
                                        endforeach; ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>