update pemutihan
All checks were successful
Run Action to Production / run pull to sync on target message (push) Has been skipped

This commit is contained in:
fikyb 2024-07-08 20:26:55 +07:00
parent 694b20bb12
commit a5a3c504b1
3 changed files with 50 additions and 8 deletions

View File

@ -19,7 +19,8 @@ public function index(){
'pengajuan_pemutihans.*', 'pengajuan_pemutihans.*',
'users.nama_gelar as dosen_pengampu', '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]); 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; $data_pemutihan['keterangan'] = $request->keterangan;
$bukti_pemutihan = $request->file('bukti_pemutihan'); $bukti_pemutihan = $request->file('bukti_pemutihan');
$bukti_pemutihan_name = 'P_'.str_replace(' ', '_',$bukti_pemutihan->getClientOriginalName()); $bukti_pemutihan_name = $caseid.'_'.str_replace(' ', '_',$bukti_pemutihan->getClientOriginalName());
$path = $request->tanggal_kelas.'/'.$request->tanggal_kelas.'/'.$bukti_pemutihan_name; $path = 'pemutihan/'.$bukti_pemutihan_name;
//jika berhasil save file dan save data mhs maka pengajuan akan diisi //jika berhasil save file dan save data mhs maka pengajuan akan diisi
if(Storage::disk('public')->put($path, file_get_contents($bukti_pemutihan))){ if(Storage::disk('public')->put($path, file_get_contents($bukti_pemutihan))){
$data_pemutihan['bukti_izin_dosen'] = $bukti_pemutihan_name; $data_pemutihan['bukti_izin_dosen'] = $bukti_pemutihan_name;
@ -119,6 +121,16 @@ public function selesai($caseid, Request $request){
$data->status_operator = Carbon::now(); $data->status_operator = Carbon::now();
$data->save(); $data->save();
return redirect()->route('layanan-pemutihan.index')->with('success','Data Berhasil Disimpan, status akan diupdate menjadi selesai'); return redirect()->route('layanan-pemutihan.index')->with('success','Data Berhasil Disimpan, status akan diupdate menjadi selesai');
}
function tolak($caseid, Request $request){
dd($request->all()); 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');
} }
} }

View File

@ -85,10 +85,39 @@
<td class="text-center"> <td class="text-center">
<form action="{{ route('layanan-pemutihan.selesai',['caseid'=>$datas->caseid]) }}" method="post">@csrf <form action="{{ route('layanan-pemutihan.selesai',['caseid'=>$datas->caseid]) }}" method="post">@csrf
<a class="btn btn-primary" data-toggle="modal" data-target="#MD{{ $datas->id }}">Details</a> <a class="btn btn-primary" data-toggle="modal" data-target="#MD{{ $datas->id }}">Details</a>
@if($datas->status_operator == null) | <button type="submit" id="selesai" class="btn btn-success">Selesai</button>@endif @if($datas->status_operator == null) | <button type="submit" id="selesai" class="btn btn-success">Selesai</button> | <a class="btn btn-danger" data-toggle="modal" data-target="#Delete{{ $datas->id }}">Tolak</a>@endif
</form> </form>
</td> </td>
</tr> </tr>
<!-- /.modal-Delete -->
<div class="modal fade" id="Delete{{$datas->id}}">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Apa Anda Yakin Menolak Pengajuan Pemutihan <b>{{ $datas->caseid }}</b> ?</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="alert alert-info alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h5><i class="icon fas fa-info"></i> Perhatian!</h5>
<span >Alasan yang Dimasukkan Disini, Akan dikirimkan melalui Email Kepada Mahasiswa Terkait.</span>
</div>
<form action="{{ route('layanan-pemutihan.tolak') }}" method="post">
<input type="hidden" name="id" value="{{$datas->id}}">
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" data-dismiss="modal">Batal</button>
<button type="submit" class="btn btn-danger">Kirim</button>
</form>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- Modal Detail dan Terima --> <!-- Modal Detail dan Terima -->
<div class="modal fade" id="MD{{$datas->id}}"> <div class="modal fade" id="MD{{$datas->id}}">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
@ -114,8 +143,8 @@
<input type="text" class="form-control form-control-border" readonly value="{{ $datas->mata_kuliah }}"> <input type="text" class="form-control form-control-border" readonly value="{{ $datas->mata_kuliah }}">
<label for="tanggal_kelas">Tanggal Kelas:</label> <label for="tanggal_kelas">Tanggal Kelas:</label>
<input type="text" class="form-control form-control-border" readonly value="{{ $datas->tanggal_kelas }}"> <input type="text" class="form-control form-control-border" readonly value="{{ $datas->tanggal_kelas }}">
<label for="bukti_izin_dosen">Bukti Izin Dosen:</label> <label for="bukti_izin_dosen">Bukti Izin Dosen:</label><br/>
<input type="text" class="form-control form-control-border" readonly value="{{ $datas->bukti_izin_dosen }}"> <a href="{{asset('storage')}}/pemutihan/{{ $datas->bukti_izin_dosen }}" target="_blank" class="btn btn-success">Klik Disini</a>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -167,7 +196,7 @@
</div> </div>
<!-- /.modal-dialog --> <!-- /.modal-dialog -->
</div> </div>
@endforeach @endforeach
</tbody> </tbody>
<tfoot> <tfoot>
@ -211,6 +240,7 @@
$(function () { $(function () {
$("#example1").DataTable({ $("#example1").DataTable({
"responsive": true, "lengthChange": false, "autoWidth": false, "responsive": true, "lengthChange": false, "autoWidth": false,
"order": [[6, 'desc']],
"buttons": [{ "buttons": [{
// New button configuration // New button configuration
text: 'Tambah Data', // Replace with your desired button text text: 'Tambah Data', // Replace with your desired button text

View File

@ -111,7 +111,7 @@
$("#example1").DataTable({ $("#example1").DataTable({
"pageLength": 50, "pageLength": 50,
"responsive": true, "lengthChange": false, "autoWidth": false, "responsive": true, "lengthChange": false, "autoWidth": false,
order: [[5, 'desc']], "order": [[5, 'desc']],
"buttons": ["csv", "excel", "pdf", "print", "colvis"] "buttons": ["csv", "excel", "pdf", "print", "colvis"]
}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)'); }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');