create table component & connect api for dashboard
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Client\Transformers;
|
||||
namespace Modules\Client\Transformers\Dashboard;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DashboardResources extends JsonResource
|
||||
class LimitResources extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
@@ -22,17 +21,15 @@ class DashboardResources extends JsonResource
|
||||
$lockPercentage = (int)$this->currentPolicy->minimal_stop_service_percentage;
|
||||
|
||||
return [
|
||||
'policy' => [
|
||||
'myLimit' => [
|
||||
'balance' => $myLimitBalance,
|
||||
'total' => $myLimitTotal,
|
||||
'percentage' => $myLimitTotal ? (($myLimitBalance / $myLimitTotal) * 100) : 0,
|
||||
],
|
||||
'lockLimit' => [
|
||||
'balance' => $lockBalance,
|
||||
'percentage' => $lockPercentage
|
||||
]
|
||||
'myLimit' => [
|
||||
'balance' => $myLimitBalance,
|
||||
'total' => $myLimitTotal,
|
||||
'percentage' => $myLimitTotal ? round(($myLimitBalance / $myLimitTotal) * 100, 2) : 0,
|
||||
],
|
||||
'lockLimit' => [
|
||||
'balance' => $lockBalance,
|
||||
'percentage' => $lockPercentage
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Client\Transformers;
|
||||
namespace Modules\Client\Transformers\Dashboard;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -18,15 +18,13 @@ class MemberResources extends JsonResource
|
||||
'id' => $this->id,
|
||||
'memberId' => $this->member_id,
|
||||
'fullName' => $this->full_name,
|
||||
$this->mergeWhen($request->input('claimMember') === 'false', [
|
||||
'division' => $this->division->name ?? '',
|
||||
'status' => $this->active
|
||||
]),
|
||||
'division' => $this->division_name ?? '',
|
||||
'limit' => [
|
||||
'current' => $this->claims_sum_total_claim,
|
||||
'total' => $this->currentPlan->limit_rules ?? 0,
|
||||
'percentage' => (!empty($this->currentPlan->limit_rules ?? 0)) ? (($this->claims_sum_total_claim / $this->currentPlan->limit_rules) * 100) : 0
|
||||
],
|
||||
'status' => $this->active,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user