mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
show company total payments
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Currency;
|
||||
use App\Models\SegmentConstant;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
@@ -36,6 +37,7 @@ class CompanyResource extends JsonResource
|
||||
'employee' => new UserResource(Auth::user()->type === RoleTypes::USER ? $this->employees()->where('email', '=', Auth::user()->email)->first() : $this->employees()->where('users.status', '=', ApprovalStatus::APPROVED)->orderBy('id', 'DESC')->first()),
|
||||
'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'),
|
||||
'personal_banks' => BankResource::collection($this->banks->where('type', BankAccountType::PERSONAL)),
|
||||
'recipient_banks' => [
|
||||
'accounts' => BankResource::collection($this->banks->where('type', BankAccountType::EXTERNAL)),
|
||||
|
||||
@@ -1,18 +1,45 @@
|
||||
<template>
|
||||
<div class="row align-items-center m-b-10 parentContainer">
|
||||
<div class="row w-100 m-0 p-0 ">
|
||||
<div class="col pull-left mt-2 pr-0">
|
||||
<div class="font-heading all-caps fs-11">{{this.item.name}}</div>
|
||||
<div class="row m-b-10 align-items-end">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted all-caps">Name</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 text-center mt-2">
|
||||
<div class="font-heading all-caps fs-11">{{this.item.bookings.length}}</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-11">{{this.item.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 text-right pull-right">
|
||||
<button type="button" @click="viewCompany()" class="btn btn-xs btn-info fs-11"><i class="fa fa-angle-down"></i></button>
|
||||
<a :href="route('customer.profile', item.reference)">
|
||||
<button type="button" class="btn btn-xs btn-primary fs-11">View</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-3 text-center">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted all-caps">Payments</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-11">MYR {{(Math.round((this.item.total_payments + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 text-center">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted all-caps">Bookings</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-11">{{this.item.bookings.length}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<a :href="route('customer.profile', item.reference)">
|
||||
<button type="button" class="btn btn-xs btn-primary fs-11">View</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -561,13 +561,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin">
|
||||
<div class="row no-margin" v-if="$store.getters.isAdmin">
|
||||
<div class="col bg-white padding-25">
|
||||
<div class="row tabsContainer tabContent" tab-name="customer-list" v-if="$store.getters.isAdmin">
|
||||
<company-quick-view-section-component></company-quick-view-section-component>
|
||||
<div class="row tabsContainer tabContent" tab-name="customer-list">
|
||||
<list-component key="2" section="customerListSection" cla :endpoint="route('api.company.list')" :options="{'business_type': 2, with_bookings:true}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<company-list-component :data="data"></company-list-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent hide" tab-name="customer-leads" v-if="$store.getters.isAdmin">
|
||||
<list-component key="2" :section="this.section" :endpoint="route('api.company.list')" :options="{'business_type': 2, with_bookings:true, Without_confirmed_payments: true, Does_not_have_segments: [5]}">
|
||||
<list-component key="2" section="leadCustomerListSection" :endpoint="route('api.company.list')" :options="{'business_type': 2, with_bookings:true, Without_confirmed_payments: true, Does_not_have_segments: [5]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<company-list-component :data="data"></company-list-component>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user