holdings wip

This commit is contained in:
hackerESQ
2024-08-26 21:34:13 -05:00
parent 92bd91ef2c
commit 2b384758ff
6 changed files with 107 additions and 5 deletions
+13 -2
View File
@@ -2,15 +2,26 @@
namespace App\Http\Controllers;
use App\Models\Holding;
use App\Models\Portfolio;
use Illuminate\Http\Request;
class HoldingController extends Controller
{
/**
* Display the specified resource.
*/
public function show()
public function show(Request $request, Portfolio $portfolio, String $symbol)
{
return view('holding.index');
$holding = Holding::where([
'portfolio_id' => $portfolio->id,
'symbol' => $symbol
])->firstOrFail();
$market_data = $holding->market_data;
return view('holding.show', compact(['portfolio', 'holding', 'market_data']));
}
}
+3
View File
@@ -107,6 +107,7 @@
"Total Market Value": "Total Market Value",
"Realized Gain/Loss": "Realized Gain/Loss",
"Dividends Earned": "Dividends Earned",
"Splits": "Splits",
"My portfolios": "My portfolios",
"Create your first portfolio!": "Create your first portfolio!",
"Wishlist": "Wishlist",
@@ -123,8 +124,10 @@
"Manage Profile": "Manage Profile",
"Symbol": "Symbol",
"Quantity": "Quantity",
"Quantity Owned": "Quantity Owned",
"Average Cost Basis": "Average Cost Basis",
"Market Value": "Market Value",
"52 week": "52 week",
"52 week low": "52 week low",
"52 week high": "52 week high",
"Number of Transactions": "Number of Transactions",
+3
View File
@@ -107,6 +107,7 @@
"Total Market Value": "Valor Total de Mercado",
"Realized Gain/Loss": "Ganancia/Pérdida Realizada",
"Dividends Earned": "Dividendos Ganados",
"Splits": "Divisiones",
"My portfolios": "Mis portafolios",
"Create your first portfolio!": "¡Crea tu primer portafolio!",
"Wishlist": "Lista de deseos",
@@ -123,8 +124,10 @@
"Manage Profile": "Gestionar Perfil",
"Symbol": "Símbolo",
"Quantity": "Cantidad",
"Quantity Owned": "Cantidad de propiedad",
"Average Cost Basis": "Costo Promedio",
"Market Value": "Valor de Mercado",
"52 week": "52 semanas",
"52 week low": "Mínimo de 52 semanas",
"52 week high": "Máximo de 52 semanas",
"Number of Transactions": "Número de Transacciones",
+83 -2
View File
@@ -1,9 +1,90 @@
<x-app-layout>
<div>
<x-ib-toolbar title="{{ __('Holding') }}" />
<x-ib-toolbar>
<x-slot:title>
<a href="{{ route('portfolio.show', ['portfolio' => $portfolio->id]) }}" title="{{ __('Portfolio') }}">
{{ $portfolio->title }}
</a> » <span title="{{ __('Holding') }}">{{ $market_data->symbol }}</span>
</x-slot:title>
</x-ib-toolbar>
@livewire('transactions-table')
<div class="mt-6 grid md:grid-cols-9 gap-5">
<x-ib-card class="md:col-span-5">
<x-slot:title class="pb-2">
{{ $market_data->symbol }}
<span class="text-sm"> {{ $market_data->name }} </span>
</x-slot:title>
<p class="font-bold text-2xl pb-2">
{{ Number::currency($market_data->market_value) }}
<span class="text-base font-normal"> 9%</span>
</p>
<p>
<span class="font-bold">{{ __('Quantity Owned') }}: </span>
{{ $holding->quantity }}
</p>
<p>
<span class="font-bold">{{ __('Average Cost Basis') }}: </span>
{{ $holding->average_cost_basis }}
</p>
<p>
<span class="font-bold">{{ __('Total Cost Basis') }}: </span>
{{ $holding->total_cost_basis }}
</p>
<p>
<span class="font-bold">{{ __('Realized Gain/Loss') }}: </span>
{{ $holding->realized_gain_dollars }}
</p>
<p>
<span class="font-bold">{{ __('Dividends Earned') }}: </span>
{{ $holding->dividends_earned }}
</p>
<p>
<span class="font-bold">{{ __('52 week') }}: </span>
</p>
<p class="pt-2 text-sm">
{{ __('Market Data Age') }}:
{{ \Carbon\Carbon::parse($market_data->updated_at)->diffForHumans() }}
</p>
</x-ib-card>
<x-ib-card title="{{ __('Fundamentals') }}" class="md:col-span-4">
</x-ib-card>
<x-ib-card title="{{ __('Recent activity') }}" class="md:col-span-3">
</x-ib-card>
<x-ib-card title="{{ __('Dividends') }}" class="md:col-span-3">
</x-ib-card>
<x-ib-card title="{{ __('Splits') }}" class="md:col-span-3">
</x-ib-card>
</div>
</div>
</x-app-layout>
@@ -26,7 +26,10 @@ new class extends Component {
<x-list-item
no-separator
:item="$holding"
link="{{ route('portfolio.show', ['portfolio' => $holding->portfolio_id]) }}"
link="{{ route('holding.show', [
'portfolio' => $holding->portfolio_id,
'symbol' => $holding->symbol,
]) }}"
>
<x-slot:value class="flex items-center">
+1
View File
@@ -1,6 +1,7 @@
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HoldingController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\PortfolioController;
use App\Http\Controllers\TransactionController;