<?php include 'comp/header.php'; ?>
<?php 

date_default_timezone_set("Asia/Jakarta");

$tanggal = date("d-m-Y");
$jam = date("H:i:s");
$jam2 = date("Hi");
$bulan = date("m");
$tahun = date("Y");

if (isset($_POST['submit'])) {
    simpan_absen();
}
?>

<div class="main-content">
<div class="content-wrapper">

<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12"><br>

<div class="card p-4">
<h4>Form Absensi</h4>

<form method="POST" enctype="multipart/form-data">

<table class="table table-bordered">

<tr>
<td>NIP</td>
<td>
<?= $adm['nip']; ?>
<input type="hidden" name="nip" value="<?= $adm['nip']; ?>">
</td>
</tr>

<tr>
<td>Nama</td>
<td>
<?= $adm['nama']; ?>
<input type="hidden" name="nama" value="<?= $adm['nama']; ?>">
</td>
</tr>

<tr>
<td>Shift</td>
<td>
<select name="shift" class="form-control" required>
<option value="">-- Pilih Shift --</option>
<option value="Pagi">Pagi (07:00 - 16:00)</option>
<option value="Middle">Middle (09:00 - 18:00)</option>
<option value="Siang">Sore (15:00 - 22:00)</option>
<option value="Malam">Malam (22:00 - 07:00)</option>
</select>
</td>
</tr>

<tr>
<td>Status</td>
<td>
<select name="keterangan" class="form-control">
<option value="Hadir">Hadir</option>
<option value="Izin">Izin</option>
<option value="Sakit">Sakit</option>
</select>
</td>
</tr>

<tr>
<td>Alasan (jika izin/sakit)</td>
<td>
<textarea name="alasan" class="form-control"></textarea>
</td>
</tr>

<tr>
<td>Upload Bukti</td>
<td>
<input type="file" name="foto" class="form-control">
</td>
</tr>

</table>

<input type="hidden" name="tanggal" value="<?= $tanggal; ?>">
<input type="hidden" name="jam" value="<?= $jam; ?>">
<input type="hidden" name="jam2" value="<?= $jam2; ?>">
<input type="hidden" name="bulan" value="<?= $bulan; ?>">
<input type="hidden" name="tahun" value="<?= $tahun; ?>">

<button type="submit" name="submit" class="btn btn-success">
Submit Absensi
</button>

</form>
</div>

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

</div>
</div>

<?php include 'comp/footer.php'; ?>
