diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 35615b2..c879a1c 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -776,4 +776,15 @@ class ActivityController extends Controller } return response()->json(['status'=>'failed','message'=>'File is required!','code'=>400], 400); } + + public function importUpdate(Request $request) { + $data = $request->all(); + foreach ($data as $value) { + $activity = Activity::find($value['id']); + $activity->start_date = $value['start_date']; + $activity->end_date = $value['end_date']; + $activity->save(); + } + return response()->json(['status'=>'success','data'=>$request,'message'=>'Update successful!','code'=>200], 200); + } } diff --git a/routes/web.php b/routes/web.php index d2861e8..7eacf60 100644 --- a/routes/web.php +++ b/routes/web.php @@ -202,6 +202,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout $router->get('/activity/{id}/{proyek_id}/get', 'ActivityController@getByGanttId'); $router->get('/activity/search', 'ActivityController@search'); $router->post('/activity/import', 'ActivityController@import'); + $router->post('/activity/import-update', 'ActivityController@importUpdate'); $router->post('/activity/import-old', 'ActivityController@importOld'); $router->post('/task', 'ActivityController@add'); $router->get('/task/edit/{id}', 'ActivityController@edit');