Browse Source

update api for project-dashboard

pull/3/head
bnu 2 years ago
parent
commit
edd8f70697
  1. 17
      app/Http/Controllers/ProjectController.php
  2. 10
      rest-client.http
  3. 1
      routes/web.php

17
app/Http/Controllers/ProjectController.php

@ -23,6 +23,7 @@ use App\Models\ActivityDokumen;
use App\Models\Holiday;
use App\Models\ReportActivity;
use App\Models\OfficeHours;
use DB;
class ProjectController extends Controller
{
@ -227,4 +228,20 @@ class ProjectController extends Controller
return response()->json(['status'=>'success','code'=>200,'data'=>$data], 200);
}
public function dashboard($id)
{
// $data = Project::WHERE("id", $id)->first();
$data = DB::table('m_proyek as mp')
->select('mp.kode_sortname', 'mp.nama as name_project', 'mp.mulai_proyek as start', 'mp.akhir_proyek as finish', 'mp.rencana_biaya', 'mp.company', 'mu.name as pm')
->join('m_users as mu', 'mu.id', '=', 'mp.pm_id')
->where('mp.id', $id)
->get();
$countData = $data->count();
if(!$data)
return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404);
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200);
}
}

10
rest-client.http

@ -1,9 +1,10 @@
@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvb3Nwcm8tYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjU2MDk3NDg4LCJleHAiOjE2NTYxODM4ODgsIm5iZiI6MTY1NjA5NzQ4OCwianRpIjoiSFRYVFZMUW1adndoZjllZCIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.EiTKPtPzjKtdGKgxZbzsNkK6fZ1LzcxskquBYVeAstk
@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYXBpLXN0YWdpbmctYWR3Lm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjU4ODkzMjc1LCJleHAiOjE2NTk0OTgwNzUsIm5iZiI6MTY1ODg5MzI3NSwianRpIjoiRDhQdncycEk5amF3cGFwaSIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.-8a1JKilV1wHsmrIpS-j67sQukJtQ3sACGc3a6G6nXY
# @hostname = https://kit-api.ospro.id/api
@hostname = https://ospro-api.ospro.id/api
# @hostname = https://ospro-api.ospro.id/api
# @hostname = https://api-iu.ospro.id/api
@hostname = https://api-staging-adw.ospro.id/api
###### login
POST {{hostname}}/login
@ -454,6 +455,11 @@ content-type: application/json
}
}
### dashboard
GET {{hostname}}/project/dashboard/47
Authorization: Bearer {{token}}
content-type: application/json
###### Divisi

1
routes/web.php

@ -48,6 +48,7 @@ $router->group(['prefix'=>'api'], function () use ($router) {
$router->get('/project/edit/{id}', 'ProjectController@edit');
$router->delete('/project/delete/{id}', 'ProjectController@delete');
$router->get('/project/list', 'ProjectController@list');
$router->get('/project/dashboard/{id}', 'ProjectController@dashboard');
$router->get('/project/list-user/{id}', 'ProjectController@getListProjectTask');
$router->post('/project-charter/search', 'ProjectCharterController@search');
$router->post('/project-charter/add', 'ProjectCharterController@add');

Loading…
Cancel
Save