revisi penilaian, input dana admin, show pendanaan seleksi internal

parent 448c7cd9
......@@ -29,6 +29,7 @@ use App\Exports\DaftarProposalMonevExport;
use App\Exports\DaftarProposalBelmawaExport;
use App\Models\JenisMonev;
use App\Models\MonevInternal;
use Exception;
use Illuminate\Support\Facades\Log;
class DaftarProposalController extends Controller
......@@ -92,6 +93,7 @@ class DaftarProposalController extends Controller
// }
$daftarProposalQry = DaftarProposal::query()
->with(['reviewerProposal1', 'reviewerProposal2'])
->select(DB::raw('*, ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_1) nilai_1, ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_2) nilai_2, round((ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_1) + ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_2 )) / 2, 2) as rata'))
->when($tahun != "0", function($query) use ($tahun){
return $query->where('periode', $tahun);
......@@ -171,6 +173,8 @@ class DaftarProposalController extends Controller
$lolos = "confirmFinal('".Crypt::encrypt($proposal_id)."', '1')";
$tidak_lolos = "confirmFinal('".Crypt::encrypt($proposal_id)."', '2')";
$batalkanNilai1 =
$disable_1 = $disable_2 = '';
if($nilai_1 > '0' || $status_administrasi_1 == '2')
......@@ -183,16 +187,61 @@ class DaftarProposalController extends Controller
$disable_2 = "disabled='true'";
}
$revisi1 = '';
if($record->reviewerProposal1) {
if($record->reviewerProposal1->revisi_nilai != 1) {
$revisi1 = '
<br>
<button class="btn btn-warning btn-sm" onclick="revisi(\''.encrypt($record->reviewerProposal1->reviewer_proposal_id).'\')">Revisi</button>
';
}
else{
$revisi1 = '
<br>
on review
';
}
}
$pilihan_1 = '<td class="table-action">
<select class="form-control select2 reviewer" data-urut="1" '.$disable_1.'>
'.$opt1.'
</select>
<br>
<br>
<p>
Nilai: '.$nilai_1.'
</p>
'.$revisi1.'
</td>';
$revisi1 = '';
$revisi2 = '';
if($record->reviewerProposal2){
if($record->reviewerProposal2->revisi_nilai != 1) {
$revisi2 = '
<br>
<button class="btn btn-warning btn-sm" onclick="revisi(\''.encrypt($record->reviewerProposal2->reviewer_proposal_id).'\')">Revisi</button>
';
}
else{
$revisi2 = '
<br>
on review
';
}
}
$pilihan_2 = '<td class="table-action">
<select class="form-control select2 reviewer" data-urut="2" '.$disable_2.'>
'.$opt2.'
</select>
<br>
<br>
<p>
Nilai: '.$nilai_2.'
</p>
'.$revisi2.'
</td>';
$jenis = Jenis::where("status_hapus", '0')
......@@ -230,6 +279,15 @@ class DaftarProposalController extends Controller
</td>';
}
$pendanaan = '
<td>
Usulan Dana: '.$record->usulan_dana.'
<br>
<br>
Diberikan: '.$record->pendanaan.'
</td>
';
$data_arr[] = array(
"proposal_id" => $proposal_id,
"kode" => $kode,
......@@ -238,8 +296,7 @@ class DaftarProposalController extends Controller
"dospem" => $dospem,
"reviewer_1" => $pilihan_1,
"reviewer_2" => $pilihan_2,
"nilai_1" => $nilai_1,
"nilai_2" => $nilai_2,
"pendanaan" => $pendanaan,
"rata" => $rata,
"aksi" => $aksi
);
......@@ -256,6 +313,29 @@ class DaftarProposalController extends Controller
exit;
}
public function bukaPenilaian(Request $request)
{
try{
$id = decrypt($request->id);
$reviewerProposal = ReviewerProposal::query()->find($id);
$reviewerProposal->revisi_nilai = 1;
$reviewerProposal->save();
return response([
'message' => 'success',
'status' => 200
], 200);
}
catch(Exception $ex){
dd($ex);
return response([
'message' => 'error',
'status' => 500
], 500);
}
}
public function index_belmawa()
{
$periode = Periode::query()->get();
......@@ -515,10 +595,29 @@ class DaftarProposalController extends Controller
}
public function approval($id, $status)
public function approval(Request $request)
{
try {
$delete = ReviewerProposal::where('proposal_id', Crypt::decrypt($id))->update(['status_final'=>$status]);
$id = $request->id;
$status = $request->status;
// if($request->status == 1){
// $count = ReviewerProposal::where('proposal_id', Crypt::decrypt($id))->where('status_administrasi', 1)->count();;
// if($count < 2){
// return response()->json([
// 'status' => 'error',
// 'message' => "Terdapat reviewer yang belum memberikan penilaian.",
// ]);
// }
// }
$delete = ReviewerProposal::where('proposal_id', Crypt::decrypt($id))
->update([
'status_final'=>$status
]);
if ($delete) {
if($status == '1')
......@@ -526,6 +625,10 @@ class DaftarProposalController extends Controller
$status = 'success';
$message = "Proposal Seleksi Internal Lolos.";
$proposal = Proposal::query()->find(Crypt::decrypt($id))->update([
'pendanaan' => $request->dana
]);
$this->createMonevInternal(Crypt::decrypt($id));
}
elseif($status == '2')
......@@ -544,7 +647,8 @@ class DaftarProposalController extends Controller
'message' => $message,
]);
} catch (\Exception $id) {
} catch (\Exception $ex) {
Log::error($ex);
return response()->json([
'status' => 'error',
'message' => "Data gagal diproses.",
......@@ -558,7 +662,7 @@ class DaftarProposalController extends Controller
$count = $reviewerProposal->where('status_administrasi', 1)->count();
$monevInternal = MonevInternal::query()->where('proposal_id', $proposalId)->get();
if($count == 2){
// if($count == 2){
for ($i = 3; $i < 5; $i++) {
$jenis = JenisMonev::query()->where('urut', $i)->first();
$monevInternal->where('jenis_monev_id', $jenis->jenis_monev_id);
......@@ -573,7 +677,7 @@ class DaftarProposalController extends Controller
}
}
}
// }
}
public function approval_belmawa($id, $status)
......
......@@ -103,6 +103,7 @@ class DaftarSeleksiController extends Controller
// $totalRecordswithFilter = DaftarProposal::select('count(1) as allcount')->whereRaw($statementGlobal.$statement)->count();
$totalRecordswithFilter = collect(DB::select("select 1 as allcount from vw_daftar_proposal('".$statementGlobal.$statement."', '".$noidentitas."') "))->count();
// echo "select 1 as allcount from vw_daftar_proposal('".$statementGlobal.$statement."', '".$noidentitas."')"; exit;
// Fetch records
// $records = DaftarProposal::orderBy($columnName,$columnSortOrder)
......@@ -115,6 +116,9 @@ class DaftarSeleksiController extends Controller
->skip($start)
->take($rowperpage);
$reviewer = Reviewer::query()->where('id_sdm', $noidentitas)->first();
$reviewerProposal = ReviewerProposal::query()->whereIn('proposal_id', $records->pluck('proposal_id'))->where('reviewer_id', $reviewer->reviewer_id)->get()->keyBy('proposal_id');
$data_arr = array();
$hitung = 1;
foreach($records as $record){
......@@ -167,6 +171,10 @@ class DaftarSeleksiController extends Controller
$aksi = '<h4>'.$nilai_1.'</h4>';
elseif($urut == '2')
$aksi = '<h4>'.$nilai_2.'</h5>';
if($reviewerProposal[$proposal_id]->revisi_nilai == 1){
$aksi .= '<a href="'.$nilai.'" class="btn btn-icon-sm btn-warning btn-sm">Beri nilai<i class="fas fa-arrow-alt-circle-right"></i></a>';
}
}
else
{
......@@ -212,6 +220,7 @@ class DaftarSeleksiController extends Controller
{
$id = $request->input('reviewer_proposal_id');
$data['komentar'] = $request->input('komentar');
$data['revisi_nilai'] = 0;
$reviewer_proposal = ReviewerProposal::findOrFail($id);
$reviewer_proposal->update($data);
......
......@@ -2,6 +2,8 @@
namespace App\Http\Middleware;
use App\Models\Reviewer;
use App\Models\ReviewerProposal;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
......@@ -26,6 +28,19 @@ class NilaiSeleksiInternal
$status_nilai = DB::select("select ambil_data_reviewer_proposal('".$noidentitas."', '".$proposal_id."', '2')")[0]->ambil_data_reviewer_proposal;
$status_administrasi = DB::select("select ambil_data_reviewer_proposal('".$noidentitas."', '".$proposal_id."', '3')")[0]->ambil_data_reviewer_proposal;
$reviewerProposal = ReviewerProposal::query()
->where('proposal_id', $proposal_id)
->whereHas('reviewer', function($query) use ($noidentitas){
return $query->wherehas('biodata', function($query) use ($noidentitas){
return $query->where('noidentitas', $noidentitas);
});
})
->first();
if($reviewerProposal->revisi_nilai == 1){
return $next($request);
}
if($status_administrasi != 0)
{
if($status_nilai != 1)
......
......@@ -24,4 +24,14 @@ class DaftarProposal extends Model
{
return $this->hasMany(ProposalUrl::class, 'proposal_id', 'proposal_id');
}
public function reviewerProposal1()
{
return $this->belongsTo(ReviewerProposal::class, 'reviewer_proposal_id_1', 'reviewer_proposal_id');
}
public function reviewerProposal2()
{
return $this->belongsTo(ReviewerProposal::class, 'reviewer_proposal_id_2', 'reviewer_proposal_id');
}
}
......@@ -45,7 +45,7 @@ class Proposal extends Model
'laporan_akhir_file',
'laporan_akhir_date',
'laporan_akhir_approval',
'pendanaan'
];
public function rKelompok()
......
......@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\Auth\Biodata;
use Illuminate\Database\Eloquent\Model;
class Reviewer extends Model
......@@ -13,4 +14,9 @@ class Reviewer extends Model
protected $fillable = [
'reviewer_id', 'periode_id', 'jenis_monev_id', 'id_sdm', 'nama', 'nidn', 'fakultas', 'prodi', 'status_hapus', 'created_user', 'updated_user'
];
public function biodata()
{
return $this->belongsTo(Biodata::class, 'id_sdm', 'noidentitas');
}
}
......@@ -12,11 +12,16 @@ class ReviewerProposal extends Model
protected $keyType = 'string';
protected $fillable = [
'reviewer_proposal_id', 'proposal_id', 'reviewer_id', 'status_administrasi', 'komentar', 'urut', 'created_user', 'updated_user'
'reviewer_proposal_id', 'proposal_id', 'reviewer_id', 'status_administrasi', 'komentar', 'urut', 'created_user', 'updated_user', 'revisi_nilai'
];
public function rReviewerProposalDetil()
{
return $this->hasMany(\App\Models\ReviewerProposalDetil::class, 'reviewer_proposal_id', 'reviewer_proposal_id');
}
public function reviewer()
{
return $this->belongsTo(Reviewer::class, 'reviewer_id', 'reviewer_id');
}
}
......@@ -82,20 +82,16 @@
<table id="example" class="table table-bordered dt-responsive wrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
<thead>
<tr>
<th rowspan="2">id</th>
<th rowspan="2" width='5%'>Kode Kelompok</th>
<th rowspan="2" width='15%'>Jenis PMW</th>
<th rowspan="2" width='20%'>Judul Proposal</th>
<th rowspan="2" width='10%'>Dosen Pembimbing</th>
<th rowspan="2" width='15%'>Reviewer 1</th>
<th rowspan="2" width='15%'>Reviewer 2</th>
<th colspan="2" width='5%' style="text-align: center">Nilai</th>
<th rowspan="2" width='5%'>Nilai Akhir</th>
<th rowspan="2" width='10%'>Aksi</th>
</tr>
<tr>
<th>Reviewer 1</th>
<th>Reviewer 2</th>
<th id</th>
<th width='5%'>Kode Kelompok</th>
<th width='15%'>Jenis PMW</th>
<th width='20%'>Judul Proposal</th>
<th width='10%'>Dosen Pembimbing</th>
<th width='15%'>Reviewer 1</th>
<th width='15%'>Reviewer 2</th>
<th width='5%' >Pendanaan</th>
<th width='5%'>Nilai Akhir</th>
<th width='10%'>Aksi</th>
</tr>
</thead>
<tbody>
......@@ -115,10 +111,10 @@
placeholder: "Semua",
allowClear: true
});
var oTable;
$(document).ready(function(){
// DataTable
var oTable = $('#example').DataTable({
oTable = $('#example').DataTable({
processing: true,
serverSide: true,
ajax: {
......@@ -138,8 +134,7 @@
{ data: 'dospem' },
{ data: 'reviewer_1' },
{ data: 'reviewer_2' },
{ data: 'nilai_1' },
{ data: 'nilai_2' },
{ data: 'pendanaan' },
{ data: 'rata' },
{ data: 'aksi' },
],
......@@ -277,13 +272,28 @@
{
var kata = "Lolos seleksi!";
var desc = "meloloskan";
var dataModal = {
title: "Apakah Anda Yakin?",
text: "Anda akan "+desc+" data ini!. Berikan nominal dana yang disetujui",
input: 'text',
icon: "warning",
showCancelButton: !0,
confirmButtonText: "Ya, "+ kata,
cancelButtonText: "Tidak, Kembali!",
confirmButtonClass: "btn btn-success mt-2",
cancelButtonClass: "btn btn-danger ms-2 mt-2",
buttonsStyling: !1,
allowOutsideClick: !1,
showLoaderOnConfirm: true
};
}
else
{
var kata = "Tidak Lolos seleksi!";
var desc = "tidak meloloskan";
}
Swal.fire({
var dataModal = {
title: "Apakah Anda Yakin?",
text: "Anda akan "+desc+" data ini!",
icon: "warning",
......@@ -295,19 +305,70 @@
buttonsStyling: !1,
allowOutsideClick: !1,
showLoaderOnConfirm: true
};
var dataAjax = {"_token": "{{ csrf_token() }}", id:reqId, status: reqStatus, dana: 0};
}
Swal.fire(dataModal).then((result) => {
if (result.value){
let dana = 0;
if(reqStatus == '1'){
dana = result.value;
}
console.log(result.value);
$.ajax({
url:"{{ route('operator.seleksi-internal.approval') }}",
type:'POST',
data:{"_token": "{{ csrf_token() }}", id:reqId, status: reqStatus, dana:dana},
dataType: "JSON",
})
.done(function(response){
swal.fire('Updated!', response.message, response.status).then(function(){
oTable.draw();
});
})
.fail(function(){
swal.fire('Oops...', 'Something went wrong with ajax !', 'error');
});
}
else
{
swal.fire('Batal!', 'Data batal diproses.', 'error');
}
})
}
function revisi(id)
{
Swal.fire({
title: "Apakah Anda Yakin?",
text: "Anda akan membuka penilaian pada reviewer ini!",
icon: "warning",
showCancelButton: !0,
confirmButtonText: "Ya",
cancelButtonText: "Tidak",
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-reviewer-approval/")}}/' +reqId+'/'+reqStatus,
type:'GET',
url:"{{ route('operator.seleksi-internal.buka-penilaian') }}",
type:'POST',
data:{
"_token": "{{ csrf_token() }}",
"_token": "{{ csrf_token() }}", id:id,
},
dataType: "JSON",
})
.done(function(response){
swal.fire('Updated!', response.message, response.status).then(function(){
location.reload();
oTable.draw();
});
})
.fail(function(){
......
......@@ -35,6 +35,7 @@ use App\Http\Controllers\Mahasiswa\BiodataController as BiodataMahasiswa;
use App\Http\Controllers\Mahasiswa\SeleksiController as SeleksiMahasiswa;
use App\Http\Controllers\Mahasiswa\KelompokController as MahasiswaKelompok;
use App\Http\Controllers\Mahasiswa\ProposalController as MahasiswaProposal;
use App\Models\DaftarProposal;
/*
|--------------------------------------------------------------------------
......@@ -176,10 +177,11 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
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::post('seleksi-internal-reviewer-approval', [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');
Route::get('cetak-daftar-proposal-new', [DaftarProposalController::class, 'cetak_daftar_proposal_new'])->name('cetak-daftar-proposal-new');
Route::post('seleksi-internal/buka-penilaian', [DaftarProposalController::class, 'bukaPenilaian'])->name('seleksi-internal.buka-penilaian');
// SELEKSI BELMAWA
Route::get('seleksi-belmawa', [DaftarProposalController::class, 'index_belmawa'])->name('seleksi-belmawa');
......
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