Browse Source

Import Nik

pull/3/head
Wahyu Ramadhan 1 year ago
parent
commit
1d321b2b48
  1. 18
      app/Http/Controllers/ActivityController.php

18
app/Http/Controllers/ActivityController.php

@ -9,6 +9,8 @@ use App\Models\TemplateGantt;
use App\Models\TmpImport; use App\Models\TmpImport;
use App\Models\VersionGantt; use App\Models\VersionGantt;
use App\Models\UserToActivity; use App\Models\UserToActivity;
use App\Models\UserToProyek;
use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -463,6 +465,22 @@ class ActivityController extends Controller
$activity->save(); $activity->save();
$activity->level = $activity_row['level']; $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'])) { if (!empty($activity_row['predecessor'])) {
$key = array_search($activity_row['predecessor'], array_column($data['activities'], 'no')); $key = array_search($activity_row['predecessor'], array_column($data['activities'], 'no'));

Loading…
Cancel
Save