<?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
$userlevelid = JsEncode(CurrentUserInfo('userlevelid'));
if ($userlevelid == '0') { ?>
    <section>
        <div class="row">
            <div class="col-lg-12">
                <div class="card card-primary card-outline">
                    <div class="card-body">
                        <h4>Petunjuk</h4>
                        <table>
                            <tr>
                                <td valign="top" align="justify">1.</td>
                                <td valign="top" align="justify">Silahkan Edit dan Lengkapi Biodata Peserta Didik yang sudah disiapkan dengan klik Tombol EDIT</td>
                            </tr>
                            <tr>
                                <td valign="top" align="justify">2.</td>
                                <td valign="top" align="justify">Untuk Informasi bisa hubungi Admin Aplikasi</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
<?php } elseif ($userlevelid == 1 || IsSysAdmin()) { ?>
    <section>
        <div class="row">
            <div class="col-md-6">
                <div class="card card-primary card-outline">
                    <div class="card-body">
                        <h4>Petunjuk</h4>
                        <table>
                            <tr>
                                <td valign="top" align="justify">1.</td>
                                <td valign="top" align="justify">Isikan Jumlah Data Siswa yang akan diimport</td>
                            </tr>
                            <tr>
                                <td valign="top" align="justify">2.</td>
                                <td valign="top" align="justify">Download Template</td>
                            </tr>
                            <tr>
                                <td valign="top" align="justify">3.</td>
                                <td valign="top" align="justify">Data ini merupakan data yang akan menjadi sumber data dalam pembuatan template nilai dan cetak biodata siswa. data kelas pun akan diambil dari data peserta didik, pastikan data benar dan valid sebelum import</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>

            <div class="col-md-6">
                <div class="card card-primary card-outline">
                    <div class="card-body">
                        <center>
                            <h5>Tahun Pelajaran / Kode : <?= tapel() ?> / <?= kode_tapel() ?></h5>
                        </center>
                        <form action="tool/export_pd.php" method="">
                            <div class="form-group row">
                                <label class="col-md-4">Jumlah Siswa</label>
                                <input class="form-control col" type="number" id="jumlah_siswa" name="jumlah_siswa" placeholder="0" required>
                            </div>
                            <?php
                            $ktp = ExecuteScalar("SELECT kode_tapel FROM tahun_pelajaran WHERE status='Aktif'");
                            ?>
                            <div class="form-group row">
                                <input class="form-control" type="hidden" id="kode_tapel" name="kode_tapel" value="<?= $ktp ?>">
                                <div class="col">
                                    <button class="btn btn-success btn-block" type="submit" id="template" name="template">Download Template</button>
                                </div>
                                <div class="col">
                                    <a class="btn btn-primary btn-block" href="#" role="button" title="" data-caption="Impor" onclick="return ew.importDialogShow({lnk:this});" data-original-title="Impor">Import Data Siswa</a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
<?php } ?>