use OOB laravel helper method
This commit is contained in:
+12
-12
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('formatMoney')) {
|
||||
/**
|
||||
* Returns a formatted string for currency
|
||||
*
|
||||
* @param int|float $amount
|
||||
*
|
||||
* */
|
||||
function formatMoney(int|float $amount) {
|
||||
$formatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
|
||||
// if (!function_exists('formatMoney')) {
|
||||
// /**
|
||||
// * Returns a formatted string for currency
|
||||
// *
|
||||
// * @param int|float $amount
|
||||
// *
|
||||
// * */
|
||||
// function formatMoney(int|float $amount) {
|
||||
// $formatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
|
||||
|
||||
return $formatter->formatCurrency((float) $amount, 'USD');
|
||||
}
|
||||
}
|
||||
// return $formatter->formatCurrency((float) $amount, 'USD');
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -7,27 +7,27 @@
|
||||
<div class="grid sm:grid-cols-5 gap-5">
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Market Gain/Loss') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($dashboard->marketGainLoss) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($dashboard->marketGainLoss) }} </div>
|
||||
</x-card>
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Total Cost Basis') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($dashboard->totalCostBasis) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($dashboard->totalCostBasis) }} </div>
|
||||
</x-card>
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Total Market Value') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($dashboard->totalMarketValue) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($dashboard->totalMarketValue) }} </div>
|
||||
</x-card>
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Realized Gain/Loss') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($dashboard->realizedGainLoss) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($dashboard->realizedGainLoss) }} </div>
|
||||
</x-card>
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Dividends Earned') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($dashboard->dividendsEarned) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($dashboard->dividendsEarned) }} </div>
|
||||
</x-card>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -36,27 +36,27 @@
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Market Gain/Loss') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($portfolio->marketGainLoss) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($portfolio->marketGainLoss) }} </div>
|
||||
</x-card>
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Total Cost Basis') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($portfolio->totalCostBasis) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($portfolio->totalCostBasis) }} </div>
|
||||
</x-card>
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Total Market Value') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($portfolio->totalMarketValue) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($portfolio->totalMarketValue) }} </div>
|
||||
</x-card>
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Realized Gain/Loss') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($portfolio->realizedGainLoss) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($portfolio->realizedGainLoss) }} </div>
|
||||
</x-card>
|
||||
|
||||
<x-card class="col-span-5 sm:col-span-1 bg-slate-100 dark:bg-base-200 rounded-lg">
|
||||
<div class="text-sm text-gray-400 whitespace-nowrap">{{ __('Dividends Earned') }}</div>
|
||||
<div class="font-black text-xl"> {{ formatMoney($portfolio->dividendsEarned) }} </div>
|
||||
<div class="font-black text-xl"> {{ Number::currency($portfolio->dividendsEarned) }} </div>
|
||||
</x-card>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user