Browse Source

Merge pull request 'Task #860q7btm6 cek username' (#11) from dev-wahyu into staging

Reviewed-on: ordo/adw-backend#11
Reviewed-by: ibnu <ibnu@mail.com>
pull/3/head
ibnu 2 years ago
parent
commit
99e921abd7
  1. 4
      app/Http/Controllers/HumanResourceController.php
  2. 4
      app/Http/Controllers/ProjectController.php

4
app/Http/Controllers/HumanResourceController.php

@ -60,6 +60,10 @@ class HumanResourceController extends Controller
if(isset($request->password) && $request->password!="" ){
$data['password'] = md5($request->password);
}
if(isset($data['username']) && HumanResource::where('username', $data['username'])->where('id', '<>', $id)->exists()){
return response()->json(['status'=>'failed','message'=>'Username already exists!','code'=>400], 400);
}
if($humanresource){
$result = $humanresource->update($data);

4
app/Http/Controllers/ProjectController.php

@ -231,7 +231,7 @@ class ProjectController extends Controller
$scheduleHealth = "on-track";
$rootActivity = Activity::whereNull('parent_id')->where('proyek_id', $d->id)->orderBy('version_gantt_id', 'desc')->first();
if($rootActivity){
$costVariance = $d->rencana_biaya - $rootActivity->biaya_actual;
$costVariance = (int)$d->rencana_biaya - (int)$rootActivity->biaya_actual;
$actualCost = $rootActivity->biaya_actual ?? 0;
$progress = $rootActivity->persentase_progress ?? 0;
@ -271,7 +271,7 @@ class ProjectController extends Controller
}
}
$totalPlannedCost = $data->sum('plannedCost');
$totalPlannedCost = array_sum(array_map('intval', array_column($data->toArray(), 'plannedCost')));
$totalActualCost = $data->sum('actualCost');
$manpowers = User::count();
$projectsOnDanger = Project::where('budget_health', 'danger')->count();

Loading…
Cancel
Save