<div class="content-wrapper">
    <div class="container-fluid mt-4">
        <div class="row">
            <div class="col-lg-12">
                <div class="card shadow-sm mb-4 border-0">
                    <div class="card-header py-3 bg-success text-white">
                        <h6 class="m-0 font-weight-bold"><i class="fas fa-edit mr-2"></i> Hadia Dadus Materia</h6>
                    </div>
                    <div class="card-body p-4">
                        <form method="post" action="<?= base_url('materia/atualiza/'.$materia->id); ?>">

                            <div class="row">
                                <div class="col-md-6 form-group mb-3">
                                    <label class="small font-weight-bold text-muted">Kode Materia</label>
                                    <input type="text" name="kode_materia" class="form-control" value="<?= htmlspecialchars($materia->kode_materia); ?>" required>
                                </div>
                                <div class="col-md-6 form-group mb-3">
                                    <label class="small font-weight-bold text-muted">Naran Materia</label>
                                    <input type="text" name="naran_materia" class="form-control" value="<?= htmlspecialchars($materia->naran_materia); ?>" required>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-4 form-group mb-3">
                                    <label class="small font-weight-bold text-muted">Credito</label>
                                    <input type="text" name="credito" class="form-control" value="<?= htmlspecialchars($materia->credito); ?>" required>
                                </div>
                                <div class="col-md-4 form-group mb-3">
                                    <label class="small font-weight-bold text-muted">Semestre</label>
                                    <input type="text" name="semestre" class="form-control" value="<?= htmlspecialchars($materia->semestre); ?>" required>
                                </div>
                                <div class="col-md-4 form-group mb-3">
                                    <label class="small font-weight-bold text-muted">Total Credito</label>
                                    <input type="text" name="total_credito" class="form-control" value="<?= htmlspecialchars($materia->total_credito); ?>" required>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-md-4 form-group mb-3">
                                    <label class="small font-weight-bold text-muted">Total Materia</label>
                                    <input type="text" name="total_materia" class="form-control" value="<?= htmlspecialchars($materia->total_materia); ?>" required>
                                </div>
                                <div class="col-md-4 form-group mb-3">
                                    <label class="small font-weight-bold text-muted">Tipu</label>
                                    <select name="tipu" class="form-control" required>
                                        <option value="Geral" <?= ($materia->tipu == 'Geral') ? 'selected' : ''; ?>>Geral</option>
                                        <option value="Espesifiku" <?= ($materia->tipu == 'Espesifiku') ? 'selected' : ''; ?>>Espesifiku</option>
                                    </select>
                                </div>

                                
                              <div class="col-md-4 form-group mb-3">
                                <label class="small font-weight-bold text-muted">Departamentu</label>
                                <select name="departamentu" id="departamentu" class="form-control" required>
                                    <option value="">-- Hili Departamentu --</option>
                                    <option value="Tecnicas de Computacao e Informatica" <?= ($materia->departamentu == 'Tecnicas de Computacao e Informatica') ? 'selected' : ''; ?>>Tecnicas de Computacao e Informatica</option>
                                    <option value="Contabilidade e Gestão" <?= ($materia->departamentu == 'Contabilidade e Gestão') ? 'selected' : ''; ?>>Contabilidade e Gestão</option>
                                    <option value="Turismo e Culinária" <?= ($materia->departamentu == 'Turismo e Culinária') ? 'selected' : ''; ?>>Turismo e Culinária</option>
                                </select>
                            </div>
                        </div>

                        <hr>

                            <div class="d-flex gap-2 mt-3">
                                <button type="submit" class="btn btn-success px-4">
                                    <i class="fas fa-save mr-1"></i> Save
                                </button>
                                <a href="<?= base_url('materia'); ?>" class="btn btn-secondary px-4">
                                    <i class="fas fa-times mr-1"></i> Kansela
                                </a>
                            </div>

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

<style>
    .content-wrapper {
        margin-left: 230px; 
        padding: 20px;
    }
</style>