Andrew Wallo 11 个月前
父节点
当前提交
4aa5f8588c

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

@@ -0,0 +1,42 @@
1
+@props([
2
+    'reportLoaded' => false,
3
+    'summaryData' => [],
4
+    'targetLabel' => null,
5
+])
6
+
7
+<div>
8
+    <x-filament::section>
9
+        @if($reportLoaded)
10
+            <div class="flex flex-col md:flex-row items-center md:items-end text-center justify-center gap-4 md:gap-8">
11
+                @foreach($summaryData as $summary)
12
+                    <div class="text-sm">
13
+                        <div class="text-gray-600 dark:text-gray-200 font-medium mb-2">{{ $summary['label'] }}</div>
14
+
15
+                        @php
16
+                            $isTargetLabel = $summary['label'] === $targetLabel;
17
+                            $isPositive = money($summary['value'], \App\Utilities\Currency\CurrencyAccessor::getDefaultCurrency())->isPositive();
18
+                        @endphp
19
+
20
+                        <strong
21
+                            @class([
22
+                                'text-lg',
23
+                                'text-green-700 dark:text-green-500' => $isTargetLabel && $isPositive,
24
+                                'text-danger-700 dark:text-danger-500' => $isTargetLabel && ! $isPositive,
25
+                            ])
26
+                        >
27
+                            {{ $summary['value'] }}
28
+                        </strong>
29
+                    </div>
30
+
31
+                    @if(! $loop->last)
32
+                        <div class="flex items-center justify-center px-2">
33
+                            <strong class="text-lg">
34
+                                {{ $loop->remaining === 1 ? '=' : '-' }}
35
+                            </strong>
36
+                        </div>
37
+                    @endif
38
+                @endforeach
39
+            </div>
40
+        @endif
41
+    </x-filament::section>
42
+</div>

+ 15
- 0
resources/views/components/report-tabs.blade.php 查看文件

@@ -0,0 +1,15 @@
1
+@props([
2
+    'activeTab' => 'summary',
3
+    'tabLabels' => ['summary' => 'Summary', 'details' => 'Details'],
4
+])
5
+
6
+<x-filament::tabs>
7
+    @foreach ($tabLabels as $tabKey => $label)
8
+        <x-filament::tabs.item
9
+            :active="$activeTab === $tabKey"
10
+            wire:click="$set('activeTab', '{{ $tabKey }}')"
11
+        >
12
+            {{ $label }}
13
+        </x-filament::tabs.item>
14
+    @endforeach
15
+</x-filament::tabs>

+ 6
- 52
resources/views/filament/company/pages/reports/balance-sheet.blade.php 查看文件

@@ -22,59 +22,13 @@
22 22
         </div>
23 23
     </x-filament::section>
24 24
 
25
+    <x-report-summary-section
26
+        :report-loaded="$this->reportLoaded"
27
+        :summary-data="$this->report?->getSummary()"
28
+        target-label="Net Assets"
29
+    />
25 30
 
26
-    <x-filament::section>
27
-        <!-- Summary Section -->
28
-        @if($this->reportLoaded)
29
-            <div
30
-                class="flex flex-col md:flex-row items-center md:items-end text-center justify-center gap-4 md:gap-8">
31
-                @foreach($this->report->getSummary() as $summary)
32
-                    <div class="text-sm">
33
-                        <div class="text-gray-600 font-medium mb-2">{{ $summary['label'] }}</div>
34
-
35
-                        @php
36
-                            $isNetAssets = $summary['label'] === 'Net Assets';
37
-                            $isPositive = money($summary['value'], \App\Utilities\Currency\CurrencyAccessor::getDefaultCurrency())->isPositive();
38
-                        @endphp
39
-
40
-                        <strong
41
-                            @class([
42
-                                'text-lg',
43
-                                'text-green-700' => $isNetAssets && $isPositive,
44
-                                'text-danger-700' => $isNetAssets && ! $isPositive,
45
-                            ])
46
-                        >
47
-                            {{ $summary['value'] }}
48
-                        </strong>
49
-                    </div>
50
-
51
-                    @if(! $loop->last)
52
-                        <div class="flex items-center justify-center px-2">
53
-                            <strong class="text-lg">
54
-                                {{ $loop->remaining === 1 ? '=' : '-' }}
55
-                            </strong>
56
-                        </div>
57
-                    @endif
58
-                @endforeach
59
-            </div>
60
-        @endif
61
-    </x-filament::section>
62
-
63
-    <x-filament::tabs>
64
-        <x-filament::tabs.item
65
-            :active="$activeTab === 'summary'"
66
-            wire:click="$set('activeTab', 'summary')"
67
-        >
68
-            Summary
69
-        </x-filament::tabs.item>
70
-
71
-        <x-filament::tabs.item
72
-            :active="$activeTab === 'details'"
73
-            wire:click="$set('activeTab', 'details')"
74
-        >
75
-            Details
76
-        </x-filament::tabs.item>
77
-    </x-filament::tabs>
31
+    <x-report-tabs :activeTab="$activeTab"/>
78 32
 
79 33
     <x-company.tables.container :report-loaded="$this->reportLoaded">
80 34
         @if($this->report)

+ 6
- 52
resources/views/filament/company/pages/reports/cash-flow-statement.blade.php 查看文件

