Browse Source

Merge pull request 'Dev-Farhan' (#16) from Dev-Farhan into staging

Reviewed-on: ibnu/generic-ospro-backend#16
pull/1/head
farhantock 1 year ago
parent
commit
7bad19181c
  1. 28
      app/Console/Commands/CalculateProgressGantt.php
  2. 3
      app/Console/Kernel.php
  3. 942
      app/Helpers/MasterFunctionsHelper.php
  4. 133
      app/Http/Controllers/ActivityController.php
  5. 117
      app/Http/Controllers/DashboardBoDController.php
  6. 73
      app/Http/Controllers/HierarchyFtthController.php
  7. 37
      app/Http/Controllers/ProjectController.php
  8. 3
      app/Models/Project.php
  9. 120
      rest-client.http
  10. 9
      routes/web.php

28
app/Console/Commands/CalculateProgressGantt.php

@ -0,0 +1,28 @@
<?php
namespace App\Console\Commands;
use App\Models\HierarchyFtth;
use Illuminate\Console\Command;
use App\Helpers\MasterFunctionsHelper;
use App\Models\Project;
class CalculateProgressGantt extends Command
{
protected $signature = 'calculate:progressgantt {hierarchy_id}';
protected $description = 'Calculate Progress Gantt';
public function handle()
{
$hierarchy_id = $this->argument('hierarchy_id');
$hierarchy = HierarchyFtth::findOrFail($hierarchy_id);
$project = Project::find($hierarchy->project_id);
$data = MasterFunctionsHelper::calculateSCurveForProgressTree($hierarchy_id);
$hierarchy->bobot_planning = 100;
$hierarchy->progress =round(((int) end($data[0]['data']['percentageReal']) / (int) end($data[0]['data']['percentagePlan'])) * 100, 2);
$hierarchy->save();
}
}

3
app/Console/Kernel.php

@ -14,7 +14,8 @@ class Kernel extends ConsoleKernel
*/
protected $commands = [
Commands\syncHumanResourceIntegration::class,
Commands\CalculateSCurve::class
Commands\CalculateSCurve::class,
Commands\CalculateProgressGantt::class
];
/**

942
app/Helpers/MasterFunctionsHelper.php

File diff suppressed because it is too large Load Diff

133
app/Http/Controllers/ActivityController.php

@ -37,6 +37,94 @@ class ActivityController extends Controller
return response()->json(['status' => 'success', 'data' => $dataGantt, 'code' => 200], 200);
}
public function activitySCurve($proyek_id, $gantt_id){
// "data": [
// {
// "id": 1,
// "text": "Office itinerancy",
// "type": "project",
// "order": "10",
// "progress": 0.4,
// "open": true,
// "user":"0",
// "start_date": "02-04-2024 00:00",
// "duration": 17,
// "end_date": "19-04-2024 00:00",
// "parent": 0
// }
// ],
// "links": [
// {
// "id": "1",
// "source": "1",
// "target": "2",
// "type": "1"
// }
// ]
// }
$checkHeader = Activity::where('version_gantt_id', $gantt_id)->where('type_activity', 'header')->count();
$finalData = [];
if ($checkHeader > 0) {
$dataHeader = Activity::select('id', 'name as text', 'type_activity as type', 'persentase_progress as progress', 'start_date', 'end_date', 'duration', 'parent_id', 'sortorder as order')->where('version_gantt_id', $gantt_id)->where('type_activity', 'header')->first();
// $dataHeader->start_date1 = isset($dataHeader->start) ? date_format(date_create($dataHeader->start), "d-m-Y H:i") : NULL;
// $dataHeader->end_date1 = isset($dataHeader->end) ? date_format(date_create($dataHeader->end), "d-m-Y H:i") : NULL;
$dataHeader->progress = $dataHeader->progress / 100;
$dataHeader->type = "project";
$dataHeader->text = $dataHeader->name;
$finalData[] = $dataHeader;
$data = Activity::select('id', 'name as text', 'type_activity as type', 'persentase_progress as progress', 'start_date', 'end_date', 'duration', 'parent_id', 'sortorder as order')->where('version_gantt_id', $gantt_id)->where('parent_id', $dataHeader->id)->orderBy('sortorder', 'asc')->get();
} else {
$data = Activity::select('id', 'name as text', 'type_activity as type', 'persentase_progress as progress', 'start_date', 'end_date', 'duration', 'parent_id', 'sortorder as order')->where('version_gantt_id', $gantt_id)->whereNull('parent_id')->orderBy('sortorder', 'asc')->get();
}
foreach ($data as $objRow) {
$type = "project";
$dataChildren = $this->getChildrenSCurve($gantt_id, $objRow->id);
if ($objRow->type_activity == "milestone")
$type = $objRow->type_activity;
if (empty($dataChildren))
$type = "task";
$objRow->parent = $objRow->parent_id ? $objRow->parent_id : null;
// $objRow->start_date = isset($objRow->start) ? date_format(date_create($objRow->start), "d-m-Y H:i") : NULL;
// $objRow->end_date1 = isset($objRow->end) ? date_format(date_create($objRow->end), "d-m-Y H:i") : NULL;
$objRow->progress = $objRow->persentase_progress / 100;
$objRow->type = $type;
$finalData[] = $objRow;
$finalData = array_merge($finalData, $dataChildren);
}
$dataLink = Link::where('version_gantt_id', $gantt_id)->get();
$finalLink = [];
foreach ($dataLink as $objRow) {
$dataRow = array(
'id' => $objRow->id,
'source' => $objRow->s_activity_id,
'target' => $objRow->t_activity_id,
'type' => $objRow->type_link,
'code' => $objRow->code_link
);
if ($objRow->lag)
$dataRow['lag'] = $objRow->lag;
$finalLink[] = $dataRow;
}
$resultData = array(
"data" => $finalData,
"links" => $finalLink
);
return response()->json(['status' => 'success', 'data' => $resultData, 'code' => 200], 200);
}
private function getDataActivity($id)
{
$checkHeader = Activity::where('version_gantt_id', $id)->where('type_activity', 'header')->count();
@ -116,6 +204,43 @@ class ActivityController extends Controller
return $resultData;
}
private function getChildrenSCurve($gantt_id, $parent_id)
{
$finalData = [];
$data = Activity::select('id', 'name as text', 'type_activity as type', 'bobot_planning', 'persentase_progress as progress', 'start_date', 'end_date', 'duration', 'parent_id', 'sortorder as order')
->where('version_gantt_id', $gantt_id)->where('parent_id', $parent_id)->orderBy('sortorder', 'asc')->get();
foreach ($data as $objRow) {
$objRow->parent = $parent_id;
$objRow->progress = (float) $objRow->bobot_planning /100;
// $objRow->start_date1 = isset($objRow->start) ? date_format(date_create($objRow->start), "d-m-Y H:i") : NULL;
// $objRow->end_date1 = isset($objRow->end) ? date_format(date_create($objRow->end), "d-m-Y H:i") : NULL;
$dataChildren = $this->getChildrenSCurve($gantt_id, $objRow->id);
if ($objRow->type_activity == "milestone") {
$objRow->type = $objRow->type_activity;
// $objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "d-m-Y") : NULL;
} elseif (empty($dataChildren)) {
$objRow->type = "task";
// $objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "d-m-Y") : NULL;
// $objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "d-m-Y") : NULL;
// if(isset($objRow->actual_start)){
// $objRow->auto_scheduling = false;
// }
} else {
$objRow->type = "project";
// $actualStart = $this->getFirstLastDateActivity($objRow->id, "start");
// $objRow->actual_start = isset($actualStart) ? date_format(date_create($actualStart), "d-m-Y") : NULL;
// $actualEnd = $this->getFirstLastDateActivity($objRow->id, "end");
// $objRow->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "d-m-Y") : NULL;
}
$finalData[] = $objRow;
$finalData = array_merge($finalData, $dataChildren);
}
return $finalData;
}
private function getChildren($gantt_id, $parent_id)
{
$finalData = [];
@ -197,7 +322,7 @@ class ActivityController extends Controller
$actualEndValues = array_column(array_filter($dataFinal, function($item) {
return isset($item['actual_end']);
}), 'actual_end');
$returnActualStartOrEnd = count($actualEndValues) == count($dataFinal) ? max($actualEndValues) : null;
$returnActualStartOrEnd = count($actualEndValues) == count($dataFinal) && count($actualEndValues) > 0 ? max($actualEndValues) : null;
if (isset($parent)) {
$parent->actual_end = $returnActualStartOrEnd;
$parent->save();
@ -479,6 +604,7 @@ class ActivityController extends Controller
$activityToUpdate = $activity->firstWhere('id', $entity['data']['id']);
$entity['data']['name'] = $entity['data']['text'];
$entity['data']['persentase_progress'] = $entity['data']['progress'] * 100;
$entity['data']['type_activity'] = $entity['data']['type'];
if (isset($entity['data']['rencana_biaya'])) {
$entity['data']['rencana_biaya'] = str_replace(",", ".", $entity['data']['rencana_biaya']);
}
@ -1030,4 +1156,9 @@ class ActivityController extends Controller
}
return response()->json(['status' => 'success', 'data' => $request, 'message' => 'Update successful!', 'code' => 200], 200);
}
// public function recalculateProject($by, $id){
// // query get activity
// $cekActivity =
// }
}

117
app/Http/Controllers/DashboardBoDController.php

@ -41,49 +41,105 @@ class DashboardBoDController extends Controller
private function getInvoiceIntegration($search)
{
if(empty($search))
return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400);
if (empty($search))
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);
if(@$response->data->project_no == "")
if (@$response->data->project_no == "")
return null;
return $response;
}
// to do
public function getCompanyCashFlow($year = '%')
// OLD
// public function getCompanyCashFlow($year = '%')
// {
// $year = $this->interpolateYear($year);
// $totalExpenditure = $totalInvoice = $totalPaidInvoice = 0;
// $totalBudgets = Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))'))
// ->where('mulai_proyek', 'like', $year)
// /* ->orWhere('akhir_proyek', 'like', $year) */
// ->pluck('sum')
// ->first();
// $projects = Project::where('mulai_proyek', 'like', $year)
// /* ->orWhere('akhir_proyek', 'like', $year) */
// ->get();
// foreach ($projects as $project) {
// $project->expenses = 0;
// $resp = null;
// if ($project->kode_sortname != "") {
// $resp = $this->getInvoiceIntegration($project->kode_sortname);
// /* $resp = $project->kode_sortname; */
// $cost = $resp->data->total_cost ?? 0;
// $cost = substr($cost, 0, strpos($cost, "."));
// $totalExpenditure += (int) $cost;
// $totalInvoice += $resp->data->total_invoice_amount ?? 0;
// $totalPaidInvoice += $resp->data->total_invoice_paid_amount ?? 0;
// }
// }
// return response()->json([
// 'data' => [
// 'total_budget' => (int) $totalBudgets ?? 0,
// 'total_expenditure' => $totalExpenditure,
// 'total_invoice' => $totalInvoice,
// 'total_paid_invoice' => $totalPaidInvoice,
// ]
// ], 200);
// }
public function getCompanyCashFlow($year = '%', $company_id, $all_project, $hierarchy)
{
$year = $this->interpolateYear($year);
$totalExpenditure = $totalInvoice = $totalPaidInvoice = 0;
// we can't use eloquent's sum() method because someone decided to use varchar as datatype in rencana_biaya field
$totalBudgets = Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))'))
->where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */
->pluck('sum')
->first();
$totalBudgets = null;
if ($all_project) {
$totalBudgets = Project::where('mulai_proyek', 'like', $year)
->where('company_id', $company_id)
->sum(DB::raw('CAST("rencana_biaya" AS DOUBLE PRECISION)'));
} else {
$totalBudgets = Project::where('mulai_proyek', 'like', $year)
->where('created_by_id', $hierarchy)
->sum(DB::raw('CAST("rencana_biaya" AS DOUBLE PRECISION)'));
}
$projects = null;
if ($all_project) {
$projects = Project::where('mulai_proyek', 'like', $year)
->where('company_id', $company_id)
->get();
} else {
$projects = Project::where('mulai_proyek', 'like', $year)
->where('created_by_id', $hierarchy)
->get();
}
$projects = Project::where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */
->get();
foreach ($projects as $project) {
$project->expenses = 0;
$resp = null;
if ($project->kode_sortname != "") {
$resp = $this->getInvoiceIntegration($project->kode_sortname);
/* $resp = $project->kode_sortname; */
$cost = $resp->data->total_cost ?? 0;
$cost = substr($cost, 0, strpos($cost, "."));
$totalExpenditure += (int) $cost;
$totalInvoice += $resp->data->total_invoice_amount ?? 0;
$totalPaidInvoice += $resp->data->total_invoice_paid_amount ?? 0;
$cost = 0;
$totalExpenditure = 0;
$totalInvoice = 0;
$totalPaidInvoice = 0;
// $totalExpenditure += (int) $cost;
// $totalInvoice += $resp->data->total_invoice_amount ?? 0;
// $totalPaidInvoice += $resp->data->total_invoice_paid_amount ?? 0;
}
}
return response()->json([
@ -96,6 +152,7 @@ class DashboardBoDController extends Controller
], 200);
}
public function getInvoiceOutstanding($year = '%')
{
$year = $this->interpolateYear($year);
@ -147,15 +204,13 @@ class DashboardBoDController extends Controller
}
$selisihProgress = $planningProgress - $actualProgress;
try {
if ($selisihProgress > 0 && $selisihProgress <= 5){
if ($selisihProgress > 0 && $selisihProgress <= 5) {
$return['warning'] += 1;
$projects[$index]->status = 'warning';
}
elseif ($selisihProgress == 0){
} elseif ($selisihProgress == 0) {
$return['on-schedule'] += 1;
$projects[$index]->status = 'on-schedule';
}
else {
} else {
$return['behind-schedule'] += 1;
$projects[$index]->status = 'behind-schedule';
}
@ -191,13 +246,11 @@ class DashboardBoDController extends Controller
$actualProgress = !empty($actualArray) ? $actualArray[count($actualArray) - 1] : 0;
}
$selisihProgress = $planningProgress - $actualProgress;
if ($selisihProgress > 0 && $selisihProgress <= 5){
if ($selisihProgress > 0 && $selisihProgress <= 5) {
$warning++;
}
elseif ($selisihProgress == 0){
} elseif ($selisihProgress == 0) {
$onSchedule++;
}
else {
} else {
$behindSchedule++;
}
}
@ -294,7 +347,7 @@ class DashboardBoDController extends Controller
{
$year = $this->interpolateYear($year);
$divisions = Divisi::select('id', 'name','parent','color')
$divisions = Divisi::select('id', 'name', 'parent', 'color')
->with('children')
->whereNull('parent')
->get();

73
app/Http/Controllers/HierarchyFtthController.php

@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use App\Models\HierarchyFtth;
use App\Models\VersionGantt;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Artisan;
class HierarchyFtthController extends Controller
{
@ -102,36 +103,41 @@ class HierarchyFtthController extends Controller
}
}
public function countProgress($project_id) {
$ftthIds = VersionGantt::select('hierarchy_ftth_id')
->where('proyek_id', $project_id)
->groupBy('hierarchy_ftth_id')
->get();
if($ftthIds){
foreach ($ftthIds as $ftthId) {
$gantts = VersionGantt::where('hierarchy_ftth_id', $ftthId->hierarchy_ftth_id)->sum('progress');
$bobot_planning = VersionGantt::where('hierarchy_ftth_id', $ftthId->hierarchy_ftth_id)->sum('bobot');
$ganttCount = VersionGantt::where('hierarchy_ftth_id', $ftthId->hierarchy_ftth_id)->count();
$ftth = HierarchyFtth::find($ftthId->hierarchy_ftth_id);
if($ftth){
$round = $gantts/$ganttCount;
$round_bobot = $bobot_planning/$ganttCount;
$ftth->progress = round($round, 2);
$ftth->bobot_planning = round($round_bobot, 2);
try {
$ftth->save();
} catch (\Exception $e) {
// Log the error or handle it in some other way
Log::error($e->getMessage());
}
public function countProgress($hierarchy_id) {
// $ftthIds = VersionGantt::select('hierarchy_ftth_id')
// ->where('proyek_id', $project_id)
// ->groupBy('hierarchy_ftth_id')
// ->get();
// if($ftthIds){
// foreach ($ftthIds as $ftthId) {
// $gantts = VersionGantt::where('hierarchy_ftth_id', $ftthId->hierarchy_ftth_id)->sum('progress');
// $bobot_planning = VersionGantt::where('hierarchy_ftth_id', $ftthId->hierarchy_ftth_id)->sum('bobot');
// $ganttCount = VersionGantt::where('hierarchy_ftth_id', $ftthId->hierarchy_ftth_id)->count();
if($ftth->parent_id){
$this->countParent($ftth);
}
}
}
}
// $ftth = HierarchyFtth::find($ftthId->hierarchy_ftth_id);
// if($ftth){
// $round = $gantts/$ganttCount;
// $round_bobot = $bobot_planning/$ganttCount;
// $ftth->progress = round($round, 2);
// $ftth->bobot_planning = round($round_bobot, 2);
// try {
// $ftth->save();
// } catch (\Exception $e) {
// // Log the error or handle it in some other way
// Log::error($e->getMessage());
// }
// if($ftth->parent_id){
// $this->countParent($ftth);
// }
// }
// }
// }
// calculate ke curva berdasarkan site
Artisan::call('calculate:progressgantt', [
'hierarchy_id' => $hierarchy_id
]);
}
public function countParent($ftth){
@ -179,7 +185,6 @@ class HierarchyFtthController extends Controller
public function getTreeByProject($project_id)
{
$this->countProgress(intval($project_id));
$data = HierarchyFtth::where('project_id', $project_id)->whereNull('parent_id')->orderByRaw('id ASC')->get();
$finalData = [];
foreach($data as $objRow){
@ -204,7 +209,13 @@ class HierarchyFtthController extends Controller
return response()->json(['status'=>'success','data'=>$finalData,'code'=>200], 200);
}
public function countProgressTree($hierarchy_id)
{
Artisan::call('calculate:progressgantt', [
'hierarchy_id' => $hierarchy_id
]);
return response()->json(['status'=>'success','code'=>200], 200);
}
private function getChildren($project_id, $parent_id)
{
$finalData = [];

37
app/Http/Controllers/ProjectController.php

@ -360,6 +360,13 @@ class ProjectController extends Controller
return response()->json(['status' => 'success', 'code' => 200, 'data' => $data], 200);
}
// testing
public function calculateSCurvetest(Request $request)
{
$data = MasterFunctionsHelper::calculateSCurve($request->project_id);
return response()->json(['status' => 'success', 'code' => 200, 'data' => $data], 200);
}
public function calculateSCurve(Request $request)
{
$sCurve = Project::select('scurve')->where('id', $request->project_id)->first();
@ -542,16 +549,25 @@ class ProjectController extends Controller
$result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->first();
$actualStartExist = Activity::where('proyek_id', $id)->whereNotNull('actual_start')->exists();
if ($result['type_proyek_id'] === 9) {
$actualEndExist = Activity::where('proyek_id', $id)->exists();
$query = Activity::where('proyek_id', $id);
// $actualEndExist = Activity::where('proyek_id', $id)->exists();
// $query = Activity::where('proyek_id', $id);
$maxEndDate = Activity::where('proyek_id', $id)->select('end_date')
->orderBy('end_date', 'desc')
->first();
} else {
$actualEndExist = Activity::where('version_gantt_id', $ganttId)->exists();
// $actualEndExist = Activity::where('version_gantt_id', $ganttId)->exists();
$maxEndDate = Activity::where('version_gantt_id', $ganttId)->select('end_date')
->orderBy('end_date', 'desc')
->first();
$query = Activity::where('version_gantt_id', $ganttId);
}
} else {
$result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->where("version_gantt_id", $ganttId)->first();
$actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists();
$actualEndExist = Activity::where('version_gantt_id', $ganttId)->exists();
// $actualEndExist = Activity::where('version_gantt_id', $ganttId)->exists();
$maxEndDate = Activity::where('version_gantt_id', $ganttId)->select('end_date')
->orderBy('end_date', 'desc')
->first();
$query = Activity::where('version_gantt_id', $ganttId);
}
@ -560,10 +576,13 @@ class ProjectController extends Controller
} else {
$startDate = $query->orderBy('start_date')->value('start_date');
}
if ($actualEndExist) {
$maxEndDate = $query->max('id');
$endDate = $query->where('id', $maxEndDate)->first()->end_date;
}
// if($actualEndExist)
// {
// // $maxEndDate = $query->max('id');
// // get last end_date
// // $endDate = $query->where('id',$maxEndDate)->first()->end_date;
// }
$plannedStart = Activity::where('version_gantt_id', $ganttId)
->orderBy('planned_start')
@ -572,7 +591,7 @@ class ProjectController extends Controller
->orderByDesc('planned_end')
->value('planned_end');
$result->header->start_date = $startDate;
$result->header->end_date = $endDate;
$result->header->end_date = $maxEndDate->end_date;
$result->header->planned_start = $plannedStart;
$result->header->planned_end = $plannedEnd;
return response()->json(['status' => 'success', 'code' => 200, 'data' => $result, 'gantt' => $ganttId], 200);

3
app/Models/Project.php

@ -48,6 +48,7 @@ class Project extends Model
'created_by',
'updated_at',
'updated_by',
'created_by_id'
'created_by_id',
'company_id'
];
}

120
rest-client.http

@ -1,4 +1,5 @@
@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODQ0NFwvYXBpXC9sb2dpbiIsImlhdCI6MTY5MTc2MDYyNCwiZXhwIjoxNjkyMzY1NDI0LCJuYmYiOjE2OTE3NjA2MjQsImp0aSI6Ikd2bEFPTE4yZ2FuRFdVbjEiLCJzdWIiOjEsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.XNGbsmcgQ-CkV8vLlvnItGKM0R1am5X5b6qUFOR1DRo
@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9iYWNrZW5kLnRlc3RcL2FwaVwvbG9naW4iLCJpYXQiOjE3MDEzNzMzNzQsImV4cCI6MTcwMTk3ODE3NCwibmJmIjoxNzAxMzczMzc0LCJqdGkiOiJhbkJWOHIwUDZndFRXZk5KIiwic3ViIjoxNzg4LCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.QCiXq-62da7Sdk7sEb_J0apEij_R6IQgZVYG9iL6M8g
@tokenS = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hZHctYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjkxNTcyMTIwLCJleHAiOjE2OTIxNzY5MjAsIm5iZiI6MTY5MTU3MjEyMCwianRpIjoiVUdqbnhLRVdlZzYyTTBnayIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.5QqK0dLW5jzbVOkSCSW0mFo0K7ycGOBW9NCG_2Zldm4
@ -6,7 +7,7 @@
# @hostname = https://ospro-api.ospro.id/api
# @hostname = https://api-iu.ospro.id/api
# @hostname = https://api-staging-adw.ospro.id/api
@hostname = http://localhost:8444/api
@hostname = http://backend.test/api
# @hostname = http://103.73.125.81:8444/api
# @hostname = http://localhost:8444/adw-backend/api
@ -17,8 +18,8 @@ POST {{hostname}}/login
content-type: application/json
{
"username": "admin",
"password": "1nt3gr4s14"
"username": "testing",
"password": "testing123"
}
###### Tools Req
@ -418,7 +419,7 @@ content-type: application/json
"operator": "AND"
}
],
"select": ["kode_sortname", "nama", "mulai_proyek"],
"select": ["id", "nama", "rencana_biaya", "type_proyek_id", "currency_symbol", "mulai_proyek", "akhir_proyek"],
"joins": [
{
"name": "m_users",
@ -455,7 +456,43 @@ Authorization: Bearer {{tokenS}}
content-type: application/json
{
"columns":[{"name":"nama","logic_operator":"ilike","value":"","operator":"AND"}],"joins":[{"name":"m_users","column_join":"pm_id","column_results":["name","username"]},{"name":"m_type_proyek","column_join":"type_proyek_id","column_results":["name","description"]}],"orders":{"columns":["id"],"ascending":false},"paging":{"start":0,"length":10}
"columns": [
{
"name": "nama",
"logic_operator": "ilike",
"value": "",
"operator": "AND"
}
],
"select": ["id", "nama", "rencana_biaya", "color_progress", "currency_symbol", "mulai_proyek", "akhir_proyek"],
"joins": [
{
"name": "m_users",
"column_join": "pm_id",
"column_results": [
"name",
"username"
]
},
{
"name": "m_type_proyek",
"column_join": "type_proyek_id",
"column_results": [
"name",
"description"
]
}
],
"orders": {
"columns": [
"id"
],
"ascending": false
},
"paging": {
"start": 0,
"length": 10
}
}
### add
@ -529,7 +566,7 @@ content-type: application/json
###### Activity
### get data by id version
GET {{hostname}}/activity/33/29/get
GET {{hostname}}/activity/550/137/get
Authorization: Bearer {{token}}
content-type: application/json
@ -785,24 +822,44 @@ content-type: application/json
###
POST {{hostname}}/activity/get-curva-s
POST {{hostname}}/dashboard/curva-s
Authorization: Bearer {{token}}
content-type: application/json
{
"project_id": [47],
"period": "week"
"project_id": [15]
}
###
POST {{hostname}}/project/s-curve-command-test
Authorization: Bearer {{token}}
content-type: application/json
# {"period":"week","project_id":"137","gantt_id":"916"}
# {"period":"week","project_id":"129","gantt_id":"862"}
{"period":"week","project_id":"140","gantt_id":"1103"}
###
POST {{hostname}}/dashboard/curva-s
POST {{hostname}}/project/calculate-s-curve
Authorization: Bearer {{token}}
content-type: application/json
{"period":"week","project_id":"129","gantt_id":"862"}
### {"period":"week","project_id":"135","gantt_id":"891"}
#######
POST {{hostname}}/project/get-s-curve
Authorization: Bearer {{token}}
content-type: application/json
{"project_id":"164","gantt_id":"973","period":"week"}
### {"period":"week","project_id":"129","gantt_id":"800"}
#######
GET {{hostname}}/activity/s-curve/137/892
Authorization: Bearer {{token}}
content-type: application/json
{
"project_id": [15]
}
###
GET https://adw-api.ospro.id/api/request-material/get-material-integration?name=c
@ -957,6 +1014,27 @@ content-type: application/json
"user_id": 1247
}
# -6.226761,106.809311 jkarta
# -6.465806,106.760559
# -6.356175,108.336182 indramayu
# -6.266805,106.468048, tigaraksa
# -6.205115,106.918373 jatinegara
######
POST {{hostname}}/presence/test
Authorization: Bearer {{token}}
content-type: application/json
{
"clock_in_out": {
"clock_out_lat": -6.356175,
"clock_out_lng": 108.336182,
"type" : "out"
},
"time": "2023-08-15T14:48:17+07:00",
"user_id": 1566
}
######
POST {{hostname}}/presence/add
Authorization: Bearer {{token}}
@ -1016,9 +1094,7 @@ POST {{hostname}}/map-monitoring/search
Authorization: Bearer {{token}}
content-type: application/json
{
"project_id" : [75, 76, 78]
}
{"project_id":[140,138,132,130]}
######
POST {{hostname}}/waypoint/add-bulk
@ -1159,13 +1235,3 @@ content-type: application/json
}
}
#######
POST {{hostname}}/project/get-s-curve
Authorization: Bearer {{token}}
content-type: application/json
{
"period":"week",
"project_id":"118",
"gantt_id":"287"
}

