|
|
@ -399,13 +399,6 @@ class ProjectController extends Controller |
|
|
|
$firstReport = ReportActivityMaterial::where('activity_id', $activity_id)->orderBy('report_date')->first(); |
|
|
|
$firstReport = ReportActivityMaterial::where('activity_id', $activity_id)->orderBy('report_date')->first(); |
|
|
|
$reports[] = ProjectController::setSyncDate($activity_id, $activity, $firstReport); |
|
|
|
$reports[] = ProjectController::setSyncDate($activity_id, $activity, $firstReport); |
|
|
|
} |
|
|
|
} |
|
|
|
$activity->reports = $reports; |
|
|
|
|
|
|
|
$successor = Link::where('t_activity_id', $activity->id)->first(); |
|
|
|
|
|
|
|
if ($successor) { |
|
|
|
|
|
|
|
$predecessor = Activity::find($successor->s_activity_id); |
|
|
|
|
|
|
|
$activity->start_date = $predecessor->end_date; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$activity->save(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
/* return response()->json(['status'=>'success','data'=> $reports,'code'=>200], 200); */ |
|
|
|
/* return response()->json(['status'=>'success','data'=> $reports,'code'=>200], 200); */ |
|
|
|
/* return response()->json(['status'=>'success','data'=> $activities,'code'=>200], 200); */ |
|
|
|
/* return response()->json(['status'=>'success','data'=> $activities,'code'=>200], 200); */ |
|
|
@ -428,6 +421,18 @@ class ProjectController extends Controller |
|
|
|
$activity->save(); |
|
|
|
$activity->save(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach($activities as $activity) { |
|
|
|
|
|
|
|
$successor = Link::where('t_activity_id', $activity->id)->first(); |
|
|
|
|
|
|
|
if ($successor) { |
|
|
|
|
|
|
|
$predecessor = Activity::find($successor->s_activity_id); |
|
|
|
|
|
|
|
$activity->start_date = $predecessor->end_date; |
|
|
|
|
|
|
|
$end_date = new DateTime($activity->start_date); |
|
|
|
|
|
|
|
$end_date->modify("+" . $activity->duration . " days"); |
|
|
|
|
|
|
|
$activity->end_date = $end_date->format("Y-m-d H:i:sO"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$activity->save(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return response()->json(['status'=>'success','message'=>'Synchronize to report success!','code'=>200], 200); |
|
|
|
return response()->json(['status'=>'success','message'=>'Synchronize to report success!','code'=>200], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|