|
|
@ -14,6 +14,7 @@ use App\Models\FolderDocumentProyek; |
|
|
|
use App\Models\ProjectCharter; |
|
|
|
use App\Models\ProjectCharter; |
|
|
|
use App\Models\ProjectApproval; |
|
|
|
use App\Models\ProjectApproval; |
|
|
|
use App\Models\ProjectPhase; |
|
|
|
use App\Models\ProjectPhase; |
|
|
|
|
|
|
|
use App\Models\ProjectType; |
|
|
|
use App\Models\ProjectMileStone; |
|
|
|
use App\Models\ProjectMileStone; |
|
|
|
use App\Models\ProjectParticipants; |
|
|
|
use App\Models\ProjectParticipants; |
|
|
|
use App\Models\ShowHideColumn; |
|
|
|
use App\Models\ShowHideColumn; |
|
|
@ -254,8 +255,10 @@ class ProjectController extends Controller |
|
|
|
|
|
|
|
|
|
|
|
$totalPlannedCost = $data->sum('plannedCost'); |
|
|
|
$totalPlannedCost = $data->sum('plannedCost'); |
|
|
|
$totalActualCost = $data->sum('actualCost'); |
|
|
|
$totalActualCost = $data->sum('actualCost'); |
|
|
|
$manpowers = User::where('employee_type', 'employee')->count(); |
|
|
|
// $manpowers = User::where('employee_type', 'employee')->count(); |
|
|
|
|
|
|
|
$manpowers = User::count(); |
|
|
|
$projectPhases = ProjectPhase::orderBy('order', 'asc')->pluck('name'); |
|
|
|
$projectPhases = ProjectPhase::orderBy('order', 'asc')->pluck('name'); |
|
|
|
|
|
|
|
$projectTypes = ProjectType::orderBy('id', 'asc')->pluck('name'); |
|
|
|
try { |
|
|
|
try { |
|
|
|
$projectsByPhase = DB::table('m_proyek') |
|
|
|
$projectsByPhase = DB::table('m_proyek') |
|
|
|
->select('m_proyek_phase.name', 'm_proyek_phase.color', DB::raw('count(*) as total')) |
|
|
|
->select('m_proyek_phase.name', 'm_proyek_phase.color', DB::raw('count(*) as total')) |
|
|
@ -265,6 +268,15 @@ class ProjectController extends Controller |
|
|
|
} catch (\Exception $e) { |
|
|
|
} catch (\Exception $e) { |
|
|
|
return response()->json(['message' => $e->getMessage()]); |
|
|
|
return response()->json(['message' => $e->getMessage()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$projectsByType = DB::table('m_proyek') |
|
|
|
|
|
|
|
->select('m_type_proyek.name', DB::raw('count(*) as total')) |
|
|
|
|
|
|
|
->join('m_type_proyek', 'm_type_proyek.id', '=', 'm_proyek.type_proyek_id') |
|
|
|
|
|
|
|
->groupBy('m_type_proyek.name') |
|
|
|
|
|
|
|
->get(); |
|
|
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
|
|
return response()->json(['message' => $e->getMessage()]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return response()->json( |
|
|
|
return response()->json( |
|
|
|
[ |
|
|
|
[ |
|
|
@ -278,6 +290,8 @@ class ProjectController extends Controller |
|
|
|
'manpowers' => $manpowers, |
|
|
|
'manpowers' => $manpowers, |
|
|
|
'projectPhases' => $projectPhases, |
|
|
|
'projectPhases' => $projectPhases, |
|
|
|
'projectsByPhase' => $projectsByPhase, |
|
|
|
'projectsByPhase' => $projectsByPhase, |
|
|
|
|
|
|
|
'projectTypes' => $projectTypes, |
|
|
|
|
|
|
|
'projectsByType' => $projectsByType, |
|
|
|
], 200); |
|
|
|
], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|