optimize index proposal

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