From e6ada6b2d48ef723de6fcf346ba90107a192653e Mon Sep 17 00:00:00 2001 From: omair saleh Date: Mon, 29 Nov 2021 12:20:00 +0800 Subject: [PATCH] show currency supplier info for transaction --- app/Http/Resources/TransactionResource.php | 1 + app/Models/Transaction.php | 8 ++++++++ .../bookings/elements/PaymentHistoryComponent.vue | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index 1793d191..4c7afc56 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -21,6 +21,7 @@ class TransactionResource extends JsonResource 'booking' => new BookingResource($this->booking), 'type' => (int) $this->type, 'bill_no' => $this->bill_no, + 'issuer' => new CompanyResource($this->issuer), 'recipient_bank_account' => new BankResource($this->when((int) $this->type === TransactionType::BILL,$this->booking->bank)), 'amount' => (double) $this->amount, 'original_amount' => (double) $this->original_amount, diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index 2624117b..7390b82b 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -26,6 +26,14 @@ class Transaction extends AbstractModel implements Documentable return $this->BelongsTo( Booking::class, 'booking_id', 'id'); } + /** + * @return BelongsTo + */ + public function issuer(): BelongsTo + { + return $this->BelongsTo( Company::class, 'issuer', 'id'); + } + /** * @return BelongsTo */ diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 8bbb639c..b91286bc 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -16,6 +16,11 @@ {{ item.type === 3 ? item.original_currency.short_code : item.currency.short_code}} {{(Math.round((item.type === 3 ? item.original_amount : item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} +
+
+ +
+