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,55 +88,48 @@ 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 $idparent => $value)
{
foreach ($request->input('jumlah_sub_peryataan') as $index => $value)
foreach ($value as $idsubparent => $value1)
{
if(empty($request->id_subhasil[$index]))
foreach ($value1 as $idfakultas => $value2)
{
$post = Hasil_Instrument::create(
$post = Hasil_Instrument::updateOrCreate(
[
'id_pernyataan_instrument' => $request->id_pernyataan_instrument[$index],
'id_sub_pernyataan_instrument' => $request->id_sub_pernyataan_instrument[$index],
'id_pernyataan_instrument' => $idparent,
'id_sub_pernyataan_instrument' => $idsubparent,
'tahun' => $request->input('tahun'),
'id_fakultas' => $request->id_fakultas[$index],
'jumlah' => $request->jumlah_sub_peryataan[$index],
'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))
$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();
$pdf = PDF::loadview('content.backend.masters.lembar_instrument_monitoring.laporan', $data);
return $pdf->download('laporan-pegawai-pdf');
$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)->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)
......
......@@ -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