-
+
-
+
@@ -75,31 +75,33 @@
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
import { required, maxValue } from "vuelidate/lib/validators";
export default {
+ props: {
+ totalRefunds:{
+ type: Number,
+ default: 0,
+ }
+ },
data(){
return {
- parameters: {
- refundAmount: this.data.booking.amount,
- },
- refundAmount: this.data.booking.amount,
+ refundAmount: (Math.round((this.data.booking.amount - this.totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2),
refundMethod: {
name: 'Partially Refund',
status: false
},
- refundMaxValue: this.data.booking.amount
+ refundMaxValue: (Math.round((this.data.booking.amount - this.totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2),
}
},
validations() {
return {
- parameters: {
- refundAmount: {
- // required,
- // maxValue: maxValue(this.refundMaxValue)
- },
+ refundAmount: {
+ // required,
+ maxValue: maxValue(this.refundMaxValue)
}
}
},
methods: {
submitForm(){
+ this.parameters.amount = this.refundAmount;
this.submit(this.route('api.booking.refund.create', this.data.booking.id, this.data.id), 'post', this.section, true, true)
},
updateRefundType(refund){
@@ -107,11 +109,8 @@
name: refund.name,
status: !this.refundMethod.status
}
- this.refundAmount = this.refundMaxValue;
+ this.refundMethod.name === 'Fully Refund' ? this.refundAmount = this.refundMaxValue : '';
},
- // successHandler(response){
- // window.location.href = this.route('booking.details', response.payload.data.marking)
- // }
},
mixins: [FormHandler, ModalFormHandler]
}
diff --git a/resources/assets/vue/general/mixins/formHandler.js b/resources/assets/vue/general/mixins/formHandler.js
index 3e7c0daa..d3b640b6 100644
--- a/resources/assets/vue/general/mixins/formHandler.js
+++ b/resources/assets/vue/general/mixins/formHandler.js
@@ -28,6 +28,7 @@ export default {
isLoading: false,
error: '',
money: {decimal: '.',thousands: ',', precision: 2},
+ moneyV2: {decimal: '.',thousands: '', precision: 2},
productPrice: {decimal: '.',thousands: ',', precision: 3},
exchangeRate: {decimal: '.', thousands: '', precision: 5},
percentage: {decimal: '.', thousands: '', precision: 2, suffix: '%'},