|
|
|
@ -28,6 +28,8 @@ use App\Models\ReportActivity;
|
|
|
|
|
use App\Models\OfficeHours; |
|
|
|
|
use DB; |
|
|
|
|
|
|
|
|
|
const API_GEOLOCATION = "https://nominatim.oslogdev.com/search/ADDR?format=json&addressdetails=1&limit=1"; |
|
|
|
|
|
|
|
|
|
class ProjectController extends Controller |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
@ -245,7 +247,6 @@ class ProjectController extends Controller
|
|
|
|
|
$d->plannedCost = $d->rencana_biaya; |
|
|
|
|
$d->actualCost = $actualCost; |
|
|
|
|
$d->lastActivity = $lastActivity ?? "-"; |
|
|
|
|
//$d->lastActivity = $daysRemaining . " -- " . $lastActivity . "\n" . $date1 . "\n" . $date2; |
|
|
|
|
$d->costVariance = $costVariance; |
|
|
|
|
$d->costHealth = $d->budget_health; |
|
|
|
|
$d->scheduleHealth = $scheduleHealth; |
|
|
|
@ -257,6 +258,11 @@ class ProjectController extends Controller
|
|
|
|
|
->where('m_proyek.id', $d->id) |
|
|
|
|
->pluck('m_users.name') |
|
|
|
|
->first(); |
|
|
|
|
if($d->area_kerja != ''){ |
|
|
|
|
$d->geolocation = $this->httpReq($d->area_kerja); |
|
|
|
|
} else { |
|
|
|
|
$d->geolocation = ''; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$totalPlannedCost = $data->sum('plannedCost'); |
|
|
|
@ -365,4 +371,20 @@ class ProjectController extends Controller
|
|
|
|
|
|
|
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataRes, 'totalRecord'=>$countData], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function httpReq($search){ |
|
|
|
|
$ch = curl_init(); |
|
|
|
|
curl_setopt($ch, CURLOPT_URL, str_replace("ADDR", $search, API_GEOLOCATION)); |
|
|
|
|
|
|
|
|
|
// SSL important |
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
|
|
|
//curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); |
|
|
|
|
|
|
|
|
|
$output = curl_exec($ch); |
|
|
|
|
curl_close($ch); |
|
|
|
|
|
|
|
|
|
return json_decode($output); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|