optimize index proposal

parent 14855908
......@@ -11,6 +11,7 @@ use App\Repositories\Auth\SsoRepository;
use App\Repositories\Auth\UserRepository;
use App\Repositories\UserdetailRepository;
use Auth;
use GuzzleHttp\Client;
use Illuminate\Support\Str;
class LoginController extends Controller
......@@ -44,7 +45,19 @@ class LoginController extends Controller
public function sso($email, $session_id)
{
$auth = $this->ssoRepo->sso($session_id);
// $auth = $this->ssoRepo->sso($session_id);
try {
$clientbiodata = new Client();
$apiRequestbiodata = $clientbiodata->request('GET', 'https://sso.unesa.ac.id/userid/'.'muhammadjava@mhs.unesa.ac.id');
$aksessso = json_decode($apiRequestbiodata->getBody()->getContents());
} catch (\Exception $apiRequestbiodata) {
$gagal_login = 'Data Tidak Ditemukan';
return $error;
}
$auth = $aksessso;
if (!is_array($auth)) {
return redirect('https://sso.unesa.ac.id/user');
......
......@@ -69,46 +69,56 @@ class DaftarProposalController extends Controller
// Total records
// $statementGlobal = " 1=1 ";
$statementGlobal = " ";
if($jenis != "0")
{
$statementGlobal .= " AND JENIS_ID = ''".$jenis."''";
}
if($status != "0")
{
// dikurang 1 karena di view mulai dari 0 sedangkan 0 itu menunggu persetujuan
$status = $status - 1;
$statementGlobal .= " AND STATUS_FINAL = ''".$status."''";
}
if($tahun != "0")
{
$statementGlobal .= " AND PERIODE = ''".$tahun."''";
}
// $totalRecords = DaftarProposal::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
$totalRecords = collect(DB::select("select 1 as allcount from vw_daftar_proposal('".$statementGlobal."') "))->count();
// $statementGlobal = " ";
// if($jenis != "0")
// {
// $statementGlobal .= " AND JENIS_ID = ''".$jenis."''";
// }
// if($status != "0")
// {
// // dikurang 1 karena di view mulai dari 0 sedangkan 0 itu menunggu persetujuan
// $status = $status - 1;
// $statementGlobal .= " AND STATUS_FINAL = ''".$status."''";
// }
// if($tahun != "0")
// {
// $statementGlobal .= " AND PERIODE = ''".$tahun."''";
// }
$daftarProposalQry = DaftarProposal::query()
->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);
})
->when(!is_null($status), function($query) use ($status){
return $query->where('status_final', $status);
})
->when($jenis != "0", function($query) use ($jenis){
return $query->where('jenis_id', $jenis);
});
$totalRecords = $daftarProposalQry->count();
// $totalRecords = collect(DB::select("select 1 as allcount from vw_daftar_proposal('".$statementGlobal."') "))->count();
$statement = " AND (UPPER(JUDUL) LIKE ''%".$searchValue."%'' OR UPPER(IDENTITAS_DOSPEM) LIKE ''%".$searchValue."%'') ";
// $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."') "))->count();
// Fetch records
// $records = DaftarProposal::orderBy($columnName,$columnSortOrder)
// ->whereRaw($statementGlobal.$statement)
// ->select('daftar_proposal.*')
// ->selectRaw(" ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_1) nilai_1 ")
// ->selectRaw(" ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_2) nilai_2 ")
// ->selectRaw(" round((ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_1) + ambil_jumlah_penilaian_seleksi(reviewer_proposal_id_2 )) / 2, 2) as rata ")
// ->skip($start)
// ->take($rowperpage)
// ->get();
$records = collect(DB::select("select *, 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 from vw_daftar_proposal('".$statementGlobal.$statement."') ORDER BY ".$columnName." ".$columnSortOrder))
$totalRecordswithFilter = $daftarProposalQry
->when($searchValue != '', function($query) use ($searchValue){
return $query->where('judul', 'ILIKE', '%'.$searchValue.'%')
->orWhere('identitas_dospem', 'ILIKE', '%'.$searchValue.'%');
})->count();
$records = $daftarProposalQry
->when($searchValue, function($query, $searchValue){
return $query->where('judul', 'ILIKE', '%'.$searchValue.'%')
->orWhere('identitas_dospem', 'ILIKE', '%'.$searchValue.'%');
})
// collect(DB::select("select *, 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 from vw_daftar_proposal('".$statementGlobal.$statement."') ORDER BY ".$columnName." ".$columnSortOrder))
->skip($start)
->take($rowperpage);
->limit($rowperpage)
->get();
$data_arr = array();
foreach($records as $record){
......
......@@ -74,8 +74,9 @@ class ProposalController extends Controller
{
$statementGlobal .= " AND PERIODE = '".$tahun."'";
}
// $totalRecords = DaftarProposal::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
$totalRecords = DaftarProposal::query()->whereRaw($statementGlobal)->count();
$totalRecords = DaftarProposal::select('count(1) as allcount')->whereRaw($statementGlobal)->count();
$statement = " AND (UPPER(JUDUL) LIKE '%".$searchValue."%' OR UPPER(IDENTITAS_KETUA) LIKE '%".$searchValue."%' OR UPPER(IDENTITAS_DOSPEM) LIKE '%".$searchValue."%') ";
......
......@@ -56,10 +56,10 @@
<label class="col-sm-3 col-form-label">Status : </label>
<div class="col-sm-6">
<select class="form-select select2" name="reqStatus" id="reqStatus">
<option value="0">Semua</option>
<option value="1">Menunggu Persetujuan</option>
<option value="2">Lolos</option>
<option value="3">Tidak Lolos</option>
<option value="">Semua</option>
<option value="0">Menunggu Persetujuan</option>
<option value="1">Lolos</option>
<option value="2">Tidak Lolos</option>
</select>
</div>
</div>
......
......@@ -67,9 +67,6 @@
<li><a href="{{ URL::to('operator/seleksi-internal-proposal') }}">Daftar Proposal</a></li>
</ul>
</li>
<li class="{{ (request()->is('operator/seleksi-belmawa*')) ? 'mm-active' : '' }}">
<a href="{{ URL::to('/operator/seleksi-belmawa') }}" class="waves-effect"><i class="ti-check-box"></i><span>Seleksi Belmawa</span></a>
</li>
<li class="{{ (request()->is('operator/monev-internal*')) ? 'mm-active' : '' }}">
<a href="javascript: void(0);" class="has-arrow waves-effect">
<i class="ti-layers-alt"></i>
......@@ -88,12 +85,6 @@
<li><a href="{{ URL::to('operator/monev-internal-proposal/'.Crypt::encrypt('21a49a70-33bb-49f1-9fd9-ebe52fa4336c')) }}">Daftar Proposal</a></li>
</ul>
</li>
<li><a href="javascript: void(0);" class="has-arrow">Monev Internal III</a>
<ul class="sub-menu" aria-expanded="true">
<li><a href="{{ URL::to('operator/monev-internal-reviewer/'.Crypt::encrypt('068aa53d-91a0-4704-b72c-54757799a286')) }}">Reviewer</a></li>
<li><a href="{{ URL::to('operator/monev-internal-proposal/'.Crypt::encrypt('068aa53d-91a0-4704-b72c-54757799a286')) }}">Daftar Proposal</a></li>
</ul>
</li>
</ul>
</li>
@endif
......
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