|
|
|
@ -193,18 +193,28 @@ class UserToActivityController extends Controller
|
|
|
|
|
|
|
|
|
|
public function activityUser(Request $request){ |
|
|
|
|
$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', |
|
|
|
|
'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('m_version_gantt as mvg', 'mvg.id', '=', 'ma.version_gantt_id') |
|
|
|
|
->join('m_proyek as mp', 'mp.id', '=', 'ma.proyek_id') |
|
|
|
|
->join('m_proyek as mp', 'mp.id', '=', 'ma.proyek_id') |
|
|
|
|
->where('ahta.user_id', $payload['user_id']) |
|
|
|
|
->where('ma.start_date', '<=', $payload['start_date']) |
|
|
|
|
->where('ma.end_date', '>=', $payload['end_date']) |
|
|
|
|
->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() |
|
|
|
|