Commit 06316eef by Novan Bagus Setiawan

tambahan kelompok untuk setujui, tolak dan rollback

parent 0526ed82
......@@ -65,7 +65,7 @@ class KelompokController extends Controller
}
$totalRecords = Kelompok::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
$statement = " AND B.STATUS_KETUA = '1' AND (UPPER(NAMA_DOSEN) LIKE '%".$searchValue."%' OR (UPPER(NAMA) LIKE '%".$searchValue."%')) ";
$statement = " AND B.STATUS_KETUA = '1' AND (UPPER(NAMA_DOSEN) LIKE '%".$searchValue."%' OR (UPPER(NAMA) LIKE '%".$searchValue."%') OR (UPPER(NIM) LIKE '%".$searchValue."%')) ";
$totalRecordswithFilter = Kelompok::select('count(1) as allcount')
->join('kelompok_detil as b', 'kelompok.kelompok_id', '=', 'b.kelompok_id')
......@@ -95,11 +95,22 @@ class KelompokController extends Controller
$status = $record->status;
if($status == '1')
{
$keterangan = '<span class="badge bg-success">Disetujui</span>';
$aksi = '';
}
elseif($status == '2')
{
$keterangan = '<span class="badge bg-danger">Ditolak</span>';
$aksi = '<a class="btn btn-warning btn-sm waves-effect waves-light aksi" role="button" data-ket="Kelompok yang di dibatalkan status tolak akan menunggu di verifikasi kembali oleh dosen pembimbing." data-id="'.Crypt::encrypt($kelompok_id.'#0').'"><i class="fas fa-undo"></i></a>';
}
else
{
$keterangan = '<span class="badge bg-warning">Menunngu Persetujuan</span>';
$aksi = '<a class="btn btn-success btn-sm waves-effect waves-light aksi" role="button" data-ket="Kelompok yang di setujui akan di teruskan untuk upload proposal" data-id="'.Crypt::encrypt($kelompok_id.'#1').'"><i class="fas fa-check"></i></a> <a class="btn btn-danger btn-sm waves-effect waves-light aksi" role="button" data-ket="Kelompok yang tidak di setujui tidak bisa untuk upload proposal" data-id="'.Crypt::encrypt($kelompok_id.'#2').'"><i class="fas fa-times"></i></a>';
}
$aksi .= ' <a class="btn btn-primary btn-sm waves-effect waves-light viewdetails" role="button" data-id="'.Crypt::encrypt($kelompok_id).'"><i class="fas fa-eye"></i></a>';
$data_arr[] = array(
"kelompok_id" => $kelompok_id,
......@@ -109,7 +120,7 @@ class KelompokController extends Controller
"nama_dosen" => $nama_dosen,
"nidn_dosen" => $nidn_dosen,
"keterangan" => $keterangan,
"aksi" => '<a class="btn btn-primary btn-sm waves-effect waves-light viewdetails" role="button" data-id="'.Crypt::encrypt($kelompok_id).'"><i class="fas fa-eye"></i></a>'
"aksi" => $aksi
);
}
......@@ -180,4 +191,23 @@ class KelompokController extends Controller
{
}
public function prosesKelompok(Request $request)
{
$kel = $request->except('_token');
$arrKel = explode('#', decrypt($kel['kelompokId']));
$reqKelompokId = $arrKel['0'];
$reqStatus = $arrKel['1'];
$kelompok = Kelompok::query()->find($reqKelompokId);
$kelompok->status = $reqStatus;
$kelompok->save();
return response()->json([
'status' => 'success',
'message' => 'Data Berhasil diubah.',
]);
}
}
......@@ -156,9 +156,6 @@
$('#reqStatus, #reqTahun').change(function(){
oTable.draw();
});
});
$(document).ready(function(){
$('#example').on('click','.viewdetails',function(){
var kelId = $(this).attr('data-id');
......@@ -185,6 +182,51 @@
}
});
$('#example').on('click','.aksi',function(){
var kelId = $(this).attr('data-id');
var ket = $(this).attr('data-ket');
if(kelId != null || kelId != ''){
Swal.fire({
title: "Apakah Anda Yakin?",
text: ket,
icon: "warning",
showCancelButton: !0,
confirmButtonText: "Ya!",
cancelButtonText: "Tidak, Kembali!",
confirmButtonClass: "btn btn-success mt-2",
cancelButtonClass: "btn btn-danger ms-2 mt-2",
buttonsStyling: !1,
allowOutsideClick: !1,
showLoaderOnConfirm: true
}).then((result) => {
if (result.value){
$.ajax({
url:'{{url("/operator/proses-kelompok")}}',
type:'POST',
data:{
"_token": "{{ csrf_token() }}",
"kelompokId": kelId
},
dataType: "JSON",
})
.done(function(response){
swal.fire(response.status, response.message, response.status).then(function(){
oTable.ajax.reload();
});
})
.fail(function(){
swal.fire('Oops...', 'Something went wrong with ajax !', 'error');
});
}
else
{
swal.fire('Batal!', 'Data batal diproses.', 'error');
}
})
}
});
});
</script>
@endsection
......@@ -150,6 +150,7 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
Route::resource('kelompok', KelompokController::class);
Route::get('getKelompok', [KelompokController::class, 'getData'])->name('getKelompok');
Route::get('getDetilKelompok', [KelompokController::class, 'getDetil'])->name('getDetilKelompok');
Route::post('proses-kelompok', [KelompokController::class, 'prosesKelompok'])->name('proses-kelompok');
Route::resource('proposal', ProposalController::class);
Route::get('getProposal', [ProposalController::class, 'getData'])->name('getProposal');
......
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