Merge branch 'dillon/34.1-jenkins-vapor' into vapor/development

This commit is contained in:
Dillon Ngo
2024-04-29 14:57:26 +08:00
8 changed files with 16 additions and 12 deletions
+12 -3
View File
@@ -3,6 +3,7 @@ namespace App\Classes\General;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Storage;
class ExcelHandel
{
@@ -67,9 +68,17 @@ class ExcelHandel
public static function generateExcel($path = '', $exceldata = '', $filename = '', $extension = '')
{
$file_info = [];
$file = \Storage::disk('public')->put('excels/' . $path . '/' . $filename . '.' . $extension, $exceldata);
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver === 's3'){
$filePathForS3 = 'public/excels/' . $path . '/' . $filename . '.' . $extension;
Storage::disk('s3')->put($filePathForS3, $exceldata);
}
else{
$file = Storage::disk('public')->put('excels/' . $path . '/' . $filename . '.' . $extension, $exceldata);
}
$file_info['original']['file'] = storage_path('app/public/excels/' . $path . '/' . $filename . '.' . $extension);
return $file_info;
}
@@ -84,4 +93,4 @@ class ExcelHandel
return true;
}
}
}
@@ -60,7 +60,7 @@ class BulkDownloadCustomerInvoicesLogic
}
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver == 's3'){
if($filesystemDriver === 's3'){
$startDate = $startDate->format('d-m-Y');
$endDate = $endDate->format('d-m-Y');
$zipFileName = "invoices_{$startDate}_to_{$endDate}_{$company->reference}.zip";
@@ -44,7 +44,7 @@ class BulkDownloadSupplierWhiteFormsLogic
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver == 's3'){
if($filesystemDriver === 's3'){
$startDate = $startDate->format('d-m-Y');
$endDate = $endDate->format('d-m-Y');
@@ -55,7 +55,7 @@ class RenderDocumentLogic extends AbstractControllerLogic
$this->canRenderDocument->passes();
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver == 's3'){
if($filesystemDriver === 's3'){
if(!Storage::disk('s3')->exists($file))
{
throw new ResourceNotFoundException();
@@ -100,7 +100,7 @@ class ConvertsBase64ToFile
private function generateFile(FileObject $file, string $suffix = '') {
$filesystemDriver = Storage::getDefaultDriver();
if($filesystemDriver == 's3'){
if($filesystemDriver === 's3'){
$filePath = 'documents/'.$this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
Storage::put($filePath, $file->getDecodedData(), 's3');
return $filePath;
@@ -4,7 +4,6 @@ namespace App\Http\Controllers\Imports;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Imports\Services\ImportsDebtor;
use App\Classes\General\ExcelHandel;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\User;
@@ -86,14 +86,12 @@ export default {
},
successHandler(response) {
this.isLoading = false;
console.log('debug response: ' + JSON.stringify(response));
if (response.message) {
this.returnData = response;
}
else {
this.returnData = null;
if(window.LARAVEL_VAPOR_ENABLED){
console.log('window.LARAVEL_VAPOR_ENABLED');
if (response.src) {
window.location.href = response.src;
}
@@ -88,14 +88,12 @@
},
successHandler(response) {
this.isLoading = false;
console.log('debug response: ' + JSON.stringify(response));
if (response.message) {
this.returnData = response;
}
else {
this.returnData = null;
if(window.LARAVEL_VAPOR_ENABLED){
console.log('window.LARAVEL_VAPOR_ENABLED');
if (response.src) {
window.location.href = response.src;
}