Commit 8bab8222 by Novan Bagus Setiawan

kasih alert waktu ubah jenis

parent 3a97d299
...@@ -562,6 +562,7 @@ class DaftarProposalController extends Controller ...@@ -562,6 +562,7 @@ class DaftarProposalController extends Controller
public function change_jenis(Request $request) public function change_jenis(Request $request)
{ {
try {
$isi = Crypt::decrypt($request->input('data')); $isi = Crypt::decrypt($request->input('data'));
$arrData = explode('###', $isi); $arrData = explode('###', $isi);
...@@ -569,6 +570,27 @@ class DaftarProposalController extends Controller ...@@ -569,6 +570,27 @@ class DaftarProposalController extends Controller
$reqJenisId = $arrData[1]?:''; $reqJenisId = $arrData[1]?:'';
$delete = Proposal::where('proposal_id', $reqProposalId)->update(['jenis_id'=>$reqJenisId]); $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.";
}
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) public function cetak_daftar_proposal(Request $request)
......
...@@ -233,6 +233,20 @@ ...@@ -233,6 +233,20 @@
$('#example tbody').on('change', '.jenis', function () { $('#example tbody').on('change', '.jenis', function () {
var isi = this.value; var isi = this.value;
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({ $.ajax({
url:'{{url("/operator/seleksi-internal-proposal-jenis")}}', url:'{{url("/operator/seleksi-internal-proposal-jenis")}}',
type:'POST', type:'POST',
...@@ -243,10 +257,17 @@ ...@@ -243,10 +257,17 @@
dataType: "JSON", dataType: "JSON",
}) })
.done(function(response){ .done(function(response){
swal.fire('sukses', 'Jenis PKM Berhasil diubah', 'success').then(function(){ swal.fire('Updated!', response.message, response.status);
// oTable.ajax.reload(); })
// location.reload(); .fail(function(){
swal.fire('Oops...', 'Something went wrong with ajax !', 'error');
}); });
}
else
{
swal.fire('Batal!', 'Data batal diproses.', 'error');
}
}) })
}); });
......
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