optional currency

This commit is contained in:
hackerESQ
2025-09-26 18:16:17 -05:00
parent 0e47b7538e
commit 39458ef44e
+10 -10
View File
@@ -127,19 +127,19 @@ class HoldingsTable extends DataTableComponent
->sortable(),
Column::make(__('Average Cost Basis'), 'average_cost_basis')
->sortable()
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data->currency) ),
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data?->currency) ),
Column::make(__('Total Cost Basis'), 'total_cost_basis')
->sortable()
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data->currency) ),
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data?->currency) ),
Column::make(__('Market Value'), 'market_data.market_value')
->sortable()
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data->currency) ),
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data?->currency) ),
Column::make(__('Total Market Value'))
->sortable(fn (Builder $query, string $direction) => $query->orderBy('total_market_value', $direction))
->label(fn ($row) => Number::currency($row->total_market_value ?? 0, $row->market_data->currency)),
->label(fn ($row) => Number::currency($row->total_market_value ?? 0, $row->market_data?->currency)),
Column::make(__('Market Gain/Loss'))
->html()
->label(fn($row) => Number::currency($row->market_gain_dollars ?? 0, $row->market_data->currency) . view('components.ui.gain-loss-arrow-badge', [
->label(fn($row) => Number::currency($row->market_gain_dollars ?? 0, $row->market_data?->currency) . view('components.ui.gain-loss-arrow-badge', [
'costBasis' => $row->average_cost_basis,
'marketValue' => $row->market_data->market_value,
'small' => true,
@@ -147,17 +147,17 @@ class HoldingsTable extends DataTableComponent
->sortable(fn (Builder $query, string $direction) => $query->orderBy('market_gain_dollars', $direction)),
Column::make(__('Realized Gain/Loss'), 'realized_gain_dollars')
->sortable()
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data->currency) )
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data->currency) ),
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data?->currency) )
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data?->currency) ),
Column::make(__('Dividends Earned'), 'dividends_earned')
->sortable()
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data->currency) ),
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data?->currency) ),
Column::make(__('52 week low'), 'market_data.fifty_two_week_low')
->sortable()
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data->currency) ),
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data?->currency) ),
Column::make(__('52 week high'), 'market_data.fifty_two_week_high')
->sortable()
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data->currency) ),
->format(fn($value, $row) => Number::currency($value ?? 0, $row->market_data?->currency) ),
Column::make(__('Number of Transactions'))
->sortable(fn (Builder $query, string $direction) => $query->orderBy('num_transactions', $direction))
->label(fn ($row) => $row->num_transactions),