diff --git a/app/Http/Controllers/HoldingController.php b/app/Http/Controllers/HoldingController.php index 8f51709..fed192a 100644 --- a/app/Http/Controllers/HoldingController.php +++ b/app/Http/Controllers/HoldingController.php @@ -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'])); } } diff --git a/lang/en.json b/lang/en.json index 78b0165..020e82a 100644 --- a/lang/en.json +++ b/lang/en.json @@ -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", diff --git a/lang/es.json b/lang/es.json index bc46be7..06c5b8e 100644 --- a/lang/es.json +++ b/lang/es.json @@ -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", diff --git a/resources/views/holding/show.blade.php b/resources/views/holding/show.blade.php index 88ed8a8..b260aaf 100644 --- a/resources/views/holding/show.blade.php +++ b/resources/views/holding/show.blade.php @@ -1,9 +1,90 @@
- + + + + {{ $portfolio->title }} + » {{ $market_data->symbol }} + + - @livewire('transactions-table') +
+ + + + + {{ $market_data->symbol }} + {{ $market_data->name }} + + +

+ {{ Number::currency($market_data->market_value) }} + ▲ 9% +

+ +

+ {{ __('Quantity Owned') }}: + {{ $holding->quantity }} +

+ +

+ {{ __('Average Cost Basis') }}: + {{ $holding->average_cost_basis }} +

+ +

+ {{ __('Total Cost Basis') }}: + {{ $holding->total_cost_basis }} +

+ +

+ {{ __('Realized Gain/Loss') }}: + {{ $holding->realized_gain_dollars }} +

+ +

+ {{ __('Dividends Earned') }}: + {{ $holding->dividends_earned }} +

+ +

+ {{ __('52 week') }}: + ● ● ● ● ● ● ● ● ● ● +

+ +

+ {{ __('Market Data Age') }}: + {{ \Carbon\Carbon::parse($market_data->updated_at)->diffForHumans() }} +

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/resources/views/livewire/top-performers-list.blade.php b/resources/views/livewire/top-performers-list.blade.php index 908e589..645ef21 100644 --- a/resources/views/livewire/top-performers-list.blade.php +++ b/resources/views/livewire/top-performers-list.blade.php @@ -26,7 +26,10 @@ new class extends Component { diff --git a/routes/web.php b/routes/web.php index 154c589..671e99a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,7 @@