From 29e926867e9c25dc188021fc611b070b8c5e0235 Mon Sep 17 00:00:00 2001 From: azumiru Date: Sun, 6 Mar 2022 13:54:35 +0800 Subject: [PATCH 1/2] refund-ui-payment - update validations --- .../elements/PaymentHistoryComponent.vue | 6 ++-- .../elements/RefundConfirmationComponent.vue | 34 +++++++++++-------- .../forms/ValidationErrorComponent.vue | 12 ++++--- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index af7eab83..ab0bb5c4 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -176,9 +176,9 @@ -
+
- + @@ -294,7 +294,7 @@ expandPaymentDetails: false, expandRefund: false, refundMethod: { - name: 'Fully Refund', + name: 'Partially Refund', status: false }, amount: (Math.round(1000 * 100) / 100).toFixed(2), diff --git a/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue b/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue index 9a810def..215c626f 100644 --- a/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue +++ b/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue @@ -10,7 +10,7 @@
-
+
@@ -64,12 +64,12 @@
-->
-
- Fully Refund -
-
+
Partially Refund
+
+ Fully Refund +
@@ -92,14 +92,14 @@
-
+
@@ -253,7 +253,7 @@ import FormHandler from '../../../general/mixins/formHandler'; // import ConfirmBookingComponent from "../forms/confirmBookingComponent"; import ModalFormHandler from '../../../general/mixins/modalFormHandler'; - import { required } from "vuelidate/lib/validators"; + import { required, maxValue } from "vuelidate/lib/validators"; export default { // components: {ConfirmBookingComponent}, data(){ @@ -264,20 +264,26 @@ account_no: '', parameters: { bankAccount: '', - refundAmount: this.data.booking.amount, + refundAmount: this.data.booking.refundAmount, bank_id: '', }, expandRefund: false, refundMethod: { - name: 'Fully Refund', + name: 'Partially Refund', status: false }, + refundMaxValue: this.data.booking.amount } }, - validations: { - parameters: { - bankAccount: { required }, - refundAmount: { required }, + validations() { + return { + parameters: { + bankAccount: { required }, + refundAmount: { + required, + maxValue: maxValue(this.refundMaxValue) + }, + } } }, computed: { diff --git a/resources/assets/vue/components/general/forms/ValidationErrorComponent.vue b/resources/assets/vue/components/general/forms/ValidationErrorComponent.vue index 3c5f6bb0..d85e38a4 100644 --- a/resources/assets/vue/components/general/forms/ValidationErrorComponent.vue +++ b/resources/assets/vue/components/general/forms/ValidationErrorComponent.vue @@ -1,9 +1,10 @@ @@ -21,7 +22,8 @@ required: 'this field is required', email: 'enter a valid email address', minLength: 'this field must have at least', - sameAs: 'this field must match the' + sameAs: 'this field must match the', + maxValue: 'this value must not exceeds' }, } }, From 8b9c6d55c656e5884f02916aea2256d821f6705f Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sun, 6 Mar 2022 16:03:25 +0800 Subject: [PATCH 2/2] update booking refund design and remove dd --- .../CreateBookingRefundLogic.php | 2 +- .../elements/RefundConfirmationComponent.vue | 256 ++---------------- 2 files changed, 17 insertions(+), 241 deletions(-) diff --git a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php index 411b9163..7f0d7e7d 100644 --- a/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php +++ b/app/Classes/Modules/Bookings/ControllersLogic/CreateBookingRefundLogic.php @@ -89,7 +89,7 @@ class CreateBookingRefundLogic extends AbstractControllerLogic } $refund = $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id, $transaction->bill_no); - dd($refund); + // dd($refund); if($refund + $request->input('amount') > $transaction->original_amount) throw new MalformedRequestException('Your refund must not be greater than '. $transaction->original_amount .'.'); diff --git a/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue b/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue index 215c626f..34d97d3b 100644 --- a/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue +++ b/resources/assets/vue/components/bookings/elements/RefundConfirmationComponent.vue @@ -10,7 +10,7 @@
-
+
@@ -23,61 +23,22 @@
Refund Type:
- - -
-
+
+
Partially Refund
-
+
Fully Refund
-
+ +
- +
@@ -90,61 +51,6 @@
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
{{bank.reference ? bank.reference + ' - ':''}}{{bank.holder_name}}
-
-
-
-
-
{{bank.account_no}} {{bank.bank_name}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- - -
-
@@ -153,95 +59,11 @@
-
-
-
-
-
-
-
Amount you are Transferring
-
-
- -
short_code
-
-
- -
amount
-
-
-
-
-
Exchange Rate
-
-
-
-
-
- -
rate
-
-
-
-
-
Money Transfer Fee
-
-
-
MYR
-
-
- -
amount
-
-
-
-
-
Sub-Total
-
-
-
MYR
-
-
- -
Sub-Total
-
-
-
-
-
Tax
-
-
- -
some%
-
-
- -
some tax
-
-
-
-
-
Amount you are Paying
-
-
-
MYR
-
-
- -
payming amount
-
-
-
-
-
-
-
-
@@ -251,23 +73,15 @@