wip more dashboard widgets
This commit is contained in:
@@ -58,17 +58,33 @@
|
||||
@if (!$user->portfolios->isEmpty())
|
||||
<x-ib-card title="{{ __('Top performers') }}" class="md:col-span-3">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@foreach($user->holdings->sortBy('market_gain_percent')->where('quantity', '>', 0)->take(5) as $holding)
|
||||
<x-list-item no-separator :item="$holding" link="{{ route('portfolio.show', ['portfolio' => $holding->portfolio_id]) }}">
|
||||
|
||||
@php
|
||||
$gainPercent = (($holding->market_data?->market_value - $holding->average_cost_basis) / $holding->average_cost_basis) * 100;
|
||||
@endphp
|
||||
|
||||
<x-slot:value class="flex items-center">
|
||||
|
||||
{{ $holding->symbol }}
|
||||
|
||||
<x-badge class="{{ $gainPercent > 0 ? 'badge-success' : 'badge-error' }} ml-2 badge-sm" >
|
||||
<x-slot:value>
|
||||
{{ Number::percentage($gainPercent) }}
|
||||
</x-slot:value>
|
||||
</x-badge>
|
||||
|
||||
</x-slot:value>
|
||||
<x-slot:sub-value>
|
||||
{{ $holding->market_data?->name }}
|
||||
</x-slot:sub-value>
|
||||
</x-list-item>
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
@endif
|
||||
|
||||
|
||||
{{-- @if (!$user->portfolios->isEmpty())
|
||||
<x-ib-card title="{{ __('Top headlines') }}" class="md:col-span-3">
|
||||
|
||||
@@ -83,20 +99,6 @@
|
||||
</x-ib-card>
|
||||
@endif --}}
|
||||
|
||||
@if (!$user->portfolios->isEmpty())
|
||||
<x-ib-card title="{{ __('Recent activity') }}" class="md:col-span-4">
|
||||
|
||||
@php
|
||||
$users = App\Models\User::take(3)->get();
|
||||
@endphp
|
||||
|
||||
@foreach($users as $user)
|
||||
<x-list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
|
||||
@endforeach
|
||||
|
||||
</x-ib-card>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
||||
</x-app-layout>
|
||||
Reference in New Issue
Block a user