From a5a3c504b1868928ebbc31bef25b1540dfbc5c55 Mon Sep 17 00:00:00 2001 From: fikyb Date: Mon, 8 Jul 2024 20:26:55 +0700 Subject: [PATCH] update pemutihan --- .../LayananPemutihanController.php | 18 +++++++-- .../views/layanan-pemutihan/index.blade.php | 38 +++++++++++++++++-- .../views/monitoring/pemutihan.blade.php | 2 +- 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/LayananPemutihanController.php b/app/Http/Controllers/LayananPemutihanController.php index ff912c6..ef8ee76 100644 --- a/app/Http/Controllers/LayananPemutihanController.php +++ b/app/Http/Controllers/LayananPemutihanController.php @@ -19,7 +19,8 @@ public function index(){ 'pengajuan_pemutihans.*', 'users.nama_gelar as dosen_pengampu', ) - ->join('users','dosen_id','=','users.id')->get(); + ->join('users','dosen_id','=','users.id') + ->get(); return view('layanan-pemutihan.index',['title' => 'Pengajuan Pemutihan | Admin Dashboard','data' => $data]); } @@ -63,8 +64,9 @@ public function store(Request $request){ $data_pemutihan['keterangan'] = $request->keterangan; $bukti_pemutihan = $request->file('bukti_pemutihan'); - $bukti_pemutihan_name = 'P_'.str_replace(' ', '_',$bukti_pemutihan->getClientOriginalName()); - $path = $request->tanggal_kelas.'/'.$request->tanggal_kelas.'/'.$bukti_pemutihan_name; + $bukti_pemutihan_name = $caseid.'_'.str_replace(' ', '_',$bukti_pemutihan->getClientOriginalName()); + $path = 'pemutihan/'.$bukti_pemutihan_name; + //jika berhasil save file dan save data mhs maka pengajuan akan diisi if(Storage::disk('public')->put($path, file_get_contents($bukti_pemutihan))){ $data_pemutihan['bukti_izin_dosen'] = $bukti_pemutihan_name; @@ -119,6 +121,16 @@ public function selesai($caseid, Request $request){ $data->status_operator = Carbon::now(); $data->save(); return redirect()->route('layanan-pemutihan.index')->with('success','Data Berhasil Disimpan, status akan diupdate menjadi selesai'); +} + +function tolak($caseid, Request $request){ dd($request->all()); + $data = PengajuanPemutihan::where('caseid', $caseid)->first(); + if($data==null){ + return redirect()->route('layanan-pemutihan.index')->with('error','Gagal Memproses, Data tidak ditemukan'); + } + $data->status_operator = 0; + $data->save(); + return redirect()->route('layanan-pemutihan.index')->with('success','Data Berhasil Disimpan, status akan diupdate menjadi selesai'); } } diff --git a/resources/views/layanan-pemutihan/index.blade.php b/resources/views/layanan-pemutihan/index.blade.php index a35982c..6466e24 100644 --- a/resources/views/layanan-pemutihan/index.blade.php +++ b/resources/views/layanan-pemutihan/index.blade.php @@ -85,10 +85,39 @@
@csrf Details - @if($datas->status_operator == null) | @endif + @if($datas->status_operator == null) | | Tolak@endif
+ +
@@ -167,7 +196,7 @@
- + @endforeach @@ -211,6 +240,7 @@ $(function () { $("#example1").DataTable({ "responsive": true, "lengthChange": false, "autoWidth": false, + "order": [[6, 'desc']], "buttons": [{ // New button configuration text: 'Tambah Data', // Replace with your desired button text diff --git a/resources/views/monitoring/pemutihan.blade.php b/resources/views/monitoring/pemutihan.blade.php index 5876b75..f593c62 100644 --- a/resources/views/monitoring/pemutihan.blade.php +++ b/resources/views/monitoring/pemutihan.blade.php @@ -111,7 +111,7 @@ $("#example1").DataTable({ "pageLength": 50, "responsive": true, "lengthChange": false, "autoWidth": false, - order: [[5, 'desc']], + "order": [[5, 'desc']], "buttons": ["csv", "excel", "pdf", "print", "colvis"] }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');