Commit d1f7f15c by Novan Bagus Setiawan

perbaikan all dan searching

parent 06316eef
...@@ -49,6 +49,9 @@ class DaftarProposalController extends Controller ...@@ -49,6 +49,9 @@ class DaftarProposalController extends Controller
$status = $request->get('status'); $status = $request->get('status');
$tahun= $request->get('tahun'); $tahun= $request->get('tahun');
if($tahun == '0')
$tahun = date('Y');
## Read value ## Read value
$draw = $request->get('draw'); $draw = $request->get('draw');
$start = $request->get("start"); $start = $request->get("start");
...@@ -85,7 +88,7 @@ class DaftarProposalController extends Controller ...@@ -85,7 +88,7 @@ class DaftarProposalController extends Controller
} }
$totalRecords = DaftarProposal::select('count(1) as allcount')->whereRaw($statementGlobal)->count(); $totalRecords = DaftarProposal::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
$statement = " AND (UPPER(JUDUL) LIKE '%".$searchValue."%') "; $statement = " AND (UPPER(JUDUL) LIKE '%".$searchValue."%' OR UPPER(IDENTITAS_DOSPEM) LIKE '%".$searchValue."%') ";
$totalRecordswithFilter = DaftarProposal::select('count(1) as allcount') $totalRecordswithFilter = DaftarProposal::select('count(1) as allcount')
->whereRaw($statementGlobal.$statement)->count(); ->whereRaw($statementGlobal.$statement)->count();
...@@ -248,6 +251,9 @@ class DaftarProposalController extends Controller ...@@ -248,6 +251,9 @@ class DaftarProposalController extends Controller
$status = $request->get('status'); $status = $request->get('status');
$tahun= $request->get('tahun'); $tahun= $request->get('tahun');
if($tahun == '0')
$tahun = date('Y');
## Read value ## Read value
$draw = $request->get('draw'); $draw = $request->get('draw');
$start = $request->get("start"); $start = $request->get("start");
...@@ -283,7 +289,7 @@ class DaftarProposalController extends Controller ...@@ -283,7 +289,7 @@ class DaftarProposalController extends Controller
$statementGlobal .= " AND PERIODE = '".$tahun."'"; $statementGlobal .= " AND PERIODE = '".$tahun."'";
} }
$totalRecords = DaftarProposalBelmawa::select('count(1) as allcount')->whereRaw($statementGlobal)->count(); $totalRecords = DaftarProposalBelmawa::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
$statement = " AND (UPPER(JUDUL) LIKE '%".$searchValue."%') "; $statement = " AND (UPPER(JUDUL) LIKE '%".$searchValue."%' OR UPPER(NAMA_DOSEN) LIKE '%".$searchValue."%') ";
$totalRecordswithFilter = DaftarProposalBelmawa::select('count(1) as allcount') $totalRecordswithFilter = DaftarProposalBelmawa::select('count(1) as allcount')
->whereRaw($statementGlobal.$statement)->count(); ->whereRaw($statementGlobal.$statement)->count();
......
...@@ -13,6 +13,7 @@ use Carbon\Carbon; ...@@ -13,6 +13,7 @@ use Carbon\Carbon;
use App\Models\Jenis; use App\Models\Jenis;
use App\Models\Periode; use App\Models\Periode;
use App\Models\Proposal;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\DaftarProposal; use App\Models\DaftarProposal;
use App\Exports\ProposalExport; use App\Exports\ProposalExport;
...@@ -109,16 +110,26 @@ class ProposalController extends Controller ...@@ -109,16 +110,26 @@ class ProposalController extends Controller
else else
{ {
$url = "https://statik.unesa.ac.id/simpkm/proposal/".$record->periode."/".$record->upload_dokumen; $url = "https://statik.unesa.ac.id/simpkm/proposal/".$record->periode."/".$record->upload_dokumen;
$proposal = '<a href="'.$url.'" target="_blank" class="btn btn-primary btn-sm waves-effect waves-light" role="button"><i class="fas fa-search"></i></a>';
if($status == '1') if($status == '1')
{
$keterangan = '<span class="badge bg-success">Disetujui Dosen</span>'; $keterangan = '<span class="badge bg-success">Disetujui Dosen</span>';
$aksi = '<a class="btn btn-warning btn-sm waves-effect waves-light aksi" role="button" data-ket="Proposal Kelompok yang dibatalkan status diterima akan otomatis menjadi status ditolak agar dapat menunggah ulang Proposal." data-id="'.Crypt::encrypt($proposal_id.'#2').'"><i class="fas fa-undo"></i></a>';
}
elseif($status == '2') elseif($status == '2')
{
$keterangan = '<span class="badge bg-danger">Ditolak Dosen</span>'; $keterangan = '<span class="badge bg-danger">Ditolak Dosen</span>';
$aksi = '';
}
else else
{
$keterangan = '<span class="badge bg-warning">Menunggu Persetujuan Dosen</span>'; $keterangan = '<span class="badge bg-warning">Menunggu Persetujuan Dosen</span>';
$aksi = '<a class="btn btn-success btn-sm waves-effect waves-light aksi" role="button" data-ket="Proposal Kelompok disetujui" data-id="'.Crypt::encrypt($proposal_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="Proposal Kelompok ditolak" data-id="'.Crypt::encrypt($proposal_id.'#2').'"><i class="fas fa-times"></i></a>';
}
} }
$aksi .= ' <a href="'.$url.'" target="_blank" class="btn btn-primary btn-sm waves-effect waves-light" role="button"><i class="fas fa-search"></i></a>';
$keterangan .= "<br><span class='badge bg-info'>Upload Proposal Pada : ".$date_upload." WIB</span>"; $keterangan .= "<br><span class='badge bg-info'>Upload Proposal Pada : ".$date_upload." WIB</span>";
$keterangan .= "<br><span class='badge bg-info'>Disetujui Dosen Pada : ".$date_approval." WIB</span>"; $keterangan .= "<br><span class='badge bg-info'>Disetujui Dosen Pada : ".$date_approval." WIB</span>";
...@@ -131,7 +142,7 @@ class ProposalController extends Controller ...@@ -131,7 +142,7 @@ class ProposalController extends Controller
"jenis_pkm" => $jenis_pkm, "jenis_pkm" => $jenis_pkm,
"judul" => $judul, "judul" => $judul,
"keterangan" => $keterangan, "keterangan" => $keterangan,
"aksi" => $proposal "aksi" => $aksi
); );
} }
...@@ -208,4 +219,24 @@ class ProposalController extends Controller ...@@ -208,4 +219,24 @@ class ProposalController extends Controller
return Excel::download(new ProposalExport($jenis, $status, $tahun), 'proposal_export.xlsx'); return Excel::download(new ProposalExport($jenis, $status, $tahun), 'proposal_export.xlsx');
} }
public function prosesProposal(Request $request)
{
$kel = $request->except('_token');
$arrKel = explode('#', decrypt($kel['proposalId']));
$reqProposalId = $arrKel['0'];
$reqStatus = $arrKel['1'];
$proposal = Proposal::query()->find($reqProposalId);
$proposal->status = $reqStatus;
$proposal->date_approval = now();
$proposal->save();
return response()->json([
'status' => 'success',
'message' => 'Data Berhasil diubah.',
]);
}
} }
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<select class="form-select select2" name="reqTahun" id="reqTahun"> <select class="form-select select2" name="reqTahun" id="reqTahun">
<option value="0">Semua</option> <option value="0">Semua</option>
@foreach ($periode as $res) @foreach ($periode as $res)
<option value="{{ $res->nama }}">{{ $res->nama }}</option> <option value="{{ $res->nama }}" @php if($res->nama == date('Y')) echo 'selected'; @endphp>{{ $res->nama }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<select class="form-select select2" name="reqTahun" id="reqTahun"> <select class="form-select select2" name="reqTahun" id="reqTahun">
<option value="0">Semua</option> <option value="0">Semua</option>
@foreach ($periode as $res) @foreach ($periode as $res)
<option value="{{ $res->nama }}">{{ $res->nama }}</option> <option value="{{ $res->nama }}" @php if($res->nama == date('Y')) echo 'selected'; @endphp>{{ $res->nama }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
......
...@@ -146,9 +146,6 @@ ...@@ -146,9 +146,6 @@
$('#reqJenisPkm, #reqStatus, #reqTahun').change(function(){ $('#reqJenisPkm, #reqStatus, #reqTahun').change(function(){
oTable.draw(); oTable.draw();
}); });
});
$(document).ready(function(){
$('#example').on('click','.viewdetails',function(){ $('#example').on('click','.viewdetails',function(){
var kelId = $(this).attr('data-id'); var kelId = $(this).attr('data-id');
...@@ -175,6 +172,51 @@ ...@@ -175,6 +172,51 @@
} }
}); });
$('#example').on('click','.aksi',function(){
var propId = $(this).attr('data-id');
var ket = $(this).attr('data-ket');
if(propId != null || propId != ''){
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-proposal")}}',
type:'POST',
data:{
"_token": "{{ csrf_token() }}",
"proposalId": propId
},
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');
}
})
}
});
}); });
function cetak() { function cetak() {
......
...@@ -156,6 +156,7 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () { ...@@ -156,6 +156,7 @@ Route::group(['middleware' => ['auth:sanctum', 'verified']], function () {
Route::get('getProposal', [ProposalController::class, 'getData'])->name('getProposal'); Route::get('getProposal', [ProposalController::class, 'getData'])->name('getProposal');
Route::get('getDetilProposal', [ProposalController::class, 'getDetil'])->name('getDetilProposal'); Route::get('getDetilProposal', [ProposalController::class, 'getDetil'])->name('getDetilProposal');
Route::get('cetak-proposal', [ProposalController::class, 'cetak_proposal'])->name('cetak-proposal'); Route::get('cetak-proposal', [ProposalController::class, 'cetak_proposal'])->name('cetak-proposal');
Route::post('proses-proposal', [ProposalController::class, 'prosesProposal'])->name('proses-proposal');
Route::resource('jenis', JenisController::class); Route::resource('jenis', JenisController::class);
Route::get('getJenis', [JenisController::class, 'getData'])->name('getJenis'); Route::get('getJenis', [JenisController::class, 'getData'])->name('getJenis');
......
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