Commit 8bab8222 by Novan Bagus Setiawan

kasih alert waktu ubah jenis

parent 3a97d299
......@@ -562,13 +562,35 @@ class DaftarProposalController extends Controller
public function change_jenis(Request $request)
{
$isi = Crypt::decrypt($request->input('data'));
$arrData = explode('###', $isi);
try {
$isi = Crypt::decrypt($request->input('data'));
$arrData = explode('###', $isi);
$reqProposalId = $arrData[0]?:'';
$reqJenisId = $arrData[1]?:'';
$reqProposalId = $arrData[0]?:'';
$reqJenisId = $arrData[1]?:'';
$delete = Proposal::where('proposal_id', $reqProposalId)->update(['jenis_id'=>$reqJenisId]);
if ($delete) {
$status = 'success';
$message = "Berhasil ubah Jenis PKM.";
}
else{
$status = 'error';
$message = "Data gagal diproses.";
}
$delete = Proposal::where('proposal_id', $reqProposalId)->update(['jenis_id'=>$reqJenisId]);
return response()->json([
'status' => $status,
'message' => $message,
]);
} catch (\Exception $id) {
return response()->json([
'status' => 'error',
'message' => "Data gagal diproses.",
]);
}
}
public function cetak_daftar_proposal(Request $request)
......
......@@ -233,21 +233,42 @@
$('#example tbody').on('change', '.jenis', function () {
var isi = this.value;
$.ajax({
url:'{{url("/operator/seleksi-internal-proposal-jenis")}}',
type:'POST',
data:{
"_token": "{{ csrf_token() }}",
"data": isi,
},
dataType: "JSON",
})
.done(function(response){
swal.fire('sukses', 'Jenis PKM Berhasil diubah', 'success').then(function(){
// oTable.ajax.reload();
// location.reload();
});
})
Swal.fire({
title: "Apakah Anda Yakin?",
text: "Anda akan meruhan jenis PKM ini?!",
icon: "warning",
showCancelButton: !0,
confirmButtonText: "Ya, Ubah Jenis",
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/seleksi-internal-proposal-jenis")}}',
type:'POST',
data:{
"_token": "{{ csrf_token() }}",
"data": isi,
},
dataType: "JSON",
})
.done(function(response){
swal.fire('Updated!', response.message, response.status);
})
.fail(function(){
swal.fire('Oops...', 'Something went wrong with ajax !', 'error');
});
}
else
{
swal.fire('Batal!', 'Data batal diproses.', 'error');
}
})
});
function confirmFinal(reqId, reqStatus)
......
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