@@ -20,59 +20,13 @@
20 20
         </div>
21 21
     </x-filament::section>
22 22
 
23
+    <x-report-summary-section
24
+        :report-loaded="$this->reportLoaded"
25
+        :summary-data="$this->report?->getSummary()"
26
+        target-label="Net Cash Flow"
27
+    />
23 28
 
24
-    <x-filament::section>
25
-        <!-- Summary Section -->
26
-        @if($this->reportLoaded)
27
-            <div
28
-                class="flex flex-col md:flex-row items-center md:items-end text-center justify-center gap-4 md:gap-8">
29
-                @foreach($this->report->getSummary() as $summary)
30
-                    <div class="text-sm">
31
-                        <div class="text-gray-600 font-medium mb-2">{{ $summary['label'] }}</div>
32
-
33
-                        @php
34
-                            $isNetCashFlow = $summary['label'] === 'Net Cash Flow';
35
-                            $isPositive = money($summary['value'], \App\Utilities\Currency\CurrencyAccessor::getDefaultCurrency())->isPositive();
36
-                        @endphp
37
-
38
-                        <strong
39
-                            @class([
40
-                                'text-lg',
41
-                                'text-green-700' => $isNetCashFlow && $isPositive,
42
-                                'text-danger-700' => $isNetCashFlow && ! $isPositive,
43
-                            ])
44
-                        >
45
-                            {{ $summary['value'] }}
46
-                        </strong>
47
-                    </div>
48
-
49
-                    @if(! $loop->last)
50
-                        <div class="flex items-center justify-center px-2">
51
-                            <strong class="text-lg">
52
-                                {{ $loop->remaining === 1 ? '=' : '-' }}
53
-                            </strong>
54
-                        </div>
55
-                    @endif
56
-                @endforeach
57
-            </div>
58
-        @endif
59
-    </x-filament::section>
60
-
61
-    <x-filament::tabs>
62
-        <x-filament::tabs.item
63
-            :active="$activeTab === 'summary'"
64
-            wire:click="$set('activeTab', 'summary')"
65
-        >
66
-            Summary
67
-        </x-filament::tabs.item>
68
-
69
-        <x-filament::tabs.item
70
-            :active="$activeTab === 'details'"
71
-            wire:click="$set('activeTab', 'details')"
72
-        >
73
-            Details
74
-        </x-filament::tabs.item>
75
-    </x-filament::tabs>
29
+    <x-report-tabs :activeTab="$activeTab"/>
76 30
 
77 31
     <x-company.tables.container :report-loaded="$this->reportLoaded">
78 32
         @if($this->report)

+ 6
- 52
resources/views/filament/company/pages/reports/income-statement.blade.php 查看文件

@@ -20,59 +20,13 @@
20 20
         </div>
21 21
     </x-filament::section>
22 22
 
23
+    <x-report-summary-section
24
+        :report-loaded="$this->reportLoaded"
25
+        :summary-data="$this->report?->getSummary()"
26
+        target-label="Net Earnings"
27
+    />
23 28
 
24
-    <x-filament::section>
25
-        <!-- Summary Section -->
26
-        @if($this->reportLoaded)
27
-            <div
28
-                class="flex flex-col md:flex-row items-center md:items-end text-center justify-center gap-4 md:gap-8">
29
-                @foreach($this->report->getSummary() as $summary)
30
-                    <div class="text-sm">
31
-                        <div class="text-gray-600 font-medium mb-2">{{ $summary['label'] }}</div>
32
-
33
-                        @php
34
-                            $isNetEarnings = $summary['label'] === 'Net Earnings';
35
-                            $isPositive = money($summary['value'], \App\Utilities\Currency\CurrencyAccessor::getDefaultCurrency())->isPositive();
36
-                        @endphp
37
-
38
-                        <strong
39
-                            @class([
40
-                                'text-lg',
41
-                                'text-green-700' => $isNetEarnings && $isPositive,
42
-                                'text-danger-700' => $isNetEarnings && ! $isPositive,
43
-                            ])
44
-                        >
45
-                            {{ $summary['value'] }}
46
-                        </strong>
47
-                    </div>
48
-
49
-                    @if(! $loop->last)
50
-                        <div class="flex items-center justify-center px-2">
51
-                            <strong class="text-lg">
52
-                                {{ $loop->remaining === 1 ? '=' : '-' }}
53
-                            </strong>
54
-                        </div>
55
-                    @endif
56
-                @endforeach
57
-            </div>
58
-        @endif
59
-    </x-filament::section>
60
-
61
-    <x-filament::tabs>
62
-        <x-filament::tabs.item
63
-            :active="$activeTab === 'summary'"
64
-            wire:click="$set('activeTab', 'summary')"
65
-        >
66
-            Summary
67
-        </x-filament::tabs.item>
68
-
69
-        <x-filament::tabs.item
70
-            :active="$activeTab === 'details'"
71
-            wire:click="$set('activeTab', 'details')"
72
-        >
73
-            Details
74
-        </x-filament::tabs.item>
75
-    </x-filament::tabs>
29
+    <x-report-tabs :activeTab="$activeTab"/>
76 30
 
77 31
     <x-company.tables.container :report-loaded="$this->reportLoaded">
78 32
         @if($this->report)

正在加载...
取消
保存