|
|
|
@ -312,54 +312,6 @@ class ProjectController extends Controller
|
|
|
|
|
], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getListProjectTask($id){ |
|
|
|
|
$data = UserToActivity::select("assign_hr_to_activity.user_id as user_id","m_proyek.*") |
|
|
|
|
->where("assign_hr_to_activity.user_id", $id) |
|
|
|
|
->join('m_proyek', 'assign_hr_to_activity.proyek_id', '=', 'm_proyek.id') |
|
|
|
|
->groupBy("m_proyek.proyek_id") |
|
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
if(!$data) |
|
|
|
|
return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404); |
|
|
|
|
|
|
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=>$data], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function dashboard($id) |
|
|
|
|
{ |
|
|
|
|
$data = DB::table('m_proyek as mp') |
|
|
|
|
->select('mp.kode_sortname', 'mp.nama as name_project', 'mp.mulai_proyek as start', 'mp.akhir_proyek as finish', |
|
|
|
|
'mp.rencana_biaya', 'mp.company', 'mp.currency_symbol', 'mu.name as pm', 'mp.budget_health') |
|
|
|
|
->join('m_users as mu', 'mu.id', '=', 'mp.pm_id') |
|
|
|
|
->where('mp.id', $id) |
|
|
|
|
->first(); |
|
|
|
|
|
|
|
|
|
if(!$data) |
|
|
|
|
return response()->json(['status'=>'failed','message'=>'Data tidak ditemukan!','code'=> 404], 404); |
|
|
|
|
|
|
|
|
|
$manpowers = UserToProyek::where('proyek_id', $id)->count(); |
|
|
|
|
$rootActivity = Activity::whereNull('parent_id')->where('proyek_id', $id)->orderBy('version_gantt_id', 'desc')->first(); |
|
|
|
|
|
|
|
|
|
$actualCost = @$rootActivity->biaya_actual ?? 0; |
|
|
|
|
$progress = @$rootActivity->persentase_progress ?? 0; |
|
|
|
|
|
|
|
|
|
$commentActivity = DB::table('m_comment_activity as mca') |
|
|
|
|
->select('mca.activity_id', 'mca.comment as comment', 'mca.created_by as comment_by', 'mca.created_at as comment_created', |
|
|
|
|
'ma.name as activity') |
|
|
|
|
->join('m_activity as ma', 'ma.id', '=', 'mca.activity_id') |
|
|
|
|
->where('ma.proyek_id', $id) |
|
|
|
|
->orderBy('comment_by') |
|
|
|
|
->take(2) |
|
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
$data->actual_cost = $actualCost; |
|
|
|
|
$data->progress = $progress; |
|
|
|
|
$data->comment = $commentActivity; |
|
|
|
|
$data->man_power = $manpowers; |
|
|
|
|
|
|
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=> $data], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function httpReq($search){ |
|
|
|
|
$ch = curl_init(); |
|
|
|
|
curl_setopt($ch, CURLOPT_URL, str_replace("ADDR", $search, API_GEOLOCATION)); |
|
|
|
@ -369,8 +321,6 @@ class ProjectController extends Controller
|
|
|
|
|
curl_setopt($ch, CURLOPT_VERBOSE, true); |
|
|
|
|
curl_setopt($ch, CURLOPT_STDERR, fopen('php://stderr', 'w')); |
|
|
|
|
|
|
|
|
|
$info = curl_getinfo($ch); |
|
|
|
|
|
|
|
|
|
$output = curl_exec($ch); |
|
|
|
|
curl_close($ch); |
|
|
|
|
|
|
|
|
|