<?php

namespace PHPMaker2021\rdigital21;

use PHPMaker2021\rdigital21\{UserProfile, Language, AdvancedSecurity, Timer, HttpErrorHandler};
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Container\ContainerInterface;
use DI\Container as Container;
use DI\ContainerBuilder;
use Selective\SameSiteCookie\SameSiteCookieConfiguration;
use Selective\SameSiteCookie\SameSiteCookieMiddleware;
use Selective\SameSiteCookie\SameSiteSessionMiddleware;
use Slim\Factory\AppFactory;
use Slim\Factory\ServerRequestCreatorFactory;
use Slim\Exception\HttpInternalServerErrorException;
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7Server\ServerRequestCreator;

// Relative path
$RELATIVE_PATH = "";

// Require files
require_once "vendor/autoload.php";
require_once "src/constants.php";
require_once "src/config.php";
require_once "src/phpfn.php";
require_once "src/userfn.php";
?>



<?php
if (CurrentPageName() == "TahunPelajaranList") { ?>
    <section>
        <div class="row">
            <div class="col-12">

                <div class="card">
                    <div class="card-header card-primary card-outline bg-light">
                        <h3 class="card-title" data-card-widget="collapse" title="Collapse"><small><i class="fas fa-list"></i> Petunjuk Penggunaan</small></h3>
                        <div class="card-tools">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-plus"></i>
                            </button>
                            <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <table class="table table-sm table-borderless">
                            <tr>
                                <td>1. </td>
                                <td>Pastikan hanya SATU Tahun Pelajaran yang Aktif.</td>
                            </tr>
                            <tr>
                                <td>2. </td>
                                <td>Data yang akan diolah dan ditampilkan sesuai Kode Tahun Pelajaran.</td>
                            </tr>
                            <tr>
                                <td>3. </td>
                                <td>Ganjil Genap pada Kode Tahun Pelajaran dikodekan dengan 1 dan 2.</td>
                            </tr>
                        </table>

                    </div>

                </div>

            </div>
        </div>
    </section>
<?php } ?>

<?php
if (CurrentPageName() == "GuruList") { ?>
    <section>
        <div class="row">
            <div class="col-12">

                <div class="card">
                    <div class="card-header card-primary card-outline bg-light">
                        <h3 class="card-title" data-card-widget="collapse" title="Collapse"><small><i class="fas fa-list"></i> Petunjuk Penggunaan</small></h3>
                        <div class="card-tools ">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-plus"></i>
                            </button>
                            <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <table class="table table-sm table-borderless">
                            <tr>
                                <td>1. Download Template Guru</td>
                                <td><a href="tool/template_guru.xlsx" class="btn bg-success"><i class="fas fa-file-excel"></i> Download Template Guru</td>
                            </tr>
                            <tr>
                                <td>2. Isi Data yang sesuai dengan template yang sudah di download</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>3. Import / Upload Template</td>
                                <td><a class="btn bg-primary" href="#" role="button" title="Impor" data-caption="Impor" onclick="return ew.importDialogShow({lnk:this,hdr:ew.language.phrase('ImportText')});"><i class="fas fa-upload"></i> Import / Upload Template</a></td>
                            </tr>
                        </table>
                    </div>
                </div>

            </div>
        </div>
    </section>
<?php } ?>

