Commit 2238c7a4 by Farendi Giotivano R.P

Merge branch 'master' of http://git.unesa.ac.id/farendi/simpkm

parents 6177b7d8 8bab8222
......@@ -13,6 +13,7 @@ use App\Models\Jenis;
use GuzzleHttp\Client;
use App\Models\Periode;
use App\Models\Proposal;
use App\Models\Reviewer;
use Illuminate\Http\Request;
use App\Models\DaftarProposal;
......@@ -172,6 +173,25 @@ class DaftarProposalController extends Controller
</select>
</td>';
$jenis = Jenis::where("status_hapus", '0')
->get();
$opt = '';
foreach ($jenis as $key => $value) {
$selected = "";
if($value->jenis_id == $jenis_id)
$selected = 'selected';
$opt .= '<option value="'.Crypt::encrypt($proposal_id.'###'.$value->jenis_id).'" '.$selected.'>'.$value->nama.'</option>';
}
$pil_jenis_pkm = '<td class="table-action">
<select class="form-control select2 jenis">
'.$opt.'
</select>
</td>';
if($status_final == '1')
{
$aksi = '<span class="badge bg-success">Lolos</span>';
......@@ -191,7 +211,7 @@ class DaftarProposalController extends Controller
$data_arr[] = array(
"proposal_id" => $proposal_id,
"kode" => $kode,
"jenis_pkm" => $jenis_pkm,
"jenis_pkm" => $pil_jenis_pkm,
"judul" => $judul,
"dospem" => $dospem,
"reviewer_1" => $pilihan_1,
......@@ -540,6 +560,39 @@ class DaftarProposalController extends Controller
}
}
public function change_jenis(Request $request)
{
try {
$isi = Crypt::decrypt($request->input('data'));
$arrData = explode('###', $isi);
$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.";
}
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)
{
ini_set('max_execution_time', 0);
......
......@@ -231,6 +231,46 @@
});
});
$('#example tbody').on('change', '.jenis', function () {
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({
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)
{
if(reqStatus == '1')
......
......@@ -173,6 +173,7 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
// SELEKSI INTERNAL
Route::resource('seleksi_internal_reviewer', ReviewerController::class);
Route::resource('seleksi-internal-proposal', DaftarProposalController::class);
Route::post('seleksi-internal-proposal-jenis', [DaftarProposalController::class, 'change_jenis'])->name('seleksi-internal-proposal-jenis');
Route::get('/seleksi-internal-reviewer-approval/{id}/{status}', [DaftarProposalController::class, 'approval'])->name('seleksi-internal.approval');
Route::get('getDaftarProposal', [DaftarProposalController::class, 'getData'])->name('getDaftarProposal');
Route::get('cetak-daftar-proposal', [DaftarProposalController::class, 'cetak_daftar_proposal'])->name('cetak-daftar-proposal');
......
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