From ea33a29ca81b669b675fc99dc99c3e76237b3055 Mon Sep 17 00:00:00 2001 From: wahyu Date: Wed, 18 Oct 2023 13:26:46 +0700 Subject: [PATCH] custom search for report analysis --- app/Http/Controllers/ProjectController.php | 4 ++-- app/Http/Controllers/UserToActivityController.php | 10 ++++++++++ routes/web.php | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index 91fbb3d..46c529d 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -229,7 +229,7 @@ class ProjectController extends Controller $dataBuilder = $this->setUpPayload($payload, 'm_proyek'); $builder = $dataBuilder['builder']; $countBuilder = $dataBuilder['count']; - $builder->where("selfTable.created_by",$this->currentName); + // $builder->where("selfTable.created_by",$this->currentName); $dataGet = $builder->get(); $totalRecord = $countBuilder->count(); @@ -276,7 +276,7 @@ class ProjectController extends Controller 'updated_at', 'updated_by' )->orderBy('id', 'desc') - ->where("created_by",$this->currentName) + // ->where("created_by",$this->currentName) ->get(); $countData = $data->count(); diff --git a/app/Http/Controllers/UserToActivityController.php b/app/Http/Controllers/UserToActivityController.php index 2c3a658..a1a9583 100644 --- a/app/Http/Controllers/UserToActivityController.php +++ b/app/Http/Controllers/UserToActivityController.php @@ -129,6 +129,16 @@ class UserToActivityController extends Controller return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200); } + public function searchAnalysis(Request $request) + { + $dataBuilder = $this->setUpPayload($request->all(), 'assign_hr_to_activity'); + $builder = $dataBuilder['builder']; + $countBuilder = $dataBuilder['count']; + $dataGet = $builder->get(); + $totalRecord = $countBuilder->count(); + return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200); + } + public function search(Request $request) { $payload = $request->all(); diff --git a/routes/web.php b/routes/web.php index 7f62207..f449cef 100644 --- a/routes/web.php +++ b/routes/web.php @@ -197,6 +197,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout $router->get('/user-to-activity/edit/{id}', 'UserToActivityController@edit'); $router->put('/user-to-activity/update/{id}', 'UserToActivityController@update'); $router->post('/user-to-activity/search', 'UserToActivityController@search'); + $router->post('/user-to-activity/search-analysis', 'UserToActivityController@searchAnalysis'); $router->post('/user-to-activity/list-filtered', 'UserToActivityController@listFiltered'); $router->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete'); $router->get('/user-to-activity/list', 'UserToActivityController@list'); @@ -204,7 +205,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout $router->get('/sumVolActualM/{id}', 'ActivityController@sumVolumeActualMaterial'); $router->get('/activity/{id}/{proyek_id}/get', 'ActivityController@getByGanttId'); - $router->get('/activity/search', 'ActivityController@search'); + $router->post('/activity/search', 'ActivityController@search'); $router->post('/activity/import', 'ActivityController@import'); $router->post('/activity/import-update', 'ActivityController@importUpdate'); $router->post('/activity/import-old', 'ActivityController@importOld');