From 22cdbe3e61a8c97070aa44979dd639aab9d65801 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Tue, 26 Oct 2021 16:56:08 +0800 Subject: [PATCH 1/8] wip --- .../BookingPaymentQuotationComponent.vue | 5 +- .../forms/EditBookingAmountFormComponent.vue | 51 +++++++++++++++++++ .../views/pages/customers/index.blade.php | 8 +-- 3 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue diff --git a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue index 9909ae8e..4652656b 100644 --- a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue +++ b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue @@ -70,8 +70,11 @@
Transfer Total:
-
{{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
{{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+ + +
diff --git a/resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue b/resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue new file mode 100644 index 00000000..3165bbc3 --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue @@ -0,0 +1,51 @@ + + \ No newline at end of file diff --git a/resources/views/pages/customers/index.blade.php b/resources/views/pages/customers/index.blade.php index 867ff561..e65fef3a 100644 --- a/resources/views/pages/customers/index.blade.php +++ b/resources/views/pages/customers/index.blade.php @@ -3,10 +3,10 @@
-
+
-
+
@@ -75,7 +75,7 @@
-
+
\ No newline at end of file From 87614bdcecb353d27bd0ee961e641bb0a2bafb2d Mon Sep 17 00:00:00 2001 From: edmondlang Date: Fri, 5 Nov 2021 12:24:00 +0800 Subject: [PATCH 3/8] tidy up change booking price --- .../UpdateBookingAmountLogic.php | 90 +++++++++++++++++++ .../Bookings/Services/UpdatesBooking.php | 4 +- .../Services/UpdatesBookingFixedAmount.php | 23 +++++ .../UpdateBookingAmountController.php | 20 +++++ .../BookingPaymentQuotationComponent.vue | 2 +- .../forms/EditBookingAmountFormComponent.vue | 32 ++++--- routes/booking.php | 2 + 7 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php create mode 100644 app/Classes/Modules/Bookings/Services/UpdatesBookingFixedAmount.php create mode 100644 app/Http/Controllers/Bookings/UpdateBookingAmountController.php diff --git a/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php new file mode 100644 index 00000000..8e67f4ec --- /dev/null +++ b/app/Classes/Modules/Bookings/ControllersLogic/UpdateBookingAmountLogic.php @@ -0,0 +1,90 @@ + 'Updated Booking', + 'message' => 'You have successfully updated the Booking' + ]; + } + + /** @var CanUpdateBooking */ + private $canUpdateBooking; + + /** @var UpdatesBookingFixedAmount */ + private $updatesBookingFixedAmount; + + /** @var FetchesBooking */ + private $fetchesBooking; + + /** @var CalculatesBookingOutstanding */ + private $calculatesBookingOutstanding; + + /** + * UpdateBookingAmountLogic constructor. + * @param CanUpdateBooking $canUpdateBooking + * @param UpdatesBookingFixedAmount $updatesBookingFixedAmount + * @param FetchesBooking $fetchesBooking + * @param CalculatesBookingOutstanding $calculatesBookingOutstanding + */ + public function __construct( + CanUpdateBooking $canUpdateBooking, + UpdatesBookingFixedAmount $updatesBookingFixedAmount, + FetchesBooking $fetchesBooking, + CalculatesBookingOutstanding $calculatesBookingOutstanding + ) + { + $this->canUpdateBooking = $canUpdateBooking; + $this->updatesBookingFixedAmount = $updatesBookingFixedAmount; + $this->fetchesBooking = $fetchesBooking; + $this->calculatesBookingOutstanding = $calculatesBookingOutstanding; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + $booking = $this->fetchesBooking->execute(['id' => $request->route('id')]); + + $input_amount = number_format( floatval(str_replace(',', '', $request->input('fix_amount', $booking->fix_amount))), 5, '.', ''); + + $minimum_amount = $booking->fix_amount - $this->calculatesBookingOutstanding->execute($booking); + + if ((float)$input_amount < $minimum_amount) { + throw new MalformedRequestException('Booking Amount cannot be less than '. $minimum_amount .'.'); + } + + // $this->canUpdateBooking->passes($booking); + $booking = $this->updatesBookingFixedAmount->execute($booking, $input_amount); + + return $this->resourceResponse(new BookingResource($booking)); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Bookings/Services/UpdatesBooking.php b/app/Classes/Modules/Bookings/Services/UpdatesBooking.php index 37ca5b7c..2c0ec871 100644 --- a/app/Classes/Modules/Bookings/Services/UpdatesBooking.php +++ b/app/Classes/Modules/Bookings/Services/UpdatesBooking.php @@ -17,8 +17,8 @@ class UpdatesBooking extends AbstractUpdateRecord */ public function execute(Booking $model, BookingObject $object) { - $model->transferable_bank_id = $object->getTransferableBankId(); - $model->reference = $object->getReference(); + $model->bank_id = $object->getTransferableBankId(); + $model->marking = $object->getMarking(); $model->fix_amount = $object->getFixAmount(); $model->fix_currency_id = $object->getFixCurrencyId(); $model->convertible_currency_id = $object->getConvertibleCurrencyId(); diff --git a/app/Classes/Modules/Bookings/Services/UpdatesBookingFixedAmount.php b/app/Classes/Modules/Bookings/Services/UpdatesBookingFixedAmount.php new file mode 100644 index 00000000..83779bc6 --- /dev/null +++ b/app/Classes/Modules/Bookings/Services/UpdatesBookingFixedAmount.php @@ -0,0 +1,23 @@ +fix_amount = $fixedAmount; + return $this->handler($model); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Bookings/UpdateBookingAmountController.php b/app/Http/Controllers/Bookings/UpdateBookingAmountController.php new file mode 100644 index 00000000..d0f6dd6c --- /dev/null +++ b/app/Http/Controllers/Bookings/UpdateBookingAmountController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue index 524826ba..f344c8cb 100644 --- a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue +++ b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue @@ -73,7 +73,7 @@
{{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
- +
diff --git a/resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue b/resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue index 2a1cd75b..528e5d61 100644 --- a/resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue @@ -10,9 +10,9 @@
- - - + + +
@@ -26,7 +26,7 @@
Cancel
-
Update
+
Update
@@ -35,23 +35,29 @@
\ No newline at end of file diff --git a/routes/booking.php b/routes/booking.php index c2805443..a1b8c8b6 100644 --- a/routes/booking.php +++ b/routes/booking.php @@ -25,6 +25,8 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking Route::post('{id}/purchase_order/verification', 'ApprovePurchaseOrderController@approve')->name('po.approval'); + Route::put('{id}/updateAmount', 'UpdateBookingAmountController@update')->name('booking_amount.update'); + Route::post('/merge', 'MergeBookingController@merge')->name('merge'); }); \ No newline at end of file From 83b3e5801bbe6ccfc7bd47722165d606f147b171 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Fri, 19 Nov 2021 20:22:10 +0800 Subject: [PATCH 4/8] enable http verifcation on crceateBillPlzBill --- app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php index 26b2800b..cda9e10b 100644 --- a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php +++ b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php @@ -20,7 +20,7 @@ class CreatesBillplzBill */ public function execute(string $name, string $email, string $description, float $amount, string $billNumber, ?string $bankCode = null) { try{ - $response = Http::withBasicAuth(config('billplz.api_key').':', '')->withOptions(["verify"=>false])->post(config('billplz.base_url').'/api/v3/bills', [ + $response = Http::withBasicAuth(config('billplz.api_key').':', '')->post(config('billplz.base_url').'/api/v3/bills', [ 'collection_id' => config('billplz.collection_id'), 'name' => $name, 'email' => $email, From 187af865779863d2dcfd2ef0d5698210c92afca8 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 25 Nov 2021 13:22:01 +0800 Subject: [PATCH 5/8] update settings - user profile - edit fullname input label --- .../settings/forms/EditUserProfileFullnameFormComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/settings/forms/EditUserProfileFullnameFormComponent.vue b/resources/assets/vue/components/settings/forms/EditUserProfileFullnameFormComponent.vue index 315600ff..de490b7e 100644 --- a/resources/assets/vue/components/settings/forms/EditUserProfileFullnameFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/EditUserProfileFullnameFormComponent.vue @@ -10,8 +10,8 @@
-
Full Name
+
From cb8cbe62746c5005f14aa16af13b9902b76dfc5e Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 25 Nov 2021 16:45:38 +0800 Subject: [PATCH 6/8] update change booking price funtion only for super admin --- .../bookings/forms/BookingPaymentQuotationComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue index adfd1b5e..ee005666 100644 --- a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue +++ b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue @@ -70,7 +70,7 @@
Transfer Total:
-
{{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
{{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
From df3e60e3b094d9048ce57394cdbd46529439ae63 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 25 Nov 2021 16:47:02 +0800 Subject: [PATCH 7/8] update CustomerProfileComponent add details of last payment date, last payment amount, and created date --- .../elements/CustomerProfileComponent.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue b/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue index f97f7916..6225a43e 100644 --- a/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue +++ b/resources/assets/vue/components/companies/elements/CustomerProfileComponent.vue @@ -38,7 +38,7 @@ {{item.status === 2 ? 'Active' : item.status === 5 ? 'Suspended' : 'Inactive'}}
-
+
+
+
+
+

Last Payment: {{item.last_payment}}

+
+
+
+
+

Payment Amount: MYR {{(Math.round((item.total_payments + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}

+
+
+
+
+

Created at: {{item.created_at}}

+
+
+
From c8e8122fd1376b9d2f7b54814f2056201d0ddb76 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sat, 27 Nov 2021 17:19:43 +0800 Subject: [PATCH 8/8] update PurchaseOrderFormComponent change order item and add function edit order item --- .../forms/PurchaseOrderFormComponent.vue | 62 +++++-------- .../forms/PurchaseOrderItemFormComponent.vue | 92 +++++++++++++++++++ 2 files changed, 116 insertions(+), 38 deletions(-) create mode 100644 resources/assets/vue/components/bookings/forms/PurchaseOrderItemFormComponent.vue diff --git a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue index ba3a39b1..e63a6f9e 100644 --- a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue @@ -29,6 +29,7 @@
+
@@ -61,38 +62,14 @@
+
-
-
-
{{index + 1}}
-
-
-
{{product.stockCode}}
-
-
-
{{product.description}}
-
-
-
{{product.quantity}}
-
-
-
{{product.unit_price}}
-
-
-
{{data.fixed_currency.short_code}}
-
-
-
{{(Math.round((product.total + Number.EPSILON) * 100) / 100).toFixed(2) }}
-
-
- -
-
+
@@ -130,7 +107,7 @@
- +
@@ -165,16 +142,16 @@ import formHandler from '../../../general/mixins/formHandler'; export default { data(){ - return { - submitted: false, - product: { - stockCode: '', - description: '', - quantity: 1, - unit_price: 0, - }, - products: [] - } + return { + submitted: false, + product: { + stockCode: '', + description: '', + quantity: 1, + unit_price: 0, + }, + products: [], + } }, created() { this.products = this.data.purchase_order ? this.data.purchase_order.details : []; @@ -231,7 +208,16 @@ quantity: 1, unit_price: 0, }; - + }, + updateProduct(product, index){ + console.log(product); + this.products[index] = { + stockCode: product.stockCode, + description: product.description, + quantity: product.quantity, + unit_price: product.unit_price, + total: product.quantity * parseFloat((product.unit_price).toString().replace(',', '')) + }; }, removeProduct(index){ this.products.splice(index, 1); diff --git a/resources/assets/vue/components/bookings/forms/PurchaseOrderItemFormComponent.vue b/resources/assets/vue/components/bookings/forms/PurchaseOrderItemFormComponent.vue new file mode 100644 index 00000000..c25ad961 --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/PurchaseOrderItemFormComponent.vue @@ -0,0 +1,92 @@ + + \ No newline at end of file