@if($car->photos && count($car->photos) > 0)
{{ $car->brand }} {{ $car->model }}
@switch($car->status)
@case('owned')
Em Estoque
@break
@case('sold')
Vendido
@break
@case('maintenance')
Manutenção
@break
@endswitch
@if($car->year)
Ano: {{ $car->year }}
@endif
@if($car->plate)
Placa: {{ $car->plate }}
@endif
@if($car->color)
Cor: {{ $car->color }}
@endif
@if($car->purchase_price)
Compra: R$ {{ number_format($car->purchase_price, 2, ',', '.') }}
@endif
@if($car->sale_price)
Venda: R$ {{ number_format($car->sale_price, 2, ',', '.') }}
@endif
Despesas: R$ {{ number_format($car->expenses_sum_amount ?? 0, 2, ',', '.') }}
@if($car->status === 'sold' && $car->purchase_price && $car->sale_price)
@php
$profit = $car->sale_price - $car->purchase_price - ($car->expenses_sum_amount ?? 0);
$class = $profit >= 0 ? 'text-success' : 'text-danger';
@endphp
{{ $profit >= 0 ? 'Lucro' : 'Prejuízo' }}:
R$ {{ number_format(abs($profit), 2, ',', '.') }}
@endif