Files
investbrain/resources/views/portfolio/show.blade.php
T

184 lines
7.2 KiB
PHP
Raw Normal View History

2025-04-09 19:25:15 -05:00
@use('App\Models\Currency')
<x-layouts.app>
<div x-data>
2024-08-05 22:41:53 -05:00
<x-ui.modal
2024-10-18 14:59:10 -05:00
key="create-transaction"
2024-10-22 12:41:18 -05:00
title="{{ __('Create Transaction') }}"
2024-08-15 21:35:43 -05:00
>
@livewire('manage-transaction-form', [
'portfolio' => $portfolio,
])
</x-ui.modal>
2024-08-15 21:35:43 -05:00
<x-ui.drawer
2024-08-05 22:41:53 -05:00
key="manage-portfolio"
2024-10-22 12:41:18 -05:00
title="{{ __('Manage Portfolio') }}"
2024-08-05 22:41:53 -05:00
>
2024-08-06 20:41:52 -05:00
@livewire('manage-portfolio-form', [
'portfolio' => $portfolio,
'hideCancel' => true
])
2024-08-05 22:41:53 -05:00
</x-ui.drawer>
2024-08-05 22:41:53 -05:00
<x-ui.toolbar :title="$portfolio->title">
2024-08-05 22:41:53 -05:00
@if($portfolio->wishlist)
<x-ui.badge value="{{ __('Wishlist') }}" title="{{ __('Wishlist') }}" class="badge-secondary badge-outline mr-3" />
2024-10-25 22:06:46 -05:00
@endif
@if(auth()->user()->id !== $portfolio->owner_id)
<x-ui.badge value="{{ $portfolio->owner->name }}" title="{{ __('Owner').': '.$portfolio->owner->name }}" class="badge-secondary badge-outline mr-3" />
2024-08-05 22:41:53 -05:00
@endif
2024-10-21 22:23:20 -05:00
@can('fullAccess', $portfolio)
<x-ui.button
2024-10-22 12:41:18 -05:00
title="{{ __('Manage Portfolio') }}"
2024-08-05 22:41:53 -05:00
icon="o-pencil"
class="btn-circle btn-ghost btn-sm text-secondary"
@click="$dispatch('toggle-manage-portfolio')"
/>
2025-01-28 21:15:29 -06:00
@else
<x-ui.icon name="o-eye" class="text-secondary w-4" title="{{ __('Read only') }}" />
2024-10-21 22:23:20 -05:00
@endcan
2024-08-15 21:35:43 -05:00
<x-ui.flex-spacer />
2024-08-15 21:35:43 -05:00
2024-10-21 22:23:20 -05:00
@can('fullAccess', $portfolio)
2024-08-15 21:35:43 -05:00
<div>
<x-ui.button
2024-10-22 12:41:18 -05:00
label="{{ __('Create Transaction') }}"
class="btn-sm btn-primary whitespace-nowrap"
2024-10-18 14:59:10 -05:00
@click="$dispatch('toggle-create-transaction')"
2024-08-15 21:35:43 -05:00
/>
</div>
2024-10-21 22:23:20 -05:00
@endcan
</x-ui.toolbar>
2024-08-05 22:41:53 -05:00
2024-08-15 21:35:43 -05:00
@livewire('portfolio-performance-chart', [
2024-08-06 22:59:17 -05:00
'name' => 'portfolio-'.$portfolio->id,
'portfolio' => $portfolio
])
2024-08-05 22:41:53 -05:00
2024-08-06 22:59:17 -05:00
<div class="grid sm:grid-cols-5 gap-5">
2024-08-05 22:41:53 -05:00
<x-ui.card dense="true" sub-title="{{ __('Market Gain/Loss') }}" class="col-span-5 sm:col-span-1">
2025-08-21 20:54:14 -05:00
<div class="font-black text-xl"> {{ Number::currency($metrics->get('total_market_gain_dollars', 0)) }} </div>
</x-ui.card>
2024-08-05 22:41:53 -05:00
<x-ui.card dense="true" sub-title="{{ __('Total Cost Basis') }}" class="col-span-5 sm:col-span-1">
2025-04-09 19:25:15 -05:00
<div class="font-black text-xl"> {{ Number::currency($metrics->get('total_cost_basis', 0)) }} </div>
</x-ui.card>
2024-08-06 22:59:17 -05:00
<x-ui.card dense="true" sub-title="{{ __('Total Market Value') }}" class="col-span-5 sm:col-span-1">
2025-04-09 19:25:15 -05:00
<div class="font-black text-xl"> {{ Number::currency($metrics->get('total_market_value', 0)) }} </div>
</x-ui.card>
2024-08-06 22:59:17 -05:00
<x-ui.card dense="true" sub-title="{{ __('Realized Gain/Loss') }}" class="col-span-5 sm:col-span-1">
2025-04-09 19:25:15 -05:00
<div class="font-black text-xl"> {{ Number::currency($metrics->get('realized_gain_dollars', 0)) }} </div>
</x-ui.card>
2024-08-06 22:59:17 -05:00
<x-ui.card dense="true" sub-title="{{ __('Dividends Earned') }}" class="col-span-5 sm:col-span-1">
2025-04-09 19:25:15 -05:00
<div class="font-black text-xl"> {{ Number::currency($metrics->get('total_dividends_earned', 0)) }} </div>
</x-ui.card>
2024-08-06 22:59:17 -05:00
2024-08-05 22:41:53 -05:00
</div>
<div class="mt-6 grid md:grid-cols-7 gap-5">
<x-ui.card title="{{ __('Holdings') }}" class="md:col-span-4">
2024-08-17 21:33:09 -05:00
2024-09-06 23:15:43 -05:00
@if($portfolio->holdings->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
{{ __('Nothing to show here yet') }}
</div>
@else
2024-08-05 22:41:53 -05:00
@livewire('datatables.holdings-table', [
'portfolio' => $portfolio
])
2024-09-06 23:15:43 -05:00
@endif
</x-ui.card>
2024-08-05 22:41:53 -05:00
<x-ui.card title="{{ __('Recent activity') }}" class="md:col-span-3">
2024-09-06 23:15:43 -05:00
@if($portfolio->transactions->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
{{ __('Nothing to show here yet') }}
</div>
2024-08-05 22:41:53 -05:00
2024-09-06 23:15:43 -05:00
@endif
2024-08-15 21:35:43 -05:00
@livewire('transactions-list', [
'portfolio' => $portfolio,
'transactions' => $portfolio->transactions
2024-08-15 21:35:43 -05:00
])
2024-08-05 22:41:53 -05:00
</x-ui.card>
2024-08-05 22:41:53 -05:00
<x-ui.card title="{{ __('Top performers') }}" class="md:col-span-3">
2024-09-06 23:15:43 -05:00
@if($portfolio->holdings->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
{{ __('Nothing to show here yet') }}
</div>
@endif
@livewire('top-performers-list', [
'holdings' => $portfolio->holdings
])
</x-ui.card>
{{-- <x-ui.card title="{{ __('Top headlines') }}" class="md:col-span-3">
@php
$users = App\Models\User::take(3)->get();
@endphp
2024-08-22 22:45:17 -05:00
@foreach($users as $user)
<x-ui.list-item no-separator :item="$user" avatar="profile_photo_url" link="/docs/installation" />
2024-08-22 22:45:17 -05:00
@endforeach
</x-ui.card> --}}
2024-08-22 22:45:17 -05:00
2024-10-31 17:33:48 -05:00
@if(config('services.ai_chat_enabled'))
@livewire('ui.ai-chat-window', [
'chatable' => $portfolio,
'suggested_prompts' => [
[
'text' => 'Which holding is most successful?',
'value' => 'Which holding is most successful in this portfolio?',
],
[
'text' => 'Should I diversify more?',
'value' => 'Is my portfolio diverse enough?',
]
],
'system_prompt' => "
2025-09-26 20:11:51 -05:00
Most recent training data: " . now()->toDateString() . ".
You are an investment portfolio assistant providing advice to an investor. Use the following information to provide relevant recommendations. Use the words 'likely' or 'may' in lieu of concrete statements (except for obvious statements of fact or common sense). Do not apologize. Be polite, but minimize gratuitous niceties. When referencing numbers, always round to the nearest 100th decimal place.
The investor has the following holdings in this portfolio:
{$formattedHoldings}
2025-09-26 20:11:51 -05:00
Based on the current market data, quantity owned, and average cost basis, you can determine the performance of any holding.
2024-10-31 15:19:59 -05:00
Below is the question from the investor. Considering these facts, provide a concise response to the following question (give a direct response). Limit your response to no more than 75 words and consider using a common decision framework. Use github style markdown for any formatting:"
])
2024-10-31 17:33:48 -05:00
@endif
2024-08-05 22:41:53 -05:00
</div>
</div>
</x-layouts.app>