Andrew Wallo 2 months ago
parent
commit
d06aa58d0c
1 changed files with 15 additions and 11 deletions
  1. 15
    11
      resources/views/components/report-summary-section.blade.php

+ 15
- 11
resources/views/components/report-summary-section.blade.php View File

1
-@php
2
-    use App\Utilities\Currency\CurrencyAccessor;
3
-@endphp
4
-
5
-
6
 @props([
1
 @props([
7
     'reportLoaded' => false,
2
     'reportLoaded' => false,
8
     'summaryData' => [],
3
     'summaryData' => [],
9
     'targetLabel' => null,
4
     'targetLabel' => null,
10
 ])
5
 ])
11
 
6
 
7
+@php
8
+    use App\Utilities\Currency\CurrencyAccessor;
9
+@endphp
10
+
12
 <div>
11
 <div>
13
     <x-filament::section>
12
     <x-filament::section>
14
         @if($reportLoaded)
13
         @if($reportLoaded)
15
-            <div class="flex flex-col md:flex-row items-center md:items-end text-center justify-center gap-4 md:gap-8">
14
+            <div @class([
15
+                'grid grid-cols-1 gap-1 place-content-center items-end text-center max-w-fit mx-auto',
16
+                'md:grid-cols-[repeat(1,minmax(0,1fr)_minmax(0,4rem))_minmax(0,1fr)]' => count($summaryData) === 2,
17
+                'md:grid-cols-[repeat(2,minmax(0,1fr)_minmax(0,4rem))_minmax(0,1fr)]' => count($summaryData) === 3,
18
+                'md:grid-cols-[repeat(3,minmax(0,1fr)_minmax(0,4rem))_minmax(0,1fr)]' => count($summaryData) === 4,
19
+                'md:grid-cols-[repeat(4,minmax(0,1fr)_minmax(0,4rem))_minmax(0,1fr)]' => count($summaryData) === 5,
20
+            ])>
16
                 @foreach($summaryData as $summary)
21
                 @foreach($summaryData as $summary)
17
-                    <div class="text-sm w-36 flex-shrink-0">
18
-                        <div
19
-                            class="text-gray-600 dark:text-gray-200 font-medium mb-2 text-center">{{ $summary['label'] }}</div>
22
+                    <div class="text-sm">
23
+                        <div class="text-gray-600 dark:text-gray-200 font-medium mb-2">{{ $summary['label'] }}</div>
20
 
24
 
21
                         @php
25
                         @php
22
                             $isTargetLabel = $summary['label'] === $targetLabel;
26
                             $isTargetLabel = $summary['label'] === $targetLabel;
25
 
29
 
26
                         <strong
30
                         <strong
27
                             @class([
31
                             @class([
28
-                                'text-lg text-center block',
32
+                                'text-lg',
29
                                 'text-success-700 dark:text-success-400' => $isTargetLabel && $isPositive,
33
                                 'text-success-700 dark:text-success-400' => $isTargetLabel && $isPositive,
30
                                 'text-danger-700 dark:text-danger-400' => $isTargetLabel && ! $isPositive,
34
                                 'text-danger-700 dark:text-danger-400' => $isTargetLabel && ! $isPositive,
31
                             ])
35
                             ])
35
                     </div>
39
                     </div>
36
 
40
 
37
                     @if(! $loop->last)
41
                     @if(! $loop->last)
38
-                        <div class="flex items-center justify-center px-2">
42
+                        <div class="flex items-center justify-center">
39
                             <strong class="text-lg">
43
                             <strong class="text-lg">
40
                                 {{ $loop->remaining === 1 ? '=' : '-' }}
44
                                 {{ $loop->remaining === 1 ? '=' : '-' }}
41
                             </strong>
45
                             </strong>

Loading…
Cancel
Save