9
routes/web.php

@ -23,7 +23,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->group(['middleware' => ['auth', 'cors']], function () use ($router) {
$router->get('/dashboard/get-company-cashflow[/{year}]', 'DashboardBoDController@getCompanyCashFlow'); // project expenditure
$router->get('/dashboard/get-company-cashflow/{year}/{company_id}/{all_project}/{hierarchy}', 'DashboardBoDController@getCompanyCashFlow'); // project expenditure
$router->get('/dashboard/get-invoice-outstanding[/{year}]', 'DashboardBoDController@getInvoiceOutstanding'); // project invoice vs cash in
$router->get('/dashboard/get-total-project-per-schedule-health[/{year}]', 'DashboardBoDController@getTotalProjectPerScheduleHealth');
$router->get('/dashboard/get-total-project-per-budget-health[/{year}]', 'DashboardBoDController@getTotalProjectPerBudgetHealth');
@ -69,17 +69,19 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->post('/project/get-s-curve', 'ProjectController@getSCurve');
$router->post('/project/calculate-s-curve', 'ProjectController@calculateSCurve');
$router->post('/project/s-curve-command', 'ProjectController@sCurveCommand');
$router->post('/project/s-curve-command-test', 'ProjectController@calculateSCurvetest');
$router->post('/project/get-linear-s-curve', 'ProjectController@getLinearSCurve');
$router->post('/project/get-overdue-activities', 'ProjectController@getOverdueActivities');
$router->post('/project/get-integration-invoice', 'ProjectController@getInvoiceIntegration');
$router->post('/project/get-report-distribution', 'ProjectController@getReportDistribution');
/* $router->get('/project/get-expenditure/{id}/{date?}', 'ProjectController@getExpenditure'); */
/* $router->get('/project/get-total-expenditure/{id}', 'ProjectController@getTotalExpenditure'); */
/* $router->get('/project/get-status-health-schedule/{id}', 'ProjectController@getStatusSchedule'); */
/* $router->get('/project/get-status-health-budget/{id}', 'ProjectController@getStatusBudget'); */
$router->get('/project-carausell','ProjectCarausellController@invoke');
$router->get('/project-carausell', 'ProjectCarausellController@invoke');
$router->post('/project-charter/search', 'ProjectCharterController@search');
$router->post('/project-charter/add', 'ProjectCharterController@add');
@ -214,6 +216,8 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->post('/activity/import-old', 'ActivityController@importOld');
$router->post('/activity/batch-update/{ganttId}', 'ActivityController@batchUpdate');
$router->get('/activity/update-schedule/{ganttId}', 'ActivityController@updateSchedule');
$router->get('/activity/s-curve/{proyek_id}/{gantt_id}', 'ActivityController@activitySCurve');
$router->post('/task', 'ActivityController@add');
$router->get('/task/edit/{id}', 'ActivityController@edit');
$router->put('/task/{id}', 'ActivityController@update');
@ -488,6 +492,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->put('/hierarchy-ftths/{id}', 'HierarchyFtthController@update');
$router->delete('/hierarchy-ftths/{id}', 'HierarchyFtthController@destroy');
$router->get('/hierarchy-ftths/tree/{project_id}', 'HierarchyFtthController@getTreeByProject');
$router->get('/hierarchy-ftths/count-tree/{hierarchy_id}', 'HierarchyFtthController@countProgressTree');
$router->get('/hierarchy-ftths/tree-gantt/{gantt_id}', 'HierarchyFtthController@getTreeByGantt');
$router->post('/map-monitoring/search', 'MapMonitoringController@search');

Loading…
Cancel
Save