first commit
This commit is contained in:
@@ -0,0 +1,442 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('css')
|
||||
<link rel="stylesheet" type="text/css" href="{{ asset('assets/css/vendors/datatables.css') }}">
|
||||
<style>
|
||||
.accordion-button.hide-arrow::after {
|
||||
background-image: none !important;
|
||||
}
|
||||
|
||||
table tr th,
|
||||
table tr td {
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.select2-search--inline {
|
||||
display: contents;
|
||||
/*this will make the container disappear, making the child the one who sets the width of the element*/
|
||||
}
|
||||
|
||||
.select2-search__field:placeholder-shown {
|
||||
width: 100% !important;
|
||||
/*makes the placeholder to be 100% of the width while there are no options selected*/
|
||||
}
|
||||
</style>
|
||||
<script src="https://cdn.plot.ly/plotly-2.34.0.min.js" charset="utf-8"></script>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Unit Kerja: {{ $units->first()?->nama ?? 'Tidak Ditemukan' }}</h5>
|
||||
@if (request()->jenis_pegawai)
|
||||
<p class="card-text">Jenis Pegawai: {{ ucfirst(request()->jenis_pegawai) }}</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="border d-flex justify-content-center w-100">
|
||||
<div id="total-chart" class="overflow-auto"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="accordion" id="penggunaan-p2">
|
||||
@foreach ($p2 as $kategori => $penggunaan)
|
||||
@continue(collect($penggunaan)->flatten()->sum() === 0)
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button
|
||||
class="accordion-button collapsed {{ gettype($penggunaan) === 'array' ? '' : 'hide-arrow' }}"
|
||||
type="button" data-bs-toggle="collapse" data-bs-target="#{{ $kategori }}">
|
||||
{{ ucwords(str_replace('_', ' ', $kategori)) }}
|
||||
<i class='fa fa-arrow-right mx-2'></i>
|
||||
{{ number_format(collect($penggunaan)->flatten()->sum(), 2, ',', '.') }}
|
||||
</button>
|
||||
</h2>
|
||||
@if (gettype($penggunaan) === 'array' && str_contains($kategori, 'tri_dharma'))
|
||||
<div id="{{ $kategori }}" class="accordion-collapse collapse">
|
||||
<div class="accordion-body">
|
||||
<div class="d-flex justify-content-center">
|
||||
<div id="{{ $kategori }}-chart" class="overflow-auto"></div>
|
||||
</div>
|
||||
@foreach ($penggunaan as $subkategori => $detail)
|
||||
@continue(collect($detail)->flatten()->sum() === 0)
|
||||
<div class="accordion" id="subdetail">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button
|
||||
class="accordion-button collapsed {{ gettype($detail) === 'array' ? '' : 'hide-arrow' }}"
|
||||
type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#{{ $kategori }}-{{ $subkategori }}">
|
||||
@if (str_contains($subkategori, 'Lainnya'))
|
||||
{{ ucwords(str_replace('_', ' ', implode(' ', explode('Lainnya', $subkategori)))) }}
|
||||
Lainnya
|
||||
@else
|
||||
{{ ucwords(str_replace('_', ' ', $subkategori)) }}
|
||||
@endif
|
||||
<i class='fa fa-arrow-right mx-2'></i>
|
||||
{{ number_format(collect($detail)->flatten()->sum(), 2, ',', '.') }}
|
||||
</button>
|
||||
</h2>
|
||||
@if (gettype($detail) === 'array')
|
||||
<div id="{{ $kategori }}-{{ $subkategori }}"
|
||||
class="accordion-collapse collapse">
|
||||
<div class="accordion-body">
|
||||
<table class='table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Jenjang</th>
|
||||
<th>P2</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($detail as $subsubkategori => $subdetail)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ ucwords(str_replace('_', ' ', $subsubkategori)) }}
|
||||
</td>
|
||||
<td>{{ number_format(collect($subdetail)->flatten()->sum(), 2, ',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@elseif(gettype($penggunaan) === 'array')
|
||||
<div id="{{ $kategori }}" class="accordion-collapse collapse">
|
||||
<div class="accordion-body">
|
||||
<div class="d-flex justify-content-center">
|
||||
<div id="{{ $kategori }}-chart" class="overflow-auto"></div>
|
||||
</div>
|
||||
@if ($kategori === 'skp')
|
||||
<div class="alert alert-info d-inline-block mb-3">
|
||||
<strong>Jumlah SKP:</strong> {{ count($penggunaan) }} item
|
||||
</div>
|
||||
@endif
|
||||
<table class='table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama</th>
|
||||
<th>P2</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($penggunaan as $subkategori => $detail)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ ucwords(str_replace('_', ' ', $subkategori)) }}</td>
|
||||
<td>{{ number_format(collect($detail)->flatten()->sum(), 2, ',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#tabulasi">
|
||||
Tabulasi
|
||||
</button>
|
||||
</h2>
|
||||
<div id="tabulasi" class="accordion-collapse collapse">
|
||||
<div class="accordion-body">
|
||||
<table class='table tabulasi cell-border'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan='2' class='border border-3'>No</th>
|
||||
<th rowspan='2' class='border border-3'>NIP</th>
|
||||
<th rowspan='2' class='border border-3'>Nama</th>
|
||||
<th rowspan='2' class='border border-3'>Unit Kerja</th>
|
||||
<th colspan='4' class='text-center border border-3'>Homebase</th>
|
||||
<th colspan='4' class='text-center border border-3'>Luar Homebase</th>
|
||||
<th rowspan='2' class='border border-3'>Dibayarkan oleh
|
||||
{{ $units->first()?->nama ?? 'Unit Kerja' }}
|
||||
</th>
|
||||
<th rowspan='2' class='border border-3'>Total Pendapatan P2</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='border border-3'>SKP</th>
|
||||
<th class='border border-3'>Tri Dharma</th>
|
||||
<th class='border border-3'>Penunjang</th>
|
||||
<th class='border border-3'>Total</th>
|
||||
<th class='border border-3'>SKP</th>
|
||||
<th class='border border-3'>Tri Dharma</th>
|
||||
<th class='border border-3'>Penunjang</th>
|
||||
<th class='border border-3'>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($pegawais as $pegawai)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $pegawai->nip }}</td>
|
||||
<td>{{ $pegawai->nama }}</td>
|
||||
<td>{{ $pegawai->unit_kerja_nama }}</td>
|
||||
<td>{{ number_format($pegawai->p2['detail']['skp_homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['detail']['tri_dharma_homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['detail']['penunjang_homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['total']['homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['detail']['skp_luar_homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['detail']['tri_dharma_luar_homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['detail']['penunjang_luar_homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['total']['luar_homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['total']['unit'], 2, ',', '.') }}
|
||||
</td>
|
||||
<td>{{ number_format($pegawai->p2['total']['homebase'] + $pegawai->p2['total']['luar_homebase'], 2, ',', '.') }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan='4'>Total</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.detail.skp_homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.detail.tri_dharma_homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.detail.penunjang_homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.total.homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.detail.skp_luar_homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.detail.tri_dharma_luar_homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.detail.penunjang_luar_homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.total.luar_homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.total.unit'), 2, ',', '.') }}</th>
|
||||
<th>{{ number_format($pegawais->sum('p2.total.homebase') + $pegawais->sum('p2.total.luar_homebase'), 2, ',', '.') }}
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script src="{{ asset('assets/js/datatable/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('assets/js/datatable/datatables/datatable.custom.js') }}"></script>
|
||||
<script src="https://datatables.net/examples/plug-ins/sorting_sType.html"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
|
||||
"numeric-comma-pre": function(a) {
|
||||
// prepare number
|
||||
a = (a.replaceAll(".", ""));
|
||||
a = +(a.replaceAll(",", "."));
|
||||
a = (isNaN(a)) ? Number.MAX_VALUE : a;
|
||||
return a;
|
||||
},
|
||||
"numeric-comma-asc": function(a, b) {
|
||||
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
||||
},
|
||||
"numeric-comma-desc": function(a, b) {
|
||||
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
|
||||
}
|
||||
});
|
||||
|
||||
$('table.table').not('.tabulasi').DataTable({
|
||||
scrollX: true,
|
||||
columnDefs: [{
|
||||
targets: [0],
|
||||
className: 'dt-center',
|
||||
width: 50
|
||||
},
|
||||
{
|
||||
targets: [-1],
|
||||
className: 'dt-body-right dt-head-center'
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
$('table.tabulasi').DataTable({
|
||||
scrollX: true,
|
||||
columnDefs: [{
|
||||
targets: [0],
|
||||
className: 'dt-center',
|
||||
width: 50
|
||||
},
|
||||
{
|
||||
targets: [-1],
|
||||
className: 'dt-body-right dt-head-center'
|
||||
},
|
||||
],
|
||||
"aoColumns": [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
{
|
||||
"sType": "numeric-comma"
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
$('button[data-bs-toggle="tab"], button[data-bs-toggle="pill"], button[data-bs-toggle="collapse"]')
|
||||
.on('click', function() {
|
||||
$($.fn.dataTable.tables(true)).DataTable().columns.adjust();
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
const data = [{
|
||||
values: [
|
||||
@foreach ($p2 as $kategori => $penggunaan)
|
||||
{{ round(collect($penggunaan)->flatten()->sum() / 1000000, 3) }},
|
||||
@endforeach
|
||||
],
|
||||
labels: [
|
||||
@foreach ($p2 as $kategori => $penggunaan)
|
||||
'{{ ucwords(str_replace('_', ' ', $kategori)) }}',
|
||||
@endforeach
|
||||
],
|
||||
domain: {
|
||||
column: 0
|
||||
},
|
||||
name: 'Penggunaan P2',
|
||||
textinfo: 'percent+value',
|
||||
hoverinfo: 'label+percent+name+value',
|
||||
hole: .5,
|
||||
type: 'pie'
|
||||
}];
|
||||
|
||||
const layout = {
|
||||
title: 'Grafik Penggunaan P2 (Dalam Juta Rupiah)',
|
||||
annotations: [{
|
||||
font: {
|
||||
size: 20
|
||||
},
|
||||
showarrow: false,
|
||||
text: '{{ number_format(collect($p2)->flatten()->sum() / 1000000, 2, ',', '.') }}',
|
||||
}, ],
|
||||
legend: {
|
||||
font: {
|
||||
size: 16
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const config = {
|
||||
displayModeBar: false,
|
||||
responsive: true
|
||||
};
|
||||
|
||||
Plotly.newPlot('total-chart', data, layout, config);
|
||||
});
|
||||
|
||||
@foreach($p2 as $kategori => $penggunaan)
|
||||
@continue(in_array($kategori, ['skp_tendik', 'presensi']))
|
||||
$(document).ready(function() {
|
||||
const data = [{
|
||||
values: [
|
||||
@foreach ($penggunaan as $subkategori => $detail)
|
||||
@continue(collect($detail)->flatten()->sum() === 0)
|
||||
{{ round(collect($detail)->flatten()->sum() / 1000000, 3) }},
|
||||
@endforeach
|
||||
],
|
||||
labels: [
|
||||
@foreach ($penggunaan as $subkategori => $detail)
|
||||
@continue(collect($detail)->flatten()->sum() === 0)
|
||||
'{{ ucwords(str_replace('_', ' ', $subkategori)) }}',
|
||||
@endforeach
|
||||
],
|
||||
domain: {
|
||||
column: 0
|
||||
},
|
||||
name: 'Penggunaan P2 {{ ucwords(str_replace('_', ' ', $kategori)) }}',
|
||||
textinfo: 'percent+value',
|
||||
hoverinfo: 'label+percent+name+value',
|
||||
hole: .5,
|
||||
type: 'pie'
|
||||
}];
|
||||
|
||||
const layout = {
|
||||
title: 'Grafik Penggunaan P2 {{ ucwords(str_replace('_', ' ', $kategori)) }} (Dalam Juta Rupiah)',
|
||||
annotations: [{
|
||||
font: {
|
||||
size: 20
|
||||
},
|
||||
showarrow: false,
|
||||
text: '{{ number_format(collect($penggunaan)->flatten()->sum() / 1000000, 2, ',', '.') }}',
|
||||
}, ],
|
||||
legend: {
|
||||
font: {
|
||||
size: 16
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const config = {
|
||||
displayModeBar: false,
|
||||
responsive: true
|
||||
};
|
||||
|
||||
Plotly.newPlot('{{ $kategori }}-chart', data, layout, config);
|
||||
});
|
||||
@endforeach
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user