Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor form variable namings #106

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/Controllers/Admin/KelasController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function create()
'kelas' => [
'rules' => 'required|max_length[32]',
],
'idJurusan' => [
'id_jurusan' => [
'rules' => 'required|numeric',
],
])) {
Expand All @@ -99,7 +99,7 @@ public function create()

// ambil variabel POST
$kelas = $this->request->getVar('kelas');
$idJurusan = $this->request->getVar('idJurusan');
$idJurusan = $this->request->getVar('id_jurusan');

$result = $this->kelasModel->tambahKelas($kelas, $idJurusan);

Expand Down Expand Up @@ -153,7 +153,7 @@ public function update($id = null)
'kelas' => [
'rules' => 'required|max_length[32]',
],
'idJurusan' => [
'id_jurusan' => [
'rules' => 'required|numeric',
],
])) {
Expand All @@ -178,7 +178,7 @@ public function update($id = null)

// ambil variabel POST
$kelas = $this->request->getRawInputVar('kelas');
$idJurusan = $this->request->getRawInputVar('idJurusan');
$idJurusan = $this->request->getRawInputVar('id_jurusan');

$result = $this->kelasModel->update($id, [
'kelas' => $kelas,
Expand Down
10 changes: 5 additions & 5 deletions app/Views/admin/kelas/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
</div>
<div class="row">
<div class="col-12">
<label for="idJurusan">Jurusan</label>
<select class="custom-select <?= $validation->getError('idJurusan') ? 'is-invalid' : ''; ?>" id="idJurusan" name="idJurusan">
<option value="">--Pilih jurusan--</option>
<label for="id_jurusan">Jurusan</label>
<select class="custom-select <?= $validation->getError('id_jurusan') ? 'is-invalid' : ''; ?>" id="id_jurusan" name="id_jurusan">
<option value="">--Pilih Jurusan--</option>
<?php foreach ($jurusan as $value) : ?>
<option value="<?= $value['id']; ?>" <?= old('idJurusan') ?? $oldInput['idJurusan'] ?? '' == $value['id'] ? 'selected' : ''; ?>>
<option value="<?= $value['id']; ?>" <?= old('id_jurusan') ?? $oldInput['id_jurusan'] ?? '' == $value['id'] ? 'selected' : ''; ?>>
<?= $value['jurusan']; ?>
</option>
<?php endforeach; ?>
</select>
<div class="invalid-feedback">
<?= $validation->getError('idJurusan'); ?>
<?= $validation->getError('id_jurusan'); ?>
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions app/Views/admin/kelas/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@
</div>
<div class="row">
<div class="col-12">
<label for="idJurusan">Jurusan</label>
<select class="custom-select <?= $validation->getError('idJurusan') ? 'is-invalid' : ''; ?>" id="idJurusan" name="idJurusan">
<option value="">--Pilih idJurusan--</option>
<label for="id_jurusan">Jurusan</label>
<select class="custom-select <?= $validation->getError('id_jurusan') ? 'is-invalid' : ''; ?>" id="id_jurusan" name="id_jurusan">
<option value="">--Pilih Jurusan--</option>
<?php foreach ($jurusan as $value) : ?>
<option value="<?= $value['id']; ?>" <?= old('idJurusan') ?? $oldInput['idJurusan'] ?? $value['id'] == $data['id_jurusan'] ? 'selected' : ''; ?>>
<option value="<?= $value['id']; ?>" <?= old('id_jurusan') ?? $oldInput['id_jurusan'] ?? $value['id'] == $data['id_jurusan'] ? 'selected' : ''; ?>>
<?= $value['jurusan']; ?>
</option>
<?php endforeach; ?>
</select>
<div class="invalid-feedback">
<?= $validation->getError('idJurusan'); ?>
<?= $validation->getError('id_jurusan'); ?>
</div>
</div>
</div>
Expand Down