fix pengajuan aduan

This commit is contained in:
efbe 2024-12-11 12:04:13 +07:00
parent 2b3c4490ca
commit f06edb4036
3 changed files with 32 additions and 6 deletions

View File

@ -71,8 +71,35 @@ public function selesai(Request $request){
return redirect()->route('layanan-aduan.tambah')->with('error','Gagal Menyelesaikan Laporan aduan, silahkan coba klik selesaikan kembali');
}
public function tolak(Request $request){
dd($request->all());
public function destroy(Request $request){
$id = $request->id;
//cari data dan kirim notif sebelum dihapus
$data = PengajuanAduan::where('id',$id)
->first();
// $data_job = [
// 'jenis' => 'penolakan',
// 'judul_seminar_proposal' => $data->judul_seminar_proposal,
// 'nama_mahasiswa' => $data->nama,
// 'nim_mahasiswa' => $data->nim,
// 'email' => $data->email,
// 'created_at' => $data->created_at,
// 'alasan' => $request->alasan,
// ];
$path = 'aduan/'.$data->bukti_laporan;
//hapus file yang diupload mahasiswa
if(Storage::disk('public')->exists($path)){
//hapus data pengajuan mahasiswa
Storage::disk('public')->delete($path);
}
$dataDelete = PengajuanAduan::findOrFail($id);
//kirim notifikasi jika data berhasil dihapus
if($dataDelete->delete()){
// dispatch(new layananPengajuanDpuDpaJob($data_job));
return redirect()->route('layanan-aduan.index')->with('success','Permintaan Sudah Diproses, Email akan segera dikirim ke penerima');
}
return redirect()->route('layanan-aduan.index')->with('error','Gagal Hapus Data, coba cek data yang akan dihapus lalu coba lagi!');
}
}
}

View File

@ -105,7 +105,7 @@
</li>
@endhasanyrole
@hasanyrole('Super Administrator|Operator Umum Perlengkapan')
<li class="nav-header text-bold mt-2">LAYANAN UMUM / Perlengkapan</li>
<li class="nav-item">
<a href="{{ route('layanan-aduan.index') }}" class="nav-link {{ Request::is('admin/layanan-aduan') ? 'active' : '' }}">
@ -115,7 +115,6 @@
</p>
</a>
</li>
@endhasanyrole
<li class="nav-header text-bold mt-2">ADMINISTRASI</li>
<li class="nav-item">
<a href="{{ route('users.index') }}" class="nav-link {{ Request::is('admin/users') ? 'active' : '' }}">

View File

@ -79,7 +79,7 @@
Route::POST('/layanan-wisuda/resend/', [LayananPengajuanWisudaController::class, 'resendsubmit'])->name('layanan-wisuda.resendsubmit');
//layanan Aduan
Route::get('/layanan-aduan', [LayananPengajuanAduanController::class, 'index'])->name('layanan-aduan.index');
Route::POST('/layanan-aduan/tolak', [LayananPengajuanAduanController::class, 'tolak'])->name('layanan-aduan.tolak');
Route::DELETE('/layanan-aduan/tolak', [LayananPengajuanAduanController::class, 'destroy'])->name('layanan-aduan.destroy');
Route::POST('/layanan-aduan', [LayananPengajuanAduanController::class, 'selesai'])->name('layanan-aduan.selesai');