Browse Source

Merge branch 'Dev-Fuad' of https://git.oslog.id/ordo/surveyor_indonesia_backend into dev-wahyun

pull/5/head
SitiAfridaFitriyani 2 months ago
parent
commit
02cc2451ba
  1. 1
      .gitignore
  2. 5
      app/Http/Controllers/ActivityDokumenController.php
  3. 149
      app/Http/Controllers/DashboardBoDController.php
  4. 33
      app/Http/Controllers/ImageController.php
  5. 5
      app/Http/Controllers/ProjectCarausellController.php
  6. 59
      app/Http/Controllers/ProjectController.php
  7. 30
      routes/web.php

1
.gitignore vendored

@ -12,3 +12,4 @@ bootstrap/backup
.config-prod.json .config-prod.json
activity_log.txt activity_log.txt
.swp .swp
composer.lock

5
app/Http/Controllers/ActivityDokumenController.php

@ -8,6 +8,11 @@ use App\Models\ActivityDokumen;
class ActivityDokumenController extends Controller class ActivityDokumenController extends Controller
{ {
public $directories;
public function __construct() {
$this->directories = $this->setCustomeDirectoryUpload();
}
public function dokumenByActivityId($id) public function dokumenByActivityId($id)
{ {
if (empty($id) || !is_int((int)$id)) if (empty($id) || !is_int((int)$id))

149
app/Http/Controllers/DashboardBoDController.php

@ -28,29 +28,24 @@ class DashboardBoDController extends Controller
public function getCompanyCashFlow($company_id, $all_project, $hierarchy, $role_name) public function getCompanyCashFlow($all_project, $hierarchy, $role_name)
{ {
$totalExpenditure = $totalInvoice = $totalPaidInvoice = 0; $totalExpenditure = $totalInvoice = $totalPaidInvoice = 0;
$totalBudgets = null; $totalBudgets = null;
$role = urldecode($role_name); $role = urldecode($role_name);
if ($role === "Super Admin") { if (!empty($all_project) || $role === "Super Admin") {
$totalBudgets = Project::sum(DB::raw('CAST("rencana_biaya" AS DOUBLE PRECISION)')); $totalBudgets = Project::sum(DB::raw('CAST("rencana_biaya" AS DOUBLE PRECISION)'));
} elseif (!empty($all_project)) {
$totalBudgets = Project::where('company_id', $company_id)
->sum(DB::raw('CAST("rencana_biaya" AS DOUBLE PRECISION)'));
} else { } else {
$totalBudgets = Project::where('created_by_id', $hierarchy) $totalBudgets = Project::where('created_by_id', $hierarchy)
->sum(DB::raw('CAST("rencana_biaya" AS DOUBLE PRECISION)')); ->sum(DB::raw('CAST("rencana_biaya" AS DOUBLE PRECISION)'));
} }
$totalBudgets = Project::sum(DB::raw('CAST("rencana_biaya" AS DOUBLE PRECISION)'));
dd($totalBudgets);
$projects = null; $projects = null;
if ($role === "Super Admin") { if (!empty($all_project) || $role === "Super Admin") {
$projects = Project::get(); $projects = Project::get();
} elseif (!empty($all_project)) {
$projects = Project::where('company_id', $company_id)
->get();
} else { } else {
$projects = Project::where('created_by_id', $hierarchy) $projects = Project::where('created_by_id', $hierarchy)
->get(); ->get();
@ -85,15 +80,11 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getDetailExpenditureColor($role_name, $company_id) public function getDetailExpenditureColor($role_name)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$query = null; $query = null;
if ($role === 'Super Admin') { $query = ProjectExpenditure::get();
$query = ProjectExpenditure::get();
} else {
$query = ProjectExpenditure::where('company_id', $company_id)->get();
}
$data = []; $data = [];
foreach ($query as $value) { foreach ($query as $value) {
@ -120,16 +111,11 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getDetailFinancialHealthColor($role_name, $company_id) public function getDetailFinancialHealthColor($role_name)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$query = null; $query = null;
if ($role === 'Super Admin') { $query = ProjectFinancialHealth::get();
$query = ProjectFinancialHealth::get();
} else {
$query = ProjectFinancialHealth::where('company_id', $company_id)->get();
}
$data = []; $data = [];
foreach ($query as $value) { foreach ($query as $value) {
@ -152,15 +138,11 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getDetailScheduleHealthColor($role_name, $company_id) public function getDetailScheduleHealthColor($role_name)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$query = null; $query = null;
if ($role === 'Super Admin') { $query = ProjectScheduleHealth::get();
$query = ProjectScheduleHealth::get();
} else {
$query = ProjectScheduleHealth::where('company_id', $company_id)->get();
}
$data = []; $data = [];
foreach ($query as $value) { foreach ($query as $value) {
@ -183,15 +165,11 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getDetailInvoiceColor($role_name, $company_id) public function getDetailInvoiceColor($role_name)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$query = null; $query = null;
if ($role === 'Super Admin') { $query = ProjectInvoice::get();
$query = ProjectInvoice::get();
} else {
$query = ProjectInvoice::where('company_id', $company_id)->get();
}
$data = []; $data = [];
foreach ($query as $value) { foreach ($query as $value) {
if ($value['name'] === 'Invoiced') { if ($value['name'] === 'Invoiced') {
@ -210,15 +188,12 @@ class DashboardBoDController extends Controller
} }
// integrasi // integrasi
public function getInvoiceOutstanding($role_name, $company_id, $all_project, $hierarchy) public function getInvoiceOutstanding($role_name, $all_project, $hierarchy)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$projects = null; $projects = null;
if ($role === 'Super Admin') { if (!empty($all_project) || $role === 'Super Admin') {
$projects = Project::get(); $projects = Project::get();
} elseif (!empty($all_project)) {
$projects = Project::where('company_id', $company_id)
->get();
} else { } else {
$projects = Project::where('created_by_id', $hierarchy) $projects = Project::where('created_by_id', $hierarchy)
->get(); ->get();
@ -241,7 +216,7 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getTotalProjectPerScheduleHealth($role_name, $company_id, $all_project, $hierarchy) public function getTotalProjectPerScheduleHealth($role_name, $all_project, $hierarchy)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$replaceHierarchy = preg_replace('/[\[\]]/', '', $hierarchy); $replaceHierarchy = preg_replace('/[\[\]]/', '', $hierarchy);
@ -253,11 +228,8 @@ class DashboardBoDController extends Controller
]; ];
$projects = null; $projects = null;
if ($role === 'Super Admin') { if ($all_project == 'true' || $role === 'Super Admin') {
$projects = Project::get(); $projects = Project::get();
} elseif ($all_project == 'true') {
$projects = Project::where('company_id', $company_id)
->get();
} else { } else {
$projects = Project::where('created_by_id', $replaceHierarchy) $projects = Project::where('created_by_id', $replaceHierarchy)
->get(); ->get();
@ -274,18 +246,11 @@ class DashboardBoDController extends Controller
} }
public function getTotalProjectScheduleHealthPerDivision($role_name, $company_id) public function getTotalProjectScheduleHealthPerDivision($role_name)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$divisions = null; $divisions = Divisi::whereNull('parent')
if ($role === 'Super Admin') { ->get();
$divisions = Divisi::whereNull('parent')
->get();
} else {
$divisions = Divisi::whereNull('parent')
->where('company_id', $company_id)
->get();
}
foreach ($divisions as $index => $division) { foreach ($divisions as $index => $division) {
$behindSchedule = $warning = $onSchedule = 0; $behindSchedule = $warning = $onSchedule = 0;
@ -311,7 +276,7 @@ class DashboardBoDController extends Controller
return response()->json(['data' => $divisions], 200); return response()->json(['data' => $divisions], 200);
} }
public function getTotalProjectPerBudgetHealth($role_name, $company_id, $all_project, $hierarchy) public function getTotalProjectPerBudgetHealth($role_name, $all_project, $hierarchy)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$replaceHierarchy = preg_replace('/[\[\]]/', '', $hierarchy); $replaceHierarchy = preg_replace('/[\[\]]/', '', $hierarchy);
@ -324,7 +289,6 @@ class DashboardBoDController extends Controller
] ]
]; ];
$divisi = Divisi::query() $divisi = Divisi::query()
->where('company_id', $company_id)
->pluck('id'); ->pluck('id');
// arr overrun // arr overrun
@ -333,7 +297,7 @@ class DashboardBoDController extends Controller
->count(); ->count();
} elseif ($all_project == 'true') { } elseif ($all_project == 'true') {
$response['data']['overrun'] = Project::whereIn('divisi_id', $divisi) $response['data']['overrun'] = Project::whereIn('divisi_id', $divisi)
->where([['budget_health', 'overrun'], ['company_id', $company_id]]) ->where([['budget_health', 'overrun']])
->count(); ->count();
} else { } else {
$response['data']['overrun'] = Project::whereIn('divisi_id', $divisi) $response['data']['overrun'] = Project::whereIn('divisi_id', $divisi)
@ -346,7 +310,7 @@ class DashboardBoDController extends Controller
->count(); ->count();
} elseif ($all_project == 'true') { } elseif ($all_project == 'true') {
$response['data']['warning'] = Project::whereIn('divisi_id', $divisi) $response['data']['warning'] = Project::whereIn('divisi_id', $divisi)
->where([['budget_health', 'warning'], ['company_id', $company_id]]) ->where([['budget_health', 'warning']])
->count(); ->count();
} else { } else {
$response['data']['warning'] = Project::whereIn('divisi_id', $divisi) $response['data']['warning'] = Project::whereIn('divisi_id', $divisi)
@ -359,7 +323,7 @@ class DashboardBoDController extends Controller
->count(); ->count();
} elseif ($all_project == 'true') { } elseif ($all_project == 'true') {
$response['data']['on-budget'] = Project::whereIn('divisi_id', $divisi) $response['data']['on-budget'] = Project::whereIn('divisi_id', $divisi)
->where([['company_id', $company_id], ['budget_health', 'on-budget']]) ->where([['budget_health', 'on-budget']])
->count(); ->count();
} else { } else {
$response['data']['on-budget'] = Project::whereIn('divisi_id', $divisi) $response['data']['on-budget'] = Project::whereIn('divisi_id', $divisi)
@ -376,7 +340,7 @@ class DashboardBoDController extends Controller
} }
public function getTotalProjectBudgetHealthPerDivision($role_name, $company_id) public function getTotalProjectBudgetHealthPerDivision($role_name)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$divisions = null; $divisions = null;
@ -389,7 +353,6 @@ class DashboardBoDController extends Controller
$divisions = Divisi::select('id', 'name') $divisions = Divisi::select('id', 'name')
->with('children') ->with('children')
->whereNull('parent') ->whereNull('parent')
->where('company_id', $company_id)
->get(); ->get();
} }
@ -414,26 +377,17 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getTotalProjectPerPhase($role_name, $company_id, $all_project, $hierarchy) public function getTotalProjectPerPhase($role_name, $all_project, $hierarchy)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$projectPhases = null; $projectPhases = null;
if ($role === 'Super Admin') { $projectPhases = ProjectPhase::orderBy('order')->get();
$projectPhases = ProjectPhase::orderBy('order')->get();
} else {
$projectPhases = ProjectPhase::where('company_id', $company_id)->orderBy('order')->get();
}
foreach ($projectPhases as $phase) { foreach ($projectPhases as $phase) {
if ($role === 'Super Admin') { if ($role === 'Super Admin' || $all_project) {
$phase->totalProject = Project::where('phase_id', $phase->id) $phase->totalProject = Project::where('phase_id', $phase->id)
->count(); ->count();
} elseif ($all_project) {
$phase->totalProject = Project::where('phase_id', $phase->id)
->where('company_id', $company_id)
->count();
} else { } else {
$phase->totalProject = Project::where('phase_id', $phase->id) $phase->totalProject = Project::where('phase_id', $phase->id)
->where('created_by_id', $hierarchy) ->where('created_by_id', $hierarchy)
@ -453,25 +407,14 @@ class DashboardBoDController extends Controller
->count(); ->count();
} }
public function getTotalProjectPerDivision($role_name, $company_id) public function getTotalProjectPerDivision($role_name)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
$divisions = null; $divisions = null;
if ($role === 'Super Admin') { $divisions = Divisi::select('id', 'name', 'parent', 'color')
$divisions = Divisi::select('id', 'name', 'parent', 'color') ->with('children')
->with('children') ->whereNull('parent')
->whereNull('parent') ->get();
->get();
} else {
$divisions = Divisi::select('id', 'name', 'parent', 'color')
->with('children')
->whereNull('parent')
->where('company_id', $company_id)
->get();
}
// to do : count in more than 1 level child // to do : count in more than 1 level child
foreach ($divisions as $v) { foreach ($divisions as $v) {
@ -495,22 +438,13 @@ class DashboardBoDController extends Controller
->first(); ->first();
} }
public function getTotalProjectValuePerDivision($role_name, $company_id) public function getTotalProjectValuePerDivision($role_name)
{ {
$role = urldecode($role_name); $role = urldecode($role_name);
if ($role === 'Super Admin') { $divisions = Divisi::select('id', 'name', 'color')
$divisions = Divisi::select('id', 'name', 'color') ->with('children')
->with('children') ->whereNull('parent')
->whereNull('parent') ->get();
->get();
} else {
$divisions = Divisi::select('id', 'name', 'color')
->with('children')
->whereNull('parent')
->where('company_id', $company_id)
->get();
}
foreach ($divisions as $v) { foreach ($divisions as $v) {
$v->total = $this->countTotalProjectValueInDivision($v->id); $v->total = $this->countTotalProjectValueInDivision($v->id);
@ -526,13 +460,12 @@ class DashboardBoDController extends Controller
} }
public function getDetailExpenditure($year = '%', $company_id, $all_project, $hierarchy) public function getDetailExpenditure($year = '%', $all_project, $hierarchy)
{ {
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$projects = null; $projects = null;
if ($all_project) { if ($all_project) {
$projects = Project::where('mulai_proyek', 'like', $year) $projects = Project::where('mulai_proyek', 'like', $year)
->where('company_id', $company_id)
->orderBy('id', 'desc') ->orderBy('id', 'desc')
->get(); ->get();
} else { } else {
@ -562,7 +495,7 @@ class DashboardBoDController extends Controller
return response()->json([ return response()->json([
'data' => $projects, 'data' => $projects,
'total_manpowers' => User::where('company_id', $company_id)->count() 'total_manpowers' => User::count()
], 200); ], 200);
} }
} }

33
app/Http/Controllers/ImageController.php

@ -123,24 +123,7 @@ class ImageController extends Controller
$totalSize += filesize($folderPath . '/' . $file); $totalSize += filesize($folderPath . '/' . $file);
} }
} }
$totalSize += $sizeFile; $totalSize += $sizeFile;
$transaction = ProductTransaction::query()
->where('company_id', $company['id']);
$cloneQueryTransaction = clone $transaction;
$countCreate = false;
if($transaction->where([['type_paket','Basic'], ['amount','!=',null]])->exists()) {
$maximumSize = 500 * 1024 * 1024;
$countCreate = true;
} elseif ($cloneQueryTransaction->where([['type_paket','Free'], ['amount', 0]])->exists()) {
$maximumSize = 50 * 1024 * 1024;
$countCreate = true;
}
if($countCreate) {
if ($totalSize > $maximumSize) {
return response()->json(['status'=>'failed','message'=>'Limited storage maximum!','code'=> 500], 500);
}
}
} }
foreach ($dokumen as $file) { foreach ($dokumen as $file) {
$extension = $file->extension(); $extension = $file->extension();
@ -219,12 +202,11 @@ class ImageController extends Controller
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);
} }
public function deleteByRef($id, $category, $company_id) public function deleteByRef($id, $category)
{ {
$data = Image::where("ref_id", (int)$id)->where("category", $category)->first(); $data = Image::where("ref_id", (int)$id)->where("category", $category)->first();
$company = Company::find($company_id); if($data){
if($data && $company){ $destinationPath = $this->setCustomeDirectoryUpload();
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']);
unlink($destinationPath['pathImage'].$data->image); unlink($destinationPath['pathImage'].$data->image);
$delete = $data->delete(); $delete = $data->delete();
}else{ }else{
@ -240,16 +222,15 @@ class ImageController extends Controller
} }
} }
public function deleteByRefMultiple($id, $category, $company_id) public function deleteByRefMultiple($id, $category)
{ {
$successCount = 0; $successCount = 0;
$data = Image::where([ $data = Image::where([
["ref_id", intval($id)], ["ref_id", intval($id)],
["category", $category] ["category", $category]
])->get(); ])->get();
$company = Company::find($company_id); if($data->isNotEmpty()) {
if($data->isNotEmpty() && $company) { $destinationPath = $this->setCustomeDirectoryUpload();
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']);
foreach($data as $img) { foreach($data as $img) {
unlink($destinationPath['pathImage'].$img->image); unlink($destinationPath['pathImage'].$img->image);
$delete = $img->delete(); $delete = $img->delete();

5
app/Http/Controllers/ProjectCarausellController.php

@ -16,16 +16,13 @@ class ProjectCarausellController extends Controller
public function invoke(Request $request) public function invoke(Request $request)
{ {
// Master Data // Master Data
$company_id = $request->route('company_id');
$all_project = $request->route('all_project'); $all_project = $request->route('all_project');
$hierarchy = $request->route('hierarchy'); $hierarchy = $request->route('hierarchy');
$query = Project::query() $query = Project::query()
->select("id", "nama", "kode_sortname", "pm_id", "budget_health", "calculation_status", "mulai_proyek", "akhir_proyek", "rencana_biaya", "company", "scurve"); ->select("id", "nama", "kode_sortname", "pm_id", "budget_health", "calculation_status", "mulai_proyek", "akhir_proyek", "rencana_biaya", "company", "scurve");
if ($all_project) { if (!$all_project) {
$query->where('company_id', $company_id);
} else {
$query->where('created_by_id', $hierarchy); $query->where('created_by_id', $hierarchy);
} }

59
app/Http/Controllers/ProjectController.php

@ -182,15 +182,14 @@ class ProjectController extends Controller
return true; return true;
} }
public function delete($id, $company_id) public function delete($id)
{ {
DB::beginTransaction(); DB::beginTransaction();
$data = Project::find($id); $data = Project::find($id);
$dateNow = Carbon::now(); $dateNow = Carbon::now();
if ($data) { if ($data) {
$this->deleteRelative($id, $company_id); $this->deleteRelative($id);
if ($data->delete()) { if ($data->delete()) {
// if ($data->update(['deleted_at' => $dateNow, 'deleted_by_id' => $this->currentId])) {
DB::commit(); DB::commit();
return response()->json(['status' => 'success', 'message' => 'Data deleted!', 'code' => 200], 200); return response()->json(['status' => 'success', 'message' => 'Data deleted!', 'code' => 200], 200);
} else { } else {
@ -203,9 +202,9 @@ class ProjectController extends Controller
} }
} }
private function deleteRelative($project_id, $company_id) private function deleteRelative($project_id)
{ {
DB::transaction(function () use ($project_id, $company_id) { DB::transaction(function () use ($project_id) {
UserToProyek::where('proyek_id', $project_id)->delete(); UserToProyek::where('proyek_id', $project_id)->delete();
UserToActivity::where('proyek_id', $project_id)->delete(); UserToActivity::where('proyek_id', $project_id)->delete();
AssignMaterial::where('proyek_id', $project_id)->delete(); AssignMaterial::where('proyek_id', $project_id)->delete();
@ -222,36 +221,33 @@ class ProjectController extends Controller
OfficeHours::where('proyek_id', $project_id)->delete(); OfficeHours::where('proyek_id', $project_id)->delete();
ReportK3::where('proyek_id', $project_id)->delete(); ReportK3::where('proyek_id', $project_id)->delete();
RequestMaterial::where('proyek_id', $project_id)->delete(); RequestMaterial::where('proyek_id', $project_id)->delete();
$this->deleteVersionGantt($project_id, $company_id); $this->deleteVersionGantt($project_id);
$this->deleteDokumenProject($project_id, $company_id); $this->deleteDokumenProject($project_id);
}, 5); }, 5);
} }
private function deleteVersionGantt($project_id, $company_id) private function deleteVersionGantt($project_id)
{ {
DB::transaction(function () use ($project_id, $company_id) { DB::transaction(function () use ($project_id) {
$dataVg = VersionGantt::where("proyek_id", $project_id)->pluck("id"); $dataVg = VersionGantt::where("proyek_id", $project_id)->pluck("id");
$vhIds = $dataVg->all(); $vhIds = $dataVg->all();
$activity = Activity::whereIn("version_gantt_id", $vhIds)->pluck('id'); $activity = Activity::whereIn("version_gantt_id", $vhIds)->pluck('id');
$activityIds = $activity->all(); $activityIds = $activity->all();
$dataRa = ReportActivity::whereIn("activity_id", $activityIds)->get(); $dataRa = ReportActivity::whereIn("activity_id", $activityIds)->get();
$company = Company::find($company_id); $destinationPath = $this->setCustomeDirectoryUpload();
if ($company) { foreach ($dataRa as $ra) {
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); $images = Image::where("ref_id", $ra->id)->where("category", "report_activity")->get();
foreach ($dataRa as $ra) { foreach ($images as $image) {
$images = Image::where("ref_id", $ra->id)->where("category", "report_activity")->get(); if (file_exists($destinationPath['pathImage'] . $image->image)) {
foreach ($images as $image) { unlink($destinationPath['pathImage'] . $image->image);
if (file_exists($destinationPath['pathImage'] . $image->image)) {
unlink($destinationPath['pathImage'] . $image->image);
}
} }
Image::where("ref_id", $ra->id)->where("category", "report_activity")->delete();
} }
$dataAd = ActivityDokumen::whereIn("activity_id", $activityIds)->get(); Image::where("ref_id", $ra->id)->where("category", "report_activity")->delete();
foreach ($dataAd as $ad) { }
if (file_exists($destinationPath['pathActivityDocument'] . $ad->file)) { $dataAd = ActivityDokumen::whereIn("activity_id", $activityIds)->get();
unlink($destinationPath['pathActivityDocument'] . $ad->file); foreach ($dataAd as $ad) {
} if (file_exists($destinationPath['pathActivityDocument'] . $ad->file)) {
unlink($destinationPath['pathActivityDocument'] . $ad->file);
} }
} }
ActivityDokumen::whereIn("activity_id", $activityIds)->delete(); ActivityDokumen::whereIn("activity_id", $activityIds)->delete();
@ -265,17 +261,14 @@ class ProjectController extends Controller
}, 5); }, 5);
} }
private function deleteDokumenProject($project_id, $company_id) private function deleteDokumenProject($project_id)
{ {
DB::transaction(function () use ($project_id, $company_id) { DB::transaction(function () use ($project_id) {
$dataDokumen = DokumenProject::where([['type_dokumen', 'project-document-out-folder'], ['ref_id', $project_id]])->get(); $dataDokumen = DokumenProject::where([['type_dokumen', 'project-document-out-folder'], ['ref_id', $project_id]])->get();
$company = Company::find($company_id); $destinationPath = $this->setCustomeDirectoryUpload();
if ($company) { foreach ($dataDokumen as $dokumen) {
$destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); if (file_exists($destinationPath['pathDocument'] . $dokumen->file)) {
foreach ($dataDokumen as $dokumen) { unlink($destinationPath['pathDocument'] . $dokumen->file);
if (file_exists($destinationPath['pathDocument'] . $dokumen->file)) {
unlink($destinationPath['pathDocument'] . $dokumen->file);
}
} }
} }
DokumenProject::where([['type_dokumen', 'project-document-out-folder'], ['ref_id', $project_id]])->delete(); DokumenProject::where([['type_dokumen', 'project-document-out-folder'], ['ref_id', $project_id]])->delete();

30
routes/web.php

@ -42,20 +42,20 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->group(['middleware' => ['auth', 'cors']], function () use ($router) { $router->group(['middleware' => ['auth', 'cors']], function () use ($router) {
$router->get('/dashboard/get-company-cashflow/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getCompanyCashFlow'); // project expenditure $router->get('/dashboard/get-company-cashflow/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getCompanyCashFlow'); // project expenditure
$router->get('/dashboard/get-invoice-outstanding/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getInvoiceOutstanding'); // project invoice vs cash in $router->get('/dashboard/get-invoice-outstanding/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getInvoiceOutstanding'); // project invoice vs cash in
$router->get('/dashboard/get-total-project-per-schedule-health/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectPerScheduleHealth'); $router->get('/dashboard/get-total-project-per-schedule-health/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectPerScheduleHealth');
$router->get('/dashboard/get-total-project-per-budget-health/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectPerBudgetHealth'); $router->get('/dashboard/get-total-project-per-budget-health/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectPerBudgetHealth');
$router->get('/dashboard/get-total-project-schedule-health-per-division/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectScheduleHealthPerDivision'); $router->get('/dashboard/get-total-project-schedule-health-per-division/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectScheduleHealthPerDivision');
$router->get('/dashboard/get-total-project-budget-health-per-division/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectBudgetHealthPerDivision'); $router->get('/dashboard/get-total-project-budget-health-per-division/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectBudgetHealthPerDivision');
$router->get('/dashboard/get-total-project-per-phase/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectPerPhase'); $router->get('/dashboard/get-total-project-per-phase/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectPerPhase');
$router->get('/dashboard/get-total-project-per-division/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectPerDivision'); $router->get('/dashboard/get-total-project-per-division/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectPerDivision');
$router->get('/dashboard/get-total-project-value-per-division/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectValuePerDivision'); $router->get('/dashboard/get-total-project-value-per-division/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getTotalProjectValuePerDivision');
$router->get('/dashboard/get-detail-expenditure/{company_id}/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getDetailExpenditure'); $router->get('/dashboard/get-detail-expenditure/{all_project}/{hierarchy}/{role_name}', 'DashboardBoDController@getDetailExpenditure');
$router->get('/dashboard/get-detail-expenditure-color/{company_id}/{role_name}', 'DashboardBoDController@getDetailExpenditureColor'); $router->get('/dashboard/get-detail-expenditure-color/{role_name}', 'DashboardBoDController@getDetailExpenditureColor');
$router->get('/dashboard/get-detail-financial-health-color/{company_id}/{role_name}', 'DashboardBoDController@getDetailFinancialHealthColor'); $router->get('/dashboard/get-detail-financial-health-color/{role_name}', 'DashboardBoDController@getDetailFinancialHealthColor');
$router->get('/dashboard/get-detail-schedule-health-color/{company_id}/{role_name}', 'DashboardBoDController@getDetailScheduleHealthColor'); $router->get('/dashboard/get-detail-schedule-health-color/{role_name}', 'DashboardBoDController@getDetailScheduleHealthColor');
$router->get('/dashboard/get-detail-invoice-color/{company_id}/{role_name}', 'DashboardBoDController@getDetailInvoiceColor'); $router->get('/dashboard/get-detail-invoice-color/{role_name}', 'DashboardBoDController@getDetailInvoiceColor');
$router->post('/role/search', 'RoleController@search'); $router->post('/role/search', 'RoleController@search');
$router->post('/role/add', 'RoleController@add'); $router->post('/role/add', 'RoleController@add');
@ -106,7 +106,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
/* $router->get('/project/get-status-health-schedule/{id}', 'ProjectController@getStatusSchedule'); */ /* $router->get('/project/get-status-health-schedule/{id}', 'ProjectController@getStatusSchedule'); */
/* $router->get('/project/get-status-health-budget/{id}', 'ProjectController@getStatusBudget'); */ /* $router->get('/project/get-status-health-budget/{id}', 'ProjectController@getStatusBudget'); */
$router->get('/project-carausell/{company_id}/{all_project}/{hierarchy}', 'ProjectCarausellController@invoke'); $router->get('/project-carausell/{all_project}/{hierarchy}', 'ProjectCarausellController@invoke');
$router->post('/project-charter/search', 'ProjectCharterController@search'); $router->post('/project-charter/search', 'ProjectCharterController@search');
$router->post('/project-charter/add', 'ProjectCharterController@add'); $router->post('/project-charter/add', 'ProjectCharterController@add');

Loading…
Cancel
Save