Browse Source

Merge branch 'staging' into dev-wahyun

pull/3/head
wahyun 1 year ago
parent
commit
01763ff3e7
  1. 2
      app/Helpers/MasterFunctionsHelper.php
  2. 9
      app/Http/Controllers/ActivityController.php
  3. 5
      app/Http/Controllers/ProjectController.php
  4. 3
      app/Http/Controllers/RoleController.php
  5. 10
      app/Http/Controllers/UserToActivityController.php
  6. 34
      app/Models/Role.php
  7. 3
      routes/web.php

2
app/Helpers/MasterFunctionsHelper.php

@ -687,7 +687,7 @@ class MasterFunctionsHelper
// } // }
$totalACWP += $keyActualM->biaya_actual / $keyActualM->duration; $totalACWP += $keyActualM->duration > 0 ? $keyActualM->biaya_actual / $keyActualM->duration : 0;
} catch (\DivisionByZeroError $e) { } catch (\DivisionByZeroError $e) {
return response()->json(['message' => $e->getMessage()]); return response()->json(['message' => $e->getMessage()]);
} }

9
app/Http/Controllers/ActivityController.php

@ -175,6 +175,7 @@ class ActivityController extends Controller
}else{ }else{
$data = Activity::select('id', 'parent_id', 'name', 'actual_end')->where('parent_id', $id)->get(); $data = Activity::select('id', 'parent_id', 'name', 'actual_end')->where('parent_id', $id)->get();
} }
$parent = Activity::findOrFail($id);
$dataFinal=[]; $dataFinal=[];
foreach ($data as $val) { foreach ($data as $val) {
$activity = $this->getchildActivityForActual($val->id, $params); $activity = $this->getchildActivityForActual($val->id, $params);
@ -187,11 +188,19 @@ class ActivityController extends Controller
return isset($item['actual_start']); return isset($item['actual_start']);
}), 'actual_start'); }), 'actual_start');
$returnActualStartOrEnd = count($actualStartValues) == count($dataFinal) ? min($actualStartValues) : null; $returnActualStartOrEnd = count($actualStartValues) == count($dataFinal) ? min($actualStartValues) : null;
if (isset($parent)) {
$parent->actual_start = $returnActualStartOrEnd;
$parent->save();
}
}else{ }else{
$actualEndValues = array_column(array_filter($dataFinal, function($item) { $actualEndValues = array_column(array_filter($dataFinal, function($item) {
return isset($item['actual_end']); return isset($item['actual_end']);
}), 'actual_end'); }), 'actual_end');
$returnActualStartOrEnd = count($actualEndValues) == count($dataFinal) ? max($actualEndValues) : null; $returnActualStartOrEnd = count($actualEndValues) == count($dataFinal) ? max($actualEndValues) : null;
if (isset($parent)) {
$parent->actual_end = $returnActualStartOrEnd;
$parent->save();
}
} }
// return json_encode(["min"=>$minActualStart, "max"=>$maxActualStart]); // return json_encode(["min"=>$minActualStart, "max"=>$maxActualStart]);

5
app/Http/Controllers/ProjectController.php

@ -229,6 +229,7 @@ class ProjectController extends Controller
$dataBuilder = $this->setUpPayload($payload, 'm_proyek'); $dataBuilder = $this->setUpPayload($payload, 'm_proyek');
$builder = $dataBuilder['builder']; $builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count']; $countBuilder = $dataBuilder['count'];
// $builder->where("selfTable.created_by",$this->currentName);
$dataGet = $builder->get(); $dataGet = $builder->get();
$totalRecord = $countBuilder->count(); $totalRecord = $countBuilder->count();
@ -274,7 +275,9 @@ class ProjectController extends Controller
'created_by', 'created_by',
'updated_at', 'updated_at',
'updated_by' 'updated_by'
)->orderBy('id', 'desc')->get(); )->orderBy('id', 'desc')
// ->where("created_by",$this->currentName)
->get();
$countData = $data->count(); $countData = $data->count();
if(!$data) if(!$data)

3
app/Http/Controllers/RoleController.php

@ -18,6 +18,9 @@ class RoleController extends Controller
$data = $request->all(); $data = $request->all();
$data['created_by'] = $this->currentName; $data['created_by'] = $this->currentName;
if (!isset($data['default_page'])) {
$data['default_page'] = 29; // dashboard
}
$result = Role::create($data); $result = Role::create($data);

10
app/Http/Controllers/UserToActivityController.php

@ -129,6 +129,16 @@ class UserToActivityController extends Controller
return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200); return response()->json(['status'=>'success','code'=>200,'data'=>$result], 200);
} }
public function searchAnalysis(Request $request)
{
$dataBuilder = $this->setUpPayload($request->all(), 'assign_hr_to_activity');
$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 search(Request $request) public function search(Request $request)
{ {
$payload = $request->all(); $payload = $request->all();

34
app/Models/Role.php

@ -1,17 +1,17 @@
<?php <?php
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Role extends Model class Role extends Model
{ {
protected $table = 'm_roles'; protected $table = 'm_roles';
const CREATED_AT = 'created_at'; const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at'; const UPDATED_AT = 'updated_at';
protected $fillable = [ protected $fillable = [
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by' 'name', 'description', 'default_page', 'created_at', 'created_by', 'updated_at', 'updated_by'
]; ];
} }

3
routes/web.php

@ -197,6 +197,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout
$router->get('/user-to-activity/edit/{id}', 'UserToActivityController@edit'); $router->get('/user-to-activity/edit/{id}', 'UserToActivityController@edit');
$router->put('/user-to-activity/update/{id}', 'UserToActivityController@update'); $router->put('/user-to-activity/update/{id}', 'UserToActivityController@update');
$router->post('/user-to-activity/search', 'UserToActivityController@search'); $router->post('/user-to-activity/search', 'UserToActivityController@search');
$router->post('/user-to-activity/search-analysis', 'UserToActivityController@searchAnalysis');
$router->post('/user-to-activity/list-filtered', 'UserToActivityController@listFiltered'); $router->post('/user-to-activity/list-filtered', 'UserToActivityController@listFiltered');
$router->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete'); $router->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete');
$router->get('/user-to-activity/list', 'UserToActivityController@list'); $router->get('/user-to-activity/list', 'UserToActivityController@list');
@ -204,7 +205,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout
$router->get('/sumVolActualM/{id}', 'ActivityController@sumVolumeActualMaterial'); $router->get('/sumVolActualM/{id}', 'ActivityController@sumVolumeActualMaterial');
$router->get('/activity/{id}/{proyek_id}/get', 'ActivityController@getByGanttId'); $router->get('/activity/{id}/{proyek_id}/get', 'ActivityController@getByGanttId');
$router->get('/activity/search', 'ActivityController@search'); $router->post('/activity/search', 'ActivityController@search');
$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');

Loading…
Cancel
Save