add empty data help text
This commit is contained in:
@@ -24,10 +24,10 @@ class HoldingController extends Controller
|
||||
->portfolio($portfolio->id)
|
||||
->firstOrFail();
|
||||
|
||||
if ($holding->quantity <= 0) {
|
||||
// if ($holding->quantity <= 0) {
|
||||
|
||||
return redirect(route('portfolio.show', ['portfolio' => $portfolio->id]));
|
||||
}
|
||||
// return redirect(route('portfolio.show', ['portfolio' => $portfolio->id]));
|
||||
// }
|
||||
|
||||
return view('holding.show', compact(['portfolio', 'holding']));
|
||||
}
|
||||
|
||||
@@ -177,7 +177,11 @@ class Holding extends Model
|
||||
->first();
|
||||
|
||||
$total_quantity = $query->qty_purchases - $query->qty_sales;
|
||||
$average_cost_basis = $query->qty_purchases > 0
|
||||
|
||||
$average_cost_basis = (
|
||||
$query->qty_purchases > 0
|
||||
&& $total_quantity > 0
|
||||
)
|
||||
? $query->cost_basis / $query->qty_purchases
|
||||
: 0;
|
||||
|
||||
|
||||
@@ -110,6 +110,21 @@ class Transaction extends Model
|
||||
return $query->where('symbol', $symbol);
|
||||
}
|
||||
|
||||
public function scopeBuy($query)
|
||||
{
|
||||
return $query->where('transaction_type', 'BUY');
|
||||
}
|
||||
|
||||
public function scopeSell($query)
|
||||
{
|
||||
return $query->where('transaction_type', 'SELL');
|
||||
}
|
||||
|
||||
public function scopeBeforeDate($query, $date)
|
||||
{
|
||||
return $query->whereDate('date', '<', $date);
|
||||
}
|
||||
|
||||
public function scopeMyTransactions()
|
||||
{
|
||||
return $this->whereHas('portfolio', function ($query) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"Close": "Close",
|
||||
"or": "or",
|
||||
"and": "and",
|
||||
"Nothing to show here yet": "Nothing to show here yet",
|
||||
|
||||
"Hang on! You're doing that too much.": "Hang on! You're doing that too much.",
|
||||
"Delete Account": "Delete Account",
|
||||
@@ -117,6 +118,7 @@
|
||||
"Dividends Earned": "Dividends Earned",
|
||||
"Split": "Split",
|
||||
"Splits": "Splits",
|
||||
"No splits for :symbol yet": "No splits for :symbol yet",
|
||||
"Distribution Date": "Distribution Date",
|
||||
"My portfolios": "My portfolios",
|
||||
"Create your first portfolio!": "Create your first portfolio!",
|
||||
@@ -148,6 +150,7 @@
|
||||
"Dividend Yield": "Dividend Yield",
|
||||
"Last Dividend Paid": "Last Dividend Paid",
|
||||
"Ex Dividend Date": "Ex Dividend Date",
|
||||
"No dividends for :symbol yet": "No dividends for :symbol yet",
|
||||
"Number of Transactions": "Number of Transactions",
|
||||
"Last Refreshed": "Last Refreshed",
|
||||
"Portfolio updated": "Portfolio updated",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"Close": "Cerrar",
|
||||
"or": "o",
|
||||
"and": "y",
|
||||
"Nothing to show here yet": "No hay nada que mostrar aquí todavía",
|
||||
|
||||
"Hang on! You're doing that too much.": "¡Por favor espere un momento!",
|
||||
"Delete Account": "Eliminar Cuenta",
|
||||
@@ -117,6 +118,7 @@
|
||||
"Dividends Earned": "Dividendos Ganados",
|
||||
"Split": "Division",
|
||||
"Splits": "Divisiones",
|
||||
"No splits for :symbol yet": "No hay divisiones para :symbol",
|
||||
"Distribution Date": "Fecha del Division",
|
||||
"My portfolios": "Mis portafolios",
|
||||
"Create your first portfolio!": "¡Crea tu primer portafolio!",
|
||||
@@ -148,6 +150,7 @@
|
||||
"Dividend Yield": "Rendimiento por dividendo",
|
||||
"Last Dividend Paid": "Fecha del último dividendo",
|
||||
"Ex Dividend Date": "Fecha del ex dividendo",
|
||||
"No dividends for :symbol yet": "No hay dividendos para :symbol",
|
||||
"Number of Transactions": "Número de Transacciones",
|
||||
"Last Refreshed": "Última fecha de actualización ",
|
||||
"Portfolio updated": "Portafolio actualizado",
|
||||
|
||||
@@ -102,12 +102,28 @@
|
||||
|
||||
<x-ib-card title="{{ __('Dividends') }}" class="md:col-span-3">
|
||||
|
||||
@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
|
||||
|
||||
@livewire('holding-dividends-list', ['holding' => $holding])
|
||||
|
||||
</x-ib-card>
|
||||
|
||||
<x-ib-card title="{{ __('Splits') }}" class="md:col-span-3">
|
||||
|
||||
@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
|
||||
|
||||
@foreach ($holding->splits->take(5) as $split)
|
||||
|
||||
<x-list-item :item="$split">
|
||||
|
||||
@@ -85,14 +85,31 @@
|
||||
|
||||
<x-ib-card title="{{ __('Holdings') }}" class="md:col-span-4">
|
||||
|
||||
@if($portfolio->holdings->isEmpty())
|
||||
<div class="flex justify-center items-center h-full pb-10 text-secondary">
|
||||
|
||||
{{ __('Nothing to show here yet') }}
|
||||
</div>
|
||||
|
||||
@else
|
||||
|
||||
@livewire('holdings-table', [
|
||||
'portfolio' => $portfolio
|
||||
])
|
||||
|
||||
@endif
|
||||
</x-ib-card>
|
||||
|
||||
<x-ib-card title="{{ __('Recent activity') }}" class="md:col-span-3">
|
||||
|
||||
@if($portfolio->transactions->isEmpty())
|
||||
<div class="flex justify-center items-center h-full pb-10 text-secondary">
|
||||
|
||||
{{ __('Nothing to show here yet') }}
|
||||
</div>
|
||||
|
||||
@endif
|
||||
|
||||
@livewire('transactions-list', [
|
||||
'portfolio' => $portfolio,
|
||||
'transactions' => $portfolio->transactions
|
||||
@@ -102,6 +119,14 @@
|
||||
|
||||
<x-ib-card title="{{ __('Top performers') }}" class="md:col-span-3">
|
||||
|
||||
@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
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user