|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers; |
|
|
|
namespace App\Http\Controllers; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use App\Helpers\MasterFunctionsHelper; |
|
|
|
use App\Models\Activity; |
|
|
|
use App\Models\Activity; |
|
|
|
use App\Models\ActivityDokumen; |
|
|
|
use App\Models\ActivityDokumen; |
|
|
|
use App\Models\AssignMaterial; |
|
|
|
use App\Models\AssignMaterial; |
|
|
@ -262,13 +263,8 @@ class ProjectController extends Controller |
|
|
|
->where('m_proyek.id', $d->id) |
|
|
|
->where('m_proyek.id', $d->id) |
|
|
|
->pluck('m_users.name') |
|
|
|
->pluck('m_users.name') |
|
|
|
->first(); |
|
|
|
->first(); |
|
|
|
if($d->area_kerja != ''){ |
|
|
|
|
|
|
|
$d->geolocation = $this->httpReq($d->area_kerja); |
|
|
|
|
|
|
|
$d->geolocation = []; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$d->geolocation = []; |
|
|
|
$d->geolocation = []; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$totalPlannedCost = $data->sum('plannedCost'); |
|
|
|
$totalPlannedCost = $data->sum('plannedCost'); |
|
|
|
$totalActualCost = $data->sum('actualCost'); |
|
|
|
$totalActualCost = $data->sum('actualCost'); |
|
|
@ -313,21 +309,6 @@ class ProjectController extends Controller |
|
|
|
], 200); |
|
|
|
], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function httpReq($search){ |
|
|
|
|
|
|
|
$ch = curl_init(); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_URL, str_replace("ADDR", $search, API_GEOLOCATION)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_VERBOSE, true); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_STDERR, fopen('php://stderr', 'w')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$output = curl_exec($ch); |
|
|
|
|
|
|
|
curl_close($ch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return json_decode($output); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function getLatestGantt($id){ |
|
|
|
private function getLatestGantt($id){ |
|
|
|
$maxGanttId = VersionGantt::where("proyek_id", $id)->max("id"); |
|
|
|
$maxGanttId = VersionGantt::where("proyek_id", $id)->max("id"); |
|
|
|
$data = array( |
|
|
|
$data = array( |
|
|
@ -674,30 +655,13 @@ class ProjectController extends Controller |
|
|
|
return response()->json(['status'=>'success','code'=> 200,'data'=>$result], 200); |
|
|
|
return response()->json(['status'=>'success','code'=> 200,'data'=>$result], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function curlReq($url, $token){ |
|
|
|
|
|
|
|
$ch = curl_init(); |
|
|
|
|
|
|
|
$headers = [ |
|
|
|
|
|
|
|
'Authorization: '.$token |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $url); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); |
|
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$response = curl_exec($ch); |
|
|
|
|
|
|
|
if ($response === false) |
|
|
|
|
|
|
|
$response = curl_error($ch); |
|
|
|
|
|
|
|
curl_close($ch); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return json_decode($response); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getInvoiceIntegration(Request $request) { |
|
|
|
public function getInvoiceIntegration(Request $request) { |
|
|
|
$search = urlencode($request->search); |
|
|
|
$search = urlencode($request->search); |
|
|
|
if(empty($search)) |
|
|
|
if(empty($search)) |
|
|
|
return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); |
|
|
|
return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); |
|
|
|
$url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); |
|
|
|
$url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH'); |
|
|
|
$token = config('api.adw_token'); |
|
|
|
|
|
|
|
$response = $this->curlReq($url, $token); |
|
|
|
$response = MasterFunctionsHelper::curlReq($url); |
|
|
|
|
|
|
|
|
|
|
|
if($response->data->project_no == "") |
|
|
|
if($response->data->project_no == "") |
|
|
|
return response()->json(['status'=>'error', 'message' => 'Project '.$search.' not found!', 'code'=>404], 404); |
|
|
|
return response()->json(['status'=>'error', 'message' => 'Project '.$search.' not found!', 'code'=>404], 404); |
|
|
|