Browse Source

get pull

pull/3/head
wahyuun 1 year ago
parent
commit
3d62b5cdd3
  1. 3
      Dockerfile
  2. 6
      app/Console/Commands/syncHumanResourceIntegration.php
  3. 42
      app/Helpers/MasterFunctionsHelper.php
  4. 121
      app/Http/Controllers/ActivityController.php
  5. 153
      app/Http/Controllers/BroadcastController.php
  6. 42
      app/Http/Controllers/Controller.php
  7. 69
      app/Http/Controllers/DashboardBoDController.php
  8. 23
      app/Http/Controllers/HumanResourceController.php
  9. 28
      app/Http/Controllers/MapMonitoringController.php
  10. 147
      app/Http/Controllers/PresenceController.php
  11. 325
      app/Http/Controllers/ProjectController.php
  12. 2
      app/Http/Controllers/RequestMaterialController.php
  13. 6
      app/Http/Controllers/ShowHideColumnController.php
  14. 2
      app/Http/Controllers/UserToProyekController.php
  15. 36
      app/Jobs/ProcessSCurve.php
  16. 6
      app/Models/Activity.php
  17. 2
      app/Models/AssignMaterial.php
  18. 2
      app/Models/Broadcast.php
  19. 4
      app/Models/UserToProyek.php
  20. 49
      app/Services/FCMService.php
  21. 1
      bootstrap/app.php
  22. 2
      config/api.php
  23. 5
      config/fcm.php
  24. 36
      database/migrations/2023_08_29_130624_create_jobs_table.php
  25. 9
      docker/nginx/conf.d/default.conf
  26. 1947
      docker/php/php.ini
  27. 72
      rest-client.http
  28. 10
      routes/web.php

3
Dockerfile

@ -29,6 +29,9 @@ RUN docker-php-ext-install \
pgsql \ pgsql \
tokenizer tokenizer
# Copy php.ini to the container
COPY /docker/php/php.ini /usr/local/etc/php/
#Install Extensions #Install Extensions
RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql

6
app/Console/Commands/syncHumanResourceIntegration.php

