Browse Source

Merge branch 'staging' of https://git.oslog.id/ordo/adw-backend into dev-wahyun

pull/3/head
wahyuun 1 year ago
parent
commit
de6ac161a5
  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) {
return response()->json(['message' => $e->getMessage()]);
}

9
app/Http/Controllers/ActivityController.php

@ -175,6 +175,7 @@ class ActivityController extends Controller
}else{
$data = Activity::select('id', 'parent_id', 'name', 'actual_end')->where('parent_id', $id)->get();
}
$parent = Activity::findOrFail($id);
$dataFinal=[];
foreach ($data as $val) {
$activity = $this->getchildActivityForActual($val->id, $params);
@ -187,11 +188,19 @@ class ActivityController extends Controller
return isset($item['actual_start']);
}), 'actual_start');
$returnActualStartOrEnd = count($actualStartValues) == count($dataFinal) ? min($actualStartValues) : null;
if (isset($parent)) {
$parent->actual_start = $returnActualStartOrEnd;
$parent->save();
}
}else{
$actualEndValues = array_column(array_filter($dataFinal, function($item) {
return isset($item['actual_end']);
}), 'actual_end');
$returnActualStartOrEnd = count($actualEndValues) == count($dataFinal) ? max($actualEndValues) : null;
if (isset($parent)) {
$parent->actual_end = $returnActualStartOrEnd;
$parent->save();
}
}
// 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');
$builder = $dataBuilder['builder'];
$countBuilder = $dataBuilder['count'];
// $builder->where("selfTable.created_by",$this->currentName);
$dataGet = $builder->get();
$totalRecord = $countBuilder->count();
@ -274,7 +275,9 @@ class ProjectController extends Controller
'created_by',
'updated_at',
'updated_by'
)->orderBy('id', 'desc')->get();
)->orderBy('id', 'desc')
// ->where("created_by",$this->currentName)
->get();
$countData = $data->count();
if(!$data)

3
app/Http/Controllers/RoleController.php

@ -18,6 +18,9 @@ class RoleController extends Controller
$data = $request->all();
$data['created_by'] = $this->currentName;
if (!isset($data['default_page'])) {
$data['default_page'] = 29; // dashboard
}
$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);
}
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)
{
$payload = $request->all();

34
app/Models/Role.php

@ -1,17 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
protected $table = 'm_roles';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
protected $fillable = [
'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by'
];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
protected $table = 'm_roles';
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
protected $fillable = [
'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->put('/user-to-activity/update/{id}', 'UserToActivityController@update');
$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->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete');
$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('/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-update', 'ActivityController@importUpdate');
$router->post('/activity/import-old', 'ActivityController@importOld');

Loading…
Cancel
Save