Commit 99df5f19 by novanbagus

update data reviewer server side

parent 69c84aa7
...@@ -197,14 +197,35 @@ class ReviewerController extends Controller ...@@ -197,14 +197,35 @@ class ReviewerController extends Controller
public function getDosen(Request $request) public function getDosen(Request $request)
{ {
$draw = $request->get('draw');
$start = $request->get("start");
$rowperpage = $request->get("length"); // Rows display per page
$columnIndex_arr = $request->get('order');
$columnName_arr = $request->get('columns');
$order_arr = $request->get('order');
$search_arr = $request->get('search');
$columnIndex = $columnIndex_arr[0]['column']; // Column index
$columnName = $columnName_arr[$columnIndex]['data']; // Column name
$columnSortOrder = $order_arr[0]['dir']; // asc or desc
$searchValue = strtoupper($search_arr['value']); // Search value
$tipe = $request->get('tipe'); $tipe = $request->get('tipe');
$i = 0; $i = 0;
if($start == 0)
$page = 1;
else
$page = ($start/10)+1;
if($tipe == '1' || $tipe == '' || $tipe == null) if($tipe == '1' || $tipe == '' || $tipe == null)
{ {
$client = new Client(); $client = new Client();
$response = $client->request('GET', 'https://i-sdm.unesa.ac.id/api/data-dosen'); $response = $client->request('GET', 'https://i-sdm.unesa.ac.id/api/detil-data-dosen?per_page='.$rowperpage.'&page='.$page.'&keyword='.$searchValue.'');
$data = json_decode($response->getBody(), true); $data = json_decode($response->getBody(), true);
$total = $data['count'];
$result = []; $result = [];
foreach ($data['data'] as $key => $value) { foreach ($data['data'] as $key => $value) {
...@@ -233,7 +254,7 @@ class ReviewerController extends Controller ...@@ -233,7 +254,7 @@ class ReviewerController extends Controller
$users = User::with(['rBiodata','rolesCustom'])->whereHas('rolesCustom',function ($q){ $users = User::with(['rBiodata','rolesCustom'])->whereHas('rolesCustom',function ($q){
$q->whereIn('name', ['reviewer']); $q->whereIn('name', ['reviewer']);
})->where('status', '2')->get(); })->where('status', '2')->get();
$total += count($users);
$j = $i?:0; $j = $i?:0;
foreach ($users as $key => $value) { foreach ($users as $key => $value) {
$result[$j]['nm_sdm'] = $value->name; $result[$j]['nm_sdm'] = $value->name;
...@@ -251,7 +272,15 @@ class ReviewerController extends Controller ...@@ -251,7 +272,15 @@ class ReviewerController extends Controller
$hasil['pesan'] = "sukses"; $hasil['pesan'] = "sukses";
$hasil['data'] = $result; $hasil['data'] = $result;
return $hasil;
$response = array(
"draw" => $draw,
"iTotalRecords" => $total,
"iTotalDisplayRecords" => $total,
"aaData" => $result
);
return $response;
// $client = new Client(['base_uri' => 'https://siakadu.unesa.ac.id/']); // $client = new Client(['base_uri' => 'https://siakadu.unesa.ac.id/']);
......
...@@ -135,7 +135,6 @@ ...@@ -135,7 +135,6 @@
var oTable1 = $('#example1').DataTable({ var oTable1 = $('#example1').DataTable({
paging: true, paging: true,
lengthChange: true,
searching: true, searching: true,
ordering: true, ordering: true,
info: true, info: true,
......
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