Andrew Wallo 2 个月前
父节点
当前提交
d06aa58d0c
共有 1 个文件被更改,包括 15 次插入11 次删除
  1. 15
    11
      resources/views/components/report-summary-section.blade.php

+ 15
- 11
resources/views/components/report-summary-section.blade.php 查看文件

@@ -1,22 +1,26 @@
1
-@php
2
-    use App\Utilities\Currency\CurrencyAccessor;
3
-@endphp
4
-
5
-
6 1
 @props([
7 2
     'reportLoaded' => false,
8 3
     'summaryData' => [],
9 4
     'targetLabel' => null,
10 5
 ])
11 6
 
7
+@php
8
+    use App\Utilities\Currency\CurrencyAccessor;
9
+@endphp
10
+
12 11
 <div>
13 12
     <x-filament::section>
14 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 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 25
                         @php
22 26
                             $isTargetLabel = $summary['label'] === $targetLabel;
@@ -25,7 +29,7 @@
25 29
 
26 30
                         <strong
27 31
                             @class([
28
-                                'text-lg text-center block',
32
+                                'text-lg',
29 33
                                 'text-success-700 dark:text-success-400' => $isTargetLabel && $isPositive,
30 34
                                 'text-danger-700 dark:text-danger-400' => $isTargetLabel && ! $isPositive,
31 35
                             ])
@@ -35,7 +39,7 @@
35 39
                     </div>
36 40
 
37 41
                     @if(! $loop->last)
38
-                        <div class="flex items-center justify-center px-2">
42
+                        <div class="flex items-center justify-center">
39 43
                             <strong class="text-lg">
40 44
                                 {{ $loop->remaining === 1 ? '=' : '-' }}
41 45
                             </strong>

正在加载...
取消
保存