From 431c8e31ee2374b0ea4965a929a36bf25368e442 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sun, 10 Oct 2021 12:47:08 +0800 Subject: [PATCH] separate customers list in a new page --- app/Http/Resources/CompanyResource.php | 1 + .../companies/elements/CompanyComponent.vue | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/Http/Resources/CompanyResource.php b/app/Http/Resources/CompanyResource.php index f295dfd9..36233f4f 100644 --- a/app/Http/Resources/CompanyResource.php +++ b/app/Http/Resources/CompanyResource.php @@ -38,6 +38,7 @@ class CompanyResource extends JsonResource 'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->first()), 'bookings' => $this->whenLoaded('bookings', $this->bookings()->orderBy('id', 'DESC')->get(), []), 'total_payments' => (float) $this->transactions()->where('transactions.type', TransactionType::PAYMENT)->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount'), + 'last_payment' => $this->transactions()->where('transactions.type', TransactionType::PAYMENT)->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->orderBy('id', 'DESC')->first()->created_at->diffForHumans(), 'personal_banks' => BankResource::collection($this->banks->where('type', BankAccountType::PERSONAL)), 'recipient_banks' => [ 'accounts' => BankResource::collection($this->banks->where('type', BankAccountType::EXTERNAL)), diff --git a/resources/assets/vue/components/companies/elements/CompanyComponent.vue b/resources/assets/vue/components/companies/elements/CompanyComponent.vue index f229114d..06017506 100644 --- a/resources/assets/vue/components/companies/elements/CompanyComponent.vue +++ b/resources/assets/vue/components/companies/elements/CompanyComponent.vue @@ -3,12 +3,12 @@
-
Name
+
Marking
-
{{this.item.name}}
+
{{this.item.reference}}
@@ -24,6 +24,18 @@ +
+
+
+
Last Payment
+
+
+
+
+
{{this.item.last_payment}}
+
+
+