E-Invoice - PM requested for extra checking when editing booking amount (cannot be less than paid amount)

This commit is contained in:
Dillon Ngo
2025-10-16 12:47:17 +08:00
parent 8c56c5840c
commit 7b269d2edf
3 changed files with 25 additions and 5 deletions
@@ -331,11 +331,11 @@
</div>
<div class="row m-t-10" v-show="showEditBookingAmount">
<div class="col">
<button class="btn btn-xs all-caps b-rad-none bg-master-lighter btn-block no-border requestModal" data-type="editBookingAmount">Edit Booking Amount</button>
<button class="btn btn-xs all-caps b-rad-none bg-master-lighter btn-block no-border requestModal" data-type="editBookingAmountForUser">Edit Booking Amount</button>
<!-- <div class="col-auto text-right">
<div class="font-heading fs-12"><i class="fa fa-edit fs-12 pointer fa-fw requestModal" data-type="editBookingAmount" v-if="$store.getters.isSuperAdmin || ($store.getters.isCustomer && $store.getters.getCompanyId === 199)"></i> {{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
</div> -->
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editBookingAmount">
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editBookingAmountForUser">
<!-- <edit-booking-amount-form-component :data="this.data.booking" :section="section"></edit-booking-amount-form-component> -->
<edit-booking-amount-form-v2-component :data="this.data.booking" :section="section"></edit-booking-amount-form-v2-component>
</modal-component>
@@ -55,7 +55,17 @@
},
methods: {
submitForm(){
this.parameters = {fix_amount : parseFloat((this.fix_amount).toString().replace(',', ''))}
this.error = '';
const enteredAmount = parseFloat(this.fix_amount.toString().replace(',', ''));
const paidAmount = parseFloat(this.data.paid_amount);
if (enteredAmount < paidAmount) {
this.error = `Booking amount cannot be less than paid amount (${paidAmount.toFixed(2)}).`;
return;
}
this.parameters = { fix_amount: enteredAmount };
this.submit(this.route('api.booking.booking_amount.update', this.data.id), 'put', this.section, true, true)
},
successHandler(){
@@ -65,4 +75,4 @@
},
mixins: [FormHandler]
}
</script>
</script>
@@ -56,7 +56,17 @@
// },
methods: {
submitForm(){
this.parameters = {amount_to_edit : parseFloat((this.amount_to_edit).toString().replace(',', ''))}
this.error = '';
const enteredAmount = parseFloat(this.amount_to_edit.toString().replace(',', ''));
const paidAmount = parseFloat(this.data.paid_amount);
if (enteredAmount < paidAmount) {
this.error = `Booking amount cannot be less than paid amount (${paidAmount.toFixed(2)}).`;
return;
}
this.parameters = { amount_to_edit: enteredAmount };
this.submit(this.route('api.booking.amount.update', this.data.id), 'put', this.section, true, true)
},
successHandler(){