Browse Source

update merge

pull/3/head
bnu 2 years ago
parent
commit
d3ddcf8883
  1. 14
      Dockerfile
  2. 33
      app/Http/Controllers/ProjectController.php
  3. 4
      docker-compose.yml

14
Dockerfile

@ -8,7 +8,15 @@ RUN apk add --no-cache \
icu-dev \
libpng-dev \
oniguruma-dev \
libpq-dev
libpq-dev \
libpng-dev \
libzip-dev \
zip \
vim \
unzip \
git \
curl
RUN rm -rf /var/cache/apk/*
@ -21,6 +29,10 @@ RUN docker-php-ext-install \
pgsql \
tokenizer
#Install Extensions
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /var/www/html

33
app/Http/Controllers/ProjectController.php

@ -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,18 +247,28 @@ 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;
$d->progress = $progress;
$d->lastGanttId = VersionGantt::where("proyek_id", $d->id)->orderBy('id', 'desc')->first()->id ?? null;
$d->manpower = UserToProyek::where("proyek_id", $d->id)->count() ?? 0;
$d->projectManager = DB::table('m_proyek')
->join('m_users', 'm_users.id', '=', 'm_proyek.pm_id')
->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');
$totalActualCost = $data->sum('actualCost');
// $manpowers = User::where('employee_type', 'employee')->count();
$manpowers = User::count();
$projectsOnDanger = Project::where('budget_health', 'danger')->count();
$projectPhases = ProjectPhase::orderBy('order', 'asc')->pluck('name');
$projectTypes = ProjectType::orderBy('id', 'asc')->pluck('name');
try {
@ -288,6 +300,7 @@ class ProjectController extends Controller
'totalActualCost' => $totalActualCost,
'totalRevenue' => $totalPlannedCost - $totalActualCost,
'manpowers' => $manpowers,
'projectsOnDanger'=> $projectsOnDanger,
'projectPhases' => $projectPhases,
'projectsByPhase' => $projectsByPhase,
'projectTypes' => $projectTypes,
@ -358,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);
}
}

4
docker-compose.yml

@ -5,8 +5,8 @@ services:
restart: unless-stopped
tty: true
ports:
- '8099:80'
- '449:443'
- '8444:80'
- '8555:443'
volumes:
- .:/var/www/html
- ./docker/nginx/conf.d/:/etc/nginx/conf.d/

Loading…
Cancel
Save