<?php
if (CurrentPageName() == "WaliKelasList") { ?>
    <section>
        <div class="row">
            <div class="col-12">

                <div class="card">
                    <div class="card-header card-primary card-outline bg-light">
                        <h3 class="card-title" data-card-widget="collapse" title="Collapse"><small><i class="fas fa-list"></i> Petunjuk Penggunaan</small></h3>
                        <div class="card-tools ">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-plus"></i>
                            </button>
                            <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <?php
                        $userlevelid = JsEncode(CurrentUserInfo('userlevelid'));
                        if ($userlevelid == '0') { ?>
                            <table class="table table-sm table-borderless">
                                <tr>
                                    <td>1. Ubah Password bila diperlukan</td>
                                </tr>
                                <tr>
                                    <td>2. Untuk Cetak Biodata PD dan Biodata P5 silahkan klik pada tombol pada kolom KELAS</td>
                                    <td></td>
                                </tr>
                            </table>
                        <?php } else { ?>
                            <table class="table table-sm table-borderless">
                                <tr>
                                    <td>1. Download Template Wali Kelas</td>
                                    <td><a href="tool/template_walas.xlsx" class="btn bg-success"><i class="fas fa-file-excel"></i> Download Template Wali Kelas</td>
                                </tr>
                                <tr>
                                    <td>2. Isi Data yang sesuai dengan template yang sudah di download</td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td>3. Import / Upload Template</td>
                                    <td><a class="btn bg-primary" href="#" role="button" title="Impor" data-caption="Impor" onclick="return ew.importDialogShow({lnk:this,hdr:ew.language.phrase('ImportText')});"><i class="fas fa-upload"></i> Import / Upload Template</a></td>
                                </tr>
                            </table>
                        <?php } ?>
                    </div>

                </div>

            </div>
        </div>
    </section>
<?php } ?>

<?php
if (CurrentPageName() == "PenilaianList") { ?>
    <section>
        <div class="row">
            <div class="col-12">

                <div class="card collapsed-card">
                    <div class="card-header card-primary card-outline bg-light">
                        <h3 class="card-title" data-card-widget="collapse" title="Collapse"><small><i class="fas fa-list"></i> Petunjuk Penggunaan</small></h3>
                        <div class="card-tools ">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-plus"></i>
                            </button>
                            <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <table width="100%">
                            <tr>
                                <td valign="top">1. </td>
                                <td>Tambah Data Penilaian dengan klik tombol <a class="btn btn-default ew-add-edit ew-add bg-primary btn-sm" title="Tambah" data-caption="Tambah" href=""><i class="fas fa-plus"></i> Tambah</a></td>
                            </tr>
                            <tr>
                                <td valign="top">2. </td>
                                <td>Warna <span class="bg-danger">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> = Belum Generate, Warna <span class="bg-success">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> = Sudah Generate</td>
                            </tr>
                            <tr>
                                <td valign="top">3. </td>
                                <td>Lihat Data Nilai yang sudah dibuat pada Nilai Formatif atau Nilai Sumatif dengan Pilih Tombol yang berwarna kuning <span class="bg-warning">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
                            </tr>
                        </table>

                    </div>

                </div>

            </div>
        </div>
    </section>
<?php } ?>

<?php
if (CurrentPageName() == "NilaiSumatifList") { ?>
    <section>
        <div class="row">
            <div class="col-12">

                <div class="card collapsed-card">
                    <div class="card-header card-primary card-outline bg-light">
                        <h3 class="card-title" data-card-widget="collapse" title="Collapse"><small><i class="fas fa-list"></i> Petunjuk Penggunaan</small></h3>
                        <div class="card-tools ">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-plus"></i>
                            </button>
                            <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <table width="100%">
                            <tr>
                                <td valign="top">1. </td>
                                <td align="justify">Data ini adalah hasil Generate Nilai dari Menu Penilaian. Export Data Sesuai Kelas dan Mata Pelajaran dilanjutkan Isi Nilai serta Pastikan Convert atau SAVE AS menjadi XLSX.</td>
                            </tr>
                            <tr>
                                <td valign="top">2. </td>
                                <td align="justify">Pada Proses Pengisian, NAS isikan dengan rumus AVERAGE sesuai jumlah pengisian nilai Sumatif (S1-dst) dan jangan hapus nilai_s_id, karna ini akan digunakan sebagai id dalam proses update data setelah upload/import</td>
                            </tr>
                            <tr>
                                <td valign="top">3. </td>
                                <td align="justify">Upload/ Import Data yang sudah valid</td>
                            </tr>
                            <tr>
                                <td valign="top">4. </td>
                                <td align="justify">Menu Cari Data untuk menampilkan data berdasarkan kelas dan juga untuk Export Excel Per Kelas</td>
                            </tr>
                        </table>

                    </div>

                </div>

            </div>
        </div>
        <style type="text/css">
            #tbl_nilai_sumatiflist {
                zoom: 80%;
            }
        </style>
    </section>
<?php } ?>

