From b9b30a1555fff35a9eaf8e126c6920750c3ca029 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 16 Dec 2021 20:24:10 +0800 Subject: [PATCH 01/34] update wallet ui at dashboard --- .../customerDashboardSectionComponent.vue | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue b/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue index 8d48fc7e..2fc0ba02 100644 --- a/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue +++ b/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue @@ -536,8 +536,35 @@
- + +
+
+
+
+ +
MYR 0.00
+
+
+
+
+ Reload +
+
+ Transaction History +
+
+
+
+ + Transfer +
+
+ + Cash Out +
+
+
+
From f9db00356b57b506979c6b1d1b126ecf6bfd36ad Mon Sep 17 00:00:00 2001 From: glovetleong Date: Thu, 23 Dec 2021 21:57:08 +0800 Subject: [PATCH 02/34] bill transaction status update --- .../UpdatePaymentTransactionStatusLogic.php | 76 +++++++++++++++++++ ...datePaymentTransactionStatusController.php | 14 ++++ routes/transaction.php | 2 + 3 files changed, 92 insertions(+) create mode 100644 app/Classes/Modules/Transactions/ControllersLogic/UpdatePaymentTransactionStatusLogic.php create mode 100644 app/Http/Controllers/Transactions/UpdatePaymentTransactionStatusController.php diff --git a/app/Classes/Modules/Transactions/ControllersLogic/UpdatePaymentTransactionStatusLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/UpdatePaymentTransactionStatusLogic.php new file mode 100644 index 00000000..11f0a377 --- /dev/null +++ b/app/Classes/Modules/Transactions/ControllersLogic/UpdatePaymentTransactionStatusLogic.php @@ -0,0 +1,76 @@ + 'Updated Transaction', + 'message' => 'You have successfully updated a transaction' + ]; + } + + /** @var FetchesTransaction */ + private $fetchesTransaction; + + /** @var UpdatesTransactionStatus */ + private $updatesTransactionStatus; + + /** @var DeletesDocument */ + private $deletesDocument; + + /** + * CreatePaymentVerificationDocumentLogic constructor. + * @param FetchesTransaction $fetchesTransaction + * @param UpdatesTransactionStatus $updatesTransactionStatus + * @param DeletesDocument $deletesDocument + */ + public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, DeletesDocument $deletesDocument) + { + $this->fetchesTransaction = $fetchesTransaction; + $this->updatesTransactionStatus = $updatesTransactionStatus; + $this->deletesDocument = $deletesDocument; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function logic(Request $request) : JsonResponse + { + $transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]); + $status = $request->route('status'); + + $this->updatesTransactionStatus->execute($transaction, $status === 'pending' ? ApprovalStatus::PENDING_VERIFICATION : ApprovalStatus::COMPLETED); + + if ($status == 'pending') { + $document = $transaction->documents()->first(); + if ($document) { + $this->deletesDocument->execute($document); + } + } + + return $this->response([]); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Transactions/UpdatePaymentTransactionStatusController.php b/app/Http/Controllers/Transactions/UpdatePaymentTransactionStatusController.php new file mode 100644 index 00000000..047bc1dc --- /dev/null +++ b/app/Http/Controllers/Transactions/UpdatePaymentTransactionStatusController.php @@ -0,0 +1,14 @@ +execute($request); + } +} \ No newline at end of file diff --git a/routes/transaction.php b/routes/transaction.php index 17502743..578b02c2 100644 --- a/routes/transaction.php +++ b/routes/transaction.php @@ -10,6 +10,8 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' => route::post('/supplier/{id}/bill/create', 'CreateSupplierTransactionController@create')->name('supplier.create'); route::post('{id}/bill/verification', 'CreatePaymentProofDocumentController@verify')->name('bill.verification'); route::post('{id}/bill/pay', 'CreatePaymentProofDocumentController@pay')->name('bill.pay'); + Route::put('/{id}/bill/{status}', 'UpdatePaymentTransactionStatusController@update')->where('status', 'pending|complete')->name('bill.status'); + route::delete('{id}/bill/delete', 'DeletePaymentProofDocumentController@delete')->name('bill.delete'); Route::post('booking/{id}/details/update', 'CreatePurchaseOrderTransactionController@create')->name('po.create'); From 8bf6b69e63cc43dc55ff3ebdd0a879b1e1627473 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sat, 25 Dec 2021 11:20:38 +0800 Subject: [PATCH 03/34] update PaymentProofComponent - add in function to delete transaction on currency_orders - VERIFICATION tab --- .../elements/PaymentProofComponent.vue | 8 +++++ .../forms/DeleteTransactionFormComponent.vue | 33 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 resources/assets/vue/components/bookings/forms/DeleteTransactionFormComponent.vue diff --git a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue index 494427cb..415655a5 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue @@ -41,6 +41,14 @@ +
+
+ Cancel this order? +
+
+ + + diff --git a/resources/assets/vue/components/bookings/forms/DeleteTransactionFormComponent.vue b/resources/assets/vue/components/bookings/forms/DeleteTransactionFormComponent.vue new file mode 100644 index 00000000..cf618df1 --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/DeleteTransactionFormComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file From da3408ad78eb5dd24c616b116fe7bb624be96e5c Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 27 Dec 2021 11:51:43 +0800 Subject: [PATCH 04/34] fix admin permission issues --- .../ControllersLogic/DeleteUserLogic.php | 21 ++++++------------- .../Standards/Rules/CanCreateSegment.php | 6 +++--- .../Standards/Rules/CanDeleteSegment.php | 6 +++--- .../Standards/Rules/CanUpdateSegment.php | 6 +++--- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/app/Classes/Modules/Accounts/ControllersLogic/DeleteUserLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/DeleteUserLogic.php index 485e9cf3..eb5fcc62 100644 --- a/app/Classes/Modules/Accounts/ControllersLogic/DeleteUserLogic.php +++ b/app/Classes/Modules/Accounts/ControllersLogic/DeleteUserLogic.php @@ -53,24 +53,15 @@ class DeleteUserLogic extends AbstractControllerLogic /** * @param Request $request * @return JsonResponse - * @throws ErrorException + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException */ public function logic(Request $request) : JsonResponse { - try { - DB::beginTransaction(); - - $user = $this->fetchesUser->execute(['id' => $request->route('id')]); - $this->canDeleteUser->passes(); - $this->deletesUser->execute($user); - - DB::commit(); - - return $this->resourceResponse(new UserResource($user)); - - } catch (\Exception $exception){ - throw new ErrorException($exception->getMessage(), $exception->getCode()); - } + $user = $this->fetchesUser->execute(['id' => $request->route('id')]); + $this->canDeleteUser->passes(); + $this->deletesUser->execute($user); } } \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php b/app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php index 50f7e81d..f7bdf2ef 100644 --- a/app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php +++ b/app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php @@ -27,9 +27,9 @@ class CanCreateSegment extends AbstractRule protected function authorized(): bool { // TODO Set Authorization rules - if (!\Auth::user()->can('add segment')) { - return false; - } +// if (!\Auth::user()->can('add segment')) { +// return false; +// } return true; } diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php b/app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php index 197b0a5f..9208f492 100644 --- a/app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php +++ b/app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php @@ -14,9 +14,9 @@ class CanDeleteSegment extends AbstractRule { // TODO Set Authorization rules - if (!\Auth::user()->can('delete segment')) { - return false; - } +// if (!\Auth::user()->can('delete segment')) { +// return false; +// } return true; diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php b/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php index 58a8c0ca..534f93ec 100644 --- a/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php +++ b/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php @@ -30,9 +30,9 @@ class CanUpdateSegment extends AbstractRule { // TODO Set Authorization rules - if (!\Auth::user()->can('edit segment')) { - return false; - } +// if (!\Auth::user()->can('edit segment')) { +// return false; +// } return true; } From a163af86be2874e6b84da2b943d5c8811cbc97db Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 27 Dec 2021 06:00:50 +0000 Subject: [PATCH 05/34] Revert "fix admin permission issues" This reverts commit da3408ad78eb5dd24c616b116fe7bb624be96e5c --- .../ControllersLogic/DeleteUserLogic.php | 21 +++++++++++++------ .../Standards/Rules/CanCreateSegment.php | 6 +++--- .../Standards/Rules/CanDeleteSegment.php | 6 +++--- .../Standards/Rules/CanUpdateSegment.php | 6 +++--- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/app/Classes/Modules/Accounts/ControllersLogic/DeleteUserLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/DeleteUserLogic.php index eb5fcc62..485e9cf3 100644 --- a/app/Classes/Modules/Accounts/ControllersLogic/DeleteUserLogic.php +++ b/app/Classes/Modules/Accounts/ControllersLogic/DeleteUserLogic.php @@ -53,15 +53,24 @@ class DeleteUserLogic extends AbstractControllerLogic /** * @param Request $request * @return JsonResponse - * @throws \App\Classes\Exceptions\AccessForbiddenException - * @throws \App\Classes\Exceptions\MalformedRequestException - * @throws \App\Classes\Exceptions\RequestValidationException + * @throws ErrorException */ public function logic(Request $request) : JsonResponse { - $user = $this->fetchesUser->execute(['id' => $request->route('id')]); - $this->canDeleteUser->passes(); - $this->deletesUser->execute($user); + try { + DB::beginTransaction(); + + $user = $this->fetchesUser->execute(['id' => $request->route('id')]); + $this->canDeleteUser->passes(); + $this->deletesUser->execute($user); + + DB::commit(); + + return $this->resourceResponse(new UserResource($user)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } } } \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php b/app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php index f7bdf2ef..50f7e81d 100644 --- a/app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php +++ b/app/Classes/Modules/Segments/Standards/Rules/CanCreateSegment.php @@ -27,9 +27,9 @@ class CanCreateSegment extends AbstractRule protected function authorized(): bool { // TODO Set Authorization rules -// if (!\Auth::user()->can('add segment')) { -// return false; -// } + if (!\Auth::user()->can('add segment')) { + return false; + } return true; } diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php b/app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php index 9208f492..197b0a5f 100644 --- a/app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php +++ b/app/Classes/Modules/Segments/Standards/Rules/CanDeleteSegment.php @@ -14,9 +14,9 @@ class CanDeleteSegment extends AbstractRule { // TODO Set Authorization rules -// if (!\Auth::user()->can('delete segment')) { -// return false; -// } + if (!\Auth::user()->can('delete segment')) { + return false; + } return true; diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php b/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php index 534f93ec..58a8c0ca 100644 --- a/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php +++ b/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php @@ -30,9 +30,9 @@ class CanUpdateSegment extends AbstractRule { // TODO Set Authorization rules -// if (!\Auth::user()->can('edit segment')) { -// return false; -// } + if (!\Auth::user()->can('edit segment')) { + return false; + } return true; } From 9068c334924fd6c77a88dddecc35cd67ffca96b8 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 27 Dec 2021 14:02:52 +0800 Subject: [PATCH 06/34] update delete transaction modal to default confirmation modal size --- .../vue/components/bookings/elements/PaymentProofComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue index 415655a5..980c50da 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue @@ -46,7 +46,7 @@ Cancel this order? - + From 7dc310258580a48f3bf9bc6659c522b356d8b529 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 27 Dec 2021 14:46:23 +0800 Subject: [PATCH 07/34] add in function to approve / reject transaction on currency_orders - VERIFICATION tab --- .../elements/PaymentProofComponent.vue | 14 ++++++++ ...ApprovePaymentTransactionFormComponent.vue | 33 +++++++++++++++++++ .../forms/DeleteTransactionFormComponent.vue | 2 +- .../RejectPaymentTransactionFormComponent.vue | 33 +++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 resources/assets/vue/components/bookings/forms/ApprovePaymentTransactionFormComponent.vue create mode 100644 resources/assets/vue/components/bookings/forms/RejectPaymentTransactionFormComponent.vue diff --git a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue index 980c50da..e197ab6a 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue @@ -69,6 +69,20 @@ +
+ + + + + + + + +
diff --git a/resources/assets/vue/components/bookings/forms/ApprovePaymentTransactionFormComponent.vue b/resources/assets/vue/components/bookings/forms/ApprovePaymentTransactionFormComponent.vue new file mode 100644 index 00000000..7be579f2 --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/ApprovePaymentTransactionFormComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/forms/DeleteTransactionFormComponent.vue b/resources/assets/vue/components/bookings/forms/DeleteTransactionFormComponent.vue index cf618df1..8ba13dba 100644 --- a/resources/assets/vue/components/bookings/forms/DeleteTransactionFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/DeleteTransactionFormComponent.vue @@ -15,7 +15,7 @@
Cancel
-
Delete
+
Confirm
diff --git a/resources/assets/vue/components/bookings/forms/RejectPaymentTransactionFormComponent.vue b/resources/assets/vue/components/bookings/forms/RejectPaymentTransactionFormComponent.vue new file mode 100644 index 00000000..ad43890c --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/RejectPaymentTransactionFormComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file From 8801a943f03bcfb35bf92717dcde1e9aee607a98 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Tue, 4 Jan 2022 22:29:20 +0800 Subject: [PATCH 08/34] update-service-content --- app/Http/Resources/TransactionResource.php | 6 +- .../elements/PaymentVerificationComponent.vue | 8 +++ .../SupplierPendingOrderComponent.vue | 16 ++++- .../SupplierPendingOrdersSectionComponent.vue | 72 +++++++++++++++---- 4 files changed, 88 insertions(+), 14 deletions(-) diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index 633985cf..9a9d8a7a 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -37,7 +37,11 @@ class TransactionResource extends JsonResource 'documents' => new DocumentResource($this->documents()->first()), 'customer_booking' => new TransactionResource($this->when((int) $this->type === TransactionType::BILL, $this->booking->transactions()->payments()->complete()->where('original_amount', '=', $this->original_amount)->where('id', '<', $this->id)->orderByDesc('id')->first())), 'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:i:s A'), - 'updated_at' => Carbon::parse($this->updated_at)->format('d-m-Y h:i:s A') + 'updated_at' => Carbon::parse($this->updated_at)->format('d-m-Y h:i:s A'), + 'interval' => [ + 'value' => (Carbon::parse($this->created_at)->addDays(3)->gt(Carbon::now()) ) ? '+' : '-' , + 'duration' => Carbon::parse($this->created_at)->addDays(3)->diff(Carbon::now())->format('%d'), + ], ]; } } diff --git a/resources/assets/vue/components/bookings/elements/PaymentVerificationComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentVerificationComponent.vue index 9acdab65..24dcaea0 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentVerificationComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentVerificationComponent.vue @@ -68,6 +68,14 @@ {{item.original_currency.short_code}} {{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} +
+
Service
+
+ {{item.booking.service.name}} +
+
+ +
+
+
Service
+
+ {{item.booking.service.name}} +
+
@@ -60,12 +66,20 @@ {{item.original_currency.short_code}}
-
+
Amount
{{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
+
timer
+
+ {{item.interval.value}} + {{item.interval.duration}} + days +
+
diff --git a/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue b/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue index 81e17c37..23e3116f 100644 --- a/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue @@ -8,30 +8,30 @@
-
-
+
+
-
- {{selectedSupplier.name}} +
+ {{selectedService.name}}
-
+
- +
-
+
-
-
+
+
-
{{supplier.name}}
+
{{service.name}}
@@ -41,7 +41,7 @@
-
+
@@ -75,11 +75,46 @@
+
+
+
+
+
+ {{selectedSupplier.name}} +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
{{supplier.name}}
+
+
+
+
+
+
+
+
+
+
- + @@ -124,6 +159,14 @@ currencyDropdownLaunch: { status: false }, + serviceDropdownLaunch: { + status: false + }, + selectedService: { + id: 1, + name: '', + status: false + }, payments: [] } }, @@ -135,6 +178,7 @@ this.suppliers = response.payload.data; this.updateSupplier(this.suppliers[0]); this.updateCurrency(this.suppliers[0].currencies[0]); + this.updateService(this.suppliers[0].services[0]); }, updateSupplier(supplier){ this.selectedSupplier = supplier; @@ -151,6 +195,10 @@ this.payments = []; }, + updateService(service){ + this.selectedService = service; + this.serviceDropdownLaunch.status = false; + }, updateOrder(payment){ this.payments.includes(payment) ? this.payments.splice(this.payments.indexOf(payment), 1) : this.payments.push(payment); } From 8305b66e83ec5b2221821fe48813da8f039d2373 Mon Sep 17 00:00:00 2001 From: glovetleong Date: Sun, 9 Jan 2022 22:40:41 +0800 Subject: [PATCH 09/34] auto generate product list --- .../AutoPackingListFillLogic.php | 116 ++++++++++++++++++ .../CreatePurchaseOrderTransactionLogic.php | 5 +- .../AutoPackingListFillController.php | 20 +++ routes/booking.php | 4 + 4 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 app/Classes/Modules/Bookings/ControllersLogic/AutoPackingListFillLogic.php create mode 100644 app/Http/Controllers/Bookings/AutoPackingListFillController.php diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPackingListFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPackingListFillLogic.php new file mode 100644 index 00000000..949973b7 --- /dev/null +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPackingListFillLogic.php @@ -0,0 +1,116 @@ + 'Purchase Order Approval', + 'message' => 'You have successfully updated the Purchase order status' + ]; + } + + /** @var CreatePurchaseOrderTransactionLogic */ + private $createPurchaseOrderTransactionLogic; + + /** + * AutoPackingListFillLogic constructor. + * @param CreatePurchaseOrderTransactionLogic $createPurchaseOrderTransactionLogic + */ + public function __construct(CreatePurchaseOrderTransactionLogic $createPurchaseOrderTransactionLogic) + { + $this->createPurchaseOrderTransactionLogic = $createPurchaseOrderTransactionLogic; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function logic(Request $request) : JsonResponse + { + $booking = Booking::where('created_at', '>', '01-07-2021') + ->whereDoesntHave('transactions', function($q){ + $q->where('type', TransactionType::PURCHASE_ORDER); + $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); + }) + ->get(); + + + foreach ($booking as $key => $row) { + $amount = $row->fix_amount; + $other_transaction = Transaction:: + where('type', TransactionType::PURCHASE_ORDER) + ->where('status', ApprovalStatus::APPROVED) + ->where('amount', '<=', $amount) + ->where('issuer', $row->company_id) + ->first(); + + + if (!$other_transaction) { + $other_transaction = Transaction:: + where('type', TransactionType::PURCHASE_ORDER) + ->where('status', ApprovalStatus::APPROVED) + ->where('amount', '<=', $amount) + ->first(); + } + + if ($other_transaction) { + $other_transaction_detail = $other_transaction->transactionDetails()->get(); + + $other_amount = 0; + foreach ($other_transaction_detail as $key_2 => $row_2) { + + if ($amount > $other_amount) { + $other_amount += $row_2->amount; + $products[] = [ + 'description' => $row_2->product_name, + 'quantity' => (int) $row_2->quantity, + 'stockCode' => $row_2->product_code, + 'total' => $row_2->amount, + 'unit_price' => (int) $row_2->price, + ]; + } + } + + $remain_amount = $amount - $other_amount; + + if ($remain_amount > 0) { + $remain = [ + 'description' => 'other service charge', + 'quantity' => 1, + 'stockCode' => 'OTHER_SERVICE_CHARGE', + 'total' => $remain_amount, + 'unit_price' => $remain_amount, + ]; + + $products = array_merge([$remain], $products); + } + $request->request->add([ + 'products' => $products + ]); + + $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); + } + } + + return $this->response([]); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreatePurchaseOrderTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreatePurchaseOrderTransactionLogic.php index aa4c6f4d..afd589c6 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/CreatePurchaseOrderTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreatePurchaseOrderTransactionLogic.php @@ -83,16 +83,15 @@ class CreatePurchaseOrderTransactionLogic extends AbstractControllerLogic * @return JsonResponse * @throws \App\Classes\Exceptions\MalformedRequestException */ - public function logic(Request $request) : JsonResponse + public function logic(Request $request, $id = '') : JsonResponse { /** @var Booking $booking */ - $booking = $this->fetchesBooking->execute(['id' => $request->route('id')]); + $booking = $this->fetchesBooking->execute(['id' => $request->route('id') ?? $id]); /** @var Transaction $transaction */ $transaction = $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first(); $billNumber = $this->generatesTransactionBillNumber->execute('PO-'); - $total = collect($request->input('products'))->sum(function($product){ return $product['quantity'] * floatval(str_replace(',', '', $product['unit_price'])); }); diff --git a/app/Http/Controllers/Bookings/AutoPackingListFillController.php b/app/Http/Controllers/Bookings/AutoPackingListFillController.php new file mode 100644 index 00000000..3c6580c0 --- /dev/null +++ b/app/Http/Controllers/Bookings/AutoPackingListFillController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/routes/booking.php b/routes/booking.php index 44767438..e19add01 100644 --- a/routes/booking.php +++ b/routes/booking.php @@ -31,4 +31,8 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking Route::post('/merge', 'MergeBookingController@merge')->name('merge'); Route::post('{id}/proforma/create', 'CreateProformaInvoiceTransaction@create')->name('proforma.create'); + + + Route::post('/auto-packing-list-fill', 'AutoPackingListFillController@auto')->name('assign'); + }); \ No newline at end of file From 0579be05d8be6af0f5d83b1b09e4012953b73fb1 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Mon, 10 Jan 2022 00:33:35 +0800 Subject: [PATCH 10/34] wallet updates --- .../CustomerProfileSectionComponent.vue | 5 + .../sections/WalletBalanceComponent.vue | 104 +++++++++++++++ .../customerDashboardSectionComponent.vue | 29 +---- resources/views/pages/wallet/index.blade.php | 4 + .../views/pages/wallet/transactions.blade.php | 121 ++++++++++++++++++ routes/web.php | 4 + 6 files changed, 239 insertions(+), 28 deletions(-) create mode 100644 resources/assets/vue/components/companies/sections/WalletBalanceComponent.vue create mode 100644 resources/views/pages/wallet/index.blade.php create mode 100644 resources/views/pages/wallet/transactions.blade.php diff --git a/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue b/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue index 09876b9b..85502c97 100644 --- a/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue +++ b/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue @@ -139,6 +139,11 @@
+
+
+ +
+
diff --git a/resources/assets/vue/components/companies/sections/WalletBalanceComponent.vue b/resources/assets/vue/components/companies/sections/WalletBalanceComponent.vue new file mode 100644 index 00000000..dd100288 --- /dev/null +++ b/resources/assets/vue/components/companies/sections/WalletBalanceComponent.vue @@ -0,0 +1,104 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue b/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue index 2fc0ba02..f399c533 100644 --- a/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue +++ b/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue @@ -537,34 +537,7 @@
-
-
-
-
- -
MYR 0.00
-
-
-
-
- Reload -
-
- Transaction History -
-
-
-
- - Transfer -
-
- - Cash Out -
-
-
-
+
diff --git a/resources/views/pages/wallet/index.blade.php b/resources/views/pages/wallet/index.blade.php new file mode 100644 index 00000000..7a9b49ef --- /dev/null +++ b/resources/views/pages/wallet/index.blade.php @@ -0,0 +1,4 @@ +@extends('layouts.base_portal') +@section('inner_content') + @include('pages.wallet.transactions') +@endsection diff --git a/resources/views/pages/wallet/transactions.blade.php b/resources/views/pages/wallet/transactions.blade.php new file mode 100644 index 00000000..8fcb3a8a --- /dev/null +++ b/resources/views/pages/wallet/transactions.blade.php @@ -0,0 +1,121 @@ +
+
+
+
+
Transaction History
+
+
+ +
+
Date
+
Description
+
Incoming
+
Outgoing
+
Balance
+
+ +
+
25/11/2015
+
Payment to bill #121221121
+
+
2,123
+
12,123
+
+ +
+
115/11/2015
+
Top Up
+
1,234
+
+
14,246
+
+
+
+ +
+
+
+
+
Top Up Records
+
+
+ + +
+
+
+
+
+
+
+
+
+
Payment Method Success
+
+
+

