diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 5402bc8..fcc8471 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/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); + } } diff --git a/rest-client.http b/rest-client.http index 55d79ef..82ce528 100644 --- a/rest-client.http +++ b/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 diff --git a/routes/web.php b/routes/web.php index abd459e..a67e4c6 100644 --- a/routes/web.php +++ b/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');