Browse Source

Merge pull request 'Import Nik' (#62) from dev-wahyu into staging

Reviewed-on: ordo/adw-backend#62
pull/3/head
ibnu 1 year ago
parent
commit
2dbf3b9751
  1. 20
      app/Http/Controllers/ActivityController.php

20
app/Http/Controllers/ActivityController.php

@ -9,6 +9,8 @@ use App\Models\TemplateGantt;
use App\Models\TmpImport;
use App\Models\VersionGantt;
use App\Models\UserToActivity;
use App\Models\UserToProyek;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@ -462,7 +464,23 @@ class ActivityController extends Controller
$activity->type_activity = "project";
$activity->save();
$activity->level = $activity_row['level'];
}
}
if (isset($data['activities'][$i]['nik'])) {
$user = User::where("ktp_number", $data['activities'][$i]['nik'])->first();
$userProyek = UserToProyek::where("user_id", $user->id)
->where("proyek_id", $projectId)
->first();
$dataInsert = array(
"user_id" => $user->id,
"activity_id" => $activity->id,
"role_proyek_id" => $userProyek->project_role,
"proyek_id" => $projectId,
"created_by" => $this->currentName,
"version_gantt_id" => $data['ganttId']
);
UserToActivity::create($dataInsert);
}
if (!empty($activity_row['predecessor'])) {
$key = array_search($activity_row['predecessor'], array_column($data['activities'], 'no'));

Loading…
Cancel
Save