Commit 19ccab77 by windychikita20

tambahan instrument

parent 4b2e78cd
......@@ -34,15 +34,30 @@ class LembarInstrumentMonitoringController extends Controller
$data['instrumentdetail'] = Instrument::query()->where('id', $data['filter_instrument'])->first();
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->orderBy('pernyataan_instrument')->get();
$data['sub_instrument'] = Sub_Instrument::query()->where('id_instrument',$data['filter_instrument'] )
->orderBy('id_instrument')->get();
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->orderBy('created_at','asc')->get();
$data['sub_instrument'] = Sub_Instrument::query()->with('jenis_input')
->where('id_instrument',$data['filter_instrument'] )
->orderBy('created_at','asc')->get();
$data['sub_pernyataan_instrument'] = Sub_Pernyataan_Instrument::query()->orderBy('sub_peryataan')->get();
$data['fakultas'] = Fakultas::query()->orderBy('id')->get();
$data['instrument'] = Instrument::query()->orderBy('instrument')->get();
$data['tahun'] = Tahun::query()->orderBy('tahun')->get();
$data['hasil_instrumen'] = Hasil_Instrument::query()->get();
$data['arr_hasil'] = [];
foreach($data['hasil_instrumen'] as $item){
$data['arr_hasil'][$item->id_pernyataan_instrument][$item->id_sub_pernyataan_instrument][$item->id_fakultas][$item->tahun] = $item;
}
$data['arr_hasil_total'] = [];
foreach($data['hasil_instrumen'] as $item)
{
$data['arr_hasil_total'][$item->id_sub_instrument][$item->id_fakultas][$item->tahun] = $item;
}
//dd($data['arr_hasil_total']->toArray());
return view('content.backend.masters.lembar_instrument_monitoring.index', $data);
}
......@@ -73,57 +88,50 @@ class LembarInstrumentMonitoringController extends Controller
*/
public function store(Request $request)
{
//dd($request->id_pernyataan_instrument);
//dd($request->all());
foreach ($request->input('jumlah_pernyataan_instrument') as $index => $value)
{
if(!empty($request->jumlah_pernyataan_instrument[$index]))
{
if(empty($request->id[$index]))
{
$post = Hasil_Instrument::create(
$post = Hasil_Instrument::updateOrCreate(
[
'id_pernyataan_instrument' => $request->id_pernyataan_instrument[$index],
'tahun' => $request->input('tahun'),
'id_fakultas' => $request->id_fakultas[$index],
'jumlah' => $request->jumlah_pernyataan_instrument[$index],
'id_sub_instrument' => $request->id_sub_instrument,
],
[
'jumlah' => $request->jumlah_pernyataan_instrument[$index]
]);
}
else
{
$update = Hasil_Instrument::where('id',$request->id[$index])
->update(['jumlah' => $request->jumlah_pernyataan_instrument[$index]]);
}
}
}
if(!empty($request->input('id_sub_pernyataan_instrument')))
if(!empty($request->input('jumlah_sub_peryataan')))
{
foreach ($request->input('jumlah_sub_peryataan') as $index => $value)
foreach ($request->input('jumlah_sub_peryataan') as $idparent => $value)
{
if(empty($request->id_subhasil[$index]))
foreach ($value as $idsubparent => $value1)
{
$post = Hasil_Instrument::create(
[
'id_pernyataan_instrument' => $request->id_pernyataan_instrument[$index],
'id_sub_pernyataan_instrument' => $request->id_sub_pernyataan_instrument[$index],
'tahun' => $request->input('tahun'),
'id_fakultas' => $request->id_fakultas[$index],
'jumlah' => $request->jumlah_sub_peryataan[$index],
'id_sub_instrument' => $request->id_sub_instrument,
]);
foreach ($value1 as $idfakultas => $value2)
{
$post = Hasil_Instrument::updateOrCreate(
[
'id_pernyataan_instrument' => $idparent,
'id_sub_pernyataan_instrument' => $idsubparent,
'tahun' => $request->input('tahun'),
'id_fakultas' => $idfakultas,
'id_sub_instrument' => $request->id_sub_instrument,
],
[
'jumlah' => $value2,
]);
}
}
else
{
$update = Hasil_Instrument::where('id',$request->id_subhasil[$index])
->update(['jumlah' => $request->jumlah_sub_peryataan[$index]]);
}
}
......@@ -154,19 +162,36 @@ class LembarInstrumentMonitoringController extends Controller
* @param int $id
* @return \Illuminate\Http\Response
*/
public function cetak_pdf($id,$id2)
public function cetak_pdf(Request $request)
{
$data['filter_instrument'] = decrypt($id);
$data['filter_tahun'] = decrypt($id2);
$data['instrumentdetail'] = Instrument::query()->where('id', decrypt($id))->first();
$data['no_dokumen'] = $request->input('no_dokumen');
$data['revisi'] = $request->input('revisi');
$data['tanggal_terbit'] = $request->input('tanggal_terbit');
$data['filter_instrument'] = $request->input('filter_instrument');
$data['filter_tahun'] = $request->input('filter_tahun');
$data['instrumentdetail'] = Instrument::query()->where('id', $request->input('filter_instrument'))->first();
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->orderBy('pernyataan_instrument')->get();
$data['sub_instrument'] = Sub_Instrument::query()->where('id_instrument',decrypt($id))
->orderBy('id_instrument')->get();
$data['sub_instrument'] = Sub_Instrument::query()
->where('id_instrument',$request->input('filter_instrument'))
->orderBy('id_instrument')->get();
$data['sub_pernyataan_instrument'] = Sub_Pernyataan_Instrument::query()->orderBy('sub_peryataan')->get();
$data['fakultas'] = Fakultas::query()->orderBy('id')->get();
$data['hasil_instrumen'] = Hasil_Instrument::query()->get();
$data['arr_hasil'] = [];
foreach($data['hasil_instrumen'] as $item){
$data['arr_hasil'][$item->id_pernyataan_instrument][$item->id_sub_pernyataan_instrument][$item->id_fakultas][$item->tahun] = $item;
}
$data['arr_hasil_total'] = [];
foreach($data['hasil_instrumen'] as $item)
{
$data['arr_hasil_total'][$item->id_sub_instrument][$item->id_fakultas][$item->tahun] = $item;
}
$pdf = PDF::loadview('content.backend.masters.lembar_instrument_monitoring.laporan', $data);
return $pdf->download('laporan-pegawai-pdf');
$pdf = PDF::loadview('content.backend.masters.lembar_instrument_monitoring.laporan', $data)->setPaper('a4', 'landscape');
return $pdf->stream('laporan-pegawai-pdf');
}
}
......@@ -27,8 +27,8 @@ class PernyataanInstrumentController extends Controller
*/
public function index()
{
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->orderBy('pernyataan_instrument')->get();
$data['sub_instrument'] = Sub_Instrument::query()->orderBy('id_instrument')->get();
$data['pernyataan_instrument'] = Pernyataan_Instrument::query()->orderBy('created_at','asc')->get();
$data['sub_instrument'] = Sub_Instrument::query()->orderBy('created_at','asc')->get();
$data['sub_instrument_pernyataan'] = Pernyataan_Instrument::with(['sub_instrument' => function ($q)
......
......@@ -2,16 +2,16 @@
@section('title', 'Lembar Instrument Monitoring')
@section('content')
<section class="row">
<div class="col-md-12">
<div class="col-md-6">
<div class="card">
<div class="card-body px-3 py-4-5">
<div class="row">
<div class="col-md-12">
<h6 class="text-muted font-semibold">Lembar Instrument Monitoring</h6>
<div class="col-md-6">
<h6 class="text-muted font-semibold">Filter Lembar Instrument Monitoring</h6>
<div class="card-header">
<form action="{{ route('lembar_instrument_monitoring.index') }}" method="PATCH" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="col-md-6 col-12">
<div class="col-md-12 col-12">
<div class="form-group">
<label for="last-name-column">Instrument</label>
<select class="form-control" name="instrument">
......@@ -23,7 +23,7 @@
</div>
</div>
<div class="col-md-6 col-12">
<div class="col-md-12 col-12">
<div class="form-group">
<label for="last-name-column">Tahun</label>
<select class="form-control" name="tahun">
......@@ -45,6 +45,49 @@
</div>
</div>
</div>
@if(!empty($filter_tahun && $filter_instrument))
<div class="col-md-6">
<div class="card">
<div class="card-body px-3 py-4-5">
<div class="row">
<div class="col-md-6">
<h6 class="text-muted font-semibold">Print Lembar Instrument Monitoring</h6>
<div class="card-header">
<form action="{{ route('cetak_pdf') }}" method="post" enctype="multipart/form-data" target="_blank">
{{ csrf_field() }}
<div class="col-md-12 col-12">
<div class="form-group">
<label for="last-name-column">No. Dokumen</label>
<input type="text" name="no_dokumen" class="form-control" required>
<input type="hidden" name="filter_tahun" value="{{$filter_tahun}}" class="form-control">
<input type="hidden" name="filter_instrument" value="{{$filter_instrument}}" class="form-control">
</div>
</div>
<div class="col-md-12 col-12">
<div class="form-group">
<label for="last-name-column">Revisi</label>
<input type="text" name="revisi" class="form-control" required>
</div>
</div>
<div class="col-md-12 col-12">
<div class="form-group">
<label for="last-name-column">Tanggal Terbit</label>
<input type="date" name="tanggal_terbit" class="form-control" required>
</div>
</div>
<button type="submit" class="btn btn-success">Print</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
@endif
</section>
......@@ -66,36 +109,31 @@
<h5 class="text-muted font-semibold">
<center>LEMBAR @if(!empty($instrumentdetail)) {{$instrumentdetail->instrument}}@endif - TAHUN @if(!empty($filter_tahun)) {{$filter_tahun}}@endif</center>
</h5>
@if(!empty($filter_tahun && $filter_instrument))
<a href="{{ route('cetak_pdf', ['id' => encrypt($filter_instrument),'id2' => encrypt($filter_tahun)]) }}" class="btn btn-primary me-1 mb-1" target="_blank">PRINT</a>
@endif
<br><br>
@foreach ($sub_instrument as $data)
<h6>{{ $data->sub_instrument }} </h6>
<div class="table-responsive">
<table class="table table-striped mb-0">
<thead>
<th>No. Pernyataan</th>
<th colspan="{{count($fakultas)}}"><center>{{ $data->jenis_input->detail }}</center></th>
@foreach ($fakultas as $data)
<th>{{$data->fakultas}}</th>
</thead>
<thead>
<th>&nbsp;</th>
@foreach ($fakultas as $dataa)
<th>{{$dataa->fakultas}}</th>
@endforeach
</thead>
<tbody>
@foreach ($sub_instrument as $data)
<form action="{{ route('lembar_instrument_monitoring.store')}}" method="POST" enctype="multipart/form-data">
@csrf
<tr>
<td>
<strong>{{ $data->instrument->instrument }}</strong> <br>
{{ $data->sub_instrument }}</td>
@for ($i = 0; $i < count($fakultas) ; $i++)
<td></td>
@endfor
<input type="hidden" value="{{$data->id}}" name="id_sub_instrument" class="form-control">
</tr>
<input type="hidden" value="{{$data->id}}" name="id_sub_instrument" class="form-control">
@php $no = 1; @endphp
@foreach($pernyataan_instrument as $item)
......@@ -106,19 +144,10 @@
@for ($i = 1; $i <= count($fakultas) ; $i++)
<td>
@php
$hasil_instrument = App\Models\Hasil_Instrument::
where('id_pernyataan_instrument',$item->id)
->where('id_sub_pernyataan_instrument',null)
->where('id_fakultas',$i)
->where('tahun',$filter_tahun)
->first();
@endphp
<input type="{{ $data->jenis_input->html }}"
name="jumlah_pernyataan_instrument[]"class="form-control"
value="@if(!empty($hasil_instrument)){{$hasil_instrument->jumlah}}@endif">
value="{{ isset($arr_hasil[$item->id][''][$i][$filter_tahun]) ? $arr_hasil[$item->id][''][$i][$filter_tahun]->jumlah : '' }}">
<input type="hidden" value="{{$item->id}}" name="id_pernyataan_instrument[]" class="form-control">
......@@ -138,7 +167,7 @@
<td>{{ $value->sub_peryataan }}</td>
@for ($a = 1; $a <= count($fakultas) ; $a++)
<td>
@php
<!-- @php
$hasil_subinstrument = App\Models\Hasil_Instrument::
where('id_pernyataan_instrument',$item->id)
->where('id_sub_pernyataan_instrument',$value->id)
......@@ -146,12 +175,13 @@
->where('tahun',$filter_tahun)
->first();
@endphp
@endphp -->
<input type="{{ $data->jenis_input->html }}"
name="jumlah_sub_peryataan[]"class="form-control" value="@if(!empty($hasil_subinstrument)){{$hasil_subinstrument->jumlah}}@endif">
<!-- <input type="{{ $data->jenis_input->html }}"
name="jumlah_sub_peryataan[{{$item->id}}][{{$value->id}}][{{$a}}]"class="form-control" value="@if(!empty($hasil_subinstrument)){{$hasil_subinstrument->jumlah}}@endif"> -->
<input type="hidden" value="{{$value->id}}" name="id_sub_pernyataan_instrument[]" class="form-control" >
<input type="{{ $data->jenis_input->html }}"
name="jumlah_sub_peryataan[{{$item->id}}][{{$value->id}}][{{$a}}]"class="form-control" value="{{ isset($arr_hasil[$item->id][$value->id][$a][$filter_tahun]) ? $arr_hasil[$item->id][$value->id][$a][$filter_tahun]->jumlah : '' }}">
<input type="hidden" value="@if(!empty($hasil_subinstrument)){{$hasil_subinstrument->id}}@endif" name="id_subhasil[]" class="form-control">
......@@ -170,17 +200,12 @@
<td><strong>Jumlah</strong></td>
@for ($b = 1; $b <= count($fakultas) ; $b++)
@php
$total = App\Models\Hasil_Instrument::
where('id_sub_instrument',$data->id)
->where('id_fakultas',$b)
->where('tahun',$filter_tahun)
->first();
@endphp
<td><center><strong>@if(!empty($total)){{$total->total}}@endif</strong></center></td>
@endfor
<td><center><strong>{{ isset($arr_hasil_total[$data->id][$b][$filter_tahun]) ? $arr_hasil_total[$data->id][$b][$filter_tahun]->total : '' }}</strong></center></td>
@endfor
</tr>
<tr>
......@@ -191,17 +216,18 @@
<div class="col-12 d-flex justify-content-end">
<button type="submit" class="btn btn-success me-1 mb-1">Simpan</button>
</div>
<br><br>
</td>
</tr>
</form>
@endforeach
</tbody>
</table>
</div>
@endforeach
</div>
</div>
......
<html>
<head>
<title>Membuat Laporan PDF Dengan DOMPDF Laravel</title>
<title>LEMBAR @if(!empty($instrumentdetail)) {{$instrumentdetail->instrument}}@endif - TAHUN @if(!empty($filter_tahun)) {{$filter_tahun}}@endif</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
......@@ -8,69 +8,75 @@
table tr td,
table tr th{
font-size: 9pt;
align:center;
}
</style>
<table class='table table-bordered'>
<thead>
<th><center><img style="width:70px" src="{{ asset('images/logo_unesa_kuning.png') }}" alt=""></center></th>
<th colspan="2"><h5 align="center">UNIVERSITAS NEGERI SURABAYA</h5></th>
</thead>
<tbody>
<tr>
<td rowspan="3"><h6 align="center">@if(!empty($instrumentdetail)) {{$instrumentdetail->instrument}}@endif</h6></td>
<td >No. Dokumen </td>
<td >@if(!empty($no_dokumen)) {{$no_dokumen}}@endif</td>
</tr>
<tr>
<td >Revisi </td>
<td >@if(!empty($revisi)) {{$revisi}}@endif</td>
</tr>
<tr>
<td >Tanggal Terbit </td>
<td >@if(!empty($tanggal_terbit)) {{$tanggal_terbit}}@endif</td>
</tr>
</tbody>
</table>
<center>
<h5>Membuat Laporan PDF Dengan DOMPDF Laravel</h4>
<h6><a target="_blank" href="https://www.malasngoding.com/membuat-laporan-…n-dompdf-laravel/">www.malasngoding.com</a></h5>
<h6> <center>LEMBAR @if(!empty($instrumentdetail)) {{$instrumentdetail->instrument}}@endif <br> TAHUN @if(!empty($filter_tahun)) {{$filter_tahun}}@endif</center></h6>
</center>
<br><br>
@foreach ($sub_instrument as $dataa)
<h6>{{ $dataa->sub_instrument }}</h6>
<table class='table table-bordered'>
<thead>
<th>No. Pernyataan</th>
<th><font size="2">No. Pernyataan</font></th>
<th colspan="{{count($fakultas)}}" class="text-center"><font size="2">{{ $dataa->jenis_input->detail }}</font></th>
@foreach ($fakultas as $data)
<th>{{$data->fakultas}}</th>
</thead>
<thead>
<th>&nbsp;</th>
@foreach ($fakultas as $data)
<th><font size="2">{{$data->fakultas}}</font></th>
@endforeach
</thead>
<tbody>
@foreach ($sub_instrument as $data)
<tr>
<td>
<strong>{{ $data->instrument->instrument }}</strong> <br>
{{ $data->sub_instrument }}</td>
@for ($i = 0; $i < count($fakultas) ; $i++)
<td></td>
@endfor
<input type="hidden" value="{{$data->id}}" name="id_sub_instrument" class="form-control">
</tr>
@php $no = 1; @endphp
@foreach($pernyataan_instrument as $item)
@if($data->id == $item->id_sub_instrument)
@if($dataa->id == $item->id_sub_instrument)
<tr>
<td>{{ $no++ }}. {{ $item->pernyataan_instrument }} </td>
@for ($i = 1; $i <= count($fakultas) ; $i++)
<td>
@php
$hasil_instrument = App\Models\Hasil_Instrument::
where('id_pernyataan_instrument',$item->id)
->where('id_sub_pernyataan_instrument',null)
->where('id_fakultas',$i)
->where('tahun',$filter_tahun)
->first();
@endphp
<input type="{{ $data->jenis_input->html }}"
name="jumlah_pernyataan_instrument[]"class="form-control"
value="@if(!empty($hasil_instrument)){{$hasil_instrument->jumlah}}@endif">
<input type="hidden" value="{{$item->id}}" name="id_pernyataan_instrument[]" class="form-control">
<center>{{ isset($arr_hasil[$item->id][''][$i][$filter_tahun]) ? $arr_hasil[$item->id][''][$i][$filter_tahun]->jumlah : '' }}</center>
<input type="hidden" value="{{$filter_tahun}}" name="tahun" class="form-control">
<input type="hidden" value="{{$i}}" name="id_fakultas[]" class="form-control">
<input type="hidden" value="@if(!empty($hasil_instrument)){{$hasil_instrument->id}}@endif" name="id[]" class="form-control">
</td>
@endfor
......@@ -82,22 +88,9 @@
<td>{{ $value->sub_peryataan }}</td>
@for ($a = 1; $a <= count($fakultas) ; $a++)
<td>
@php
$hasil_subinstrument = App\Models\Hasil_Instrument::
where('id_pernyataan_instrument',$item->id)
->where('id_sub_pernyataan_instrument',$value->id)
->where('id_fakultas',$a)
->where('tahun',$filter_tahun)
->first();
@endphp
<input type="{{ $data->jenis_input->html }}"
name="jumlah_sub_peryataan[]"class="form-control" value="@if(!empty($hasil_subinstrument)){{$hasil_subinstrument->jumlah}}@endif">
<input type="hidden" value="{{$value->id}}" name="id_sub_pernyataan_instrument[]" class="form-control" >
<input type="hidden" value="@if(!empty($hasil_subinstrument)){{$hasil_subinstrument->id}}@endif" name="id_subhasil[]" class="form-control">
<center>{{ isset($arr_hasil[$item->id][$value->id][$a][$filter_tahun]) ? $arr_hasil[$item->id][$value->id][$a][$filter_tahun]->jumlah : '' }}</center>
</td>
@endfor
......@@ -106,46 +99,27 @@
</tr>
@endif
@endforeach
@endif
@endforeach
<tr>
<tr>
<td><strong>Jumlah</strong></td>
@for ($b = 1; $b <= count($fakultas) ; $b++)
<td><center><strong>{{ isset($arr_hasil_total[$dataa->id][$b][$filter_tahun]) ? $arr_hasil_total[$dataa->id][$b][$filter_tahun]->total : '' }}</strong></center></td>
@endfor
</tr>
<td><strong>Jumlah</strong></td>
@for ($b = 1; $b <= count($fakultas) ; $b++)
@php
$total = App\Models\Hasil_Instrument::
where('id_sub_instrument',$data->id)
->where('id_fakultas',$b)
->where('tahun',$filter_tahun)
->first();
@endphp
<td><center><strong>@if(!empty($total)){{$total->total}}@endif</strong></center></td>
@endfor
</tr>
<tr>
<td>
&nbsp;
</td>
<td colspan="{{count($fakultas)}}">
<div class="col-12 d-flex justify-content-end">
<button type="submit" class="btn btn-success me-1 mb-1">Simpan</button>
</div>
<br><br>
</td>
</tr>
@endforeach
</tbody>
</table>
@endforeach
</body>
</html>
......
......@@ -57,5 +57,5 @@ Route::middleware(['auth:sanctum'])->group(function () {
Route::resource('/lembar_instrument_monitoring', LembarInstrumentMonitoringController::class);
Route::post('/filter',[LembarInstrumentMonitoringController::class, 'filter'])->name('filter');
Route::get('cetak_pdf/{id}/{id2}', [LembarInstrumentMonitoringController::class, 'cetak_pdf'])->name('cetak_pdf');
Route::post('cetak_pdf', [LembarInstrumentMonitoringController::class, 'cetak_pdf'])->name('cetak_pdf');
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment