WIP
This commit is contained in:
@@ -102,11 +102,14 @@
|
|||||||
"Toggle Theme": "Toggle Theme",
|
"Toggle Theme": "Toggle Theme",
|
||||||
|
|
||||||
"Dashboard": "Dashboard",
|
"Dashboard": "Dashboard",
|
||||||
|
"Gain/Loss": "Gain/Loss",
|
||||||
"Market Gain/Loss": "Market Gain/Loss",
|
"Market Gain/Loss": "Market Gain/Loss",
|
||||||
"Total Cost Basis": "Total Cost Basis",
|
"Total Cost Basis": "Total Cost Basis",
|
||||||
|
"Total Sale Price": "Total Sale Price",
|
||||||
"Total Market Value": "Total Market Value",
|
"Total Market Value": "Total Market Value",
|
||||||
"Realized Gain/Loss": "Realized Gain/Loss",
|
"Realized Gain/Loss": "Realized Gain/Loss",
|
||||||
"Dividends Earned": "Dividends Earned",
|
"Dividends Earned": "Dividends Earned",
|
||||||
|
"Split": "Split",
|
||||||
"Splits": "Splits",
|
"Splits": "Splits",
|
||||||
"My portfolios": "My portfolios",
|
"My portfolios": "My portfolios",
|
||||||
"Create your first portfolio!": "Create your first portfolio!",
|
"Create your first portfolio!": "Create your first portfolio!",
|
||||||
@@ -130,6 +133,9 @@
|
|||||||
"52 week": "52 week",
|
"52 week": "52 week",
|
||||||
"52 week low": "52 week low",
|
"52 week low": "52 week low",
|
||||||
"52 week high": "52 week high",
|
"52 week high": "52 week high",
|
||||||
|
"Forward PE": "Forward PE",
|
||||||
|
"Trailing PE": "Trailing PE",
|
||||||
|
"Market Cap": "Market Cap",
|
||||||
"Number of Transactions": "Number of Transactions",
|
"Number of Transactions": "Number of Transactions",
|
||||||
"Market Data Age": "Market Data Age",
|
"Market Data Age": "Market Data Age",
|
||||||
"Portfolio updated": "Portfolio updated",
|
"Portfolio updated": "Portfolio updated",
|
||||||
@@ -148,6 +154,7 @@
|
|||||||
"Delete Transaction": "Delete Transaction",
|
"Delete Transaction": "Delete Transaction",
|
||||||
"Are you sure you want to delete this transaction?": "Are you sure you want to delete this transaction?",
|
"Are you sure you want to delete this transaction?": "Are you sure you want to delete this transaction?",
|
||||||
"Cost Basis": "Cost Basis",
|
"Cost Basis": "Cost Basis",
|
||||||
|
"Sale Price": "Sale Price",
|
||||||
"Market Gain": "Market Gain",
|
"Market Gain": "Market Gain",
|
||||||
"Realized Gains": "Realized Gains",
|
"Realized Gains": "Realized Gains",
|
||||||
"Performance": "Performance",
|
"Performance": "Performance",
|
||||||
|
|||||||
@@ -102,11 +102,14 @@
|
|||||||
"Toggle Theme": "Cambiar Tema",
|
"Toggle Theme": "Cambiar Tema",
|
||||||
|
|
||||||
"Dashboard": "Tablero",
|
"Dashboard": "Tablero",
|
||||||
|
"Gain/Loss": "Ganancia/Pérdida",
|
||||||
"Market Gain/Loss": "Ganancia/Pérdida del Mercado",
|
"Market Gain/Loss": "Ganancia/Pérdida del Mercado",
|
||||||
"Total Cost Basis": "Costo Total",
|
"Total Cost Basis": "Costo Total",
|
||||||
|
"Total Sale Price": "Precio de Venta Total",
|
||||||
"Total Market Value": "Valor Total de Mercado",
|
"Total Market Value": "Valor Total de Mercado",
|
||||||
"Realized Gain/Loss": "Ganancia/Pérdida Realizada",
|
"Realized Gain/Loss": "Ganancia/Pérdida Realizada",
|
||||||
"Dividends Earned": "Dividendos Ganados",
|
"Dividends Earned": "Dividendos Ganados",
|
||||||
|
"Split": "Division",
|
||||||
"Splits": "Divisiones",
|
"Splits": "Divisiones",
|
||||||
"My portfolios": "Mis portafolios",
|
"My portfolios": "Mis portafolios",
|
||||||
"Create your first portfolio!": "¡Crea tu primer portafolio!",
|
"Create your first portfolio!": "¡Crea tu primer portafolio!",
|
||||||
@@ -130,6 +133,9 @@
|
|||||||
"52 week": "52 semanas",
|
"52 week": "52 semanas",
|
||||||
"52 week low": "Mínimo de 52 semanas",
|
"52 week low": "Mínimo de 52 semanas",
|
||||||
"52 week high": "Máximo de 52 semanas",
|
"52 week high": "Máximo de 52 semanas",
|
||||||
|
"Forward PE": "PE a futuro",
|
||||||
|
"Trailing PE": "PE histórico",
|
||||||
|
"Market Cap": "Cap de mercado",
|
||||||
"Number of Transactions": "Número de Transacciones",
|
"Number of Transactions": "Número de Transacciones",
|
||||||
"Market Data Age": "Antigüedad de los Datos del Mercado",
|
"Market Data Age": "Antigüedad de los Datos del Mercado",
|
||||||
"Portfolio updated": "Portafolio actualizado",
|
"Portfolio updated": "Portafolio actualizado",
|
||||||
@@ -148,6 +154,7 @@
|
|||||||
"Delete Transaction": "Eliminar Transacción",
|
"Delete Transaction": "Eliminar Transacción",
|
||||||
"Are you sure you want to delete this transaction?": "¿Estás seguro de que quieres eliminar esta transacción?",
|
"Are you sure you want to delete this transaction?": "¿Estás seguro de que quieres eliminar esta transacción?",
|
||||||
"Cost Basis": "Costo Base",
|
"Cost Basis": "Costo Base",
|
||||||
|
"Sale Price": "Precio de Venta",
|
||||||
"Market Gain": "Ganancia del Mercado",
|
"Market Gain": "Ganancia del Mercado",
|
||||||
"Realized Gains": "Ganancias Realizadas",
|
"Realized Gains": "Ganancias Realizadas",
|
||||||
"Performance": "Desempeño",
|
"Performance": "Desempeño",
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
<span
|
<span
|
||||||
class=""
|
class=""
|
||||||
style="width:90em;overflow: hidden; white-space: nowrap;"
|
style="width:90em;overflow: hidden; white-space: nowrap;"
|
||||||
title="{{ Number::currency($low) }} - {{ Number::currency($high) }}"
|
title="{{ Number::currency($low ?? 0) }} - {{ Number::currency($high ?? 0) }}"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@php
|
||||||
|
// 52-week low must be a non-zero
|
||||||
|
if (empty($low)) {
|
||||||
|
$low = 1;
|
||||||
|
}
|
||||||
|
@endphp
|
||||||
|
|
||||||
@for ($x = 0; $x < 10; $x++)
|
@for ($x = 0; $x < 10; $x++)
|
||||||
@if ((($current - $low) * 100) / ($high - $low) > ($x * 10))
|
@if ((($current - $low) * 100) / ($high - $low) > ($x * 10))
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
@php
|
||||||
|
if (isset($percent)) {
|
||||||
|
|
||||||
|
$isUp = $percent > 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$isUp = $costBasis <= $marketValue;
|
||||||
|
$percent = ($marketValue - $costBasis) / $costBasis;
|
||||||
|
}
|
||||||
|
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if(!empty($percent))
|
||||||
|
|
||||||
|
<x-badge class="badge-sm {{ $isUp ? 'badge-success' : 'badge-error' }} badge-outline ml-2">
|
||||||
|
<x-slot:value>
|
||||||
|
{!! $isUp ? '▲' :'▼' !!}
|
||||||
|
{{ Number::percentage(
|
||||||
|
$percent,
|
||||||
|
$percent < 1 ? 2 : 0
|
||||||
|
) }}
|
||||||
|
</x-slot:value>
|
||||||
|
</x-badge>
|
||||||
|
|
||||||
|
@endif
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-grow gap-4 w-50">
|
<div class="flex flex-grow gap-4 w-50" x-data>
|
||||||
|
|
||||||
<x-spotlight
|
<x-spotlight
|
||||||
shortcut="slash"
|
shortcut="slash"
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
<x-button
|
<x-button
|
||||||
icon="o-magnifying-glass"
|
icon="o-magnifying-glass"
|
||||||
@click="$dispatch('mary-search-open')"
|
@click.stop="$dispatch('mary-search-open')"
|
||||||
class="btn-sm"
|
class="btn-sm"
|
||||||
>
|
>
|
||||||
<x-slot:label>
|
<x-slot:label>
|
||||||
@lang('Press :key to search', ['key' => '<kbd class="kbd kbd-sm">/</kbd>'])
|
@lang('Click or press :key to search', ['key' => '<kbd class="kbd kbd-sm">/</kbd>'])
|
||||||
|
|
||||||
</x-slot:label>
|
</x-slot:label>
|
||||||
</x-button>
|
</x-button>
|
||||||
|
|||||||
@@ -18,26 +18,14 @@
|
|||||||
<span class="text-sm"> {{ $market_data->name }} </span>
|
<span class="text-sm"> {{ $market_data->name }} </span>
|
||||||
</x-slot:title>
|
</x-slot:title>
|
||||||
|
|
||||||
<p class="font-bold text-2xl pb-2">
|
<div class="font-bold text-2xl py-1 flex items-center">
|
||||||
{{ Number::currency($market_data->market_value) }}
|
{{ Number::currency($market_data->market_value ?? 0) }}
|
||||||
|
|
||||||
@if ($holding->average_cost_basis)
|
<x-gain-loss-arrow-badge
|
||||||
|
:cost-basis="$holding->average_cost_basis"
|
||||||
@php
|
:market-value="$market_data->market_value"
|
||||||
$isUp = $holding->average_cost_basis <= $market_data->market_value;
|
/>
|
||||||
$percent = ($market_data->market_value - $holding->average_cost_basis) / $holding->average_cost_basis
|
</div>
|
||||||
@endphp
|
|
||||||
|
|
||||||
<span class="text-base font-normal" style="color: {{ $isUp ? 'rgb(0, 200, 0)' : 'rgb(255, 20, 0)' }};">
|
|
||||||
{!! $isUp ? '▲' :'▼' !!}
|
|
||||||
{{ Number::percentage(
|
|
||||||
$percent,
|
|
||||||
$percent < 1 ? 2 : 1
|
|
||||||
) }}
|
|
||||||
</span>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span class="font-bold">{{ __('Quantity Owned') }}: </span>
|
<span class="font-bold">{{ __('Quantity Owned') }}: </span>
|
||||||
@@ -46,22 +34,22 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span class="font-bold">{{ __('Average Cost Basis') }}: </span>
|
<span class="font-bold">{{ __('Average Cost Basis') }}: </span>
|
||||||
{{ Number::currency($holding->average_cost_basis) }}
|
{{ Number::currency($holding->average_cost_basis ?? 0) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span class="font-bold">{{ __('Total Cost Basis') }}: </span>
|
<span class="font-bold">{{ __('Total Cost Basis') }}: </span>
|
||||||
{{ Number::currency($holding->total_cost_basis) }}
|
{{ Number::currency($holding->total_cost_basis ?? 0) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span class="font-bold">{{ __('Realized Gain/Loss') }}: </span>
|
<span class="font-bold">{{ __('Realized Gain/Loss') }}: </span>
|
||||||
{{ Number::currency($holding->realized_gain_dollars) }}
|
{{ Number::currency($holding->realized_gain_dollars ?? 0) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span class="font-bold">{{ __('Dividends Earned') }}: </span>
|
<span class="font-bold">{{ __('Dividends Earned') }}: </span>
|
||||||
{{ Number::currency($holding->dividends_earned) }}
|
{{ Number::currency($holding->dividends_earned ?? 0) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -84,25 +72,75 @@
|
|||||||
|
|
||||||
<x-ib-card title="{{ __('Fundamentals') }}" class="md:col-span-4">
|
<x-ib-card title="{{ __('Fundamentals') }}" class="md:col-span-4">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<span class="font-bold">{{ __('Forward PE') }}: </span>
|
||||||
|
{{ $market_data->forward_pe }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<span class="font-bold">{{ __('Trailing PE') }}: </span>
|
||||||
|
{{ $market_data->trailing_pe }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<span class="font-bold">{{ __('Market Cap') }}: </span>
|
||||||
|
${{ Number::forHumans($market_data->market_cap ?? 0) }}
|
||||||
|
</p>
|
||||||
|
|
||||||
</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">
|
||||||
|
|
||||||
|
@livewire('transactions-list', [
|
||||||
|
'portfolio' => $holding->portfolio,
|
||||||
|
'transactions' => $holding->transactions
|
||||||
|
])
|
||||||
|
|
||||||
</x-ib-card>
|
</x-ib-card>
|
||||||
|
|
||||||
<x-ib-card title="{{ __('Dividends') }}" class="md:col-span-3">
|
<x-ib-card title="{{ __('Dividends') }}" class="md:col-span-3">
|
||||||
|
|
||||||
|
@foreach ($holding->dividends->take(5) as $dividend)
|
||||||
|
|
||||||
|
<x-list-item :item="$dividend">
|
||||||
|
<x-slot:value>
|
||||||
|
|
||||||
|
Purchased {{$dividend->purchased}}<br>
|
||||||
|
Sold {{$dividend->sold}}<br>
|
||||||
|
@php
|
||||||
|
$owned = ($dividend->purchased - $dividend->sold);
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
{{ Number::currency($dividend->dividend_amount) }}
|
||||||
|
x {{ $owned }}
|
||||||
|
= {{ Number::currency($owned * $dividend->dividend_amount) }}
|
||||||
|
|
||||||
|
</x-slot:value>
|
||||||
|
<x-slot:sub-value>
|
||||||
|
{{ $dividend->date->format('F d, Y') }}
|
||||||
|
</x-slot:sub-value>
|
||||||
|
</x-list-item>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
</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">
|
||||||
|
|
||||||
|
@foreach ($holding->splits->take(5) as $split)
|
||||||
|
|
||||||
|
<x-list-item :item="$split">
|
||||||
|
<x-slot:value>
|
||||||
|
|
||||||
|
1:{{ $split->split_amount }}
|
||||||
|
|
||||||
|
</x-slot:value>
|
||||||
|
<x-slot:sub-value>
|
||||||
|
{{ $split->date->format('F d, Y') }}
|
||||||
|
</x-slot:sub-value>
|
||||||
|
</x-list-item>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
</x-ib-card>
|
</x-ib-card>
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,21 @@ new class extends Component {
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function goToHolding($holding)
|
||||||
|
{
|
||||||
|
return $this->redirect(route('holding.show', ['portfolio' => $holding['portfolio_id'], 'symbol' => $holding['symbol']]));
|
||||||
|
}
|
||||||
|
|
||||||
}; ?>
|
}; ?>
|
||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|
||||||
<x-table wire:loading.remove :headers="$headers" :rows="$this->holdings()" :sort-by="$sortBy">
|
<x-table
|
||||||
|
:headers="$headers"
|
||||||
|
:rows="$this->holdings()"
|
||||||
|
:sort-by="$sortBy"
|
||||||
|
@row-click="$wire.goToHolding($event.detail)"
|
||||||
|
>
|
||||||
@scope('cell_average_cost_basis', $row)
|
@scope('cell_average_cost_basis', $row)
|
||||||
{{ Number::currency($row->average_cost_basis ?? 0) }}
|
{{ Number::currency($row->average_cost_basis ?? 0) }}
|
||||||
@endscope
|
@endscope
|
||||||
@@ -63,7 +73,7 @@ new class extends Component {
|
|||||||
{{ Number::currency($row->market_gain_dollars ?? 0) }}
|
{{ Number::currency($row->market_gain_dollars ?? 0) }}
|
||||||
@endscope
|
@endscope
|
||||||
@scope('cell_market_gain_percent', $row)
|
@scope('cell_market_gain_percent', $row)
|
||||||
{{ Number::percentage($row->market_gain_percent ?? 0) }}
|
<x-gain-loss-arrow-badge :percent="$row->market_gain_percent" />
|
||||||
@endscope
|
@endscope
|
||||||
@scope('cell_market_data_market_value', $row)
|
@scope('cell_market_data_market_value', $row)
|
||||||
{{ Number::currency($row->market_data_market_value ?? 0) }}
|
{{ Number::currency($row->market_data_market_value ?? 0) }}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ new class extends Component {
|
|||||||
public ?Portfolio $portfolio;
|
public ?Portfolio $portfolio;
|
||||||
public ?Transaction $transaction;
|
public ?Transaction $transaction;
|
||||||
|
|
||||||
|
public ?String $portfolio_id;
|
||||||
public String $symbol;
|
public String $symbol;
|
||||||
public String $transaction_type;
|
public String $transaction_type;
|
||||||
public String $date;
|
public String $date;
|
||||||
@@ -31,6 +32,7 @@ new class extends Component {
|
|||||||
return [
|
return [
|
||||||
'symbol' => ['required', 'string', new SymbolValidationRule],
|
'symbol' => ['required', 'string', new SymbolValidationRule],
|
||||||
'transaction_type' => 'required|string|in:BUY,SELL',
|
'transaction_type' => 'required|string|in:BUY,SELL',
|
||||||
|
'portfolio_id' => 'required|exists:portfolios,id',
|
||||||
'date' => 'required|date_format:Y-m-d',
|
'date' => 'required|date_format:Y-m-d',
|
||||||
'quantity' => 'required|min:0|numeric',
|
'quantity' => 'required|min:0|numeric',
|
||||||
'cost_basis' => 'exclude_if:transaction_type,SELL|min:0|numeric',
|
'cost_basis' => 'exclude_if:transaction_type,SELL|min:0|numeric',
|
||||||
@@ -44,6 +46,7 @@ new class extends Component {
|
|||||||
|
|
||||||
$this->symbol = $this->transaction->symbol;
|
$this->symbol = $this->transaction->symbol;
|
||||||
$this->transaction_type = $this->transaction->transaction_type;
|
$this->transaction_type = $this->transaction->transaction_type;
|
||||||
|
$this->portfolio_id = $this->transaction->portfolio_id;
|
||||||
$this->date = $this->transaction->date->format('Y-m-d');
|
$this->date = $this->transaction->date->format('Y-m-d');
|
||||||
$this->quantity = $this->transaction->quantity;
|
$this->quantity = $this->transaction->quantity;
|
||||||
$this->cost_basis = $this->transaction->cost_basis;
|
$this->cost_basis = $this->transaction->cost_basis;
|
||||||
@@ -51,6 +54,7 @@ new class extends Component {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->transaction_type = 'BUY';
|
$this->transaction_type = 'BUY';
|
||||||
|
$this->portfolio_id = isset($this->portfolio) ? $this->portfolio->id : '';
|
||||||
$this->date = now()->format('Y-m-d');
|
$this->date = now()->format('Y-m-d');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,15 +66,25 @@ new class extends Component {
|
|||||||
// $this->transaction->owner_id = auth()->user()->id;
|
// $this->transaction->owner_id = auth()->user()->id;
|
||||||
$this->transaction->save();
|
$this->transaction->save();
|
||||||
|
|
||||||
$this->success(__('Transaction updated'), redirectTo: route('portfolio.show', ['portfolio' => $this->transaction->portfolio_id]));
|
$this->success(__('Transaction updated'));
|
||||||
|
|
||||||
|
$this->dispatch('toggle-manage-transaction');
|
||||||
|
$this->dispatch('transaction-updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
|
$validated = $this->validate();
|
||||||
|
|
||||||
$transaction = $this->portfolio->transactions()->create($this->validate());
|
if (!isset($this->portfolio)) {
|
||||||
|
$this->portfolio = Portfolio::find($this->portfolio_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$transaction = $this->portfolio->transactions()->create($validated);
|
||||||
$transaction->save();
|
$transaction->save();
|
||||||
|
|
||||||
|
$this->dispatch('transaction-saved');
|
||||||
|
|
||||||
$this->success(__('Transaction created'), redirectTo: route('portfolio.show', ['portfolio' => $this->portfolio->id]));
|
$this->success(__('Transaction created'), redirectTo: route('portfolio.show', ['portfolio' => $this->portfolio->id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +100,19 @@ new class extends Component {
|
|||||||
<div class="" x-data="{ transaction_type: @entangle('transaction_type') }">
|
<div class="" x-data="{ transaction_type: @entangle('transaction_type') }">
|
||||||
<x-form wire:submit="{{ $transaction ? 'update' : 'save' }}" class="">
|
<x-form wire:submit="{{ $transaction ? 'update' : 'save' }}" class="">
|
||||||
|
|
||||||
|
@if(empty($portfolio))
|
||||||
|
|
||||||
|
<x-select
|
||||||
|
label="{{ __('Portfolio') }}"
|
||||||
|
wire:model="portfolio_id"
|
||||||
|
required
|
||||||
|
:options="auth()->user()->portfolios"
|
||||||
|
option-label="title"
|
||||||
|
placeholder="Select a portfolio"
|
||||||
|
/>
|
||||||
|
|
||||||
|
@endif
|
||||||
|
|
||||||
<x-input label="{{ __('Symbol') }}" wire:model="symbol" required />
|
<x-input label="{{ __('Symbol') }}" wire:model="symbol" required />
|
||||||
|
|
||||||
<x-select label="{{ __('Transaction Type') }}" :options="[
|
<x-select label="{{ __('Transaction Type') }}" :options="[
|
||||||
@@ -99,7 +126,7 @@ new class extends Component {
|
|||||||
|
|
||||||
@if($transaction_type == 'SELL')
|
@if($transaction_type == 'SELL')
|
||||||
<x-input
|
<x-input
|
||||||
label="Sale Price"
|
label="{{ __('Sale Price') }}"
|
||||||
wire:model.number="sale_price"
|
wire:model.number="sale_price"
|
||||||
required
|
required
|
||||||
prefix="USD"
|
prefix="USD"
|
||||||
@@ -109,7 +136,7 @@ new class extends Component {
|
|||||||
{{-- money --}}
|
{{-- money --}}
|
||||||
@else
|
@else
|
||||||
<x-input
|
<x-input
|
||||||
label="Cost Basis"
|
label="{{ __('Cost Basis') }}"
|
||||||
wire:model.number="cost_basis"
|
wire:model.number="cost_basis"
|
||||||
required
|
required
|
||||||
prefix="USD"
|
prefix="USD"
|
||||||
|
|||||||
@@ -35,12 +35,8 @@ new class extends Component {
|
|||||||
<x-slot:value class="flex items-center">
|
<x-slot:value class="flex items-center">
|
||||||
|
|
||||||
{{ $holding->market_data?->name }} ({{ $holding->symbol }})
|
{{ $holding->market_data?->name }} ({{ $holding->symbol }})
|
||||||
|
|
||||||
<x-badge class="{{ $holding->market_gain_percent > 0 ? 'badge-success' : 'badge-error' }} ml-2 badge-sm" >
|
<x-gain-loss-arrow-badge :percent="$holding->market_gain_percent" />
|
||||||
<x-slot:value>
|
|
||||||
{{ Number::percentage($holding->market_gain_percent) }}
|
|
||||||
</x-slot:value>
|
|
||||||
</x-badge>
|
|
||||||
|
|
||||||
</x-slot:value>
|
</x-slot:value>
|
||||||
<x-slot:sub-value>
|
<x-slot:sub-value>
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ new class extends Component {
|
|||||||
public ?Portfolio $portfolio;
|
public ?Portfolio $portfolio;
|
||||||
public ?Transaction $editingTransaction;
|
public ?Transaction $editingTransaction;
|
||||||
|
|
||||||
|
protected $listeners = [
|
||||||
|
'transaction-updated' => '$refresh',
|
||||||
|
'transaction-saved' => '$refresh'
|
||||||
|
];
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public function showTransactionDialog($transactionId)
|
public function showTransactionDialog($transactionId)
|
||||||
{
|
{
|
||||||
@@ -45,7 +50,6 @@ new class extends Component {
|
|||||||
? 'badge-success'
|
? 'badge-success'
|
||||||
: 'badge-error' }} badge-sm mr-3"
|
: 'badge-error' }} badge-sm mr-3"
|
||||||
/>
|
/>
|
||||||
{{ $transaction->date->format('M j, Y') }}
|
|
||||||
{{ $transaction->symbol }}
|
{{ $transaction->symbol }}
|
||||||
({{ $transaction->quantity }}
|
({{ $transaction->quantity }}
|
||||||
@ {{ $transaction->transaction_type == 'BUY'
|
@ {{ $transaction->transaction_type == 'BUY'
|
||||||
@@ -54,6 +58,9 @@ new class extends Component {
|
|||||||
|
|
||||||
<x-loading x-show="loading" x-cloak class="text-gray-400 ml-2" />
|
<x-loading x-show="loading" x-cloak class="text-gray-400 ml-2" />
|
||||||
</x-slot:value>
|
</x-slot:value>
|
||||||
|
<x-slot:sub-value>
|
||||||
|
{{ $transaction->date->format('F j, Y') }}
|
||||||
|
</x-slot:sub-value>
|
||||||
</x-list-item>
|
</x-list-item>
|
||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ new class extends Component {
|
|||||||
public User $user;
|
public User $user;
|
||||||
public ?Transaction $editingTransaction;
|
public ?Transaction $editingTransaction;
|
||||||
|
|
||||||
|
protected $listeners = [
|
||||||
|
'transaction-updated' => '$refresh',
|
||||||
|
'transaction-saved' => '$refresh'
|
||||||
|
];
|
||||||
|
|
||||||
public array $sortBy = ['column' => 'date', 'direction' => 'desc'];
|
public array $sortBy = ['column' => 'date', 'direction' => 'desc'];
|
||||||
|
|
||||||
public array $headers;
|
public array $headers;
|
||||||
@@ -33,16 +38,10 @@ new class extends Component {
|
|||||||
['key' => 'symbol', 'label' => __('Symbol'), 'class' => ''],
|
['key' => 'symbol', 'label' => __('Symbol'), 'class' => ''],
|
||||||
['key' => 'market_data_name', 'label' => __('Name')],
|
['key' => 'market_data_name', 'label' => __('Name')],
|
||||||
['key' => 'transaction_type', 'label' => __('Type')],
|
['key' => 'transaction_type', 'label' => __('Type')],
|
||||||
|
['key' => 'split', 'label' => __('Split')],
|
||||||
['key' => 'quantity', 'label' => __('Quantity')],
|
['key' => 'quantity', 'label' => __('Quantity')],
|
||||||
['key' => 'cost_basis', 'label' => __('Cost Basis')],
|
['key' => 'cost_basis', 'label' => __('Cost Basis')],
|
||||||
['key' => 'total_cost_basis', 'label' => __('Total Cost Basis')],
|
['key' => 'gain_dollars', 'label' => __('Gain/Loss')],
|
||||||
['key' => 'market_data_market_value', 'label' => __('Market Value')],
|
|
||||||
['key' => 'total_market_value', 'label' => __('Total Market Value')],
|
|
||||||
// ['key' => 'market_gain_dollars', 'label' => __('Market Gain/Loss')],
|
|
||||||
// ['key' => 'market_gain_percent', 'label' => __('Market Gain/Loss')],
|
|
||||||
// ['key' => 'realized_gain_dollars', 'label' => __('Realized Gain/Loss')],
|
|
||||||
// ['key' => 'dividends_earned', 'label' => __('Dividends Earned')],
|
|
||||||
// ['key' => 'market_data_updated_at', 'label' => __('Market Data Age')],
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +81,9 @@ new class extends Component {
|
|||||||
@scope('cell_date', $row)
|
@scope('cell_date', $row)
|
||||||
{{ $row->date->format('M d, Y') }}
|
{{ $row->date->format('M d, Y') }}
|
||||||
@endscope
|
@endscope
|
||||||
|
@scope('cell_split', $row)
|
||||||
|
{{ $row->split ? 'Yes' : '' }}
|
||||||
|
@endscope
|
||||||
@scope('cell_transaction_type', $row)
|
@scope('cell_transaction_type', $row)
|
||||||
<x-badge
|
<x-badge
|
||||||
:value="$row->transaction_type"
|
:value="$row->transaction_type"
|
||||||
@@ -96,14 +98,8 @@ new class extends Component {
|
|||||||
@scope('cell_total_cost_basis', $row)
|
@scope('cell_total_cost_basis', $row)
|
||||||
{{ Number::currency($row->total_cost_basis ?? 0) }}
|
{{ Number::currency($row->total_cost_basis ?? 0) }}
|
||||||
@endscope
|
@endscope
|
||||||
@scope('cell_realized_gain_dollars', $row)
|
@scope('cell_gain_dollars', $row)
|
||||||
{{ Number::currency($row->realized_gain_dollars ?? 0) }}
|
{{ Number::currency($row->gain_dollars ?? 0) }}
|
||||||
@endscope
|
|
||||||
@scope('cell_market_gain_dollars', $row)
|
|
||||||
{{ Number::currency($row->market_gain_dollars ?? 0) }}
|
|
||||||
@endscope
|
|
||||||
@scope('cell_market_gain_percent', $row)
|
|
||||||
{{ Number::percentage($row->market_gain_percent ?? 0) }}
|
|
||||||
@endscope
|
@endscope
|
||||||
@scope('cell_market_data_market_value', $row)
|
@scope('cell_market_data_market_value', $row)
|
||||||
{{ Number::currency($row->market_data_market_value ?? 0) }}
|
{{ Number::currency($row->market_data_market_value ?? 0) }}
|
||||||
@@ -111,12 +107,6 @@ new class extends Component {
|
|||||||
@scope('cell_total_market_value', $row)
|
@scope('cell_total_market_value', $row)
|
||||||
{{ Number::currency($row->total_market_value ?? 0) }}
|
{{ Number::currency($row->total_market_value ?? 0) }}
|
||||||
@endscope
|
@endscope
|
||||||
@scope('cell_dividends_earned', $row)
|
|
||||||
{{ Number::currency($row->dividends_earned ?? 0) }}
|
|
||||||
@endscope
|
|
||||||
@scope('cell_market_data_updated_at', $row)
|
|
||||||
{{ \Carbon\Carbon::parse($row->market_data_updated_at)->diffForHumans() }}
|
|
||||||
@endscope
|
|
||||||
</x-table>
|
</x-table>
|
||||||
|
|
||||||
<x-ib-modal
|
<x-ib-modal
|
||||||
|
|||||||
@@ -1,7 +1,26 @@
|
|||||||
<x-app-layout>
|
<x-app-layout>
|
||||||
<div>
|
<div x-data>
|
||||||
|
|
||||||
<x-ib-toolbar title="{{ __('All Transactions') }}" />
|
<x-ib-modal
|
||||||
|
key="new-transaction"
|
||||||
|
title="New Transaction"
|
||||||
|
>
|
||||||
|
@livewire('manage-transaction-form')
|
||||||
|
|
||||||
|
</x-ib-modal>
|
||||||
|
|
||||||
|
<x-ib-toolbar title="{{ __('All Transactions') }}">
|
||||||
|
|
||||||
|
<x-ib-flex-spacer />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<x-button
|
||||||
|
label="{{ __('Create Transaction') }}"
|
||||||
|
class="btn-sm btn-primary"
|
||||||
|
@click="$dispatch('toggle-new-transaction')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</x-ib-toolbar>
|
||||||
|
|
||||||
@livewire('transactions-table')
|
@livewire('transactions-table')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user