diff --git a/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadSupplierWhiteFormsLogic.php b/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadSupplierWhiteFormsLogic.php index 61cce5ae..6708646b 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadSupplierWhiteFormsLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/BulkDownloadSupplierWhiteFormsLogic.php @@ -73,27 +73,12 @@ class BulkDownloadSupplierWhiteFormsLogic Log::info('BulkDownloadSupplierWhiteFormsLogic finished processing files count: '.count($groups)); - // return response()->streamDownload(function () use ($filePathForS3) { - // $temporaryUrl = Storage::disk('s3')->temporaryUrl( - // $filePathForS3, - // Carbon::now()->addMinutes(60) - // ); - // $response = Http::get($temporaryUrl); - // echo $response->getBody()->getContents(); - // }, $zipFileName); + $temporaryUrl = Storage::disk('s3')->temporaryUrl( + $filePathForS3, + Carbon::now()->addMinutes(60) + ); - return response()->stream(function () use ($filePathForS3) { - $temporaryUrl = Storage::disk('s3')->temporaryUrl( - $filePathForS3, - Carbon::now()->addMinutes(60) - ); - $fileStream = fopen($temporaryUrl, 'r'); - fpassthru($fileStream); - fclose($fileStream); - }, 200, [ - 'Content-Type' => 'application/octet-stream', - 'Content-Disposition' => 'attachment', - ]); + return response(['src' => $temporaryUrl ]); } else { return response()->json([ diff --git a/resources/assets/vue/components/companies/elements/BulkDownloadInvoiceComponent.vue b/resources/assets/vue/components/companies/elements/BulkDownloadInvoiceComponent.vue index df9f4f9d..deff567e 100644 --- a/resources/assets/vue/components/companies/elements/BulkDownloadInvoiceComponent.vue +++ b/resources/assets/vue/components/companies/elements/BulkDownloadInvoiceComponent.vue @@ -88,10 +88,16 @@ }, successHandler(response) { this.isLoading = false; - if (response.message) { - this.returnData = response; - } else { - this.returnData = null; + if(window.LARAVEL_VAPOR_ENABLED){ + let src = response.payload.src; + window.location.href = src; + } + else{ + if (response.message) { + this.returnData = response; + } else { + this.returnData = null; + } } }, hasMarkingParameter() {