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