Browse Source

Merge pull request 'update search activity for mobile' (#288) from dev-ibnu into staging

Reviewed-on: ordo/adw-backend#288
pull/1/head
ibnu 1 year ago
parent
commit
02d90f0ff8
  1. 14
      app/Http/Controllers/UserToActivityController.php
  2. 3
      routes/web.php

14
app/Http/Controllers/UserToActivityController.php

@ -193,7 +193,7 @@ class UserToActivityController extends Controller
public function activityUser(Request $request){ public function activityUser(Request $request){
$payload = $request->all(); $payload = $request->all();
$query = DB::table('m_activity as ma') $activity = DB::table('m_activity as ma')
->select('ahta.id', 'ma.id as activity_id', 'ma.proyek_id', 'ma.name as join_second_name', 'ma.start_date as join_second_start_date', ->select('ahta.id', 'ma.id as activity_id', 'ma.proyek_id', 'ma.name as join_second_name', 'ma.start_date as join_second_start_date',
'ma.end_date as join_second_end_date', 'ma.persentase_progress', 'mvg.name_version', 'mp.nama as nama_proyek', 'mp.type_proyek_id') 'ma.end_date as join_second_end_date', 'ma.persentase_progress', 'mvg.name_version', 'mp.nama as nama_proyek', 'mp.type_proyek_id')
->join('assign_hr_to_activity as ahta', 'ahta.activity_id', '=', 'ma.id') ->join('assign_hr_to_activity as ahta', 'ahta.activity_id', '=', 'ma.id')
@ -204,7 +204,17 @@ class UserToActivityController extends Controller
->where('ma.end_date', '>=', $payload['end_date']) ->where('ma.end_date', '>=', $payload['end_date'])
->get(); ->get();
return response()->json(['status'=>'success','code'=>200,'data'=>$query, 'totalRecord'=>count($request->all())], 200); if ($payload['status'] != "") {
$filteredData = [];
foreach ($activity as $value) {
$assignMaterial = AssignMaterial::where('activity_id', $value->activity_id)->first();
if ($assignMaterial->status_activity == $payload['status']) {
$filteredData[] = $value;
}
}
$activity = $filteredData;
}
return response()->json(['status'=>'success','code'=>200,'data'=>$activity, 'totalRecord'=>count($activity)], 200);
} }
public function list() public function list()

3
routes/web.php

@ -198,7 +198,8 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout
$router->post('/user-to-activity/add-multiple', 'UserToActivityController@addMultiple'); $router->post('/user-to-activity/add-multiple', 'UserToActivityController@addMultiple');
$router->get('/user-to-activity/edit/{id}', 'UserToActivityController@edit'); $router->get('/user-to-activity/edit/{id}', 'UserToActivityController@edit');
$router->put('/user-to-activity/update/{id}', 'UserToActivityController@update'); $router->put('/user-to-activity/update/{id}', 'UserToActivityController@update');
$router->post('/user-to-activity/search', 'UserToActivityController@activityUser'); $router->post('/user-to-activity/search', 'UserToActivityController@search');
$router->post('/user-to-activity/by-date-status', 'UserToActivityController@activityUser');
$router->post('/user-to-activity/search-analysis', 'UserToActivityController@searchAnalysis'); $router->post('/user-to-activity/search-analysis', 'UserToActivityController@searchAnalysis');
$router->post('/user-to-activity/list-filtered', 'UserToActivityController@listFiltered'); $router->post('/user-to-activity/list-filtered', 'UserToActivityController@listFiltered');
$router->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete'); $router->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete');

Loading…
Cancel
Save