$123,123

+
+
+
+
+ 12-03-2021 +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
Payment Method Failed
+
+
+

$123,123

+
+
+
+
+ 12-03-2021 +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
Payment Method Processing
+
+
+

$123,123

+
+
+
+
+ 12-03-2021 +
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 84e1f2c1..23b4499c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -75,6 +75,10 @@ Route::get('/transfer/merge/{marking}', function ($marking) { return view('pages.bookings.merge', ['marking' => $marking]); })->name('booking.merge'); +Route::get('/wallet-transactions', function () { + return view('pages.wallet.index'); +})->name('wallet.transactions'); + Route::get('/test', function(){ // Auth::login(User::findOrFail(1)); From 2b150e9a75464a9f57cc6411b42482b230319596 Mon Sep 17 00:00:00 2001 From: glovetleong Date: Mon, 10 Jan 2022 14:41:49 +0800 Subject: [PATCH 11/34] created at --- ...ngListFillLogic.php => AutoPurchaseOrderFillLogic.php} | 7 +++---- .../Bookings/AutoPackingListFillController.php | 8 ++++---- routes/booking.php | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) rename app/Classes/Modules/Bookings/ControllersLogic/{AutoPackingListFillLogic.php => AutoPurchaseOrderFillLogic.php} (95%) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPackingListFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php similarity index 95% rename from app/Classes/Modules/Bookings/ControllersLogic/AutoPackingListFillLogic.php rename to app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 949973b7..0db23bc0 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPackingListFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -14,7 +14,7 @@ use App\Models\Transaction; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -class AutoPackingListFillLogic extends AbstractControllerLogic +class AutoPurchaseOrderFillLogic extends AbstractControllerLogic { /** @@ -46,13 +46,12 @@ class AutoPackingListFillLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { - $booking = Booking::where('created_at', '>', '01-07-2021') + $booking = Booking::whereMonth('created_at', 7) + ->whereYear('created_at', 2021) ->whereDoesntHave('transactions', function($q){ $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); }) - ->get(); - foreach ($booking as $key => $row) { $amount = $row->fix_amount; diff --git a/app/Http/Controllers/Bookings/AutoPackingListFillController.php b/app/Http/Controllers/Bookings/AutoPackingListFillController.php index 3c6580c0..45f5ebb1 100644 --- a/app/Http/Controllers/Bookings/AutoPackingListFillController.php +++ b/app/Http/Controllers/Bookings/AutoPackingListFillController.php @@ -2,18 +2,18 @@ namespace App\Http\Controllers\Bookings; -use App\Classes\Modules\Bookings\ControllersLogic\AutoPackingListFillLogic; +use App\Classes\Modules\Bookings\ControllersLogic\AutoPurchaseOrderFillLogic; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -class AutoPackingListFillController +class AutoPurchaseOrderFillController { /** * @param Request $request - * @param AutoPackingListFillLogic $logic + * @param AutoPurchaseOrderFillLogic $logic * @return JsonResponse */ - public function auto(Request $request, AutoPackingListFillLogic $logic): JsonResponse { + public function auto(Request $request, AutoPurchaseOrderFillLogic $logic): JsonResponse { return $logic->execute($request); } diff --git a/routes/booking.php b/routes/booking.php index e19add01..69dff750 100644 --- a/routes/booking.php +++ b/routes/booking.php @@ -33,6 +33,6 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking Route::post('{id}/proforma/create', 'CreateProformaInvoiceTransaction@create')->name('proforma.create'); - Route::post('/auto-packing-list-fill', 'AutoPackingListFillController@auto')->name('assign'); + Route::post('/auto-purchase-order-fill', 'AutoPurchaseOrderFillController@auto')->name('assign'); }); \ No newline at end of file From 0f18dcf11795c61ab9e7de2ed90011f254631e45 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:28:11 +0800 Subject: [PATCH 12/34] fix route name for xpo generator controller --- ...ListFillController.php => AutoPurchaseOrderFillController.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename app/Http/Controllers/Bookings/{AutoPackingListFillController.php => AutoPurchaseOrderFillController.php} (100%) diff --git a/app/Http/Controllers/Bookings/AutoPackingListFillController.php b/app/Http/Controllers/Bookings/AutoPurchaseOrderFillController.php similarity index 100% rename from app/Http/Controllers/Bookings/AutoPackingListFillController.php rename to app/Http/Controllers/Bookings/AutoPurchaseOrderFillController.php From 1096f9bb63c108da164a5bc0df55f7d01bc36ae2 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:29:14 +0800 Subject: [PATCH 13/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 0db23bc0..1797f99d 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -51,7 +51,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic ->whereDoesntHave('transactions', function($q){ $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); - }) + }); foreach ($booking as $key => $row) { $amount = $row->fix_amount; From a06a8d58af265428bc1a9f3882fb95c505b5a7c3 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:34:03 +0800 Subject: [PATCH 14/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 1797f99d..b12fc37f 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -105,6 +105,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic $request->request->add([ 'products' => $products ]); + dd($row->id, $products); $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); } From 9a8cf7188b702d7e00290b6f5a5cb68ebcf66377 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:35:02 +0800 Subject: [PATCH 15/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index b12fc37f..3951aab6 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -107,7 +107,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic ]); dd($row->id, $products); - $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); +// $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); } } From dba0a1a59eebc186f239650d13edf081a8e06f01 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:35:46 +0800 Subject: [PATCH 16/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 3951aab6..9b6e5b23 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -52,7 +52,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); }); - +dd($booking); foreach ($booking as $key => $row) { $amount = $row->fix_amount; $other_transaction = Transaction:: From 559337313a4989af0898fa6072271359d2ee5bf2 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:36:17 +0800 Subject: [PATCH 17/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 9b6e5b23..23bba1fa 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -51,7 +51,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic ->whereDoesntHave('transactions', function($q){ $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); - }); + })->get(); dd($booking); foreach ($booking as $key => $row) { $amount = $row->fix_amount; From 2a270b264e4de258390fc2bd6d7fb77b015dc8a5 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:36:48 +0800 Subject: [PATCH 18/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 23bba1fa..2d86eb99 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -52,7 +52,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); })->get(); -dd($booking); + foreach ($booking as $key => $row) { $amount = $row->fix_amount; $other_transaction = Transaction:: @@ -105,9 +105,8 @@ dd($booking); $request->request->add([ 'products' => $products ]); - dd($row->id, $products); -// $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); + $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); } } From 29250ae400060a0b5cee44e14abcb7b3b34e4689 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:43:17 +0800 Subject: [PATCH 19/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 2d86eb99..0ccdcd57 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -51,7 +51,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic ->whereDoesntHave('transactions', function($q){ $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); - })->get(); + })->limit(20)->get(); foreach ($booking as $key => $row) { $amount = $row->fix_amount; From 2a534d564b63d301bf466bb1b215a8db06e18227 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:47:03 +0800 Subject: [PATCH 20/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 0ccdcd57..7ad87f46 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -51,7 +51,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic ->whereDoesntHave('transactions', function($q){ $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); - })->limit(20)->get(); + })->limit(100)->get(); foreach ($booking as $key => $row) { $amount = $row->fix_amount; From 9b20734a045f43305ce88a76ae649a6a1a0cbe75 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:52:36 +0800 Subject: [PATCH 21/34] fix route name for xpo generator controller --- .../AutoPurchaseOrderFillLogic.php | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index 7ad87f46..b1d38cb9 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -71,43 +71,41 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic ->first(); } - if ($other_transaction) { - $other_transaction_detail = $other_transaction->transactionDetails()->get(); + $other_transaction_detail = $other_transaction->transactionDetails()->get(); - $other_amount = 0; - foreach ($other_transaction_detail as $key_2 => $row_2) { + $other_amount = 0; + foreach ($other_transaction_detail as $key_2 => $row_2) { - if ($amount > $other_amount) { - $other_amount += $row_2->amount; - $products[] = [ - 'description' => $row_2->product_name, - 'quantity' => (int) $row_2->quantity, - 'stockCode' => $row_2->product_code, - 'total' => $row_2->amount, - 'unit_price' => (int) $row_2->price, - ]; - } - } - - $remain_amount = $amount - $other_amount; - - if ($remain_amount > 0) { - $remain = [ - 'description' => 'other service charge', - 'quantity' => 1, - 'stockCode' => 'OTHER_SERVICE_CHARGE', - 'total' => $remain_amount, - 'unit_price' => $remain_amount, + if ($amount > $other_amount) { + $other_amount += $row_2->amount; + $products[] = [ + 'description' => $row_2->product_name, + 'quantity' => (int) $row_2->quantity, + 'stockCode' => $row_2->product_code, + 'total' => $row_2->amount, + 'unit_price' => (int) $row_2->price, ]; - - $products = array_merge([$remain], $products); } - $request->request->add([ - 'products' => $products - ]); - - $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); } + + $remain_amount = $amount - $other_amount; + + if ($remain_amount > 0) { + $remain = [ + 'description' => 'other service charge', + 'quantity' => 1, + 'stockCode' => 'OTHER_SERVICE_CHARGE', + 'total' => $remain_amount, + 'unit_price' => $remain_amount, + ]; + + $products = array_merge([$remain], $products); + } + $request->request->add([ + 'products' => $products + ]); + + $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); } return $this->response([]); From 2e3d002dc6145108c89cb28835000c6574538c28 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Wed, 12 Jan 2022 15:53:14 +0800 Subject: [PATCH 22/34] fix route name for xpo generator controller --- .../Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php index b1d38cb9..79f56916 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/AutoPurchaseOrderFillLogic.php @@ -51,7 +51,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic ->whereDoesntHave('transactions', function($q){ $q->where('type', TransactionType::PURCHASE_ORDER); $q->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED]); - })->limit(100)->get(); + })->limit(10)->get(); foreach ($booking as $key => $row) { $amount = $row->fix_amount; @@ -105,7 +105,7 @@ class AutoPurchaseOrderFillLogic extends AbstractControllerLogic 'products' => $products ]); - $create_transaction = $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); + $this->createPurchaseOrderTransactionLogic->logic($request, $row->id); } return $this->response([]); From a3d3d73267b330b48b3eba067cae2efb80a1e8fc Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 14 Jan 2022 19:29:15 +0800 Subject: [PATCH 23/34] export products list --- .../Exports/Services/ExportsProducts.php | 51 +++++++++++++++++++ routes/web.php | 11 ++-- 2 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 app/Classes/Modules/Exports/Services/ExportsProducts.php diff --git a/app/Classes/Modules/Exports/Services/ExportsProducts.php b/app/Classes/Modules/Exports/Services/ExportsProducts.php new file mode 100644 index 00000000..541f1d21 --- /dev/null +++ b/app/Classes/Modules/Exports/Services/ExportsProducts.php @@ -0,0 +1,51 @@ +whereHas('transaction', function($query){ + return $query->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->where('status', ApprovalStatus::APPROVED); + })->limit(50); + } + + /** + * @param $product + * @return array + */ + public function map($product): array + { + + return [ + $product->product_code, + $product->product_name, + $product->price, + ]; + } +} \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 238505b3..7d39e036 100644 --- a/routes/web.php +++ b/routes/web.php @@ -4,6 +4,7 @@ use App\Models\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Route; +use Maatwebsite\Excel\Excel; /* |-------------------------------------------------------------------------- @@ -79,10 +80,6 @@ Route::get('/online_payment/redirect', 'Billplz\CallbackBillplzController@callba Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export'); Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions'); -Route::get('/x2/data', function (Request $request) { - $token = Auth::fromUser(User::find(1)); - $request->headers->set('Authorization', 'Bearer '.$token); - dd(\App\Models\Booking::whereDoesntHave('transactions', function($query){ - $query->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->whereIn('status', [\App\Classes\ValueObjects\Constants\ApprovalStatus::PENDING_VERIFICATION, \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED]); - })->groupBy('company_id')->get()); -})->name('x2.data'); \ No newline at end of file +Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) { + return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']); +})->name('products.random'); \ No newline at end of file From 0a0da91c21df708af164f9e911fc2a3171a3d058 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sun, 16 Jan 2022 20:33:55 +0800 Subject: [PATCH 24/34] update wallet-ui --- .../accounts/forms/TopUpAccountComponent.vue | 196 ------------------ .../CustomerProfileSectionComponent.vue | 2 +- .../customerDashboardSectionComponent.vue | 2 +- .../elements/WalletComponent.vue} | 30 ++- .../elements/WalletTopUpHistoryComponent.vue | 73 +++++++ .../forms/WalletTopUpFormComponent.vue | 41 ++++ .../views/pages/wallet/transactions.blade.php | 15 +- resources/views/partials/header.blade.php | 8 - routes/web.php | 5 +- 9 files changed, 145 insertions(+), 227 deletions(-) delete mode 100644 resources/assets/vue/components/accounts/forms/TopUpAccountComponent.vue rename resources/assets/vue/components/{companies/sections/WalletBalanceComponent.vue => wallets/elements/WalletComponent.vue} (93%) create mode 100644 resources/assets/vue/components/wallets/elements/WalletTopUpHistoryComponent.vue create mode 100644 resources/assets/vue/components/wallets/forms/WalletTopUpFormComponent.vue diff --git a/resources/assets/vue/components/accounts/forms/TopUpAccountComponent.vue b/resources/assets/vue/components/accounts/forms/TopUpAccountComponent.vue deleted file mode 100644 index af8a43b7..00000000 --- a/resources/assets/vue/components/accounts/forms/TopUpAccountComponent.vue +++ /dev/null @@ -1,196 +0,0 @@ - - \ No newline at end of file diff --git a/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue b/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue index 85502c97..b95f385f 100644 --- a/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue +++ b/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue @@ -141,7 +141,7 @@
- +
diff --git a/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue b/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue index f399c533..cce6e90f 100644 --- a/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue +++ b/resources/assets/vue/components/companies/sections/customerDashboardSectionComponent.vue @@ -537,7 +537,7 @@
- +
diff --git a/resources/assets/vue/components/companies/sections/WalletBalanceComponent.vue b/resources/assets/vue/components/wallets/elements/WalletComponent.vue similarity index 93% rename from resources/assets/vue/components/companies/sections/WalletBalanceComponent.vue rename to resources/assets/vue/components/wallets/elements/WalletComponent.vue index dd100288..af0398d5 100644 --- a/resources/assets/vue/components/companies/sections/WalletBalanceComponent.vue +++ b/resources/assets/vue/components/wallets/elements/WalletComponent.vue @@ -1,4 +1,4 @@ -