Merge branch 'dillon/34.8-jenkins-vapor' into vapor/production

This commit is contained in:
Dillon Ngo
2024-10-28 16:18:41 +08:00
2 changed files with 5 additions and 1 deletions
@@ -22,13 +22,16 @@ class TransactionResource extends JsonResource
$booking = null; //cief todo: 66
$bank = null;
//Check if Transaction of type PAYMENT has an override for recipient bank - starts
$isEditedBankRecipient = false;
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND, TransactionType::SUPPLIER_REFUND])){
$booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank;
$isEditedBankRecipient = $this->owner->bank ? true : false;
}
else{
$booking = $this->owner;
$bank = $this->bank ?? $booking->bank;
$isEditedBankRecipient = $this->bank ? true : false;
}
//Check if Transaction of type PAYMENT has an override for recipient bank - ends
$days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
@@ -66,6 +69,7 @@ class TransactionResource extends JsonResource
'remarks' => RemarkResource::collection($this->remarks),
'redemption' => new VoucherRedemptionResource($this->voucherRedemption),
'bank' => ((int) $this->type === TransactionType::PAYMENT) ? new BankResource($bank) : null, //When a transaction (of type payment) has an override recipient bank details on booking, this is NOT null
'bank_recipient_edited' => $isEditedBankRecipient
];
}
}
@@ -614,7 +614,7 @@
bookingId: this.data.id
},
isEditRecipientBankDetailsCollapsed: false,
isAnyPaymentRecipientBankEdited: this.data.payment_history.some(payment => payment.bank !== null),
isAnyPaymentRecipientBankEdited: this.data.payment_history.some(payment => payment.bank_recipient_edited !== null && payment.bank_recipient_edited),
}
},
validations () {