|
1 | 1 | <x-dynamic-component :component="$getEntryWrapperView()" :entry="$entry"> |
2 | 2 | @php |
3 | | - $total = $getState()['total']; |
4 | | - $progress = $getState()['progress']; |
5 | | - $progress = $total > 0 ? ($progress / $total) * 100 : 0; |
6 | | -
|
7 | | - if($progress === 100){ |
8 | | - $progressColor = '#2980b9'; |
9 | | - } else if($progress > 50){ |
10 | | - $progressColor = '#27ae60'; |
11 | | - } else if($progress > 25){ |
12 | | - $progressColor = '#f39c12'; |
13 | | - } else { |
14 | | - $progressColor = '#e74c3c'; |
15 | | - } |
16 | | -
|
17 | | - $displayProgress = $progress === 100 ? number_format($progress, 0) : number_format($progress, 2); |
| 3 | + $data = $column->getProgressData($getState()); |
18 | 4 | @endphp |
19 | 5 |
|
20 | 6 | <div class="progress-container"> |
21 | | - <div class="progress-bar" style="width: {{ $displayProgress }}%; background-color: {{ $progressColor }};"></div> |
| 7 | + <div class="progress-bar" style="width: {{ $data['displayProgress'] }}%; background-color: {{ $data['progressColor'] }};"></div> |
22 | 8 | <div class="progress-text"> |
23 | 9 | @if($entry instanceof \LaraZeus\Progress\Infolists\Components\ProgressBarEntry && $entry->getCanShow()) |
24 | 10 | <small @class([ |
25 | | - 'text-gray-700' => $displayProgress != 100, |
26 | | - 'text-white' => $displayProgress == 100 |
| 11 | + 'text-gray-700' => $data['displayProgress'] != 100, |
| 12 | + 'text-white' => $data['displayProgress'] == 100 |
27 | 13 | ])> |
28 | | - {{ $displayProgress }}% |
| 14 | + {{ $data['displayProgress'] }}% |
29 | 15 | </small> |
30 | 16 | @endif |
31 | 17 | </div> |
|
0 commit comments