<?php

namespace PHPMaker2021\rdigital21;

// Page object
$SekolahView = &$Page;
?>
<?php if (!$Page->isExport()) { ?>
<script>
var currentForm, currentPageID;
var fsekolahview;
loadjs.ready("head", function () {
    var $ = jQuery;
    // Form object
    currentPageID = ew.PAGE_ID = "view";
    fsekolahview = currentForm = new ew.Form("fsekolahview", "view");
    loadjs.done("fsekolahview");
});
</script>
<script>
loadjs.ready("head", function () {
    // Write your table-specific client script here, no need to add script tags.
});
</script>
<?php } ?>
<script>
if (!ew.vars.tables.sekolah) ew.vars.tables.sekolah = <?= JsonEncode(GetClientVar("tables", "sekolah")) ?>;
</script>
<?php if (!$Page->isExport()) { ?>
<div class="btn-toolbar ew-toolbar">
<?php $Page->ExportOptions->render("body") ?>
<?php $Page->OtherOptions->render("body") ?>
<div class="clearfix"></div>
</div>
<?php } ?>
<?php $Page->showPageHeader(); ?>
<?php
$Page->showMessage();
?>
<form name="fsekolahview" id="fsekolahview" class="form-inline ew-form ew-view-form" action="<?= CurrentPageUrl(false) ?>" method="post">
<?php if (Config("CHECK_TOKEN")) { ?>
<input type="hidden" name="<?= $TokenNameKey ?>" value="<?= $TokenName ?>"><!-- CSRF token name -->
<input type="hidden" name="<?= $TokenValueKey ?>" value="<?= $TokenValue ?>"><!-- CSRF token value -->
<?php } ?>
<input type="hidden" name="t" value="sekolah">
<input type="hidden" name="modal" value="<?= (int)$Page->IsModal ?>">
<table class="table table-borderless table-hover table-sm ew-view-table d-none">
<?php if ($Page->npsn->Visible) { // npsn ?>
    <tr id="r_npsn">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_npsn"><template id="tpc_sekolah_npsn"><?= $Page->npsn->caption() ?></template></span></td>
        <td data-name="npsn" <?= $Page->npsn->cellAttributes() ?>>
<template id="tpx_sekolah_npsn"><span id="el_sekolah_npsn">
<span<?= $Page->npsn->viewAttributes() ?>>
<?= $Page->npsn->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->nss->Visible) { // nss ?>
    <tr id="r_nss">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_nss"><template id="tpc_sekolah_nss"><?= $Page->nss->caption() ?></template></span></td>
        <td data-name="nss" <?= $Page->nss->cellAttributes() ?>>
<template id="tpx_sekolah_nss"><span id="el_sekolah_nss">
<span<?= $Page->nss->viewAttributes() ?>>
<?= $Page->nss->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->nama_sekolah->Visible) { // nama_sekolah ?>
    <tr id="r_nama_sekolah">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_nama_sekolah"><template id="tpc_sekolah_nama_sekolah"><?= $Page->nama_sekolah->caption() ?></template></span></td>
        <td data-name="nama_sekolah" <?= $Page->nama_sekolah->cellAttributes() ?>>
<template id="tpx_sekolah_nama_sekolah"><span id="el_sekolah_nama_sekolah">
<span<?= $Page->nama_sekolah->viewAttributes() ?>>
<?= $Page->nama_sekolah->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->status->Visible) { // status ?>
    <tr id="r_status">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_status"><template id="tpc_sekolah_status"><?= $Page->status->caption() ?></template></span></td>
        <td data-name="status" <?= $Page->status->cellAttributes() ?>>
<template id="tpx_sekolah_status"><span id="el_sekolah_status">
<span<?= $Page->status->viewAttributes() ?>>
<?= $Page->status->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->website->Visible) { // website ?>
    <tr id="r_website">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_website"><template id="tpc_sekolah_website"><?= $Page->website->caption() ?></template></span></td>
        <td data-name="website" <?= $Page->website->cellAttributes() ?>>
<template id="tpx_sekolah_website"><span id="el_sekolah_website">
<span<?= $Page->website->viewAttributes() ?>>
<?= $Page->website->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->_email->Visible) { // email ?>
    <tr id="r__email">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah__email"><template id="tpc_sekolah__email"><?= $Page->_email->caption() ?></template></span></td>
        <td data-name="_email" <?= $Page->_email->cellAttributes() ?>>
<template id="tpx_sekolah__email"><span id="el_sekolah__email">
<span<?= $Page->_email->viewAttributes() ?>>
<?= $Page->_email->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->alamat->Visible) { // alamat ?>
    <tr id="r_alamat">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_alamat"><template id="tpc_sekolah_alamat"><?= $Page->alamat->caption() ?></template></span></td>
        <td data-name="alamat" <?= $Page->alamat->cellAttributes() ?>>
<template id="tpx_sekolah_alamat"><span id="el_sekolah_alamat">
<span<?= $Page->alamat->viewAttributes() ?>>
<?= $Page->alamat->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->desa_kelurahan->Visible) { // desa_kelurahan ?>
    <tr id="r_desa_kelurahan">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_desa_kelurahan"><template id="tpc_sekolah_desa_kelurahan"><?= $Page->desa_kelurahan->caption() ?></template></span></td>
        <td data-name="desa_kelurahan" <?= $Page->desa_kelurahan->cellAttributes() ?>>
<template id="tpx_sekolah_desa_kelurahan"><span id="el_sekolah_desa_kelurahan">
<span<?= $Page->desa_kelurahan->viewAttributes() ?>>
<?= $Page->desa_kelurahan->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->kecamatan->Visible) { // kecamatan ?>
    <tr id="r_kecamatan">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_kecamatan"><template id="tpc_sekolah_kecamatan"><?= $Page->kecamatan->caption() ?></template></span></td>
        <td data-name="kecamatan" <?= $Page->kecamatan->cellAttributes() ?>>
<template id="tpx_sekolah_kecamatan"><span id="el_sekolah_kecamatan">
<span<?= $Page->kecamatan->viewAttributes() ?>>
<?= $Page->kecamatan->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->kabupaten->Visible) { // kabupaten ?>
    <tr id="r_kabupaten">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_kabupaten"><template id="tpc_sekolah_kabupaten"><?= $Page->kabupaten->caption() ?></template></span></td>
        <td data-name="kabupaten" <?= $Page->kabupaten->cellAttributes() ?>>
<template id="tpx_sekolah_kabupaten"><span id="el_sekolah_kabupaten">
<span<?= $Page->kabupaten->viewAttributes() ?>>
<?= $Page->kabupaten->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->namaks->Visible) { // namaks ?>
    <tr id="r_namaks">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_namaks"><template id="tpc_sekolah_namaks"><?= $Page->namaks->caption() ?></template></span></td>
        <td data-name="namaks" <?= $Page->namaks->cellAttributes() ?>>
<template id="tpx_sekolah_namaks"><span id="el_sekolah_namaks">
<span<?= $Page->namaks->viewAttributes() ?>>
<?= $Page->namaks->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->nipks->Visible) { // nipks ?>
    <tr id="r_nipks">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_nipks"><template id="tpc_sekolah_nipks"><?= $Page->nipks->caption() ?></template></span></td>
        <td data-name="nipks" <?= $Page->nipks->cellAttributes() ?>>
<template id="tpx_sekolah_nipks"><span id="el_sekolah_nipks">
<span<?= $Page->nipks->viewAttributes() ?>>
<?= $Page->nipks->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
<?php if ($Page->datetime->Visible) { // datetime ?>
    <tr id="r_datetime">
        <td class="<?= $Page->TableLeftColumnClass ?>"><span id="elh_sekolah_datetime"><template id="tpc_sekolah_datetime"><?= $Page->datetime->caption() ?></template></span></td>
        <td data-name="datetime" <?= $Page->datetime->cellAttributes() ?>>
<template id="tpx_sekolah_datetime"><span id="el_sekolah_datetime">
<span<?= $Page->datetime->viewAttributes() ?>>
<?= $Page->datetime->getViewValue() ?></span>
</span></template>
</td>
    </tr>
<?php } ?>
</table>
<div id="tpd_sekolahview" class="ew-custom-template"></div>
<template id="tpm_sekolahview">
<div id="ct_SekolahView"><div class="row">
                <div class="col-lg-3 col-md-6 col-sm-12">
                    <div class="info-box bg-white">
                        <span class="info-box-icon bg-info elevation-1"><i class="fas fa-users"></i></span>
                        <div class="info-box-content">
                            <span class="info-box-text">Peserta Didik</span>
                            <span class="info-box-number">
                                <?php $ktapel = kode_tapel(); ?>
                                <?= $pd = number_format(ExecuteScalar("SELECT COUNT(*) FROM peserta_didik WHERE kode_tapel='$ktapel'")); ?>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6 col-sm-12">
                    <div class="info-box bg-white">
                        <span class="info-box-icon bg-danger elevation-1"><i class="fas fa-users"></i></span>
                        <div class="info-box-content">
                            <span class="info-box-text">Guru</span>
                            <span class="info-box-number">
                                <?= $guru = number_format(ExecuteScalar("SELECT COUNT(*) FROM guru WHERE kode_tapel='$ktapel'")); ?>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6 col-sm-12">
                    <div class="info-box bg-white">
                        <span class="info-box-icon bg-success elevation-1"><i class="fas fa-home"></i></span>
                        <div class="info-box-content">
                            <span class="info-box-text">Rombongan Belajar</span>
                            <span class="info-box-number">
                                <?= $walas = number_format(ExecuteScalar("SELECT COUNT(*) FROM wali_kelas WHERE kode_tapel='$ktapel'")); ?>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6 col-sm-12">
                    <div class="info-box bg-white">
                        <span class="info-box-icon bg-warning elevation-1"><i class="fas fa-users"></i></span>
                        <div class="info-box-content">
                            <span class="info-box-text">Ekstrakurikuler</span>
                            <span class="info-box-number">
                                <?= $ekstra = number_format(ExecuteScalar("SELECT COUNT(*) FROM ektrakurikuler WHERE kode_tapel='$ktapel'")); ?>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
<div class="row">  
    <div class="col-md-8">
        <div class="card card-body table-responsive shadow">
        <h3 class="text-primary"><?=$sekolah = ExecuteScalar("SELECT nama_sekolah FROM sekolah");?></h3>
            <table class="table table-borderless table-sm">
                <tbody><tr>
                    <td>NPSN</td>
                    <td><slot class="ew-slot" name="tpx_sekolah_npsn"></slot></td>
                </tr>
                <tr>
                    <td>Status</td>
                    <td><slot class="ew-slot" name="tpx_sekolah_status"></slot></td>
                </tr>
                <tr>
                    <td>Alamat</td>
                    <td><slot class="ew-slot" name="tpx_sekolah_alamat"></slot></td>
                </tr>
                <tr>
                    <td>Kecamatan</td>
                    <td><slot class="ew-slot" name="tpx_sekolah_kecamatan"></slot></td>
                </tr> 
                <tr>
                    <td colspan="3">
                        <hr>
                    </td>
                </tr>
                <tr>
                    <td>Kepala Sekolah</td>
                    <td><slot class="ew-slot" name="tpx_sekolah_namaks"></slot></td>
                </tr>
                <tr>
                    <td>NIP</td>
                    <td><slot class="ew-slot" name="tpx_sekolah_nipks"></slot></td>
                </tr> 
            </tbody>
            </table>
        </div>
    </div>
<div class="col-sm-4">
            <?php
            $userlevel=JsEncode(CurrentUserInfo('userlevelid'));
            $npsn=$Page->npsn->getViewValue();
            $nama_sekolah=$Page->nama_sekolah->getViewValue();
            $tahun_pelajaran=tapel();
            $url=urlencode($npsn."|".$nama_sekolah."|".$tahun_pelajaran);
            if(!IsSysAdmin() && $userlevel==0){
            } else {
            ?>
            <div id="tool" class="card card-body shadow">
            <center>Setting Aplikasi</center><hr>
            <a href="../db.php?c=backup&n=<?=$url?>" class="btn btn-primary btn-block border-0">BackUp DataBase</a>
            <hr> 
            <a href="../db.php?c=restore&n=<?=$url?>" class="btn btn-warning btn-block">Restore DataBase</a> 
            <hr>
        <?php
        $ckktp = ExecuteScalar("SELECT COUNT(*) FROM kktp_sumatif WHERE tahun_pelajaran='$tahun_pelajaran'");
        if ($ckktp <= 1) { ?>
            <a href="../db.php?c=kktp&n=<?= $url ?>" class="btn btn-success btn-block">Generate KKTP Sumatif</a>
        <?php } else {
            echo '<a href="" class="btn btn-secondary btn-block">Generate KKTP Sumatif</a>';
        }
        ?>
            <?php } ?>
        </div>
    </div>
</div>
</div>
</template>
</form>
<script class="ew-apply-template">
loadjs.ready(["jsrender", "makerjs"], function() {
    ew.templateData = { rows: <?= JsonEncode($Page->Rows) ?> };
    ew.applyTemplate("tpd_sekolahview", "tpm_sekolahview", "sekolahview", "<?= $Page->CustomExport ?>", ew.templateData.rows[0]);
    loadjs.done("customtemplate");
});
</script>
<?php
$Page->showPageFooter();
echo GetDebugMessage();
?>
<?php if (!$Page->isExport()) { ?>
<script>
loadjs.ready("load", function () {
    // Write your table-specific startup script here, no need to add script tags.
});
</script>
<?php } ?>
