Browse Source

endpoint peta persebaran laporan

pull/3/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
6cc0a077bc
  1. 20
      app/Http/Controllers/ProjectController.php
  2. 1
      routes/web.php

20
app/Http/Controllers/ProjectController.php

@ -809,5 +809,25 @@ class ProjectController extends Controller
return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200); return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200);
} }
public function getReportDistribution(Request $request){
$payload = $request->all();
if(empty($payload['project_id']) || !is_int((int)$payload['project_id']))
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
$reports = DB::table('assign_material_to_activity as ama')
->select('u.name', 'a.name as activity_name', 'ama.qty_planning', 'rm.description as material_name', 'rm.uom as material_unit',
'ram.lat', 'ram.lon', 'ram.description as report_notes', 'ram.report_date')
->join('report_activity_material as ram', 'ram.assign_material_id', '=', 'ama.id')
->join('m_req_material as rm', 'rm.id', '=', 'ama.material_id')
->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
->join('m_users as u', 'u.id', '=', 'ram.user_id')
->where('ama.proyek_id', '=', $payload['project_id'])
->whereNotNull('ram.lat')
->whereBetween('ram.report_date', [$payload['start_date'], $payload['end_date']])
->get();
return response()->json(['status'=>'success', 'code'=> 200, 'data'=> $reports], 200);
}
} }

1
routes/web.php

@ -65,6 +65,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout
$router->post('/project/get-s-curve', 'ProjectController@getSCurve'); $router->post('/project/get-s-curve', 'ProjectController@getSCurve');
$router->post('/project/get-overdue-activities', 'ProjectController@getOverdueActivities'); $router->post('/project/get-overdue-activities', 'ProjectController@getOverdueActivities');
$router->post('/project/get-integration-invoice', 'ProjectController@getInvoiceIntegration'); $router->post('/project/get-integration-invoice', 'ProjectController@getInvoiceIntegration');
$router->post('/project/get-report-distribution', 'ProjectController@getReportDistribution');
/* $router->get('/project/get-progress/{id}/{date?}', 'ProjectController@getProgress'); */ /* $router->get('/project/get-progress/{id}/{date?}', 'ProjectController@getProgress'); */
/* $router->get('/project/get-expenditure/{id}/{date?}', 'ProjectController@getExpenditure'); */ /* $router->get('/project/get-expenditure/{id}/{date?}', 'ProjectController@getExpenditure'); */

Loading…
Cancel
Save