<?php
if (CurrentPageName() == "NilaiFormatifList") { ?>
    <section>
        <div class="row">
            <div class="col-12">

                <div class="card collapsed-card">
                    <div class="card-header card-primary card-outline bg-light">
                        <h3 class="card-title" data-card-widget="collapse" title="Collapse"><small><i class="fas fa-list"></i> Petunjuk Penggunaan</small></h3>
                        <div class="card-tools ">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-plus"></i>
                            </button>
                            <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <table width="100%">
                            <tr>
                                <td valign="top">1. </td>
                                <td align="justify">Data ini adalah hasil Generate Nilai dari Menu Penilaian. Export Data Sesuai Kelas dan Mata Pelajaran dilanjutkan Isi Nilai serta Pastikan Convert atau SAVE AS menjadi XLSX.</td>
                            </tr>
                            <tr>
                                <td valign="top">2. </td>
                                <td align="justify">Pada Proses Pengisian, NAS isikan dengan rumus AVERAGE sesuai jumlah pengisian nilai Sumatif (S1-dst) dan jangan hapus nilai_f_id, karna ini akan digunakan sebagai id dalam proses update data setelah upload/import</td>
                            </tr>
                            <tr>
                                <td valign="top">3. </td>
                                <td align="justify">Upload/ Import Data yang sudah valid</td>
                            </tr>
                        </table>

                    </div>

                </div>

            </div>
        </div>
        <style type="text/css">
            #tbl_nilai_formatiflist {
                zoom: 80%;
            }
        </style>
    </section>
<?php } ?>



<?php
if (CurrentPageName() == "ExtraAbsensiList") { ?>
    <section>
        <div class="row">
            <div class="col-12">

                <div class="card">
                    <div class="card-header card-primary card-outline bg-light">
                        <h3 class="card-title" data-card-widget="collapse" title="Collapse"><small><i class="fas fa-list"></i> Petunjuk Penggunaan</small></h3>
                        <div class="card-tools ">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-plus"></i>
                            </button>
                            <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <?php
                        $kelas = JsEncode(CurrentUserID());
                        $kode_tapel = kode_tapel();
                        $cek = ExecuteScalar("SELECT COUNT(*) FROM extra_absensi WHERE kelas='$kelas' and kode_tapel='$kode_tapel'");
                        if ($cek == '0' && !IsSysAdmin()) {
                            echo '<h6>Klik Tarik Data Siswa untuk Generate Data Absensi dan Extrakurikuler</h6><a href="act.php?absensi=' . $kelas . '|' . $kode_tapel . '" class="btn btn-success">Tarik Data Siswa</a>';
                        } else {
                            if (IsSysAdmin()) {
                                echo "Silahkan Cek / Lengkapi " . $cek = ExecuteScalar("SELECT COUNT(*) FROM extra_absensi WHERE kode_tapel='$kode_tapel'") . " Data yang sudah di generate";
                            } else {
                                echo "Silahkan Lengkapi " . $cek = ExecuteScalar("SELECT COUNT(*) FROM extra_absensi WHERE kelas='$kelas' and kode_tapel='$kode_tapel'") . " Data yang sudah di generate";
                            }
                        }
                        ?>


                    </div>

                </div>
            </div>
    </section>
<?php } ?>

<?php
if (CurrentPageName() == "ProyekList") { ?>
    <section>
        <div class="row">
            <div class="col-12">

                <div class="card collapsed-card">
                    <div class="card-header card-primary card-outline bg-light">
                        <h3 class="card-title" data-card-widget="collapse" title="Collapse"><small><i class="fas fa-list"></i> Petunjuk Penggunaan</small></h3>
                        <div class="card-tools ">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-plus"></i>
                            </button>
                            <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <h5>Isikan Data Proyek P5 seperti <br><small>TAHUN PELAJARAN, PROJECT, NAMA PROYEK, TEMA, DIMENSI, DESKRIPSI PROYEK dengan Klik
                                <a class="btn btn-default ew-add-edit ew-add bg-primary btn-sm" title="Tambah" data-caption="Tambah" href=""><i class="fas fa-plus"></i> Tambah</a></small></h5>
                        <hr>
                    </div>

                </div>
            </div>
    </section>
<?php } ?>