<div class="row justify-content-center">
    <div class="col-lg-10">
        <div class="card shadow-sm">
            <div class="card-body">
                <h4 class="card-title">Leave Application</h4>
                <?php if (!empty($message)): ?>
                    <div class="alert alert-success"><?= htmlspecialchars($message) ?></div>
                <?php endif; ?>
                <?php if (!empty($error)): ?>
                    <div class="alert alert-danger"><?= htmlspecialchars($error) ?></div>
                <?php endif; ?>
                <form method="post" action="index.php?route=leave/store">
                    <?= $csrf ?>
                    <div class="row g-3">
                        <div class="col-md-6">
                            <label class="form-label">Nama</label>
                            <input type="text" class="form-control" value="<?= htmlspecialchars($user['name'] ?? '') ?>" readonly>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label">Nama Kilang / Tempat Bekerja</label>
                            <input type="text" name="tempat_bekerja" class="form-control" value="<?= htmlspecialchars($location ?? '') ?>" readonly>
                        </div>
                        <div class="col-12">
                            <label class="form-label">Alasan</label>
                            <textarea name="alasan" class="form-control" rows="3" required></textarea>
                        </div>
                        <div class="col-md-4">
                            <label class="form-label">Tarikh Mula</label>
                            <input type="date" name="tarikh_mula" class="form-control" required>
                        </div>
                        <div class="col-md-4">
                            <label class="form-label">Tarikh Akhir</label>
                            <input type="date" name="tarikh_akhir" class="form-control" required>
                        </div>
                        <div class="col-md-4">
                            <label class="form-label">Jumlah Hari</label>
                            <input type="number" name="jumlah_hari" id="jumlah_hari" class="form-control" readonly>
                        </div>
                        <div class="col-12">
                            <label class="form-label">Kenyataan</label>
                            <select name="kenyataan" class="form-select" required>
                                <option value="">Pilih</option>
                                <option value="setuju">Setuju</option>
                                <option value="tidak_setuju">Tidak Setuju</option>
                            </select>
                        </div>
                    </div>
                    <div class="mt-3 d-flex gap-2">
                        <button class="btn btn-primary">Submit</button>
                        <a class="btn btn-outline-secondary" href="index.php?route=dashboard">Back</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

