289 lines
11 KiB
PHP
289 lines
11 KiB
PHP
@extends('layouts.main')
|
|
|
|
@section('css')
|
|
<style>
|
|
#pegawai-table tbody tr {
|
|
cursor: pointer;
|
|
}
|
|
|
|
#pegawai-table td, #pegawai-table th {
|
|
border-color: #ced4da !important;
|
|
}
|
|
|
|
#pegawai-table thead th {
|
|
background: #2563eb !important; background-color: #2563eb !important;
|
|
color: #fff !important;
|
|
border-color: #2563eb !important;
|
|
}
|
|
|
|
#pegawai-table tbody tr:hover > * {
|
|
background-color: rgba(13, 110, 253, 0.08) !important;
|
|
}
|
|
</style>
|
|
@endsection
|
|
|
|
@section('breadcrumb')
|
|
<ol class="breadcrumb m-0">
|
|
<li class="breadcrumb-item"><a href="javascript:void(0);">Verifikasi</a></li>
|
|
<li class="breadcrumb-item"><a href="javascript:void(0);">Tri Dharma</a></li>
|
|
<li class="breadcrumb-item active" aria-current="page">{{ $title }}</li>
|
|
</ol>
|
|
@endsection
|
|
|
|
@section('content')
|
|
@if ($periode && !$periode->canVerifyTriDharma() && Auth::user()->id != 1)
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="alert alert-warning" role="alert">
|
|
<i class="fas fa-exclamation-triangle me-2"></i>
|
|
<strong>Perhatian!</strong> {{ $periode->getTriDharmaVerificationErrorMessage() ?? 'Periode verifikasi Tri Dharma tidak aktif.' }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card border">
|
|
<div class="card-body">
|
|
@include('components.datatable-header', [
|
|
'title' => 'Daftar Pleno Tri Dharma',
|
|
'description' => 'Berikut adalah daftar pegawai yang akan mengikuti pleno Tri Dharma'
|
|
])
|
|
|
|
<div class="row mb-3">
|
|
@if($team && $team->id == 1)
|
|
<div class="col-md-6">
|
|
<label for="filter-unit-kerja" class="form-label">Filter Unit Kerja</label>
|
|
<select class="form-select select2" id="filter-unit-kerja" data-placeholder="Pilih Unit Kerja">
|
|
<option value=""></option>
|
|
@foreach($unitKerjas as $unitKerja)
|
|
<option value="{{ $unitKerja->id }}">{{ $unitKerja->nama }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
@endif
|
|
<div class="col-md-6">
|
|
<label for="filter-jenis-pegawai" class="form-label">Filter Jenis Pegawai</label>
|
|
<select class="form-select select2" id="filter-jenis-pegawai" data-placeholder="Pilih Jenis Pegawai">
|
|
<option value=""></option>
|
|
<option value="dosen">Dosen</option>
|
|
<option value="tendik">Tendik</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table id="pegawai-table" class="table table-bordered w-100">
|
|
<thead>
|
|
<tr>
|
|
<th>NIP</th>
|
|
<th>Nama</th>
|
|
<th>Jenis Pegawai</th>
|
|
<th>Tugas Izin Belajar</th>
|
|
<th>Status Pleno</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@section('js')
|
|
<script>
|
|
$('.si-tri-dharma').addClass('menuitem-active');
|
|
$('.ni-tri-dharma').addClass('badge-primary-lighten');
|
|
$('.li-tri-dharma').addClass('show');
|
|
$('.li-pleno-tri-dharma').addClass('active badge-primary-lighten');
|
|
</script>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
var table = $('#pegawai-table').DataTable({
|
|
processing: true,
|
|
serverSide: true,
|
|
ajax: {
|
|
url: "{{ route('tri-dharma.pleno.data') }}",
|
|
data: function(d) {
|
|
d.jenis_pegawai = $('#filter-jenis-pegawai').val();
|
|
d.unit_kerja_id = $('#filter-unit-kerja').val();
|
|
}
|
|
},
|
|
columns: [{
|
|
data: 'nip',
|
|
name: 'nip',
|
|
className: 'text-center'
|
|
},
|
|
{
|
|
data: 'nama',
|
|
name: 'nama'
|
|
},
|
|
{
|
|
data: 'jenis_pegawai',
|
|
name: 'jenis_pegawai',
|
|
className: 'text-center'
|
|
},
|
|
{
|
|
data: 'tugas_izin_belajar',
|
|
name: 'tugas_izin_belajar',
|
|
searchable: false,
|
|
className: 'text-center'
|
|
},
|
|
{
|
|
data: 'status_pleno',
|
|
name: 'status_pleno',
|
|
searchable: false,
|
|
className: 'text-center'
|
|
},
|
|
{
|
|
data: 'action',
|
|
name: 'action',
|
|
orderable: false,
|
|
searchable: false,
|
|
visible: false
|
|
}
|
|
],
|
|
createdRow: function(row, data) {
|
|
if (data.action) {
|
|
$(row).attr('data-nip', data.nip)
|
|
.attr('data-url', data.action)
|
|
.attr('data-bs-toggle', 'tooltip')
|
|
.attr('data-bs-placement', 'top')
|
|
.attr('title', 'Klik untuk melihat detail');
|
|
}
|
|
},
|
|
order: [[1, 'asc']],
|
|
language: {
|
|
processing: "<div class='spinner'></div> Sedang Memuat...",
|
|
},
|
|
drawCallback: function() {
|
|
document.querySelectorAll('body > .tooltip').forEach(function(el) { el.remove(); });
|
|
loadStatusPlenoLazy();
|
|
document.querySelectorAll('#pegawai-table tbody [data-bs-toggle="tooltip"]').forEach(function(el) {
|
|
bootstrap.Tooltip.getOrCreateInstance(el);
|
|
});
|
|
}
|
|
});
|
|
|
|
// Reload table when filter changes
|
|
$('#filter-jenis-pegawai').on('change', function() {
|
|
table.ajax.reload();
|
|
});
|
|
|
|
$('#filter-unit-kerja').on('change', function() {
|
|
table.ajax.reload();
|
|
});
|
|
|
|
// Function untuk lazy loading status pleno (batch loading)
|
|
function loadStatusPlenoLazy() {
|
|
var batch = [];
|
|
var containers = {};
|
|
|
|
// Kumpulkan semua pegawai yang belum di-load
|
|
$('.status-pleno-container').each(function() {
|
|
var $container = $(this);
|
|
|
|
// Skip jika sudah di-load
|
|
if ($container.data('loaded')) {
|
|
return;
|
|
}
|
|
|
|
var nip = $container.data('nip');
|
|
var nipSiakad = $container.data('nip-siakad');
|
|
|
|
// Tandai sebagai sedang loading
|
|
$container.data('loaded', true);
|
|
|
|
batch.push({
|
|
nip: nip,
|
|
nip_siakad: nipSiakad
|
|
});
|
|
|
|
containers[nip] = $container;
|
|
});
|
|
|
|
// Jika tidak ada yang perlu di-load, skip
|
|
if (batch.length === 0) {
|
|
return;
|
|
}
|
|
|
|
// Load semua status dalam 1 request (batch)
|
|
$.ajax({
|
|
url: "{{ route('tri-dharma.pleno.status-pleno') }}",
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
},
|
|
data: JSON.stringify({
|
|
batch: batch
|
|
}),
|
|
contentType: 'application/json',
|
|
success: function(response) {
|
|
if (response.success && response.results) {
|
|
// Update setiap container dengan hasil
|
|
$.each(response.results, function(nip, html) {
|
|
if (containers[nip]) {
|
|
containers[nip].html(html);
|
|
}
|
|
});
|
|
} else {
|
|
// Jika gagal, update semua container dengan error
|
|
$.each(containers, function(nip, $container) {
|
|
$container.html('<span class="text-danger">Error</span>');
|
|
});
|
|
}
|
|
},
|
|
error: function() {
|
|
// Jika error, update semua container dengan error
|
|
$.each(containers, function(nip, $container) {
|
|
$container.html('<span class="text-danger">Error</span>');
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
$('#pegawai-table tbody').on('click', 'tr', function() {
|
|
var url = $(this).attr('data-url');
|
|
if (!url) { return; }
|
|
|
|
@if (Auth::user()->id == 1)
|
|
$('body').css('cursor', 'wait');
|
|
$(this).css('cursor', 'wait');
|
|
window.location.href = url;
|
|
@else
|
|
var $row = $(this);
|
|
$.ajax({
|
|
url: url,
|
|
type: 'GET',
|
|
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
|
success: function(response) {
|
|
if (response.success) {
|
|
$('body').css('cursor', 'wait');
|
|
$row.css('cursor', 'wait');
|
|
window.location.href = url;
|
|
} else {
|
|
showWarning('Peringatan', response.message || 'Periode verifikasi tidak aktif');
|
|
}
|
|
},
|
|
error: function(xhr) {
|
|
var message = 'Periode verifikasi tidak aktif';
|
|
if (xhr.responseJSON && xhr.responseJSON.message) {
|
|
message = xhr.responseJSON.message;
|
|
}
|
|
showWarning('Peringatan', message);
|
|
}
|
|
});
|
|
@endif
|
|
});
|
|
|
|
$(window).on('pageshow', function() {
|
|
$('body').css('cursor', 'default');
|
|
$('#pegawai-table tbody tr').css('cursor', '');
|
|
});
|
|
});
|
|
</script>
|
|
@endsection
|