@ -39,9 +39,9 @@ class syncHumanResourceIntegration extends Command
*/ */
public function handle() public function handle()
{ {
// $url = config('api.adw').'/employees?page=1'; $url = config('api.adw').'/employees?page=1';
// echo "Requesting to " . $url; echo "Requesting to " . $url;
$response = null; $response = MasterFunctionsHelper::curlReq($url);
if(!$response) if(!$response)
return; return;

42
app/Helpers/MasterFunctionsHelper.php

@ -189,13 +189,18 @@ class MasterFunctionsHelper
/* $interval = \DateInterval::createFromDateString('1 day'); */// should be using this but its bugged /* $interval = \DateInterval::createFromDateString('1 day'); */// should be using this but its bugged
$interval = new \DateInterval('P7D'); $interval = new \DateInterval('P7D');
} else { } else {
$maxDate = DB::table('assign_material_to_activity as ama') $actualMaxDate = DB::table('assign_material_to_activity as ama')
->where("ama.proyek_id", $keyGantt['proyek_id']) ->where("ama.proyek_id", $keyGantt['proyek_id'])
->join('m_activity as a', 'a.id', '=', 'ama.activity_id') ->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
->where('a.version_gantt_id', '=', $keyGantt['id']) ->where('a.version_gantt_id', '=', $keyGantt['id'])
->max("plan_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's ->max("a.end_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's
$end = new \DateTime($maxDate . ' Friday'); $plannedMaxDate = DB::table('assign_material_to_activity as ama')
$end->modify('next Friday'); ->where("ama.proyek_id", $keyGantt['proyek_id'])
->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
->where('a.version_gantt_id', '=', $keyGantt['id'])
->max("a.planned_end"); // plan date overlapped with assign_material_to_activity's, it should be m_activity'
$maxDate = max(new \DateTime($plannedMaxDate), new \DateTime($actualMaxDate));
$end = new \DateTime($maxDate->format('Y-m-d') . ' Friday');
$end->modify('next Friday'); $end->modify('next Friday');
$interval = new \DateInterval('P7D'); $interval = new \DateInterval('P7D');
} }
@ -422,6 +427,8 @@ class MasterFunctionsHelper
$potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN";
} }
$lastReal = $tempPercentageReal[count($tempPercentageReal) - 1];
$totalBCWP = $lastReal * $dataProject->rencana_biaya / 100;
$dataResponse = array( $dataResponse = array(
"date" => $tempDate, "date" => $tempDate,
"percentage" => $tempPercentage, "percentage" => $tempPercentage,
@ -600,6 +607,12 @@ class MasterFunctionsHelper
->where('activity_id', '=', $keyActualM->activity_id) ->where('activity_id', '=', $keyActualM->activity_id)
->groupBy('activity_id') ->groupBy('activity_id')
->first(); ->first();
if (!isset($sumVolActual)) {
$sumVolActual = (object) [
'activity_id' => $keyActualM->activity_id,
'ttl_qty_plan' => "0"
];
}
$sumReportActual = DB::table('report_activity_material') $sumReportActual = DB::table('report_activity_material')
->where('activity_id', $keyActualM->activity_id) ->where('activity_id', $keyActualM->activity_id)
->sum('qty'); ->sum('qty');
@ -619,18 +632,29 @@ class MasterFunctionsHelper
->where('activity_id', '=', $keyActualM->activity_id) ->where('activity_id', '=', $keyActualM->activity_id)
->orderBy('status_activity', 'ASC') ->orderBy('status_activity', 'ASC')
->first(); ->first();
$dataTempReport[$w]['percentage'] = ($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning; if (!isset($checkStatusActivity)) {
$checkStatusActivity = (object) [
'activity_id' => $keyActualM->activity_id,
'status_activity' => 'open'
];
}
if ($sumVolActual->ttl_qty_plan == "0") {
$actual = 0;
} else {
$actual = $keyActualM->qty / $sumVolActual->ttl_qty_plan;
}
$dataTempReport[$w]['percentage'] = $actual * $keyActualM->bobot_planning;
// $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; // $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning;
// if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ // if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){
if ($checkStatusActivity->status_activity == 'done') { if ($checkStatusActivity->status_activity == 'done') {
$sumPercentageActual += $keyActualM->bobot_planning / $reportCount; $sumPercentageActual += $keyActualM->bobot_planning / $reportCount;
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
} else { } else {
if ($keyActualM->qty / $sumVolActual->ttl_qty_plan >= 1 || (int) $sumVolActual->ttl_qty_plan == (int) $sumReportActual) { if ( $actual >= 1 || (int) $sumVolActual->ttl_qty_plan == (int) $sumReportActual) {
$sumPercentageActual += (($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning) * (95 / 100); $sumPercentageActual += ($actual * $keyActualM->bobot_planning) * (95 / 100);
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
} else { } else {
$sumPercentageActual += ($keyActualM->qty / $sumVolActual->ttl_qty_plan) * $keyActualM->bobot_planning; $sumPercentageActual += $actual * $keyActualM->bobot_planning;
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
} }
} }
@ -698,6 +722,8 @@ class MasterFunctionsHelper
$potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN"; $potential = $costDeviation == 0 ? "ON BUDGET" : "OVERRUN";
} }
$lastReal = $tempPercentageReal[count($tempPercentageReal) - 1];
$totalBCWP = $lastReal * $dataProject->rencana_biaya / 100;
$dataResponse = array( $dataResponse = array(
"date" => $tempDate, "date" => $tempDate,
"percentage" => $tempPercentage, "percentage" => $tempPercentage,

121
app/Http/Controllers/ActivityController.php

@ -36,7 +36,8 @@ class ActivityController extends Controller
private function getDataActivity($id) private function getDataActivity($id)
{ {
$checkHeader = Activity::where('version_gantt_id', $id)->where('type_activity', 'header')->count(); $finalData = []; $checkHeader = Activity::where('version_gantt_id', $id)->where('type_activity', 'header')->count();
$finalData = [];
if ($checkHeader > 0) { if ($checkHeader > 0) {
$dataHeader = Activity::where('version_gantt_id', $id)->where('type_activity', 'header')->first(); $dataHeader = Activity::where('version_gantt_id', $id)->where('type_activity', 'header')->first();
$startDate = date_create($dataHeader->start_date); $startDate = date_create($dataHeader->start_date);
@ -46,6 +47,12 @@ class ActivityController extends Controller
$dataHeader->progress = $dataHeader->persentase_progress / 100; $dataHeader->progress = $dataHeader->persentase_progress / 100;
$dataHeader->planned_start = isset($dataHeader->planned_start) ? date_format(date_create($dataHeader->planned_start), "Y-m-d H:i:s") : NULL; $dataHeader->planned_start = isset($dataHeader->planned_start) ? date_format(date_create($dataHeader->planned_start), "Y-m-d H:i:s") : NULL;
$dataHeader->planned_end = isset($dataHeader->planned_end) ? date_format(date_create($dataHeader->planned_end), "Y-m-d H:i:s") : NULL; $dataHeader->planned_end = isset($dataHeader->planned_end) ? date_format(date_create($dataHeader->planned_end), "Y-m-d H:i:s") : NULL;
$actualStart = $this->getActivityFirst($dataHeader->id);
$dataHeader->actual_start = date_format(date_create($actualStart), "Y-m-d");
$actualEnd = $this->getActivityLast($dataHeader->id);
$dataHeader->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL;
$dataHeader->type = "header"; $dataHeader->type = "header";
$dataHeader->text = $dataHeader->name; $dataHeader->text = $dataHeader->name;
$finalData[] = $dataHeader; $finalData[] = $dataHeader;
@ -71,6 +78,12 @@ class ActivityController extends Controller
$objRow->end_date = date_format($endDate, "Y-m-d H:i:s"); $objRow->end_date = date_format($endDate, "Y-m-d H:i:s");
$objRow->planned_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start), "Y-m-d H:i:s") : NULL; $objRow->planned_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start), "Y-m-d H:i:s") : NULL;
$objRow->planned_end = isset($objRow->planned_end) ? date_format(date_create($objRow->planned_end), "Y-m-d H:i:s") : NULL; $objRow->planned_end = isset($objRow->planned_end) ? date_format(date_create($objRow->planned_end), "Y-m-d H:i:s") : NULL;
$actualStart = $this->getActivityFirst($objRow->id);
$objRow->actual_start = isset($actualStart) ? date_format(date_create($actualStart), "Y-m-d") : NULL;
$actualEnd = $this->getActivityLast($objRow->id);
$objRow->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL;
$objRow->progress = $objRow->persentase_progress / 100; $objRow->progress = $objRow->persentase_progress / 100;
$objRow->type = $type; $objRow->type = $type;
$finalData[] = $objRow; $finalData[] = $objRow;
@ -79,8 +92,7 @@ class ActivityController extends Controller
$dataLink = Link::where('version_gantt_id', $id)->get(); $dataLink = Link::where('version_gantt_id', $id)->get();
$finalLink = []; $finalLink = [];
foreach($dataLink as $objRow) foreach ($dataLink as $objRow) {
{
$dataRow = array( $dataRow = array(
'id' => $objRow->id, 'id' => $objRow->id,
'source' => $objRow->s_activity_id, 'source' => $objRow->s_activity_id,
@ -115,13 +127,25 @@ class ActivityController extends Controller
$objRow->end_date = date_format($endDate, "Y-m-d H:i:s"); $objRow->end_date = date_format($endDate, "Y-m-d H:i:s");
$objRow->planned_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start), "Y-m-d H:i:s") : NULL; $objRow->planned_start = isset($objRow->planned_start) ? date_format(date_create($objRow->planned_start), "Y-m-d H:i:s") : NULL;
$objRow->planned_end = isset($objRow->planned_end) ? date_format(date_create($objRow->planned_end), "Y-m-d H:i:s") : NULL; $objRow->planned_end = isset($objRow->planned_end) ? date_format(date_create($objRow->planned_end), "Y-m-d H:i:s") : NULL;
$dataChildren = $this->getChildren($gantt_id, $objRow->id); $dataChildren = $this->getChildren($gantt_id, $objRow->id);
if ($objRow->type_activity == "milestone") { if ($objRow->type_activity == "milestone") {
$objRow->type = $objRow->type_activity; $objRow->type = $objRow->type_activity;
$objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL;
} elseif (empty($dataChildren)) { } elseif (empty($dataChildren)) {
$objRow->type = "task"; $objRow->type = "task";
$objRow->actual_start = isset($objRow->actual_start) ? date_format(date_create($objRow->actual_start), "Y-m-d") : NULL;
$objRow->actual_end = isset($objRow->actual_end) ? date_format(date_create($objRow->actual_end), "Y-m-d") : NULL;
if(isset($objRow->actual_start)){
$objRow->auto_scheduling = false;
}
} else { } else {
$objRow->type = "project"; $objRow->type = "project";
$actualStart = $this->getActivityFirst($objRow->id);
$objRow->actual_start = isset($actualStart) ? date_format(date_create($actualStart), "Y-m-d") : NULL;
$actualEnd = $this->getActivityLast($objRow->id);
$objRow->actual_end = isset($actualEnd) ? date_format(date_create($actualEnd), "Y-m-d") : NULL;
} }
$finalData[] = $objRow; $finalData[] = $objRow;
$finalData = array_merge($finalData, $dataChildren); $finalData = array_merge($finalData, $dataChildren);
@ -129,7 +153,36 @@ class ActivityController extends Controller
return $finalData; return $finalData;
} }
private function cloneTemplate($id, $proyek_id, $hierarchy_ftth_id = null) { public function getActivityFirst($parentId){
$activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_start ASC')->first();
if (!isset($activity)) {
return null;
}
if($activity->type_activity == "task"){
// Log::info("activity ", [$activity]);
return $activity->actual_start;
}else{
return $this->getActivityFirst($activity->id);
}
}
public function getActivityLast($parentId){
$activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_end DESC')->first();
if (!isset($activity)) {
return null;
}
if($activity->type_activity == "task"){
// Log::info("activity ", [$activity]);
return $activity->actual_end;
}else{
return $this->getActivityLast($activity->id);
}
}
private function cloneTemplate($id, $proyek_id, $hierarchy_ftth_id = null)
{
$project = Project::find($proyek_id); $project = Project::find($proyek_id);
if ($hierarchy_ftth_id) { if ($hierarchy_ftth_id) {
$gantt = VersionGantt::find($id); $gantt = VersionGantt::find($id);
@ -215,7 +268,9 @@ class ActivityController extends Controller
$data['created_by'] = $this->currentName; $data['created_by'] = $this->currentName;
$max = Activity::where('version_gantt_id', $request->version_gantt_id)->max('sortorder'); $max = Activity::where('version_gantt_id', $request->version_gantt_id)->max('sortorder');
$data['sortorder'] = $max + 1; $data['sortorder'] = $max + 1;
if (!isset($data['type_activity'])) {
$data['type_activity'] = "task"; $data['type_activity'] = "task";
}
$parent = $data['parent_id'] ?? null; $parent = $data['parent_id'] ?? null;
if ($parent) { if ($parent) {
@ -233,7 +288,8 @@ class ActivityController extends Controller
return response()->json(['status' => 'success', 'action' => 'inserted', 'tid' => $result->id, 'code' => 200], 200); return response()->json(['status' => 'success', 'action' => 'inserted', 'tid' => $result->id, 'code' => 200], 200);
} }
public function edit($id){ public function edit($id)
{
if (empty($id) || !is_int((int) $id)) if (empty($id) || !is_int((int) $id))
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400);
@ -270,7 +326,8 @@ class ActivityController extends Controller
return response()->json(['status' => 'success', 'update_bobot' => $updateBobot, 'data' => $dataUpdate, 'action' => 'updated', 'message' => 'Activity updated!', 'code' => 200], 200); return response()->json(['status' => 'success', 'update_bobot' => $updateBobot, 'data' => $dataUpdate, 'action' => 'updated', 'message' => 'Activity updated!', 'code' => 200], 200);
} }
private function updateOrder($taskId, $target){ private function updateOrder($taskId, $target)
{
$nextTask = false; $nextTask = false;
$targetId = $target; $targetId = $target;
@ -293,7 +350,8 @@ class ActivityController extends Controller
$updatedTask->save(); $updatedTask->save();
} }
public function updateRegular(Request $request, $id){ public function updateRegular(Request $request, $id)
{
if (empty($id) || !is_int((int) $id)) if (empty($id) || !is_int((int) $id))
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400);
@ -308,6 +366,37 @@ class ActivityController extends Controller
return response()->json(['status' => 'success', 'message' => 'Activity Updated!', 'code' => 200], 200); return response()->json(['status' => 'success', 'message' => 'Activity Updated!', 'code' => 200], 200);
} }
public function batchUpdate(Request $request, $ganttId)
{
$entities = $request->all();
if (empty($ganttId) || !is_int((int) $ganttId))
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400);
$activity = Activity::where('version_gantt_id',$ganttId)->get();
$link = Link::where('version_gantt_id', $ganttId)->get();
if (!$activity)
return response()->json(['status' => 'failed', 'message' => 'Activity not found!', 'code' => 404], 404);
if (!$link)
return response()->json(['status' => 'failed', 'message' => 'Link not found!', 'code' => 404], 404);
foreach ($entities as $entity) {
if ($entity['entity'] == "task") {
$activityToUpdate = $activity->firstWhere('id', $entity['data']['id']);
$entity['data']['name'] = $entity['data']['text'];
$entity['data']['persentase_progress'] = $entity['data']['progress'] * 100;
if (isset($entity['data']['target'])) {
$this->updateOrder($entity['data']['id'], $entity['data']['target']);
}
if(!$activityToUpdate->update($entity['data']))
return response()->json(['status' => 'failed', 'message' => 'Failed to update activity !', 'code' => 500], 500);
$updatedJobsDone = $activityToUpdate->jobs_done;
} else if ($entity['entity'] == "link"){
$linkToUpdate = $link->firstWhere('id', $entity['data']['id']);
if(!$linkToUpdate->update($entity['data']))
return response()->json(['status' => 'failed', 'message' => 'Failed to update link !', 'code' => 500], 500);
}
}
return response()->json(['status' => 'success', 'message' => 'Activity Updated!', 'code' => 200], 200);
}
public function delete($id) public function delete($id)
{ {
if (!$data = Activity::find($id)) if (!$data = Activity::find($id))
@ -349,7 +438,7 @@ class ActivityController extends Controller
Activity::where('version_gantt_id', $data['ganttId'])->delete(); Activity::where('version_gantt_id', $data['ganttId'])->delete();
$projectId = VersionGantt::where('id', $data['ganttId'])->first()->proyek_id; $projectId = VersionGantt::where('id', $data['ganttId'])->first()->proyek_id;
$dayOffs = VersionGantt::find($data['ganttId'])->first()->config_dayoff; $dayOffs = VersionGantt::where('id', $data['ganttId'])->first()->config_dayoff;
$activityStack = []; $activityStack = [];
@ -396,7 +485,8 @@ class ActivityController extends Controller
$data['activities'][$key]['weight'] = $parentWeight / $siblingsCount; $data['activities'][$key]['weight'] = $parentWeight / $siblingsCount;
} }
}; }
;
} }
$projectStart = Project::select('mulai_proyek')->where('id', $projectId)->first(); $projectStart = Project::select('mulai_proyek')->where('id', $projectId)->first();
foreach ($data['activities'] as $i => $activity_row) { foreach ($data['activities'] as $i => $activity_row) {
@ -457,8 +547,12 @@ class ActivityController extends Controller
do { do {
array_pop($activityStack); array_pop($activityStack);
$lastStack = end($activityStack); $lastStack = end($activityStack);
if ($lastStack) {
if ($activity->level > $lastStack->level) if ($activity->level > $lastStack->level)
$lastStackIsNotRight = false; $lastStackIsNotRight = false;
} else {
$lastStackIsNotRight = false;
}
} while ($lastStackIsNotRight); } while ($lastStackIsNotRight);
} }
@ -527,7 +621,8 @@ class ActivityController extends Controller
return response()->json(['stack' => $activityStack, 'status' => 'success', 'message' => 'Data imported!', 'projectId' => $projectId, 'code' => 200], 200); return response()->json(['stack' => $activityStack, 'status' => 'success', 'message' => 'Data imported!', 'projectId' => $projectId, 'code' => 200], 200);
} }
private function getLatestGantt($id){ private function getLatestGantt($id)
{
$maxGanttId = VersionGantt::where("proyek_id", $id)->max("id"); $maxGanttId = VersionGantt::where("proyek_id", $id)->max("id");
$data = array( $data = array(
"last_gantt_id" => $maxGanttId, "last_gantt_id" => $maxGanttId,
@ -696,7 +791,8 @@ class ActivityController extends Controller
"date" => $tempDate, "date" => $tempDate,
"percentage" => $tempPercentage, "percentage" => $tempPercentage,
"data_details" => $arr_ActualM, "data_details" => $arr_ActualM,
"budget_control" =>array("current_budget"=> $totalRencanaBudget, "budget_control" => array(
"current_budget" => $totalRencanaBudget,
"acwp" => round($totalACWP, 0), "acwp" => round($totalACWP, 0),
"bcwp" => round($totalBCWP, 0), "bcwp" => round($totalBCWP, 0),
"rem_to_complete" => ($totalRencanaBudget - round($totalACWP, 0)), "rem_to_complete" => ($totalRencanaBudget - round($totalACWP, 0)),
@ -756,7 +852,8 @@ class ActivityController extends Controller
return response()->json(['status' => 'failed', 'message' => 'File is required!', 'code' => 400], 400); return response()->json(['status' => 'failed', 'message' => 'File is required!', 'code' => 400], 400);
} }
public function importUpdate(Request $request) { public function importUpdate(Request $request)
{
$data = $request->all(); $data = $request->all();
foreach ($data as $value) { foreach ($data as $value) {
$activity = Activity::find($value['id']); $activity = Activity::find($value['id']);

153
app/Http/Controllers/BroadcastController.php

@ -3,7 +3,160 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Broadcast;
use App\Models\User;
use App\Services\FCMService;
class BroadcastController extends Controller class BroadcastController extends Controller
{ {
public function add(Request $request)
{
$data = $request->all();
$data['status_send'] = true;
$data['created_by'] = $this->currentName;
// dd($data);
$result = Broadcast::create($data);
if($result){
$this->sendNotification($data);
return response()->json(['status'=>'success','message'=>'add broadcast successfully!','code'=>200], 200);
}else{
return response()->json(['status'=>'failed','message'=>'add broadcast failed!','code'=>400], 400);
}
}
public function edit($id){
if(!$id || (int) $id < 0 || $id==""){
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
die();
}
$result = Broadcast::find($id);
if($result){
return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200);
}else{
return response()->json(['status'=>'failed','message'=>'failed get data broadcast, please try again later!','code'=>400], 400);
}
}
public function update(Request $request, $id)
{
if(!$id || (int) $id < 0 || $id==""){
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
}
$data = Broadcast::find($id);
if($data){
$result = $data->update($request->all());
}else{
return response()->json(['status'=>'failed','message'=>'data broadcast not found!','code'=>400], 400);
die();
}
if($result){
return response()->json(['status'=>'success','message'=>'data broadcast successfully updated!','code'=>200], 200);
}else{
return response()->json(['status'=>'failed','message'=>'data broadcast failed updated!','code'=>400], 400);
}
}
public function delete($id)
{
$data = Broadcast::find($id);
if($data){
$delete = $data->delete();
}else{
return response()->json(['status'=>'failed','message'=>'data broadcast not found!','code'=>400], 400);
die();
}
if($delete){
return response()->json(['status'=>'success','message'=>'data broadcast successfully deleted!','code'=>200], 200);
}else{
return response()->json(['status'=>'failed','message'=>'data broadcast failed deleted!','code'=>400], 400);
}
}
public function search(Request $request)
{
$payload = $request->all();
$dataBuilder = $this->setUpPayload($payload, 'm_broadcast');
$builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count'];
$dataGet = $builder->get();
$totalRecord = $countBuilder->count();
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);
}
public function list()
{
$data = Broadcast::all();
$countData = $data->count();
if($data){
return response()->json(['status'=>'success','code'=>200,'data'=>$data, 'totalRecord'=>$countData], 200);
}else{
return response()->json(['status'=>'failed','message'=>'failed get list broadcast, please try again later!','code'=>400], 400);
}
}
public function sendNotification($data)
{
// send_to_type (all, roles, user)
if (isset($data['send_to_type'])) {
switch ($data['send_to_type']) {
case 'all':
$users = User::whereNotNull('fcm_token')->get();
if (isset($users)) {
foreach ($users as $user) {
FCMService::send(
$user->fcm_token,
[
'title' => $data['title_notif'],
'body' => $data['message_notif'],
]
);
}
}
break;
case 'roles':
$users = User::where("role_id", $data['send_to_id'])->whereNotNull('fcm_token')->get();
if (isset($users)) {
foreach ($users as $user) {
FCMService::send(
$user->fcm_token,
[
'title' => $data['title_notif'],
'body' => $data['message_notif'],
]
);
}
}
break;
case 'user':
$user = User::where("id", $data['send_to_id'])->whereNotNull('fcm_token')->first();
if (isset($user)) {
FCMService::send(
$user->fcm_token,
[
'title' => $data['title_notif'],
'body' => $data['message_notif'],
]
);
}
break;
default:
# code...
break;
}
}
}
} }

42
app/Http/Controllers/Controller.php

@ -1,27 +1,23 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Activity;
use App\Models\UserToProyek;
use App\Models\AssignMaterial;
use App\Models\ReportK3Detail;
use App\Models\UserToActivity;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use App\Models\UserToActivity;
use App\Models\Activity;
use App\Models\AssignMaterial;
use Laravel\Lumen\Routing\Controller as BaseController; use Laravel\Lumen\Routing\Controller as BaseController;
use App\Models\ReportK3Detail;
class Controller extends BaseController class Controller extends BaseController
{ {
protected $pathImage = "assets/image/"; protected $pathImage = "assets/image/";
protected $pathDocument = "assets/file/project/"; protected $pathDocument = "assets/file/project/";
protected $pathTmpImport = "assets/file/tmpimport/"; protected $pathTmpImport = "assets/file/tmpimport/";
protected $pathActivityDocument = "assets/file/activity/"; protected $pathActivityDocument = "assets/file/activity/";
protected $listJoinAll = [ protected $listJoinAll = ['first', 'second', 'third', 'fourth', 'fifth',
'first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth'];
'sixth', 'seventh', 'eighth', 'ninth', 'tenth'
];
protected $currentDate; protected $currentDate;
protected $currentName; protected $currentName;
protected $currentId; protected $currentId;
@ -41,8 +37,15 @@ class Controller extends BaseController
{ {
$alias = "selfTable"; $alias = "selfTable";
$builder = DB::table($tableSelf." AS ".$alias); $builder = DB::table($tableSelf." AS ".$alias);
$builder = $builder->select($alias . ".*"); // $builder = $builder->select($alias.".*");
if($condition){ if($condition){
if(isset($condition['select'])){
foreach($condition['select'] as $select){
$builder = $builder->addSelect($alias.".".$select);
}
}else{
$builder = $builder->addSelect($alias.".*");
}
if(isset($condition['joins'])){ if(isset($condition['joins'])){
$selectColumn = []; $selectColumn = [];
$no = 0; $no = 0;
@ -179,8 +182,7 @@ class Controller extends BaseController
return $query; return $query;
} }
private function whereConditionSingleTable($oldQuery, $operator, $column, $value, $value2) private function whereConditionSingleTable($oldQuery, $operator, $column, $value, $value2){
{
$query = $oldQuery; $query = $oldQuery;
if($operator=="range"){ if($operator=="range"){
$query = $query->whereBetween($column, [$value, $value2]); $query = $query->whereBetween($column, [$value, $value2]);
@ -221,8 +223,7 @@ class Controller extends BaseController
return $query; return $query;
} }
protected function calculateAllCost($activity_id, $proyek_id) protected function calculateAllCost($activity_id, $proyek_id){
{
$humanCostPlanning = $this->calculateAllHumanCost($activity_id, $proyek_id); $humanCostPlanning = $this->calculateAllHumanCost($activity_id, $proyek_id);
$materialCostPlanning = $this->calculateMaterialCost($activity_id, $proyek_id); $materialCostPlanning = $this->calculateMaterialCost($activity_id, $proyek_id);
$toolsCostPlanning = 0; $toolsCostPlanning = 0;
@ -270,8 +271,7 @@ class Controller extends BaseController
return $totalCost; return $totalCost;
} }
protected function getLoc($lat, $lng) protected function getLoc($lat, $lng){
{
// $response = Http::get(config('api.nominatim') . "/reverse?lat=".$lat."&lon=".$lng."&format=json"); // $response = Http::get(config('api.nominatim') . "/reverse?lat=".$lat."&lon=".$lng."&format=json");
// return $response->json; // return $response->json;
@ -281,8 +281,7 @@ class Controller extends BaseController
return $response; return $response;
} }
private function curlRequest($url) private function curlRequest($url){
{
$ch = curl_init(); $ch = curl_init();
// $headers = [ // $headers = [
// 'Authorization: '.$token // 'Authorization: '.$token
@ -299,8 +298,7 @@ class Controller extends BaseController
return json_decode($response); return json_decode($response);
} }
protected function addDetailK3($dataDetail, $report_id) protected function addDetailK3($dataDetail, $report_id){
{
foreach ($dataDetail as $value) { foreach ($dataDetail as $value) {
$dataNew = array( $dataNew = array(
"report_k3_id"=>$report_id, "report_k3_id"=>$report_id,

69
app/Http/Controllers/DashboardBoDController.php

@ -14,13 +14,15 @@ use Illuminate\Support\Facades\Log;
class DashboardBoDController extends Controller class DashboardBoDController extends Controller
{ {
private function interpolateYear($year){ private function interpolateYear($year)
{
if ($year) if ($year)
$year = '%' . $year . '%'; $year = '%' . $year . '%';
return $year; return $year;
} }
private function curlReq($url, $token){ private function curlReq($url, $token)
{
$ch = curl_init(); $ch = curl_init();
$headers = [ $headers = [
'Authorization: ' . $token 'Authorization: ' . $token
@ -37,22 +39,24 @@ class DashboardBoDController extends Controller
return json_decode($response); return json_decode($response);
} }
private function getInvoiceIntegration($search) { 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');
// $token = config('api.adw_token'); $url = str_replace("SEARCH", $search, config('api.adw').'/project_cost?project_no=SEARCH');
// $response = $this->curlReq($url, $token); $token = config('api.adw_token');
// $response = $this->curlReq($url, $token);
// if(@$response->data->project_no == "")
// return null; if(@$response->data->project_no == "")
//
return null; return null;
return $response;
} }
// to do // to do
public function getCompanyCashFlow($year = '%') { public function getCompanyCashFlow($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$totalExpenditure = $totalInvoice = $totalPaidInvoice = 0; $totalExpenditure = $totalInvoice = $totalPaidInvoice = 0;
@ -92,7 +96,8 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getInvoiceOutstanding($year = '%'){ public function getInvoiceOutstanding($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$projects = Project::where('mulai_proyek', 'like', $year) $projects = Project::where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */ /* ->orWhere('akhir_proyek', 'like', $year) */
@ -117,7 +122,8 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getTotalProjectPerScheduleHealth($year = '%'){ public function getTotalProjectPerScheduleHealth($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$return = [ $return = [
@ -152,7 +158,8 @@ class DashboardBoDController extends Controller
return response()->json(['data' => $return, 'q' => $projects], 200); return response()->json(['data' => $return, 'q' => $projects], 200);
} }
public function getTotalProjectScheduleHealthPerDivision($year = '%'){ public function getTotalProjectScheduleHealthPerDivision($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$divisions = Divisi::whereNull('parent')->get(); $divisions = Divisi::whereNull('parent')->get();
@ -184,7 +191,8 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getTotalProjectPerBudgetHealth($year = '%'){ public function getTotalProjectPerBudgetHealth($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
return response()->json([ return response()->json([
'data' => [ 'data' => [
@ -195,7 +203,8 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
private function countTotalProjectByBudgetHealthInDivision($divisi, $year, $health){ private function countTotalProjectByBudgetHealthInDivision($divisi, $year, $health)
{
return Project::where('divisi_id', $divisi) return Project::where('divisi_id', $divisi)
->where('mulai_proyek', 'like', $year) ->where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */ /* ->orWhere('akhir_proyek', 'like', $year) */
@ -204,7 +213,8 @@ class DashboardBoDController extends Controller
} }
public function getTotalProjectBudgetHealthPerDivision($year = '%'){ public function getTotalProjectBudgetHealthPerDivision($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$divisions = Divisi::select('id', 'name') $divisions = Divisi::select('id', 'name')
->with('children') ->with('children')
@ -233,7 +243,8 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
public function getTotalProjectPerPhase($year = '%'){ public function getTotalProjectPerPhase($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$projectPhases = ProjectPhase::orderBy('order')->get(); $projectPhases = ProjectPhase::orderBy('order')->get();
foreach ($projectPhases as $phase) { foreach ($projectPhases as $phase) {
@ -249,13 +260,15 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
private function countTotalProjectInDivision($id, $year){ private function countTotalProjectInDivision($id, $year)
{
return Project::where('divisi_id', $id) return Project::where('divisi_id', $id)
->where('mulai_proyek', 'like', $year) ->where('mulai_proyek', 'like', $year)
->count(); ->count();
} }
public function getTotalProjectPerDivision($year = '%') { public function getTotalProjectPerDivision($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$divisions = Divisi::select('id', 'name') $divisions = Divisi::select('id', 'name')
@ -277,7 +290,8 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
private function countTotalProjectValueInDivision($id, $year){ private function countTotalProjectValueInDivision($id, $year)
{
return Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))')) return Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))'))
->where('mulai_proyek', 'like', $year) ->where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */ /* ->orWhere('akhir_proyek', 'like', $year) */
@ -286,7 +300,8 @@ class DashboardBoDController extends Controller
->first(); ->first();
} }
public function getTotalProjectValuePerDivision($year = '%') { public function getTotalProjectValuePerDivision($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$divisions = Divisi::select('id', 'name') $divisions = Divisi::select('id', 'name')
@ -309,7 +324,8 @@ class DashboardBoDController extends Controller
} }
public function getDetailExpenditure($year = '%'){ public function getDetailExpenditure($year = '%')
{
$year = $this->interpolateYear($year); $year = $this->interpolateYear($year);
$projects = Project::where('mulai_proyek', 'like', $year) $projects = Project::where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */ /* ->orWhere('akhir_proyek', 'like', $year) */
@ -343,4 +359,3 @@ class DashboardBoDController extends Controller
], 200); ], 200);
} }
} }

23
app/Http/Controllers/HumanResourceController.php

@ -112,7 +112,7 @@ class HumanResourceController extends Controller
public function list() public function list()
{ {
$data = HumanResource::all(); $data = HumanResource::select('id', 'name')->get();
$countData = $data->count(); $countData = $data->count();
if($data){ if($data){
@ -139,10 +139,25 @@ class HumanResourceController extends Controller
} }
if ($search && !empty($search)) { if ($search && !empty($search)) {
$data = UserToProyek::select("m_users.id as id", "m_users.name as name", "assign_hr_to_proyek.project_role as proyek_role")->join('m_users', 'm_users.id', '=', 'assign_hr_to_proyek.user_id') $data = UserToProyek::select("m_users.id as id", "m_users.name as name", "assign_hr_to_proyek.project_role as proyek_role")
->where("assign_hr_to_proyek.proyek_id", $idProyek)->where("m_users.name", 'like', '%'.$search.'%')->whereNotIn("m_users.id", $forbidden)->get(); ->join('m_users', 'm_users.id', '=', 'assign_hr_to_proyek.user_id')
->where("assign_hr_to_proyek.proyek_id", $idProyek)
->where(function ($query) {
$query->where("assign_hr_to_proyek.is_customer", "!=", true)
->orWhereNull("assign_hr_to_proyek.is_customer");
})
->where("m_users.name", 'like', '%' . $search . '%')
->whereNotIn("m_users.id", $forbidden)->get();
} else { } else {
$data = UserToProyek::select("m_users.id as id", "m_users.name as name", "assign_hr_to_proyek.project_role as proyek_role")->where("assign_hr_to_proyek.proyek_id", $idProyek)->join('m_users', 'm_users.id', '=', 'assign_hr_to_proyek.user_id')->whereNotIn("m_users.id", $forbidden)->get(); $data = UserToProyek::select("m_users.id as id", "m_users.name as name", "assign_hr_to_proyek.project_role as proyek_role")
->where("assign_hr_to_proyek.proyek_id", $idProyek)
->where(function ($query) {
$query->where("assign_hr_to_proyek.is_customer", "!=", true)
->orWhereNull("assign_hr_to_proyek.is_customer");
})
->join('m_users', 'm_users.id', '=', 'assign_hr_to_proyek.user_id')
->whereNotIn("m_users.id", $forbidden)
->get();
} }
return response()->json($data); return response()->json($data);

28
app/Http/Controllers/MapMonitoringController.php

@ -27,12 +27,21 @@ class MapMonitoringController extends Controller
$tmp = []; $tmp = [];
foreach ($hr_assign_project as $key) { foreach ($hr_assign_project as $key) {
$presensi = DB::table('t_clock_in_out as tcio') $presensi = DB::table('t_clock_in_out as tcio')
->select('tcio.id as clock_in_out_id','mu.id as user_id', 'mu.name as fullname', 'tcio.clock_in', 'tcio.clock_out', 'tcio.clock_in_lat', 'tcio.clock_in_lng', ->select(
'tcio.clock_out_lat', 'tcio.clock_out_lng', 'tcio.clock_in_loc', 'tcio.clock_out_loc', 'tcio.clock_in_boundary', 'tcio.id as clock_in_out_id',
'tcio.clock_out_boundary', 'mu.username', 'tcio.date_presence', 'tcio.created_at') 'mu.id as user_id',
'mu.name as fullname',
'tcio.clock_in',
'tcio.clock_out',
'tcio.clock_in_lat',
'tcio.clock_in_lng',
'tcio.clock_in_loc',
'tcio.clock_out_loc',
'tcio.date_presence'
)
->join('m_users as mu', 'mu.id', '=', 'tcio.user_id') ->join('m_users as mu', 'mu.id', '=', 'tcio.user_id')
->where('mu.id', $key->user_id) ->where('mu.id', $key->user_id)
->orderBy('tcio.id', 'DESC') ->orderBy('tcio.clock_in', 'DESC')
->first(); ->first();
$project = DB::table('assign_hr_to_proyek as ahtp') $project = DB::table('assign_hr_to_proyek as ahtp')
->select('ahtp.proyek_id as id', 'mp.nama as project_name') ->select('ahtp.proyek_id as id', 'mp.nama as project_name')
@ -42,23 +51,20 @@ class MapMonitoringController extends Controller
->get(); ->get();
if ($presensi && isset($presensi->user_id)) { if ($presensi && isset($presensi->user_id)) {
$image = DB::table('m_image')->select('image')->where('category', 'presensi')->where('ref_id', $presensi->clock_in_out_id)->first(); $image = DB::table('m_image')->select('image')->where('category', 'presensi')->where('ref_id', $presensi->clock_in_out_id)->first();
$waypoint = DB::table('m_waypoint')->select('lat', 'lon', 'wptime')->where('user_id', $presensi->user_id)->orderBy('wptime', 'DESC')->first();
$tmp[] = array( $tmp[] = array(
'user_id' => $presensi->user_id, 'user_id' => $presensi->user_id,
'wp_lat' => isset($waypoint) ? $waypoint->lat : $presensi->clock_in_lat,
'wp_lon' => isset($waypoint) ? $waypoint->lon : $presensi->clock_in_lng,
'wp_time' => isset($waypoint) ? $waypoint->wptime : $presensi->clock_in,
'clock_in' => $presensi->clock_in, 'clock_in' => $presensi->clock_in,
'clock_out' => $presensi->clock_out, 'clock_out' => $presensi->clock_out,
'date_presence' => $presensi->date_presence,
'clock_in_lat' => $presensi->clock_in_lat, 'clock_in_lat' => $presensi->clock_in_lat,
'clock_in_lng' => $presensi->clock_in_lng, 'clock_in_lng' => $presensi->clock_in_lng,
'clock_out_lat' => $presensi->clock_out_lat,
'clock_out_lng' => $presensi->clock_out_lng,
'clock_in_loc' => $presensi->clock_in_loc, 'clock_in_loc' => $presensi->clock_in_loc,
'clock_out_loc' => $presensi->clock_out_loc, 'clock_out_loc' => $presensi->clock_out_loc,
'clock_in_boundary' => $presensi->clock_in_boundary,
'clock_out_boundary' => $presensi->clock_out_boundary,
'username' => $presensi->username,
'name' => $presensi->fullname, 'name' => $presensi->fullname,
'image_selfie' => isset($image->image) ? $image->image : '-', 'image_selfie' => isset($image->image) ? $image->image : '-',
'created_at' => $presensi->created_at,
'presence_status' => $presensi->date_presence == $dateNow ? true : false, //true, //status date_presence, 'presence_status' => $presensi->date_presence == $dateNow ? true : false, //true, //status date_presence,
'projects' => $project 'projects' => $project
); );

147
app/Http/Controllers/PresenceController.php

@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\HumanResource;
use Log; use Log;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Presence; use App\Models\Presence;
@ -24,7 +25,10 @@ class PresenceController extends Controller
if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){
$statusBoundary = true; $statusBoundary = true;
} }
$statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first();
if ($statusRestriction->status_boundary) {
$statusBoundary = true;
}
// not assign // not assign
if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){
$data=array( $data=array(
@ -134,7 +138,10 @@ class PresenceController extends Controller
if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){
$statusBoundary = true; $statusBoundary = true;
} }
$statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first();
if ($statusRestriction->status_boundary) {
$statusBoundary = true;
}
// not assign // not assign
if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){ if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false){
$data=array( $data=array(
@ -263,12 +270,148 @@ class PresenceController extends Controller
foreach($geom as $dataGeom){ foreach($geom as $dataGeom){
$valGeom = json_decode($dataGeom->geom); $valGeom = json_decode($dataGeom->geom);
if($params->clock_in_out['type']=="out"){ if($params->clock_in_out['type']=="out"){
if($valGeom->type == "FeatureCollection"){
$multiArea = $valGeom->features;
foreach($multiArea as $area){
if ($area->geometry->type === "Point") {
$pointCoordinates = $area->geometry->coordinates;
$pointLng = $pointCoordinates[0];
$pointLat = $pointCoordinates[1];
$check = DB::select(DB::raw("SELECT ST_Distance(
ST_GeomFromGeoJSON('" . json_encode($area->geometry) . "'),
ST_GeomFromText('POINT(" . $params->clock_in_out['clock_in_lng'] . " " . $params->clock_in_out['clock_in_lat'] . ")', 4326)
) <= " . $area->properties->radius . " as within_radius"));
if ($check[0]->within_radius) {
break;
}
}
$check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'),
ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary"));
if($check[0]->boundary){
break;
}
}
}else{
$check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'),
ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary"));
}
}else{
if($valGeom->type == "FeatureCollection"){
$multiArea = $valGeom->features;
foreach($multiArea as $area){
if ($area->geometry->type === "Point") {
$pointCoordinates = $area->geometry->coordinates;
$pointLng = $pointCoordinates[0];
$pointLat = $pointCoordinates[1];
$check = DB::select(DB::raw("SELECT ST_Distance(
ST_GeomFromGeoJSON('" . json_encode($area->geometry) . "'),
ST_GeomFromText('POINT(" . $params->clock_in_out['clock_in_lng'] . " " . $params->clock_in_out['clock_in_lat'] . ")', 4326)
) <= " . $area->properties->radius . " as within_radius"));
if ($check[0]->within_radius) {
break;
}
}
$check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'),
ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary"));
if($check[0]->boundary){
break;
}
}
}else{
$check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'),
ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary"));
}
}
if(count($check)>0){
if(isset($check[0]->boundary) && $check[0]->boundary){
$temp[]=array(
"activity_id" => $dataGeom->id,
"boundary" => $check[0]->boundary,
"status_assign" => true
);
} else if (isset($check[0]->within_radius) && $check[0]->within_radius) {
$temp[]=array(
"activity_id" => $dataGeom->id,
"boundary" => $check[0]->within_radius,
"status_assign" => true
);
}
}
}
// assign and not in boundary
if(count($temp) < 1){
$temp[]=array(
"activity_id" => null,
"boundary" => false,
"status_assign" => true
// "geom" => $geom,
// "cek" => $check[0]->boundary
);
}
}
else{
// not assign
$temp[]=array(
"activity_id" => null,
"boundary" => false,
"status_assign" => false
);
}
return $temp;
}
public function checkLocationTest(Request $request){
// cek user tersebut apakah punya assign task yang ada bondary nya
// geom ada di table activity
// $clock_time =
$params = $request;
$geom = DB::table("assign_hr_to_activity as ahta")->select("ma.geom", "ma.id")
->join("m_activity as ma", "ma.id", "=", "ahta.activity_id")
->where("ahta.user_id", $params->user_id)
->whereNotNull("ma.geom")
->whereDate("ma.start_date", "<=", $params->time)
->whereDate("ma.end_date", ">=", $params->time)
->get();
$temp = [];
// return json_encode($geom);
if (count($geom) > 0) {
foreach($geom as $dataGeom){
$valGeom = json_decode($dataGeom->geom);
if($params->clock_in_out['type']=="out"){
if($valGeom->type == "FeatureCollection"){
// return count($valGeom->features);
$multiArea = $valGeom->features;
foreach($multiArea as $area){
$check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'),
ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary"));
if($check[0]->boundary){
break;
}
}
}else{
$check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'), $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'),
ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary")); ST_GeomFromText('POINT(".$params->clock_in_out['clock_out_lng']." ".$params->clock_in_out['clock_out_lat'].")', 4326)) as boundary"));
}
}else{
if($valGeom->type == "FeatureCollection"){
// return count($valGeom->features);
$multiArea = $valGeom->features;
foreach($multiArea as $area){
$check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($area->geometry)."'),
ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary"));
if($check[0]->boundary){
break;
}
}
}else{ }else{
$check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'), $check = DB::select(DB::raw("SELECT ST_Intersects(ST_GeomFromGeoJSON('".json_encode($valGeom->geometry)."'),
ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary")); ST_GeomFromText('POINT(".$params->clock_in_out['clock_in_lng']." ".$params->clock_in_out['clock_in_lat'].")', 4326)) as boundary"));
} }
}
if(count($check)>0){ if(count($check)>0){
if($check[0]->boundary){ if($check[0]->boundary){
$temp[]=array( $temp[]=array(

325
app/Http/Controllers/ProjectController.php

@ -30,6 +30,7 @@ use Illuminate\Support\Facades\DB;
use App\Helpers\MasterFunctionsHelper; use App\Helpers\MasterFunctionsHelper;
use App\Models\ReportActivityMaterial; use App\Models\ReportActivityMaterial;
use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Artisan;
use App\Jobs\ProcessSCurve;
const API_GEOLOCATION = "https://nominatim.oslogdev.com/search/ADDR?format=json&addressdetails=1&limit=1"; const API_GEOLOCATION = "https://nominatim.oslogdev.com/search/ADDR?format=json&addressdetails=1&limit=1";
@ -64,8 +65,7 @@ class ProjectController extends Controller
return response()->json(['status'=>'success','message'=>'Data added!', 'data_result' =>$dataResultInsert, 'code'=> 200], 200); return response()->json(['status'=>'success','message'=>'Data added!', 'data_result' =>$dataResultInsert, 'code'=> 200], 200);
} }
public function edit($id) public function edit($id){
{
if(empty($id) || !is_int((int)$id)) if(empty($id) || !is_int((int)$id))
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
@ -204,25 +204,6 @@ class ProjectController extends Controller
DokumenProject::where("type_dokumen", "project-document-in-folder")->whereIn('ref_id', $ref_ids)->delete(); DokumenProject::where("type_dokumen", "project-document-in-folder")->whereIn('ref_id', $ref_ids)->delete();
} }
public function getByUser($id)
{
$alias = "utp";
$userProyek = UserToProyek::query()
->from('assign_hr_to_proyek AS ' . $alias)
->where([
['is_customer', true],
['user_id', $id]
])
->leftJoin('m_users', $alias.'.user_id', '=', 'm_users.id')
->leftJoin('m_proyek', $alias.'.proyek_id', '=', 'm_proyek.id')
->leftJoin('m_type_proyek', 'm_proyek.type_proyek_id', '=', 'm_type_proyek.id')
->select('m_proyek.*', 'm_type_proyek.name AS join_second_name','m_users.name AS join_first_name')
->get();
$totalRecord = $userProyek->count();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $userProyek, 'totalRecord' => $totalRecord], 200);
}
public function search(Request $request) public function search(Request $request)
{ {
$payload = $request->all(); $payload = $request->all();
@ -238,60 +219,49 @@ class ProjectController extends Controller
public function list() public function list()
{ {
$data = Project::orderBy('id', 'desc')->get(); $data = Project::select(
'id',
'kode_sortname',
'jumlah_stakeholder',
'nama',
'mulai_proyek',
'akhir_proyek',
'area_kerja',
'lokasi_kantor',
'rencana_biaya',
'biaya_actual',
'company',
'pm_id',
'type_proyek_id',
'divisi_id',
'persentase_progress',
'keterangan',
'durasi_proyek',
'progress_by_worklog',
'status',
'currency_symbol',
'currency_code',
'currency_name',
'project_objectives',
'considered_success_when',
'potential_risk',
'testing_environment',
'currency_code',
'currency_symbol',
'currency_name',
'budget_health',
'phase_id',
'calculation_status',
'created_at',
'created_by',
'updated_at',
'updated_by'
)->orderBy('id', 'desc')->get();
$countData = $data->count(); $countData = $data->count();
if(!$data) if(!$data)
return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404); return response()->json(['status'=>'failed','message'=>'Data not found!','code'=> 404], 404);
$scheduleWarningThreshold = 10;
$scheduleDangerThreshold = 5;
foreach ($data as $d) {
$progress = $costVariance = $actualCost = 0;
$lastActivity = null;
$scheduleHealth = "on-track";
$rootActivity = Activity::whereNull('parent_id')->where('proyek_id', $d->id)->orderBy('version_gantt_id', 'desc')->first();
if ($rootActivity) {
$costVariance = (int)$d->rencana_biaya - (int)$rootActivity->biaya_actual;
$actualCost = $rootActivity->biaya_actual ?? 0;
$progress = $rootActivity->persentase_progress ?? 0;
$timeleft = strtotime($d->mulai_proyek) - strtotime($rootActivity->end_date);
$date1 = new \DateTime(date("Y-m-d", strtotime($d->mulai_proyek)));
$date2 = new \DateTime(date("Y-m-d", strtotime($rootActivity->end_date)));
$daysRemaining = $date2->diff($date1);
$daysRemaining = $daysRemaining->d;
if ($daysRemaining <= $scheduleDangerThreshold) {
$scheduleHealth = "danger";
} elseif ($daysRemaining <= $scheduleWarningThreshold) {
$scheduleHealth = "warning";
}
$lastActivity = date("d/m/Y", strtotime($rootActivity->end_date));
}
$d->plannedInterval = date("d/m/Y", strtotime($d->mulai_proyek)) . " - " . date("d/m/Y", strtotime($d->akhir_proyek));
$d->plannedCost = $d->rencana_biaya;
$d->actualCost = $actualCost;
$d->lastActivity = $lastActivity ?? "-";
$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);
$d->geolocation = [];
} else {
$d->geolocation = [];
}
}
$totalPlannedCost = array_sum(array_map('intval', array_column($data->toArray(), 'plannedCost'))); $totalPlannedCost = array_sum(array_map('intval', array_column($data->toArray(), 'plannedCost')));
$totalActualCost = $data->sum('actualCost'); $totalActualCost = $data->sum('actualCost');
$manpowers = User::count(); $manpowers = User::count();
@ -309,7 +279,7 @@ class ProjectController extends Controller
} }
try { try {
$projectsByType = DB::table('m_proyek') $projectsByType = DB::table('m_proyek')
->select('m_type_proyek.name', DB::raw('count(*) as total')) ->select('m_type_proyek.name', DB::raw('count(m_type_proyek.id) as total'))
->join('m_type_proyek', 'm_type_proyek.id', '=', 'm_proyek.type_proyek_id') ->join('m_type_proyek', 'm_type_proyek.id', '=', 'm_proyek.type_proyek_id')
->groupBy('m_type_proyek.name') ->groupBy('m_type_proyek.name')
->get(); ->get();
@ -332,13 +302,10 @@ class ProjectController extends Controller
'projectsByPhase' => $projectsByPhase, 'projectsByPhase' => $projectsByPhase,
'projectTypes' => $projectTypes, 'projectTypes' => $projectTypes,
'projectsByType' => $projectsByType, 'projectsByType' => $projectsByType,
], ], 200);
200
);
} }
public function getListProjectTask($id) public function getListProjectTask($id){
{
$data = UserToActivity::select("assign_hr_to_activity.user_id as user_id","m_proyek.*") $data = UserToActivity::select("assign_hr_to_activity.user_id as user_id","m_proyek.*")
->where("assign_hr_to_activity.user_id", $id) ->where("assign_hr_to_activity.user_id", $id)
->join('m_proyek', 'assign_hr_to_activity.proyek_id', '=', 'm_proyek.id') ->join('m_proyek', 'assign_hr_to_activity.proyek_id', '=', 'm_proyek.id')
@ -351,31 +318,59 @@ class ProjectController extends Controller
return response()->json(['status'=>'success','code'=>200,'data'=>$data], 200); return response()->json(['status'=>'success','code'=>200,'data'=>$data], 200);
} }
public function getSCurve(Request $request) public function getSCurve(Request $request){
{
$data = MasterFunctionsHelper::getSCurve($request); $data = MasterFunctionsHelper::getSCurve($request);
return response()->json(['status'=>'success','code'=>200, 'data' => $data], 200); return response()->json(['status'=>'success','code'=>200, 'data' => $data], 200);
} }
public function calculateSCurve(Request $request) public function calculateSCurve(Request $request){
{
$sCurve = Project::select('scurve')->where('id', $request->project_id)->first(); $sCurve = Project::select('scurve')->where('id', $request->project_id)->first();
return response()->json(['status'=>'success','code'=>200, 'data' => json_decode($sCurve->scurve)], 200); return response()->json(['status'=>'success','code'=>200, 'data' => json_decode($sCurve->scurve)], 200);
} }
public function sCurveCommand(Request $request) public function sCurveCommand(Request $request){
{
Artisan::call('calculate:scurve', [ Artisan::call('calculate:scurve', [
'project_id' => $request->project_id 'project_id' => $request->project_id
]); ]);
// $project = Project::find($request->project_id);
// if ($project) {
// dispatch(new ProcessSCurve($project));
// return response()->json(['message' => 'S Curve calculation queued']);
// }
// return response()->json(['message' => 'Project not found'], 404);
} }
public function getLinearSCurve(Request $request) public function getLinearSCurve(Request $request){
{
$data = MasterFunctionsHelper::getLinearSCurve($request); $data = MasterFunctionsHelper::getLinearSCurve($request);
return response()->json(['status'=>'success','code'=>200, 'data' => $data], 200); return response()->json(['status'=>'success','code'=>200, 'data' => $data], 200);
} }
public static function setSyncDate($activity_id, $activity, $report) {
$status = AssignMaterial::select('status_activity')->where('activity_id', $activity_id)->first();
if (!isset($status->status_activity)) {
$status->status_activity = 'open';
}
if ($status->status_activity != 'done') {
$minDate = date_create($report->report_date);
$maxDate = date_create($report->report_date);
date_add($maxDate, date_interval_create_from_date_string($activity->duration . " days"));
} else {
$material = AssignMaterial::where('activity_id', $activity_id)->first();
$minDate = date_create($material->start_activity);
$maxDate = date_create($material->finish_activity);
}
$reports = array(
'activity_id' => $activity_id,
'min_date' => $minDate,
'max_date' => $maxDate,
'status' => $status->status_activity
);
return $reports;
}
public function synchronizeReport($gantt_id) public function synchronizeReport($gantt_id)
{ {
$activities = Activity::where("version_gantt_id", $gantt_id)->get(); $activities = Activity::where("version_gantt_id", $gantt_id)->get();
@ -387,21 +382,12 @@ class ProjectController extends Controller
if ($countReports === 1) { if ($countReports === 1) {
$dataReports = ReportActivityMaterial::where('activity_id', $activity_id)->orderBy('report_date')->get(); $dataReports = ReportActivityMaterial::where('activity_id', $activity_id)->orderBy('report_date')->get();
foreach($dataReports as $dr) { foreach($dataReports as $dr) {
$reports[] = array( $reports[] = ProjectController::setSyncDate($activity_id, $activity, $dr);
'activity_id' => $activity_id,
'min_date' => $dr->report_date,
'max_date' => date_modify(date_create($dr->report_date), "1 days")
);
} }
} }
if ($countReports > 1) { if ($countReports > 1) {
$firstReport = ReportActivityMaterial::where('activity_id', $activity_id)->orderBy('report_date')->first(); $firstReport = ReportActivityMaterial::where('activity_id', $activity_id)->orderBy('report_date')->first();
$lastReport = ReportActivityMaterial::where('activity_id', $activity_id)->orderByDesc('report_date')->first(); $reports[] = ProjectController::setSyncDate($activity_id, $activity, $firstReport);
$reports[] = array(
'activity_id' => $activity_id,
'min_date' => $firstReport->report_date,
'max_date' => date_modify(date_create($lastReport->report_date), "1 days")
);
} }
$activity->reports = $reports; $activity->reports = $reports;
} }
@ -410,8 +396,19 @@ class ProjectController extends Controller
for ($i=0; $i < count($reports); $i++) { for ($i=0; $i < count($reports); $i++) {
$activity = Activity::find($reports[$i]['activity_id']); $activity = Activity::find($reports[$i]['activity_id']);
$activity->start_date = $reports[$i]['min_date']; $successor = Link::where('t_activity_id', $activity->id)->first();
$activity->end_date = $reports[$i]['max_date']; if ($successor) {
$predecessor = Activity::find($successor->s_activity_id);
$activity->start_date = $predecessor->end_date;
}
if($reports[$i]['status'] != 'done'){
$reports[$i]['max_date']->modify('-1 day');
}else if($reports[$i]['status'] == 'done'){
$activity->actual_end = $reports[$i]['max_date']->setTime(23,59,59);
}
$activity->start_date = $reports[$i]['min_date']; //same early
$activity->end_date = $reports[$i]['max_date']->setTime(23,59,59); // same early
$activity->actual_start = $reports[$i]['min_date'];
$activity->save(); $activity->save();
} }
@ -426,27 +423,44 @@ class ProjectController extends Controller
$activity->update([ $activity->update([
"planned_start"=>$activity->start_date, "planned_start"=>$activity->start_date,
"planned_end"=>$activity->end_date, "planned_end"=>$activity->end_date,
"early_start"=>$activity->start_date,
"early_end"=>$activity->end_date,
]); ]);
} }
return response()->json(['status'=>'success','message'=>'Set baseline success!','code'=> 200], 200); return response()->json(['status'=>'success','message'=>'Set baseline success!','code'=> 200], 200);
} }
public function getInvoiceIntegration(Request $request) public function getInvoiceIntegration(Request $request) {
{ $search = urlencode($request->search);
// $search = urlencode($request->search); if(empty($search))
// if(empty($search)) return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400);
// 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');
$response = null; $response = MasterFunctionsHelper::curlReq($url);
// return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200); // return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200);
return response()->json(['status'=>'success', 'data'=> '', 'code'=>200], 200); return response()->json(['status'=>'success', 'data'=> '', 'code'=>200], 200);
} }
public function getByUser($id)
public function detail($id)
{ {
$alias = "utp";
$userProyek = UserToProyek::query()
->from('assign_hr_to_proyek AS ' . $alias)
->where([
['is_customer', true],
['user_id', $id]
])
->leftJoin('m_users', $alias.'.user_id', '=', 'm_users.id')
->leftJoin('m_proyek', $alias.'.proyek_id', '=', 'm_proyek.id')
->leftJoin('m_type_proyek', 'm_proyek.type_proyek_id', '=', 'm_type_proyek.id')
->select('m_proyek.*', 'm_type_proyek.name AS join_second_name','m_users.name AS join_first_name')
->get();
$totalRecord = $userProyek->count();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $userProyek, 'totalRecord' => $totalRecord], 200);
}
public function detail($id){
if(empty($id) || !is_int((int)$id)) if(empty($id) || !is_int((int)$id))
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
@ -458,11 +472,36 @@ class ProjectController extends Controller
$gantt = MasterFunctionsHelper::getLatestGantt($id); $gantt = MasterFunctionsHelper::getLatestGantt($id);
$result->projectManager = User::where('id', $result->pm_id)->value('name'); $result->projectManager = User::where('id', $result->pm_id)->value('name');
$result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->where("version_gantt_id", $gantt['last_gantt_id'])->first(); $result->header = Activity::whereNull('parent_id')->where("proyek_id", $id)->where("version_gantt_id", $gantt['last_gantt_id'])->first();
// dd($result->header->start_date);
$ganttId = $gantt['last_gantt_id'];
$actualStartExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_start')->exists();
$actualEndExist = Activity::where('version_gantt_id', $ganttId)->whereNotNull('actual_end')->exists();
if ($actualStartExist) {
$startDate = Activity::where('version_gantt_id', $ganttId)
->orderBy('actual_start')
->value('start_date');
} else {
$startDate = Activity::where('version_gantt_id', $ganttId)
->orderBy('start_date')
->value('start_date');
}
if ($actualEndExist) {
$endDate = Activity::where('version_gantt_id', $ganttId)
->orderByDesc('actual_end')
->value('end_date');
} else {
$endDate = Activity::where('version_gantt_id', $ganttId)
->orderByDesc('end_date')
->value('end_date');
}
$result->header->start_date = $startDate;
$result->header->end_date = $endDate;
return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$gantt], 200); return response()->json(['status'=>'success','code'=> 200,'data'=>$result, 'gantt'=>$gantt], 200);
} }
public function getOverdueActivities(Request $request) public function getOverdueActivities(Request $request){
{
$payload = $request->all(); $payload = $request->all();
if(empty($payload['id']) || !is_int((int)$payload['id'])) if(empty($payload['id']) || !is_int((int)$payload['id']))
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
@ -472,36 +511,37 @@ class ProjectController extends Controller
if(!$result) if(!$result)
return response()->json(['status'=>'failed','message'=> 'Project not found!','code'=> 404], 404); return response()->json(['status'=>'failed','message'=> 'Project not found!','code'=> 404], 404);
//TODO possible overdue bug //TODO possible overdue bug
if (isset($payload['till_date'])) $endDate = Activity::where('proyek_id', $payload['id'])
$overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date', '<=', $payload['till_date'])->orderBy('end_date', 'asc')->get(); ->orderByDesc('end_date')
else ->value('end_date');
if(isset($payload['till_date'])) {
if (isset($payload['scurve'])) {
$overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$endDate)->orderBy('end_date', 'asc')->get();
} else {
$overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date','<=',$endDate)->orderBy('end_date', 'asc')->get();
}
}
else {
if (isset($payload['scurve'])) {
$overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get(); $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get();
} else {
$overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get();
}
}
$result->overdueActivities = $overdueActivities; $result->overdueActivities = $overdueActivities;
return response()->json(['status'=>'success','code'=> 200,'data'=>$result], 200); return response()->json(['status'=>'success','code'=> 200,'data'=>$result], 200);
} }
public function getReportDistribution(Request $request) public function getReportDistribution(Request $request){
{
$payload = $request->all(); $payload = $request->all();
if(empty($payload['project_id']) || !is_int((int)$payload['project_id'])) if(empty($payload['project_id']) || !is_int((int)$payload['project_id']))
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);
$reports = DB::table('assign_material_to_activity as ama') $reports = DB::table('assign_material_to_activity as ama')
->select( ->select('u.name', 'a.name as activity_name', 'ama.qty_planning', 'ram.qty as qty_real','rm.description as material_name', 'rm.uom as material_unit',
'u.name', 'ram.lat', 'ram.lon', 'ram.description as report_notes', 'ram.report_date')
'a.name as activity_name',
'ama.qty_planning',
'ram.qty as qty_real',
'rm.description as material_name',
'rm.uom as material_unit',
'ram.lat',
'ram.lon',
'ram.description as report_notes',
'ram.report_date'
)
->join('report_activity_material as ram', 'ram.assign_material_id', '=', 'ama.id') ->join('report_activity_material as ram', 'ram.assign_material_id', '=', 'ama.id')
->join('m_req_material as rm', 'rm.id', '=', 'ama.material_id') ->join('m_req_material as rm', 'rm.id', '=', 'ama.material_id')
->join('m_activity as a', 'a.id', '=', 'ama.activity_id') ->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
@ -513,14 +553,12 @@ class ProjectController extends Controller
return response()->json(['status'=>'success', 'code'=> 200, 'data'=> $reports], 200); return response()->json(['status'=>'success', 'code'=> 200, 'data'=> $reports], 200);
} }
public function getManpower($proyek_id) public function getManpower($proyek_id){
{
$manCount = UserToProyek::where('proyek_id', $proyek_id)->count(); $manCount = UserToProyek::where('proyek_id', $proyek_id)->count();
return response()->json(['totalRecord'=>$manCount]); return response()->json(['totalRecord'=>$manCount]);
} }
public function getAssignedHR($gantt_id) public function getAssignedHR($gantt_id){
{
$results = UserToActivity::select('assign_hr_to_activity.proyek_id', 'assign_hr_to_activity.user_id', 'm_activity.id', 'm_activity.name', 'm_activity.start_date', 'm_activity.end_date') $results = UserToActivity::select('assign_hr_to_activity.proyek_id', 'assign_hr_to_activity.user_id', 'm_activity.id', 'm_activity.name', 'm_activity.start_date', 'm_activity.end_date')
->join('m_activity', 'm_activity.id', '=', 'assign_hr_to_activity.activity_id') ->join('m_activity', 'm_activity.id', '=', 'assign_hr_to_activity.activity_id')
->where('assign_hr_to_activity.version_gantt_id', $gantt_id) ->where('assign_hr_to_activity.version_gantt_id', $gantt_id)
@ -531,17 +569,8 @@ class ProjectController extends Controller
public function dashboard($id) public function dashboard($id)
{ {
$data = DB::table('m_proyek as mp') $data = DB::table('m_proyek as mp')
->select( ->select('mp.kode_sortname', 'mp.nama as name_project', 'mp.mulai_proyek as start', 'mp.akhir_proyek as finish',
'mp.kode_sortname', 'mp.rencana_biaya', 'mp.company', 'mp.currency_symbol', 'mu.name as pm', 'mp.budget_health')
'mp.nama as name_project',
'mp.mulai_proyek as start',
'mp.akhir_proyek as finish',
'mp.rencana_biaya',
'mp.company',
'mp.currency_symbol',
'mu.name as pm',
'mp.budget_health'
)
->join('m_users as mu', 'mu.id', '=', 'mp.pm_id') ->join('m_users as mu', 'mu.id', '=', 'mp.pm_id')
->where('mp.id', $id) ->where('mp.id', $id)
->first(); ->first();
@ -556,13 +585,8 @@ class ProjectController extends Controller
$progress = @$rootActivity->persentase_progress ?? 0; $progress = @$rootActivity->persentase_progress ?? 0;
$commentActivity = DB::table('m_comment_activity as mca') $commentActivity = DB::table('m_comment_activity as mca')
->select( ->select('mca.activity_id', 'mca.comment as comment', 'mca.created_by as comment_by', 'mca.created_at as comment_created',
'mca.activity_id', 'ma.name as activity')
'mca.comment as comment',
'mca.created_by as comment_by',
'mca.created_at as comment_created',
'ma.name as activity'
)
->join('m_activity as ma', 'ma.id', '=', 'mca.activity_id') ->join('m_activity as ma', 'ma.id', '=', 'mca.activity_id')
->where('ma.proyek_id', $id) ->where('ma.proyek_id', $id)
->orderBy('comment_by') ->orderBy('comment_by')
@ -577,8 +601,7 @@ class ProjectController extends Controller
return response()->json(['status'=>'success','code'=>200,'data'=> $data], 200); return response()->json(['status'=>'success','code'=>200,'data'=> $data], 200);
} }
private function httpReq($search) private function httpReq($search){
{
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, str_replace("ADDR", $search, API_GEOLOCATION)); curl_setopt($ch, CURLOPT_URL, str_replace("ADDR", $search, API_GEOLOCATION));
@ -594,4 +617,6 @@ class ProjectController extends Controller
return json_decode($output); return json_decode($output);
} }
} }

2
app/Http/Controllers/RequestMaterialController.php

@ -170,7 +170,7 @@ class RequestMaterialController extends Controller
} }
public function getMaterialIntegration(Request $request) { public function getMaterialIntegration(Request $request) {
$search = null; $search = urlencode($request->name);
if(empty($search)) if(empty($search))
return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400);
$url = str_replace("SEARCH", $search, config('api.adw').'/stock_master?name=SEARCH'); $url = str_replace("SEARCH", $search, config('api.adw').'/stock_master?name=SEARCH');

6
app/Http/Controllers/ShowHideColumnController.php

@ -45,12 +45,12 @@ class ShowHideColumnController extends Controller
$success = 0; $success = 0;
foreach ($columns as $column) { foreach ($columns as $key => $column) {
$dataAdd = array( $dataAdd = array(
'version_gantt_id'=>$request->version_gantt_id, 'version_gantt_id'=>$request->version_gantt_id,
'user_id'=>$this->currentId, 'user_id'=>$this->currentId,
'column_name'=>$column, 'column_name'=>$key,
'show'=>true, 'show'=>$column,
'created_by'=>$this->currentName 'created_by'=>$this->currentName
); );

2
app/Http/Controllers/UserToProyekController.php

@ -185,7 +185,7 @@ class UserToProyekController extends Controller
} }
public function getEmployeeIntegration(Request $request) { public function getEmployeeIntegration(Request $request) {
$search = null; $search = urlencode($request->name);
if(empty($search)) if(empty($search))
return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400); return response()->json(['status'=>'error', 'message'=>'Empty query string!'], 400);
$url = str_replace("SEARCH", $search, config('api.adw').'/employees?emp_name=SEARCH'); $url = str_replace("SEARCH", $search, config('api.adw').'/employees?emp_name=SEARCH');

36
app/Jobs/ProcessSCurve.php

@ -0,0 +1,36 @@
<?php
namespace App\Jobs;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Queue;
use App\Helpers\MasterFunctionsHelper;
use App\Models\Project;
class ProcessSCurve extends Job
{
protected $project;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Project $project)
{
$this->project = $project;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$data = MasterFunctionsHelper::CalculateSCurve($this->project->id);
$this->project->scurve = json_encode($data);
$this->project->calculation_status = true;
$this->project->save();
}
}

6
app/Models/Activity.php

@ -25,7 +25,7 @@ class Activity extends Model
'buffer_radius', 'duration', 'color_progress', 'jumlah_pekerjaan', 'satuan', 'buffer_radius', 'duration', 'color_progress', 'jumlah_pekerjaan', 'satuan',
'description', 'priority', 'bobot_planning', 'type_activity', 'open', 'geom', 'description', 'priority', 'bobot_planning', 'type_activity', 'open', 'geom',
'version_gantt_id', 'budget_plan', 'biaya_material_plan', 'biaya_human_plan', 'biaya_tools_plan', 'version_gantt_id', 'budget_plan', 'biaya_material_plan', 'biaya_human_plan', 'biaya_tools_plan',
'planned_start', 'planned_end', 'satuan_id', 'planned_start', 'planned_end', 'satuan_id', 'actual_start', 'actual_end',
'created_at', 'created_by', 'updated_at', 'updated_by', 'sortorder' 'created_at', 'created_by', 'updated_at', 'updated_by', 'sortorder'
]; ];
@ -71,8 +71,8 @@ class Activity extends Model
$data->updateCostPlanning(); $data->updateCostPlanning();
if($data->bobot_planning){ if($data->bobot_planning){
$data->updatePersentaseProgress(); $data->updatePersentaseProgress();
$data->updateCostActual();
} }
$data->updateCostActual();
// if($data->start_date != request()->start_date || $data->end_date != request()->end_date) { // if($data->start_date != request()->start_date || $data->end_date != request()->end_date) {
// $data->updateStartEndDateHeader(); // $data->updateStartEndDateHeader();
// } // }
@ -86,8 +86,8 @@ class Activity extends Model
$data->updateCostPlanning(); $data->updateCostPlanning();
if($data->bobot_planning){ if($data->bobot_planning){
$data->updatePersentaseProgress(); $data->updatePersentaseProgress();
$data->updateCostActual();
} }
$data->updateCostActual();
$data->updateStartEndDateHeader(); $data->updateStartEndDateHeader();
}); });

2
app/Models/AssignMaterial.php

@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use App\Models\RequestMaterial; use App\Models\RequestMaterial;
use App\Models\Activity; use App\Models\Activity;
use App\Models\ReportActivityMaterial;
class AssignMaterial extends Model class AssignMaterial extends Model
{ {
@ -35,6 +36,7 @@ class AssignMaterial extends Model
}); });
static::deleted(function($data) { static::deleted(function($data) {
$reportActivities = ReportActivityMaterial::where('assign_material_id', $data->id)->delete();
$activity = Activity::where('id', $data->activity_id)->first(); $activity = Activity::where('id', $data->activity_id)->first();
$activity->rencana_biaya -= floatval($data->budget) * floatval($data->qty_planning); $activity->rencana_biaya -= floatval($data->budget) * floatval($data->qty_planning);
$activity->save(); $activity->save();

2
app/Models/Broadcast.php

@ -12,6 +12,6 @@ class Broadcast extends Model
const UPDATED_AT = 'updated_at'; const UPDATED_AT = 'updated_at';
protected $fillable = [ protected $fillable = [
'title_notif', 'message_notif', 'description', 'send_to_type', 'created_at', 'created_by', 'updated_at', 'updated_by' 'title_notif', 'message_notif', 'description', 'send_to_type', 'send_to_id', 'status_send', 'created_at', 'created_by', 'updated_at', 'updated_by'
]; ];
} }

4
app/Models/UserToProyek.php

@ -12,8 +12,8 @@ class UserToProyek extends Model
const UPDATED_AT = 'updated_at'; const UPDATED_AT = 'updated_at';
protected $fillable = [ protected $fillable = [
'user_id', 'proyek_id', 'rbs', 'project_role', 'group_r', 'max_used', 'is_customer', 'standart_rate', 'user_id', 'proyek_id', 'rbs', 'project_role', 'group_r', 'max_used', 'standart_rate',
'uom_standart_rate', 'overtime_rate', 'uom_overtime_rate', 'cost_per_used', 'accrue_at', 'uom_standart_rate', 'overtime_rate', 'uom_overtime_rate', 'cost_per_used', 'accrue_at',
'base_calender', 'created_at', 'created_by', 'updated_at', 'updated_by' 'base_calender', 'is_customer', 'created_at', 'created_by', 'updated_at', 'updated_by'
]; ];
} }

49
app/Services/FCMService.php

@ -0,0 +1,49 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
class FCMService
{
public static function send($fcm_token, $notification)
{
$url = 'https://fcm.googleapis.com/fcm/send';
// $url = 'https://fcm.googleapis.com/v1/projects/594814396007/messages:send';
$serverKey = config('fcm.server_key');
$data = [
"registration_ids" => [$fcm_token],
"notification" => [
"title" => $notification['title'],
"body" => $notification['body'],
]
];
$encodedData = json_encode($data);
$headers = [
'Authorization:key=' . $serverKey,
'Content-Type: application/json',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $encodedData);
$result = curl_exec($ch);
if ($result === FALSE) {
return array("success"=> false, "message"=> curl_error($ch));
}
// Close connection
curl_close($ch);
return array("success"=> true, "message"=> $result);
}
}

1
bootstrap/app.php

@ -63,6 +63,7 @@ $app->configure('auth');
$app->configure('api'); $app->configure('api');
$app->configure('assets'); $app->configure('assets');
$app->configure('app'); $app->configure('app');
$app->configure('fcm');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

2
config/api.php

@ -2,6 +2,6 @@
return [ return [
'nominatim' => env('API_NOMINATIM', 'https://nominatim.oslogdev.com'), 'nominatim' => env('API_NOMINATIM', 'https://nominatim.oslogdev.com'),
'adw' => env('API_ADW', 'http://ospro-api.adyawinsa.com:9083/api'), 'adw' => env('API_ADW', 'http://ospro-api.adyawinsa.com:9083/api'),
'adw_token' => env('API_ADW_TOKEN', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNjkxODMwNDkzfQ.DvBQIOZsdFndWsliPCZT65Y6G5Xx4vWBKz8Rhe7rvRA') 'adw_token' => env('API_ADW_TOKEN', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxMjAyIiwiZXhwIjoxNzI0Mzk1NTExfQ.z9_Q7vjZbcbr8Mook4EmlOuOByNP12_DEDSabf0zanU')
]; ];
?> ?>

5
config/fcm.php

@ -0,0 +1,5 @@
<?php
return [
'server_key' => "AAAAin2zZmc:APA91bHFIYDzZGyVyXvt2C8I09wC2k8siWPQIo4b1Db0QjxCzQR5SRQU9KY1iNRIUhTL6OoLUs2x6UAiP1BNv-mwOlSR7C_405msoNL2p33JVBxrtqc7hdMc5TEdTBB4ZGRVH7ltQzSe",
];

36
database/migrations/2023_08_29_130624_create_jobs_table.php

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
}

9
docker/nginx/conf.d/default.conf

@ -15,6 +15,15 @@ server {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
client_max_body_size 100M;
client_body_buffer_size 5M;
fastcgi_read_timeout 900;
keepalive_timeout 900;
send_timeout 300;
proxy_read_timeout 900;
proxy_connect_timeout 900;
proxy_send_timeout 900;
} }
location / { location / {

1947
docker/php/php.ini

File diff suppressed because it is too large Load Diff

72
rest-client.http

@ -1,10 +1,12 @@
@token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODQ0NFwvYXBpXC9sb2dpbiIsImlhdCI6MTY3NzQ3NzIzMSwiZXhwIjoxNjc4MDgyMDMxLCJuYmYiOjE2Nzc0NzcyMzEsImp0aSI6ImR5WWhRY3ZIbUJEcmFKMG0iLCJzdWIiOjEsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.9zT6CBbQholzIdQ9ZBDoxMvrR-PKvIYkGzdNB6bim0Y @token = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODQ0NFwvYXBpXC9sb2dpbiIsImlhdCI6MTY5MTc2MDYyNCwiZXhwIjoxNjkyMzY1NDI0LCJuYmYiOjE2OTE3NjA2MjQsImp0aSI6Ikd2bEFPTE4yZ2FuRFdVbjEiLCJzdWIiOjEsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.XNGbsmcgQ-CkV8vLlvnItGKM0R1am5X5b6qUFOR1DRo
@tokenS = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9hZHctYXBpLm9zcHJvLmlkXC9hcGlcL2xvZ2luIiwiaWF0IjoxNjkxNTcyMTIwLCJleHAiOjE2OTIxNzY5MjAsIm5iZiI6MTY5MTU3MjEyMCwianRpIjoiVUdqbnhLRVdlZzYyTTBnayIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.5QqK0dLW5jzbVOkSCSW0mFo0K7ycGOBW9NCG_2Zldm4
@hostname = https://adw-api.ospro.id/api
# @hostname = https://adw-api.ospro.id/api
# @hostname = https://ospro-api.ospro.id/api # @hostname = https://ospro-api.ospro.id/api
# @hostname = https://api-iu.ospro.id/api # @hostname = https://api-iu.ospro.id/api
# @hostname = https://api-staging-adw.ospro.id/api # @hostname = https://api-staging-adw.ospro.id/api
# @hostname = http://localhost:8444/api @hostname = http://localhost:8444/api
# @hostname = http://103.73.125.81:8444/api # @hostname = http://103.73.125.81:8444/api
# @hostname = http://localhost:8444/adw-backend/api # @hostname = http://localhost:8444/adw-backend/api
@ -402,6 +404,59 @@ GET {{hostname}}/project/list
Authorization: Bearer {{token}} Authorization: Bearer {{token}}
content-type: application/json content-type: application/json
###
POST {{hostname}}/project/search
Authorization: Bearer {{token}}
content-type: application/json
{
"columns": [
{
"name": "nama",
"logic_operator": "ilike",
"value": "",
"operator": "AND"
}
],
"select": ["kode_sortname", "nama", "mulai_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
}
}
###
POST https://adw-api.ospro.id/api/project/search
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}
}
### add ### add
POST {{hostname}}/project/add POST {{hostname}}/project/add
@ -1103,3 +1158,14 @@ 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"
}

10
routes/web.php

@ -208,6 +208,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->post('/activity/import', 'ActivityController@import'); $router->post('/activity/import', 'ActivityController@import');
$router->post('/activity/import-update', 'ActivityController@importUpdate'); $router->post('/activity/import-update', 'ActivityController@importUpdate');
$router->post('/activity/import-old', 'ActivityController@importOld'); $router->post('/activity/import-old', 'ActivityController@importOld');
$router->post('/activity/batch-update/{ganttId}', 'ActivityController@batchUpdate');
$router->post('/task', 'ActivityController@add'); $router->post('/task', 'ActivityController@add');
$router->get('/task/edit/{id}', 'ActivityController@edit'); $router->get('/task/edit/{id}', 'ActivityController@edit');
$router->put('/task/{id}', 'ActivityController@update'); $router->put('/task/{id}', 'ActivityController@update');
@ -236,6 +237,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->get('/comment-activity/list', 'CommentActivityController@list'); $router->get('/comment-activity/list', 'CommentActivityController@list');
$router->post('/presence/add', 'PresenceController@add'); $router->post('/presence/add', 'PresenceController@add');
$router->post('/presence/test', 'PresenceController@checkLocationTest');
$router->get('/presence/edit/{id}', 'PresenceController@edit'); $router->get('/presence/edit/{id}', 'PresenceController@edit');
$router->put('/presence/update/{id}', 'PresenceController@update'); $router->put('/presence/update/{id}', 'PresenceController@update');
$router->post('/presence/search', 'PresenceController@search'); $router->post('/presence/search', 'PresenceController@search');
@ -456,5 +458,13 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->get('/hierarchy-ftths/tree-gantt/{gantt_id}', 'HierarchyFtthController@getTreeByGantt'); $router->get('/hierarchy-ftths/tree-gantt/{gantt_id}', 'HierarchyFtthController@getTreeByGantt');
$router->post('/map-monitoring/search', 'MapMonitoringController@search'); $router->post('/map-monitoring/search', 'MapMonitoringController@search');
$router->post('/broadcast/add', 'BroadcastController@add');
$router->get('/broadcast/edit/{id}', 'BroadcastController@edit');
$router->put('/broadcast/update/{id}', 'BroadcastController@update');
$router->post('/broadcast/search', 'BroadcastController@search');
$router->delete('/broadcast/delete/{id}', 'BroadcastController@delete');
$router->get('/broadcast/list', 'BroadcastController@list');
}); });
}); });

Loading…
Cancel
Save