|
|
|
@@ -155,6 +155,52 @@ class CompoundController extends Controller{ |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function uploadPictureManually(Request $request)
|
|
|
|
{
|
|
|
|
$i = 1; $success_upload = 0; $count_upload = 0;
|
|
|
|
|
|
|
|
$filesystem = new Filesystem();
|
|
|
|
if($request->get('type') == 'staging'){
|
|
|
|
$destinationPath = 'staging/document/'.$request->get('no_siri').'/compound';
|
|
|
|
if(!$filesystem->exists('staging/document/'.$request->get('no_siri').'/compound')){
|
|
|
|
$filesystem->mkdir($destinationPath, 0700);
|
|
|
|
}
|
|
|
|
}else if($request->get('type') == 'production'){
|
|
|
|
$destinationPath = 'production/document/'.$request->get('no_siri').'/compound';
|
|
|
|
if(!$filesystem->exists('production/document/'.$request->get('no_siri').'/compound')){
|
|
|
|
$filesystem->mkdir($destinationPath, 0700);
|
|
|
|
}
|
|
|
|
}else if($request->get('type') == 'proxy'){
|
|
|
|
$destinationPath = 'proxy/'.$request->get('no_siri').'/compound';
|
|
|
|
if(!$filesystem->exists('proxy/'.$request->get('no_siri').'/compound')){
|
|
|
|
$filesystem->mkdir($destinationPath, 0700);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$allowedfileExtension = ['jpg','jpeg'];
|
|
|
|
$destinationPathImage = array();
|
|
|
|
if($request->files->has('file')){
|
|
|
|
$count_upload = count($request->files->get('file'));
|
|
|
|
$urlPackage = new UrlPackage('http://filegoforce.sipadu.my', new EmptyVersionStrategy());
|
|
|
|
|
|
|
|
foreach($request->files->get('file') as $f){
|
|
|
|
$extension = $f->getClientOriginalExtension();
|
|
|
|
$check=in_array($extension,$allowedfileExtension);
|
|
|
|
|
|
|
|
if($check) {
|
|
|
|
$name = 'manual'.$request->get('kp').'-'.bin2hex(random_bytes(5)).'.'.$f->getClientOriginalExtension();
|
|
|
|
$destinationPathImage[] = $urlPackage->getUrl('/'.$destinationPath.'/'.$name);
|
|
|
|
$f->move($destinationPath, $name);
|
|
|
|
$success_upload++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->sendResponse($destinationPathImage, $success_upload.'/'.$count_upload.' berjaya memuatnaik gambar kompaun');
|
|
|
|
}else{
|
|
|
|
return $this->sendError('Gagal', 'Gambar kompaun tidak dimuatnaik!');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function storeCompoundPDF(Request $request)
|
|
|
|
{
|
|
|
|
//Decode Json
|