first commit
This commit is contained in:
@@ -0,0 +1,373 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('css')
|
||||
@endsection
|
||||
|
||||
@section('style')
|
||||
<style>
|
||||
table tr th,
|
||||
table tr td {
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('breadcrumb')
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript:void(0);">Manajemen</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('manajemen.limit.mengajar.index') }}">Limit</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('manajemen.limit.mengajar.index') }}">Mengajar</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ $unit->nama }}</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border">
|
||||
<div class="card-body">
|
||||
@include('components.datatable-header', [
|
||||
'title' => 'Detail Limit Mengajar - ' . $unit->nama,
|
||||
'description' => 'Berikut adalah detail limit mengajar untuk ' . $unit->nama,
|
||||
'actionButton' => $canTambah ? '<button class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#limitModal">
|
||||
<i class="fa fa-plus"></i> Tambah / Edit Limit Mengajar
|
||||
</button>' : '',
|
||||
])
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<label for="filterPeriode" class="form-label fw-semibold">Filter Periode</label>
|
||||
<select class="form-select" id="filterPeriode">
|
||||
@foreach($periodes as $periode)
|
||||
<option value="{{ $periode->id_periode }}">{{ $periode->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="display table table-striped w-100" id="limitsTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama</th>
|
||||
<th>Unit Kerja</th>
|
||||
<th>Jenjang</th>
|
||||
<th>Tipe MK</th>
|
||||
<th>Batas</th>
|
||||
<th>Tipe Batas</th>
|
||||
@if($canHapus)
|
||||
<th>Aksi</th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Limit Mengajar -->
|
||||
<div class="modal fade" id="limitModal" tabindex="-1" aria-labelledby="limitModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<form action="{{ route('manajemen.limit.mengajar.store') }}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="periode_id" id="periode_id">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="limitModalLabel">Tambah / Edit Limit Mengajar</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12 mb-3">
|
||||
<label for="nama" class="form-label">Nama Limit <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="nama" name="nama"
|
||||
placeholder="Misal: Limit Mengajar S1" required>
|
||||
<small class="text-muted">Nama identitas untuk limit ini</small>
|
||||
</div>
|
||||
<div class="col-md-12 mb-2">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="select-all">
|
||||
<label class="form-check-label" for="select-all">Pilih Semua Prodi</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<label for="unit_kerjas" class="form-label">Prodi <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="unit_kerjas" name="unit_kerjas[]" multiple required>
|
||||
@foreach($prodis as $prodi)
|
||||
<option value="{{ $prodi->id }}">{{ $prodi->nama }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small class="text-muted">Pilih satu atau lebih prodi yang akan diatur limitnya</small>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="jenjangs" class="form-label">Jenjang <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="jenjangs" name="jenjangs[]" multiple required>
|
||||
<option value="D3">D3</option>
|
||||
<option value="D4">D4</option>
|
||||
<option value="S1">S1</option>
|
||||
<option value="S2">S2</option>
|
||||
<option value="S3">S3</option>
|
||||
<option value="Profesi">Profesi</option>
|
||||
</select>
|
||||
<small class="text-muted">Pilih satu atau lebih jenjang</small>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="tipe_mks" class="form-label">Tipe Mata Kuliah <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="tipe_mks" name="tipe_mks[]" multiple required>
|
||||
<option value="Teori">Teori</option>
|
||||
<option value="Praktek">Praktek</option>
|
||||
<option value="Teori dan Praktek">Teori dan Praktek</option>
|
||||
</select>
|
||||
<small class="text-muted">Pilih satu atau lebih tipe mata kuliah</small>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="limit" class="form-label">Batas Limit <span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="limit" name="limit"
|
||||
placeholder="Contoh: 12" min="0" step="0.01" required>
|
||||
<small class="text-muted">Masukkan nilai batas limit</small>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="limit_type" class="form-label">Tipe Batas <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="limit_type" name="limit_type" required>
|
||||
<option value="">Pilih Tipe Batas</option>
|
||||
<option value="sks">SKS</option>
|
||||
<option value="kelas">Kelas</option>
|
||||
<option value="jam">Jam</option>
|
||||
<option value="mata_kuliah">Mata Kuliah</option>
|
||||
</select>
|
||||
<small class="text-muted">Pilih satuan yang digunakan untuk limit</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-info mt-3" role="alert">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
<strong>Informasi:</strong>
|
||||
<ul class="mb-0 mt-2">
|
||||
<li>Semua field yang ditandai dengan <span class="text-danger">*</span> wajib diisi</li>
|
||||
<li>Untuk memilih multiple option, tekan dan tahan Ctrl (Windows) atau Cmd (Mac) saat mengklik</li>
|
||||
<li>Jika limit sudah ada dengan nama yang sama, data akan diupdate</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fa fa-save"></i> Simpan
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
#limitModal .modal-body { max-height: calc(100vh - 200px); overflow-y: auto; }
|
||||
</style>
|
||||
|
||||
<!-- Modal Konfirmasi Hapus -->
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-danger text-white">
|
||||
<h5 class="modal-title"><i class="fas fa-trash me-2"></i> Hapus Limit Mengajar</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="modal-hapus-msg" class="mb-1"></p>
|
||||
<p class="text-danger fw-bold mb-0">Data yang dihapus tidak dapat dikembalikan!</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" id="confirmDeleteBtn">
|
||||
<i class="fas fa-trash"></i> Ya, Hapus
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('js')
|
||||
<script>
|
||||
$('.si-limit').addClass('menuitem-active');
|
||||
$('.ni-limit').addClass('badge-primary-lighten');
|
||||
$('.li-limit').addClass('show');
|
||||
$('.li-limit-mengajar').addClass('active badge-primary-lighten');
|
||||
|
||||
$(document).ready(function() {
|
||||
// Set initial periode value in modal form
|
||||
$('#periode_id').val($('#filterPeriode').val());
|
||||
|
||||
// Initialize DataTable with server-side processing
|
||||
const limitsTable = $('#limitsTable').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: {
|
||||
url: "{{ route('manajemen.limit.mengajar.data-detail', ['mengajar' => $unit->id]) }}",
|
||||
type: "GET",
|
||||
data: function(d) {
|
||||
d.periode = $('#filterPeriode').val();
|
||||
}
|
||||
},
|
||||
columns: [{
|
||||
data: 'DT_RowIndex',
|
||||
name: 'DT_RowIndex',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '50px',
|
||||
className: 'dt-center'
|
||||
},
|
||||
{
|
||||
data: 'name',
|
||||
name: 'name'
|
||||
},
|
||||
{
|
||||
data: 'unit_kerja',
|
||||
name: 'unit_kerja',
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
data: 'jenjang',
|
||||
name: 'jenjang',
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
data: 'tipe_mk',
|
||||
name: 'tipe_mk',
|
||||
orderable: false,
|
||||
searchable: false
|
||||
},
|
||||
{
|
||||
data: 'limit',
|
||||
name: 'limit',
|
||||
className: 'dt-center'
|
||||
},
|
||||
{
|
||||
data: 'limit_type_formatted',
|
||||
name: 'limit_type'
|
||||
},
|
||||
@if($canHapus)
|
||||
{
|
||||
data: 'aksi',
|
||||
name: 'aksi',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '150px',
|
||||
className: 'dt-center'
|
||||
}
|
||||
@endif
|
||||
],
|
||||
language: {
|
||||
processing: "Sedang Memuat.."
|
||||
}
|
||||
});
|
||||
|
||||
// Reload table when periode filter changes
|
||||
$('#filterPeriode').on('change', function() {
|
||||
$('#periode_id').val($(this).val());
|
||||
limitsTable.ajax.reload();
|
||||
});
|
||||
|
||||
// Initialize Select2 for Unit Kerja/Prodi
|
||||
$('select#unit_kerjas').select2({
|
||||
dropdownParent: $("#limitModal"),
|
||||
allowClear: true,
|
||||
placeholder: 'Pilih Prodi',
|
||||
width: '100%',
|
||||
templateResult: function(option) {
|
||||
if (option.selected) {
|
||||
return null;
|
||||
}
|
||||
return option.text;
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize Select2 for Jenjang
|
||||
$('select#jenjangs').select2({
|
||||
dropdownParent: $("#limitModal"),
|
||||
placeholder: 'Pilih Jenjang',
|
||||
width: '100%',
|
||||
closeOnSelect: false
|
||||
});
|
||||
|
||||
// Initialize Select2 for Tipe MK
|
||||
$('select#tipe_mks').select2({
|
||||
dropdownParent: $("#limitModal"),
|
||||
placeholder: 'Pilih Tipe Mata Kuliah',
|
||||
width: '100%',
|
||||
closeOnSelect: false
|
||||
});
|
||||
|
||||
// Initialize Select2 for Limit Type
|
||||
$('select#limit_type').select2({
|
||||
dropdownParent: $("#limitModal"),
|
||||
placeholder: 'Pilih Tipe Batas',
|
||||
width: '100%',
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
// Select All functionality
|
||||
$("#select-all").on('click', function() {
|
||||
if ($("#select-all").is(':checked')) {
|
||||
$('select#unit_kerjas > option').prop("selected", "selected");
|
||||
$('select#unit_kerjas').trigger("change");
|
||||
} else {
|
||||
$('select#unit_kerjas').val("");
|
||||
$('select#unit_kerjas').trigger("change");
|
||||
}
|
||||
});
|
||||
|
||||
$('select#unit_kerjas').on('select2:select', function() {
|
||||
if ($("select#unit_kerjas option:selected").length === $("select#unit_kerjas option")
|
||||
.length) {
|
||||
$("#select-all").prop("checked", true);
|
||||
}
|
||||
});
|
||||
|
||||
$('select#unit_kerjas').on('select2:unselect', function() {
|
||||
$("#select-all").prop("checked", false);
|
||||
});
|
||||
|
||||
// Delete functionality
|
||||
let deleteId = null;
|
||||
const deleteModal = new bootstrap.Modal(document.getElementById('deleteModal'));
|
||||
|
||||
$('#limitsTable').on('click', '.btn-delete', function() {
|
||||
deleteId = $(this).data('id');
|
||||
const nama = $(this).data('nama');
|
||||
$('#modal-hapus-msg').text('Apakah anda yakin ingin menghapus limit "' + nama + '"?');
|
||||
deleteModal.show();
|
||||
});
|
||||
|
||||
$('#confirmDeleteBtn').on('click', function() {
|
||||
if (!deleteId) { return; }
|
||||
|
||||
const deleteUrl = "{{ url('manajemen/limit/mengajar') }}/" + deleteId;
|
||||
|
||||
$.ajax({
|
||||
url: deleteUrl,
|
||||
type: "POST",
|
||||
data: {
|
||||
_method: "DELETE",
|
||||
_token: "{{ csrf_token() }}",
|
||||
},
|
||||
success: function(response) {
|
||||
deleteModal.hide();
|
||||
showSuccess('Terhapus!', response.message || 'Data berhasil dihapus.');
|
||||
limitsTable.ajax.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
deleteModal.hide();
|
||||
handleAjaxError(xhr, status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Flash messages are handled by layouts.main automatically
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user