@props([ 'goalAmount' => 0, 'raisedAmount' => 0, 'size' => 'md', // sm, md, lg 'showPercentage' => true, 'showAmounts' => true, 'currency' => null, 'currencySymbol' => null ]) @php // Calculate percentage with safety check to avoid division by zero $percentage = $goalAmount > 0 ? min(100, round(($raisedAmount / $goalAmount) * 100)) : 0; // Get currency information $currency = $currency ?? \App\Services\CurrencyService::getUserCurrency(); $currencySymbol = $currencySymbol ?? \App\Services\CurrencyService::getCurrencySymbol($currency); // Determine height based on size $height = [ 'sm' => 'h-1.5', 'md' => 'h-2', 'lg' => 'h-3', ][$size] ?? 'h-2'; // Format amounts $formattedRaised = \App\Services\CurrencyService::formatAmount($raisedAmount, $currency); $formattedGoal = \App\Services\CurrencyService::formatAmount($goalAmount, $currency); @endphp