diff --git a/app/Classes/Jobs/Commands/V2/ProcessBookingForEInvoiceV2CommandJob.php b/app/Classes/Jobs/Commands/V2/ProcessBookingForEInvoiceV2CommandJob.php new file mode 100644 index 00000000..e5e0a552 --- /dev/null +++ b/app/Classes/Jobs/Commands/V2/ProcessBookingForEInvoiceV2CommandJob.php @@ -0,0 +1,43 @@ +booking = $booking; + } + + public function handle() + { + Log::info(Carbon::now() . ': Start job - Processing single booking for E-Invoice.'); + $start = new Carbon(); + + (App()->make(RegenerateInvoiceBookingProcessor::class))->execute($this->booking); + + $end = new Carbon(); + $elapsedTime = $start->diff($end)->format('%H:%I:%S'); + Log::info(Carbon::now() . ': End job - Processing single booking for E-Invoice. ElapsedTime: ' . $elapsedTime . '.'); + } +} diff --git a/app/Classes/Modules/Bookings/ControllersLogic/BatchBookingsGenerateEInvoiceLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/BatchBookingsGenerateEInvoiceLogic.php index d674c3c6..1b467042 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/BatchBookingsGenerateEInvoiceLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/BatchBookingsGenerateEInvoiceLogic.php @@ -4,6 +4,7 @@ namespace App\Classes\Modules\Bookings\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; +use App\Classes\Jobs\Commands\V2\ProcessBookingForEInvoiceV2CommandJob; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Models\Booking; use App\Classes\Modules\Bookings\Processors\RegenerateInvoiceBookingProcessor; @@ -17,6 +18,7 @@ use Illuminate\Support\Facades\Log; class BatchBookingsGenerateEInvoiceLogic extends AbstractControllerLogic { + protected int $processedCount = 0; /** * @return array */ @@ -24,7 +26,11 @@ class BatchBookingsGenerateEInvoiceLogic extends AbstractControllerLogic { return [ 'title' => 'Generate Bookings E-Invoices', - 'message' => 'You have successfully process bookings for E-Invoices' + 'message' => sprintf( + 'You have successfully submitted %d booking%s for E-Invoices.', + $this->processedCount, + $this->processedCount === 1 ? '' : 's' + ), ]; } @@ -87,8 +93,10 @@ class BatchBookingsGenerateEInvoiceLogic extends AbstractControllerLogic foreach ($bookings as $booking) { // $autocountValue = optional($booking->attributesKVP->first())->value; //Log::info('Booking ID: ' . $booking->marking . ' | AUTOCOUNT_DOCNO: ' . $autocountValue); - $this->regenerateInvoiceBookingProcessor->execute($booking); + // $this->regenerateInvoiceBookingProcessor->execute($booking); + ProcessBookingForEInvoiceV2CommandJob::dispatch($booking); } + $this->processedCount = count($bookings); return $this->resourceResponse(JsonResource::collection(collect([]))); } diff --git a/resources/assets/vue/components/bookings/elements/DownloadUploadComponent.vue b/resources/assets/vue/components/bookings/elements/DownloadUploadComponent.vue index 4bacfb71..ab1524e8 100644 --- a/resources/assets/vue/components/bookings/elements/DownloadUploadComponent.vue +++ b/resources/assets/vue/components/bookings/elements/DownloadUploadComponent.vue @@ -33,9 +33,9 @@