WIP
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user