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

208 lines
7.2 KiB
PHP
Raw Normal View History

2025-04-09 19:25:15 -05:00
@use('App\Models\Currency')
<x-layouts.app>
2024-08-27 21:17:54 -05:00
<div x-data>
<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-27 21:17:54 -05:00
>
@livewire('manage-transaction-form', [
'portfolio' => $portfolio,
2024-08-28 22:06:47 -05:00
'symbol' => $holding->market_data->symbol,
2024-08-27 21:17:54 -05:00
])
</x-ui.modal>
2024-08-26 19:52:46 -05:00
<x-ui.modal
key="holding-options"
2024-10-22 12:41:18 -05:00
title="{{ __('Holding Options') }}"
>
@livewire('holding-options-form', [
'holding' => $holding
])
</x-ui.modal>
<x-ui.toolbar>
2024-08-26 21:34:13 -05:00
<x-slot:title>
<a href="{{ route('portfolio.show', ['portfolio' => $portfolio->id]) }}" title="{{ __('Portfolio') }}">
{{ $portfolio->title }}
2024-08-28 22:06:47 -05:00
</a> » <span title="{{ __('Holding') }}">{{ $holding->market_data->symbol }}</span>
2024-08-26 21:34:13 -05:00
</x-slot:title>
2024-08-27 21:17:54 -05:00
2024-10-21 22:23:20 -05:00
@can('fullAccess', $portfolio)
<x-ui.button
title="{{ __('Holding options') }}"
icon="o-pencil"
class="btn-circle btn-ghost btn-sm text-secondary"
@click="$dispatch('toggle-holding-options')"
/>
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
<x-ui.flex-spacer />
2024-08-27 21:17:54 -05:00
2024-10-21 22:23:20 -05:00
@can('fullAccess', $portfolio)
<x-ui.button
2024-10-22 12:36:43 -05:00
label="{{ __('Create transaction') }}"
2024-10-21 22:23:20 -05:00
class="btn-sm btn-primary whitespace-nowrap"
@click="$dispatch('toggle-create-transaction')"
/>
@endcan
</x-ui.toolbar>
2024-08-26 19:52:46 -05:00
2024-08-26 21:34:13 -05:00
<div class="mt-6 grid md:grid-cols-9 gap-5">
<x-ui.card class="md:col-span-5">
2024-10-18 20:46:22 -05:00
<x-slot:title>
2024-08-26 21:34:13 -05:00
2024-08-28 22:06:47 -05:00
{{ $holding->market_data->symbol }}
2024-10-18 20:46:22 -05:00
<span class="text-sm ml-2"> {{ $holding->market_data->name }} </span>
2024-08-26 21:34:13 -05:00
</x-slot:title>
2024-08-30 20:58:00 -05:00
@livewire('holding-market-data', ['holding' => $holding])
2024-08-27 22:41:13 -05:00
</x-ui.card>
2024-08-27 22:41:13 -05:00
<x-ui.card title="{{ __('Fundamentals') }}" class="md:col-span-4">
2024-08-27 22:41:13 -05:00
2025-04-09 19:25:15 -05:00
@if(!empty($holding->market_data->market_cap))
2024-09-01 16:06:29 -05:00
<p>
<span class="font-bold">{{ __('Market Cap') }}: </span>
2025-04-09 19:25:15 -05:00
{{ Currency::forHumans($holding->market_data->market_cap, $holding->market_data->currency) }}
2024-09-01 16:06:29 -05:00
</p>
2025-04-09 19:25:15 -05:00
@endif
2024-09-01 16:06:29 -05:00
2025-04-09 19:25:15 -05:00
@if(!empty($holding->market_data->forward_pe))
2024-08-27 18:12:51 -05:00
<p>
<span class="font-bold">{{ __('Forward PE') }}: </span>
2024-08-28 22:06:47 -05:00
{{ $holding->market_data->forward_pe }}
2024-08-27 18:12:51 -05:00
</p>
2025-04-09 19:25:15 -05:00
@endif
2024-08-27 18:12:51 -05:00
2025-04-09 19:25:15 -05:00
@if(!empty($holding->market_data->trailing_pe))
2024-08-27 18:12:51 -05:00
<p>
<span class="font-bold">{{ __('Trailing PE') }}: </span>
2024-08-28 22:06:47 -05:00
{{ $holding->market_data->trailing_pe }}
2024-08-27 18:12:51 -05:00
</p>
2025-04-09 19:25:15 -05:00
@endif
2024-08-27 18:12:51 -05:00
2025-04-09 19:25:15 -05:00
@if(!empty($holding->market_data->book_value))
<p>
<span class="font-bold">{{ __('Book Value') }}: </span>
{{ Number::currency($holding->market_data->book_value, $holding->market_data->currency) }}
</p>
@endif
2024-08-26 21:34:13 -05:00
2024-08-27 22:49:01 -05:00
<p>
<span class="font-bold">{{ __('52 week') }}: </span>
<x-ui.fifty-two-week-range :market-data="$holding->market_data" />
2024-09-01 16:06:29 -05:00
</p>
2025-04-09 19:25:15 -05:00
@if(!empty($holding->market_data->dividend_yield))
2024-09-01 16:06:29 -05:00
<p>
<span class="font-bold">{{ __('Dividend Yield') }}: </span>
2024-09-05 20:23:41 -05:00
{{ Number::percentage(
2025-04-09 19:25:15 -05:00
$holding->market_data->dividend_yield,
2024-09-05 20:23:41 -05:00
$holding->market_data->dividend_yield < 1 ? 2 : 0
) }}
2024-09-01 16:06:29 -05:00
</p>
2025-04-09 19:25:15 -05:00
@endif
2024-09-01 16:06:29 -05:00
2025-04-09 19:25:15 -05:00
@if(!empty($holding->market_data->last_dividend_date))
2024-09-01 16:06:29 -05:00
<p>
2024-09-05 20:41:07 -05:00
<span class="font-bold">{{ __('Last Dividend Paid') }}: </span>
2025-04-09 19:25:15 -05:00
{{ $holding->market_data->last_dividend_date->format('F d, Y') }}
2024-08-27 22:49:01 -05:00
</p>
2025-04-09 19:25:15 -05:00
@endif
2024-08-27 22:49:01 -05:00
</x-ui.card>
2024-08-26 21:34:13 -05:00
<x-ui.card title="{{ __('Recent activity') }}" class="md:col-span-3">
2024-08-27 18:12:51 -05:00
@livewire('transactions-list', [
'portfolio' => $holding->portfolio,
2024-08-29 18:46:21 -05:00
'transactions' => $holding->transactions,
2024-08-27 21:17:54 -05:00
'shouldGoToHolding' => false
2024-08-27 18:12:51 -05:00
])
2024-08-26 21:34:13 -05:00
</x-ui.card>
2024-08-26 21:34:13 -05:00
<x-ui.card title="{{ __('Dividends') }}" class="md:col-span-3">
2024-10-18 14:59:10 -05:00
2024-09-06 23:15:43 -05:00
@if($holding->dividends->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
{{ __('No dividends for :symbol yet', ['symbol' => $holding->symbol]) }}
</div>
@endif
2024-08-30 20:58:00 -05:00
@livewire('holding-dividends-list', ['holding' => $holding])
2024-08-26 21:34:13 -05:00
</x-ui.card>
2024-08-26 21:34:13 -05:00
<x-ui.card title="{{ __('Splits') }}" class="md:col-span-3">
2024-08-26 21:34:13 -05:00
2024-09-06 23:15:43 -05:00
@if($holding->splits->isEmpty())
<div class="flex justify-center items-center h-full pb-10 text-secondary">
{{ __('No splits for :symbol yet', ['symbol' => $holding->symbol]) }}
</div>
@endif
2024-08-27 18:12:51 -05:00
@foreach ($holding->splits->take(5) as $split)
2025-09-28 19:54:49 -05:00
<x-ui.list-item :item="$split" no-separator no-hover>
2024-08-27 18:12:51 -05:00
<x-slot:value>
2024-09-06 23:15:43 -05:00
1:{{ $split->split_amount }}
2024-08-27 18:12:51 -05:00
</x-slot:value>
<x-slot:sub-value>
2024-09-05 20:41:07 -05:00
<span title="{{ __('Distribution Date') }}">{{ $split->date->format('F d, Y') }}</span>
2024-08-27 18:12:51 -05:00
</x-slot:sub-value>
</x-ui.list-item>
2024-08-26 21:34:13 -05:00
2024-08-27 18:12:51 -05:00
@endforeach
2024-08-26 21:34:13 -05:00
</x-ui.card>
2024-08-26 21:34:13 -05:00
2024-10-31 17:33:48 -05:00
@if(config('services.ai_chat_enabled'))
@livewire('ui.ai-chat-window', [
'chatable' => $holding,
'suggested_prompts' => [
[
'text' => 'What are the key risks?',
2026-03-13 15:21:22 -05:00
'value' => 'What are the key risks for the holding?'
],
[
'text' => 'Should I invest more?',
'value' => 'Is it worthwhile to invest more?'
],
[
'text' => 'Should I sell?',
2026-03-13 15:21:22 -05:00
'value' => 'When would be a good time for me to sell?'
],
[
'text' => 'What are the key strengths?',
2026-03-13 15:21:22 -05:00
'value' => 'Can you tell me the key strengths for this holding?'
],
[
'text' => 'Is this a successful position?',
'value' => 'Is this a successful holding in my portfolio?'
]
],
])
2024-10-31 17:33:48 -05:00
@endif
2024-08-26 21:34:13 -05:00
</div>
2024-08-26 19:52:46 -05:00
</div>
</x-layouts.app>