[Operator] Kelengkapan Menu Mahasiswa
This commit is contained in:
@@ -228,6 +228,35 @@ Alpine.data('formDialog', () => ({
|
||||
if (event.target === this.$refs.dialog) this.close();
|
||||
},
|
||||
}));
|
||||
/*
|
||||
* Dialog Konversi Matakuliah (satu dialog untuk semua baris KRS): show({action, label, pilihan, setara}) mengisi tujuan formulir,
|
||||
* teks KRS yang dikonversi, dan memilihkan padanan pertama (id mata kuliah) bila ada; setara = nama padanan untuk bantuan.
|
||||
*/
|
||||
Alpine.data('konversiDialog', () => ({
|
||||
action: '',
|
||||
label: '',
|
||||
mk: '',
|
||||
setara: [],
|
||||
opener: null,
|
||||
|
||||
show(row) {
|
||||
this.opener = document.activeElement;
|
||||
this.action = row.action;
|
||||
this.label = row.label;
|
||||
this.setara = row.setara ?? [];
|
||||
this.mk = row.pilihan?.length ? String(row.pilihan[0]) : '';
|
||||
this.$refs.dialog.showModal();
|
||||
},
|
||||
|
||||
close() {
|
||||
this.$refs.dialog.close();
|
||||
this.opener?.focus();
|
||||
},
|
||||
|
||||
backdrop(event) {
|
||||
if (event.target === this.$refs.dialog) this.close();
|
||||
},
|
||||
}));
|
||||
/*
|
||||
* Status sibuk untuk setiap formulir: tombol kirim menampilkan pemintal dan
|
||||
* kirim ganda ditahan. Formulir yang tidak ingin ini memberi atribut data-no-busy.
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
{{--
|
||||
Konversi Matakuliah (akun DB lama): cari mahasiswa prodi akun lewat NIM, tampilkan KRS-nya, lalu Konversi (modal pilih mata
|
||||
kuliah pengganti) atau Tidak diakui (konfirmasi hapus) per baris. Formulir GET untuk pencarian, POST/DELETE untuk aksi.
|
||||
--}}
|
||||
<x-satu.frame :page="$page" :crumbs="$crumbs" :note="$note">
|
||||
<x-glass.panel padding="sm" as="section" aria-label="Cari mahasiswa">
|
||||
<form method="GET" action="{{ route('operator.halaman', $page['slug']) }}" class="filter-bar">
|
||||
<x-form.field name="nim" label="NIM Mahasiswa" :value="$nim" placeholder="Masukkan NIM" maxlength="20" autocomplete="off" class="filter-bar__search" />
|
||||
<x-ui.button type="submit" variant="secondary" icon="magnifying-glass">Cari</x-ui.button>
|
||||
</form>
|
||||
</x-glass.panel>
|
||||
|
||||
@if (! $linked)
|
||||
<x-glass.panel padding="lg" as="section"><x-ui.empty icon="building-library" title="Akun belum terhubung ke program studi" description="Konversi tampil setelah akun Anda dipetakan ke program studi oleh Pusat Komputer." /></x-glass.panel>
|
||||
@elseif ($nim !== '' && $student === null)
|
||||
<x-ui.alert tone="warning">Mahasiswa dengan NIM {{ $nim }} tidak ditemukan di program studi Anda.</x-ui.alert>
|
||||
@elseif ($student !== null)
|
||||
<x-glass.panel padding="lg" as="section" aria-labelledby="konversi-mhs">
|
||||
<h2 id="konversi-mhs" class="visually-hidden">Data mahasiswa</h2>
|
||||
<dl class="kv">
|
||||
<div><dt>NIM</dt><dd>{{ $student['nim'] }}</dd></div>
|
||||
<div><dt>Nama</dt><dd>{{ $student['nama'] }}</dd></div>
|
||||
<div><dt>Program Studi</dt><dd>{{ $student['prodi'] }}</dd></div>
|
||||
<div><dt>Kurikulum</dt><dd>{{ $student['kurikulum'] ?? 'Belum ada kurikulum' }}</dd></div>
|
||||
<div><dt>Angkatan</dt><dd>{{ $student['angkatan'] ?? '–' }}</dd></div>
|
||||
</dl>
|
||||
</x-glass.panel>
|
||||
|
||||
<x-glass.panel padding="none" as="section" aria-labelledby="konversi-krs" x-data="konversiDialog">
|
||||
<div class="panel-title panel-title--inset"><h2 id="konversi-krs">KRS mahasiswa</h2><p class="kv__muted">{{ count($credits) }} mata kuliah</p></div>
|
||||
@if ($credits === [])
|
||||
<p class="satu-empty">Mahasiswa ini belum punya KRS.</p>
|
||||
@else
|
||||
<x-ui.table label="KRS mahasiswa">
|
||||
<table class="table satu-table">
|
||||
<thead><tr><th scope="col">Periode</th><th scope="col">Kode MK</th><th scope="col">Mata Kuliah</th><th scope="col" class="num">SKS</th><th scope="col">Kelas</th><th scope="col">Nilai</th><th scope="col">Aksi</th></tr></thead>
|
||||
<tbody>
|
||||
@foreach ($credits as $krs)
|
||||
@php
|
||||
$teks = $krs['periode'].': '.$krs['kode'].' '.$krs['mk'];
|
||||
$setara = collect($equivalents[$krs['idmk']] ?? []);
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $krs['periode'] }}</td>
|
||||
<td class="table__title">{{ $krs['kode'] }}</td>
|
||||
<td>{{ $krs['mk'] }}</td>
|
||||
<td class="num">{{ $krs['sks'] }}</td>
|
||||
<td>@if ($krs['konv'])<span class="badge badge--info">{{ $krs['kelas'] }}</span>@else{{ $krs['kelas'] }}@endif</td>
|
||||
<td>{{ $krs['nilai'] }}</td>
|
||||
<td class="table__actions">
|
||||
@if ($options->isNotEmpty())
|
||||
<x-ui.button variant="ghost" size="sm" icon="arrows-right-left" x-on:click="show(@js(['action' => route('operator.konversi-mk.convert', $krs['id']), 'label' => $teks, 'pilihan' => $setara->all(), 'setara' => $setara->map(fn (int $id): string => $options[$id])->values()->all()]))">Konversi</x-ui.button>
|
||||
@endif
|
||||
<x-ui.confirm
|
||||
class="inline-flex"
|
||||
:action="route('operator.konversi-mk.disallow', ['id' => $krs['id'], 'nim' => $student['nim']])"
|
||||
method="DELETE"
|
||||
title="Mata kuliah tidak diakui?"
|
||||
:message="$teks.' dihapus dari KRS mahasiswa. Nilai lamanya tetap tercatat di log konversi.'"
|
||||
confirm-label="Ya, hapus dari KRS"
|
||||
trigger-label="Tidak diakui"
|
||||
tone="danger"
|
||||
icon="trash"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</x-ui.table>
|
||||
@endif
|
||||
|
||||
@if ($options->isNotEmpty())
|
||||
<dialog x-ref="dialog" class="dialog dialog--stack dialog--tall" aria-labelledby="konversi-judul" x-on:click="backdrop($event)">
|
||||
<form method="POST" x-bind:action="action" class="dialog__body" novalidate>
|
||||
@csrf
|
||||
<input type="hidden" name="nim" value="{{ $student['nim'] }}">
|
||||
<div class="dialog__head">
|
||||
<span class="dialog__icon" aria-hidden="true"><x-heroicon-o-arrows-right-left /></span>
|
||||
<p id="konversi-judul" class="dialog__title">Konversi mata kuliah</p>
|
||||
<x-ui.dialog-close />
|
||||
</div>
|
||||
<p class="dialog__message" x-text="label"></p>
|
||||
<div class="satu-form">
|
||||
<x-form.select name="mk" label="Mata kuliah pengganti" :options="$options->all()" placeholder="" data-search="true" data-placeholder="Pilih mata kuliah pengganti" x-model="mk" required />
|
||||
<p class="field__help" x-show="setara.length" x-cloak>Padanan terdaftar: <span x-text="setara.join('; ')"></span></p>
|
||||
</div>
|
||||
<p class="dialog__message">KRS dialihkan ke kelas KONV periode yang sama dengan nilai tetap. Kelas KONV dibuat bila belum ada.</p>
|
||||
<div class="dialog__actions">
|
||||
<x-ui.button type="submit" variant="primary" icon="check">Konversi</x-ui.button>
|
||||
<x-ui.button variant="secondary" x-on:click="close()">Batal</x-ui.button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
@endif
|
||||
</x-glass.panel>
|
||||
@endif
|
||||
</x-satu.frame>
|
||||
Reference in New Issue
Block a user