@props([ 'goalAmount' => 0, 'raisedAmount' => 0, 'size' => 'md', 'showAmount' => true, 'animate' => true ]) @php // Prevent division by zero $progressPercentage = $goalAmount > 0 ? min(round(($raisedAmount / $goalAmount) * 100), 100) : 0; // Define height classes based on size $progressHeight = [ 'sm' => 'h-1.5', 'md' => 'h-2', 'lg' => 'h-3', ]; // Format currency with proper internationalization $formatCurrency = function($amount) { return '$' . number_format($amount, 0, '.', ','); }; // Generate unique ID for this progress bar $progressId = 'progress-' . md5($goalAmount . $raisedAmount . uniqid()); @endphp
{{ $progressPercentage }}%
@if($showAmount)
{{ $formatCurrency($raisedAmount) }} raised Goal: {{ $formatCurrency($goalAmount) }}
@endif
@if($animate) @once @endonce @endif