|
|
|
@ -14,6 +14,7 @@ use App\Models\FolderDocumentProyek;
|
|
|
|
|
use App\Models\ProjectCharter; |
|
|
|
|
use App\Models\ProjectApproval; |
|
|
|
|
use App\Models\ProjectPhase; |
|
|
|
|
use App\Models\ProjectType; |
|
|
|
|
use App\Models\ProjectMileStone; |
|
|
|
|
use App\Models\ProjectParticipants; |
|
|
|
|
use App\Models\ShowHideColumn; |
|
|
|
@ -254,8 +255,10 @@ class ProjectController extends Controller
|
|
|
|
|
|
|
|
|
|
$totalPlannedCost = $data->sum('plannedCost'); |
|
|
|
|
$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'); |
|
|
|
|
$projectTypes = ProjectType::orderBy('id', 'asc')->pluck('name'); |
|
|
|
|
try { |
|
|
|
|
$projectsByPhase = DB::table('m_proyek') |
|
|
|
|
->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) { |
|
|
|
|
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( |
|
|
|
|
[ |
|
|
|
@ -278,6 +290,8 @@ class ProjectController extends Controller
|
|
|
|
|
'manpowers' => $manpowers, |
|
|
|
|
'projectPhases' => $projectPhases, |
|
|
|
|
'projectsByPhase' => $projectsByPhase, |
|
|
|
|
'projectTypes' => $projectTypes, |
|
|
|
|
'projectsByType' => $projectsByType, |
|
|
|
|
], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|