|
|
@ -136,6 +136,38 @@ class UserToActivityController extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function listFiltered(Request $request) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$startDate = $request->start_date; |
|
|
|
|
|
|
|
$endDate = $request->end_date; |
|
|
|
|
|
|
|
$userId = $request->user_id; |
|
|
|
|
|
|
|
$proyekId = $request->proyek_id; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($proyekId)) { |
|
|
|
|
|
|
|
$data = UserToActivity::select('assign_hr_to_activity.id', 'assign_hr_to_activity.activity_id', 'm_activity.name', 'm_activity.kode_sortname', 'm_activity.start_date', 'm_activity.end_date') |
|
|
|
|
|
|
|
->join('m_activity', 'assign_hr_to_activity.activity_id', '=', 'm_activity.id') |
|
|
|
|
|
|
|
->where('m_activity.start_date', '=', $startDate) |
|
|
|
|
|
|
|
->where('m_activity.end_date', '=', $endDate) |
|
|
|
|
|
|
|
->where('assign_hr_to_activity.user_id', '=', $userId) |
|
|
|
|
|
|
|
->where('assign_hr_to_activity.proyek_id', '=', $proyekId) |
|
|
|
|
|
|
|
->get(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
$data = UserToActivity::select('assign_hr_to_activity.id', 'assign_hr_to_activity.activity_id', 'm_activity.name', 'm_activity.kode_sortname', 'm_activity.start_date', 'm_activity.end_date') |
|
|
|
|
|
|
|
->join('m_activity', 'assign_hr_to_activity.activity_id', '=', 'm_activity.id') |
|
|
|
|
|
|
|
->where('m_activity.start_date', '=', $startDate) |
|
|
|
|
|
|
|
->where('m_activity.end_date', '=', $endDate) |
|
|
|
|
|
|
|
->where('assign_hr_to_activity.user_id', '=', $userId) |
|
|
|
|
|
|
|
->get(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$countData = $data->count(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($data){ |
|
|
|
|
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
return response()->json(['status'=>'failed','message'=>'failed get list user to activity gantt, please try again later!','code'=>400], 400); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function datatables(Request $request){ |
|
|
|
public function datatables(Request $request){ |
|
|
|
$id_activity = $request->query('idact'); |
|
|
|
$id_activity = $request->query('idact'); |
|
|
|
$data = UserToActivity::select("assign_hr_to_activity.id as id", "u.name as user_name", "mrp.name as role_name") |
|
|
|
$data = UserToActivity::select("assign_hr_to_activity.id as id", "u.name as user_name", "mrp.name as role_name") |
|
|
|