diff --git a/app/Classes/General/Eloquent/Filters/WithContainersPackages.php b/app/Classes/General/Eloquent/Filters/WithContainersPackages.php new file mode 100644 index 00000000..5fabff27 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/WithContainersPackages.php @@ -0,0 +1,20 @@ +with(['containers', 'packages']); + } +} diff --git a/app/Classes/Jobs/ListPackingListsJob.php b/app/Classes/Jobs/ListPackingListsJob.php index 474531f4..37a970fe 100644 --- a/app/Classes/Jobs/ListPackingListsJob.php +++ b/app/Classes/Jobs/ListPackingListsJob.php @@ -15,6 +15,8 @@ class ListPackingListsJob implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; + public $timeout = 900; + /** @var ListGenericJobObject */ private $listGenericJobObject; diff --git a/app/Classes/Modules/PackingLists/Processors/ListPackingListsJobProcessor.php b/app/Classes/Modules/PackingLists/Processors/ListPackingListsJobProcessor.php index 4e67f7a1..2f3a5eed 100644 --- a/app/Classes/Modules/PackingLists/Processors/ListPackingListsJobProcessor.php +++ b/app/Classes/Modules/PackingLists/Processors/ListPackingListsJobProcessor.php @@ -37,7 +37,10 @@ class ListPackingListsJobProcessor */ public function execute(ListGenericJobObject $listGenericJobObject) { - $query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page']]); + // $query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page'], 'with_containers_packages' => true]); + + $query = $this->listsPackingLists->execute(array_merge($this->listsPackingLists->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page'], 'with_containers_packages' => true])); + foreach ($query->items() as &$item) { $item['userInfo'] = $listGenericJobObject->getUserInfo(); } diff --git a/app/Classes/Modules/Transactions/Processors/CheckStorageInvoiceTransactionProcessor.php b/app/Classes/Modules/Transactions/Processors/CheckStorageInvoiceTransactionProcessor.php index 95089642..bc9adccd 100644 --- a/app/Classes/Modules/Transactions/Processors/CheckStorageInvoiceTransactionProcessor.php +++ b/app/Classes/Modules/Transactions/Processors/CheckStorageInvoiceTransactionProcessor.php @@ -200,6 +200,11 @@ class CheckStorageInvoiceTransactionProcessor $this->createStorageInvoiceTransactionDetails($storageInvoice, $destinationWarehousePackage, $cbm, $pricePerCBM, $resultNumberOfDaysExceeded); } else if($storageInvoice){ + //Additional handling for giving selected storage invoice a waiver + if(isset($storageInvoice->is_waived) && $storageInvoice->is_waived){ + $pricePerCBM = 0; + $price_cbm = $pricePerCBM * $cbm * $resultNumberOfDaysExceeded; + } //Additional handling for calculation of numberOfDaysExceeded in the event of the storage already paid $paymentStorageTransaction = $storageInvoice->transactions()->where('transactions.type', TransactionType::PAYMENT)->where('transactions.status', ApprovalStatus::APPROVED)->first(); @@ -216,10 +221,12 @@ class CheckStorageInvoiceTransactionProcessor Log::channel('storage_invoices')->info('Update $transaction->id: '.$transaction->id); Log::channel('storage_invoices')->info('$storageInvoice->status: '.$storageInvoice->status); Log::channel('storage_invoices')->info('price_cbm: '.$price_cbm."-".gettype($price_cbm)); + Log::channel('storage_invoices')->info('amount: '.$amount); + + $proceedToUpdate = false; if(abs($price_cbm - $amount) > $epsilon && $storageInvoice->status !== ApprovalStatus::COMPLETED){ $paymentTransactions = $storageInvoice->transactions()->where('transactions.type', TransactionType::PAYMENT)->where('transactions.status', ApprovalStatus::PENDING_SUBMISSION)->get(); - if(!$isBackDoorCheck){ if(count($paymentTransactions) > 0){ $this->updatePaymentTransactionViaNonGroupPayment($paymentTransactions); @@ -229,6 +236,11 @@ class CheckStorageInvoiceTransactionProcessor } } + $proceedToUpdate = true; + } + + if($proceedToUpdate || ($pricePerCBM == 0 && $amount != 0)){ + Log::channel('storage_invoices')->info('proceedToUpdate'); $storageInvoice = $this->updateStorageInvoiceTransaction($storageInvoice, $price_cbm); $invoiceTransactionDetails = $storageInvoice->transactionDetails()->first(); $this->updateStorageInvoiceTransactionDetails($invoiceTransactionDetails, $destinationWarehousePackage, $cbm, $pricePerCBM, $resultNumberOfDaysExceeded); diff --git a/app/Http/Resources/ListPackingListJobResource.php b/app/Http/Resources/ListPackingListJobResource.php index d260f4b6..6b13be59 100644 --- a/app/Http/Resources/ListPackingListJobResource.php +++ b/app/Http/Resources/ListPackingListJobResource.php @@ -32,10 +32,13 @@ class ListPackingListJobResource extends JsonResource 'transport' => new TransportResource($this->transports()->first()), 'type' => $this->type, 'receive_packing_list' => $this->when($this->type === PackingListType::SHIPPING_PACKING_LIST, new PackingListV2Resource(PackingList::where('reference', $this->reference)->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST)->first(), $this->userInfo)), - 'packages' => PackageResource::collection($packages), - $this->mergeWhen($this->owner instanceof Order, [ - 'order' => New OrderResource($this->owner) - ]), + // 'packages' => PackageResource::collection($packages), + // $this->mergeWhen($this->owner instanceof Order, [ + // 'order' => New OrderResource($this->owner) + // ]), + 'container' => new ContainerResource($this->containers->first()), + 'packages' => PackageWithoutOrderResource::collection($packages), + $this->mergeWhen($this->owner instanceof Order, [ 'order' => New OrderResource($this->owner) ]), 'shipping_transaction' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereNotIn('status', [ApprovalStatus::SUSPENDED, ApprovalStatus::EXPIRED])->first()), 'suspended_invoice' => new TransactionResource($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->first()), // 'suspended_invoices' => TransactionResource::collection($this->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [ApprovalStatus::SUSPENDED])->get()), diff --git a/app/Http/Resources/PackageWithoutOrderResource.php b/app/Http/Resources/PackageWithoutOrderResource.php new file mode 100644 index 00000000..fea5500b --- /dev/null +++ b/app/Http/Resources/PackageWithoutOrderResource.php @@ -0,0 +1,38 @@ + $this->id, + 'type' => $this->type, + 'description' => $this->description, + 'width' => floatval($this->width), + 'height' => floatval($this->height), + 'length' => floatval($this->length), + 'weight' => $this->weight, + 'quantity' => $this->quantity, + 'cbm' => (($this->width / 100) * ($this->height / 100) * ($this->length / 100)) * $this->quantity, + 'reference' => $this->packingList->reference, + 'status' => $this->status, + // $this->mergeWhen($originalPackingList->owner instanceof Order, [ + // 'order' => New OrderResource($originalPackingList->owner) + // ]), + // 'container' => new ContainerResource($originalPackingList->containers()->first()), + // 'transport' => new TransportResource($originalPackingList->transports()->first()) + ]; + } +} diff --git a/database/migrations/2024_01_23_233651_add_is_waived_to_transactions_logs_table.php b/database/migrations/2024_01_23_233651_add_is_waived_to_transactions_logs_table.php new file mode 100644 index 00000000..6755dcef --- /dev/null +++ b/database/migrations/2024_01_23_233651_add_is_waived_to_transactions_logs_table.php @@ -0,0 +1,32 @@ +boolean('is_waived')->nullable()->after('status')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('transaction_logs', function (Blueprint $table) { + $table->dropColumn('is_waived'); + }); + } +} diff --git a/database/migrations/2024_01_23_233651_add_is_waived_to_transactions_table.php b/database/migrations/2024_01_23_233651_add_is_waived_to_transactions_table.php new file mode 100644 index 00000000..30a5e738 --- /dev/null +++ b/database/migrations/2024_01_23_233651_add_is_waived_to_transactions_table.php @@ -0,0 +1,32 @@ +boolean('is_waived')->nullable()->after('status')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('transactions', function (Blueprint $table) { + $table->dropColumn('is_waived'); + }); + } +} diff --git a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingWithSearchComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingWithSearchComponent.vue index 120fc803..be4038bb 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingWithSearchComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingWithSearchComponent.vue @@ -35,16 +35,16 @@ - - + + diff --git a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingWithSearchPollingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingWithSearchPollingComponent.vue new file mode 100644 index 00000000..13df803e --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingWithSearchPollingComponent.vue @@ -0,0 +1,90 @@ + + diff --git a/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingComponent.vue new file mode 100644 index 00000000..825d9a67 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/elements/SingleAdminPaymentsBillingComponent.vue @@ -0,0 +1,322 @@ + + diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue new file mode 100644 index 00000000..25e4c303 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingPollingSectionComponent.vue @@ -0,0 +1,141 @@ + + diff --git a/resources/assets/vue/components/wallets/elements/CustomerWalletTransactionComponent.vue b/resources/assets/vue/components/wallets/elements/CustomerWalletTransactionComponent.vue index cb0bb88f..4f6fba87 100644 --- a/resources/assets/vue/components/wallets/elements/CustomerWalletTransactionComponent.vue +++ b/resources/assets/vue/components/wallets/elements/CustomerWalletTransactionComponent.vue @@ -1,7 +1,7 @@