|
|
|
@ -6,6 +6,7 @@ use App\Models\CommentActivity;
|
|
|
|
|
use App\Models\Link; |
|
|
|
|
use App\Models\Project; |
|
|
|
|
use App\Models\TemplateGantt; |
|
|
|
|
use App\Models\TmpImport; |
|
|
|
|
use App\Models\VersionGantt; |
|
|
|
|
use App\Models\UserToActivity; |
|
|
|
|
use Illuminate\Http\Request; |
|
|
|
@ -280,9 +281,9 @@ class ActivityController extends Controller
|
|
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function import(Request $request) |
|
|
|
|
public function import(Request $request) |
|
|
|
|
{ |
|
|
|
|
$data = $request->all(); |
|
|
|
|
$data = $request->all(); |
|
|
|
|
|
|
|
|
|
$data['created_by'] = $this->currentName; |
|
|
|
|
|
|
|
|
@ -306,7 +307,7 @@ class ActivityController extends Controller
|
|
|
|
|
$input['bobot_planning'] = $activity_row['weight']; |
|
|
|
|
$input['persentase_progress'] = 0; |
|
|
|
|
$input['type_activity'] = $i == 0 ? "header" : "task"; |
|
|
|
|
$input['created_by'] = $this->currentName; |
|
|
|
|
$input['created_by'] = $this->currentName; |
|
|
|
|
|
|
|
|
|
if (!$activity = Activity::create($input)) { |
|
|
|
|
Activity::where('version_gantt_id', $data['ganttId'])->delete(); |
|
|
|
@ -385,5 +386,34 @@ class ActivityController extends Controller
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return response()->json(['stack' => $activityStack, 'status' => 'success', 'message' => 'Data imported!', 'projectId' => $projectId, 'code' => 200], 200); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function uploadTmpImport(Request $request) |
|
|
|
|
{ |
|
|
|
|
if($request->hasFile('dokumen')){ |
|
|
|
|
$document = $request->file('dokumen'); |
|
|
|
|
$gantt_id = $request->gantt_id; |
|
|
|
|
$name = $document->getClientOriginalName(); |
|
|
|
|
|
|
|
|
|
$result = $document->move($this->pathDocument, $name); |
|
|
|
|
if($result){ |
|
|
|
|
$data = [ |
|
|
|
|
'ref_id' => (int)$gantt_id, |
|
|
|
|
'file' => $name, |
|
|
|
|
'type_dokumen' => $request->type_dokumen |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
$result = TmpImport::create($data); |
|
|
|
|
|
|
|
|
|
if(!$result){ |
|
|
|
|
unlink($this->pathDocument.$name); |
|
|
|
|
return response()->json(['status'=>'failed','message'=>'Upload failed!','code'=> 500], 500); |
|
|
|
|
} |
|
|
|
|
return response()->json(['status'=>'success','message'=>'Upload successful!','code'=>200], 200); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return response()->json(['status'=>'failed','message'=>'Upload failed!','code'=> 500], 500); |
|
|
|
|
} |
|
|
|
|
return response()->json(['status'=>'failed','message'=>'File is required!','code'=>400], 400); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|