Merge branch 'dillon/90-e-invoice-e' into vapor/production

This commit is contained in:
Dillon Ngo
2025-10-23 13:58:39 +08:00
2 changed files with 27 additions and 5 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ class BookingResource extends JsonResource
'marking' => $this->marking,
'amount' => $this->fix_amount,
'floating_amount' => floatval((App()->make(CalculatesBookingFloatingAmount::class))->execute($this->resource, $this->fix_currency_id)),
'paid_amount_with_refund' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)),
// 'paid_amount_with_refund' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)),
'paid_amount' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)),
'outstanding_amount_with_refund' => $outStandingAmountWithRefund > 0 ? $outStandingAmountWithRefund : 0,
'refunded_amount' => floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)),
@@ -5,8 +5,8 @@
<div class="row" v-show="!isLoading" v-if="booking">
<div class="col-md col-sm-12 m-b-20">
<div class="row" v-if="booking">
<div class="col" v-if="!(booking.amount === 0 && booking.outstanding_amount === 0 && booking.paid_amount === 0)">
<div class="row m-b-50" v-if="booking.status === 3">
<div class="col" v-if="showDownloadPDFButtons">
<div class="row m-b-50" v-if="booking.status === 3 || isBookingWithAFullRefund">
<div class="col no-padding">
<div class="row">
<div class="col">
@@ -122,7 +122,7 @@
</div>
</div>
</div>
<div class="row m-b-10" v-if="booking.status !== 3">
<div class="row m-b-10" v-if="booking.status !== 3 && !isBookingWithAFullRefund">
<div class="col">
<div class="row text-center m-b-15">
<div class="col">
@@ -395,7 +395,7 @@
</general-confirmation-form-component>
</modal-component>
</div>
<div class="row m-t-15" v-if="booking.amount === 0 && booking.outstanding_amount === 0 && booking.paid_amount === 0 && $store.getters.isSuperAdmin && booking.einvoice">
<div class="row m-t-15" v-if="showGenerateEInvoiceRefundButton">
<div class="col-sm col-md-auto">
<div class="btn btn-sm btn block all-caps b-rad-none btn-danger pointer requestModal equal-width-button" data-type="regenerateEInvoiceRefund">Regenerate E-Invoice<br>(Refund)</div>
</div>
@@ -636,6 +636,28 @@
}
return 'NOT PROVIDED';
},
showDownloadPDFButtons(){
const condition1 = !(this.booking.amount === 0 && this.booking.outstanding_amount === 0 && this.booking.paid_amount === 0);
const isBookingWithFullRefund = this.booking.payment_history.some(payment =>
payment.status === 7 && this.booking.amount === payment.refunded_amount
);
return condition1 || isBookingWithFullRefund;
},
showGenerateEInvoiceRefundButton(){
const condition1 = this.booking.amount === 0 && this.booking.outstanding_amount === 0 && this.booking.paid_amount === 0
&& this.$store.getters.isSuperAdmin && this.booking.einvoice;
const isBookingWithFullRefund = this.booking.payment_history.some(payment =>
payment.status === 7 && this.booking.amount === payment.refunded_amount
);
return condition1 || isBookingWithFullRefund;
},
isBookingWithAFullRefund(){
const isBookingWithFullRefund = this.booking.payment_history.some(payment =>
payment.status === 7 && this.booking.amount === payment.refunded_amount
);
return isBookingWithFullRefund;
}
},
watch: {
pendingQueue(inComplete){