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, 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 ccc7c12b..ee005666 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..528e5d61 --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/EditBookingAmountFormComponent.vue @@ -0,0 +1,63 @@ + + \ No newline at end of file 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 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}}

+
+
+
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
+
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 @@
-
+