|
|
@ -6,9 +6,9 @@ use App\Models\CommentActivity; |
|
|
|
use App\Models\Link; |
|
|
|
use App\Models\Link; |
|
|
|
use App\Models\Project; |
|
|
|
use App\Models\Project; |
|
|
|
use App\Models\TemplateGantt; |
|
|
|
use App\Models\TemplateGantt; |
|
|
|
|
|
|
|
use App\Models\TmpImport; |
|
|
|
use App\Models\VersionGantt; |
|
|
|
use App\Models\VersionGantt; |
|
|
|
use App\Models\UserToActivity; |
|
|
|
use App\Models\UserToActivity; |
|
|
|
use App\Models\TmpImport; |
|
|
|
|
|
|
|
use Illuminate\Http\Request; |
|
|
|
use Illuminate\Http\Request; |
|
|
|
|
|
|
|
|
|
|
|
class ActivityController extends Controller |
|
|
|
class ActivityController extends Controller |
|
|
@ -281,7 +281,8 @@ class ActivityController extends Controller |
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); |
|
|
|
return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function import(Request $request) |
|
|
|
// before upload file |
|
|
|
|
|
|
|
public function importOld(Request $request) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$data = $request->all(); |
|
|
|
$data = $request->all(); |
|
|
|
|
|
|
|
|
|
|
@ -388,17 +389,29 @@ class ActivityController extends Controller |
|
|
|
return response()->json(['stack' => $activityStack, 'status' => 'success', 'message' => 'Data imported!', 'projectId' => $projectId, 'code' => 200], 200); |
|
|
|
return response()->json(['stack' => $activityStack, 'status' => 'success', 'message' => 'Data imported!', 'projectId' => $projectId, 'code' => 200], 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function import(Request $request) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$data = $request->all(); |
|
|
|
|
|
|
|
$data['created_by'] = $this->currentName; |
|
|
|
|
|
|
|
Activity::where('version_gantt_id', $data['gantt_id'])->delete(); |
|
|
|
|
|
|
|
$projectId = VersionGantt::where('id', $data['gantt_id'])->first()->proyek_id; |
|
|
|
|
|
|
|
// get data excel |
|
|
|
|
|
|
|
$excel = TmpImport::latest('id')->first(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return response()->json(['stack' => $excel, 'status' => 'success', 'message' => 'Data imported!', 'data' => $data, 'code' => 200], 200); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function uploadTmpImport(Request $request) |
|
|
|
public function uploadTmpImport(Request $request) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if($request->hasFile('dokumen')){ |
|
|
|
if($request->hasFile('dokumen')){ |
|
|
|
$document = $request->file('dokumen'); |
|
|
|
$document = $request->file('dokumen'); |
|
|
|
$ref_id = $request->ref_id; |
|
|
|
$gantt_id = $request->gantt_id; |
|
|
|
$name = $document->getClientOriginalName(); |
|
|
|
$name = $document->getClientOriginalName(); |
|
|
|
|
|
|
|
|
|
|
|
$result = $document->move($this->pathDocument, $name); |
|
|
|
$result = $document->move($this->pathTmpImport, $name); |
|
|
|
if($result){ |
|
|
|
if($result){ |
|
|
|
$data = [ |
|
|
|
$data = [ |
|
|
|
'ref_id' => (int)$ref_id, |
|
|
|
'gantt_id' => (int)$gantt_id, |
|
|
|
'file' => $name, |
|
|
|
'file' => $name, |
|
|
|
'type_dokumen' => $request->type_dokumen |
|
|
|
'type_dokumen' => $request->type_dokumen |
|
|
|
]; |
|
|
|
]; |
|
|
@ -406,7 +419,7 @@ class ActivityController extends Controller |
|
|
|
$result = TmpImport::create($data); |
|
|
|
$result = TmpImport::create($data); |
|
|
|
|
|
|
|
|
|
|
|
if(!$result){ |
|
|
|
if(!$result){ |
|
|
|
unlink($this->pathDocument.$name); |
|
|
|
unlink($this->pathTmpImport.$name); |
|
|
|
return response()->json(['status'=>'failed','message'=>'Upload failed!','code'=> 500], 500); |
|
|
|
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'=>'success','message'=>'Upload successful!','code'=>200], 200); |
|
|
|