<?php
/**
 * =====================================================
 * SIMPAS v1.0
 * Modul : Data Siswa
 * File   : tambah.php
 * =====================================================
 */

include "../../config/koneksi.php";
include "../../config/session.php";

include "../../templates/header.php";
include "../../templates/navbar.php";
include "../../templates/sidebar.php";

/*
|--------------------------------------------------------------------------
| Ambil Data Kelas
|--------------------------------------------------------------------------
*/

$kelas = mysqli_query($conn,"SELECT * FROM kelas ORDER BY nama_kelas ASC");

?>

<div class="content-wrapper">

<section class="content-header">

<div class="container-fluid">

<div class="row mb-2">

<div class="col-sm-6">

<h1>

<i class="fas fa-user-plus"></i>

Tambah Data Siswa

</h1>

</div>

<div class="col-sm-6 text-right">

<a href="index.php" class="btn btn-secondary">

<i class="fas fa-arrow-left"></i>

Kembali

</a>

</div>

</div>

</div>

</section>

<section class="content">

<div class="container-fluid">

<div class="card shadow">

<div class="card-header bg-success">

<h3 class="card-title">

Form Tambah Siswa

</h3>

</div>

<div class="card-body">

<form
action="simpan.php"
method="POST"
enctype="multipart/form-data">

<div class="form-group">

<label>NIS</label>

<input
type="text"
name="nis"
class="form-control"
required>

</div>

<div class="form-group">

<label>NISN</label>

<input
type="text"
name="nisn"
class="form-control">

</div>

<div class="form-group">

<label>Nama Siswa</label>

<input
type="text"
name="nama_siswa"
class="form-control"
required>

</div>

<div class="form-group">

<label>Jenis Kelamin</label>

<div>

<label class="mr-3">

<input
type="radio"
name="jk"
value="L"
required>

Laki-laki

</label>

<label>

<input
type="radio"
name="jk"
value="P">

Perempuan

</label>

</div>

</div>

<div class="form-group">

<label>Kelas</label>

<select
name="id_kelas"
class="form-control"
required>

<option value="">

-- Pilih Kelas --

</option>

<?php while($k=mysqli_fetch_assoc($kelas)): ?>

<option value="<?= $k['id_kelas']; ?>">

<?= $k['nama_kelas']; ?>

</option>

<?php endwhile; ?>

</select>

</div>
<div class="form-group">

    <label>Foto</label>

    <input
        type="file"
        name="foto"
        class="form-control"
        accept=".jpg,.jpeg,.png">

    <small class="text-muted">
        Kosongkan jika belum ada foto siswa.
    </small>

</div>

<div class="form-group">

    <label>Status</label>

    <select
        name="status"
        class="form-control"
        required>

        <option value="Aktif" selected>
            Aktif
        </option>

        <option value="Lulus">
            Lulus
        </option>

        <option value="Pindah">
            Pindah
        </option>

    </select>

</div>

<hr>

<div class="text-center">

    <button
        type="submit"
        class="btn btn-success">

        <i class="fas fa-save"></i>

        Simpan

    </button>

    <button
        type="reset"
        class="btn btn-warning">

        <i class="fas fa-undo"></i>

        Reset

    </button>

    <a
        href="index.php"
        class="btn btn-secondary">

        <i class="fas fa-times"></i>

        Batal

    </a>

</div>

</form>

</div>

</div>

</div>

</section>

</div>

<?php
include "../../templates/footer.php";
?>