<?php
$ids = $_GET['ids'];

$sql = mysqli_query($koneksi, "SELECT * FROM siswa WHERE ids='$ids'");
$rs  = mysqli_fetch_assoc($sql);
?>

<div class="row">
    <div class="col-lg-12">
        <h3 class="page-header">
            <strong>Detail Siswa : <?= $rs['nama']; ?></strong>
        </h3>
    </div>
</div>

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-primary">
            <div class="panel-heading">Data Siswa</div>

            <div class="panel-body">
                <div class="row">

<!-- KOLOM KIRI -->
<div class="col-lg-6">
<fieldset disabled>

    <div class="form-group">
        <label>NIS</label>
        <input class="form-control" value="<?= $rs['nis']; ?>">
    </div>

    <div class="form-group">
        <label>Nama</label>
        <input class="form-control" value="<?= $rs['nama']; ?>">
    </div>

    <div class="form-group">
        <label>Jenis Kelamin</label>
        <div class="radio">
            <label>
                <input type="radio" <?= ($rs['jk']=="L")?"checked":""; ?>>
                Laki - Laki
            </label>
        </div>
        <div class="radio">
            <label>
                <input type="radio" <?= ($rs['jk']=="P")?"checked":""; ?>>
                Perempuan
            </label>
        </div>
    </div>

    <div class="form-group">
        <label>Alamat</label>
        <textarea class="form-control"><?= $rs['alamat']; ?></textarea>
    </div>

    <div class="form-group">
        <label>Kelas</label>
        <select class="form-control">
            <?php
            $kelas = mysqli_query(
                $koneksi,
                "SELECT kelas.*, sekolah.id AS id_sekolah
                 FROM kelas
                 JOIN sekolah ON kelas.id = sekolah.id"
            );

            while ($k = mysqli_fetch_assoc($kelas)) {
                if ($_SESSION['level']=="admin_guru" && $k['id_sekolah'] != $_SESSION['id']) {
                    continue;
                }

                $selected = ($rs['idk'] == $k['idk']) ? "selected" : "";
                echo "<option $selected>{$k['nama']}</option>";
            }
            ?>
        </select>
    </div>

    <div class="form-group input-group">
        <span class="input-group-addon">+62</span>
        <input class="form-control" value="<?= $rs['tlp']; ?>">
    </div>

</fieldset>
</div>

<!-- KOLOM KANAN -->
<div class="col-lg-6">
<fieldset disabled>

    <div class="form-group">
        <label>Nama Ayah</label>
        <input class="form-control" value="<?= $rs['bapak']; ?>">
    </div>

    <div class="form-group">
        <label>Pekerjaan Ayah</label>
        <input class="form-control" value="<?= $rs['k_bapak']; ?>">
    </div>

    <div class="form-group">
        <label>Nama Ibu</label>
        <input class="form-control" value="<?= $rs['ibu']; ?>">
    </div>

    <div class="form-group">
        <label>Pekerjaan Ibu</label>
        <input class="form-control" value="<?= $rs['k_ibu']; ?>">
    </div>

</fieldset>
</div>

                </div>
            </div>
        </div>
    </div>
</div>
