Pārlūkot izejas kodu

refactor: Report design pattern

3.x
wallo 1 gadu atpakaļ
vecāks
revīzija
c7eed8138c

+ 7
- 1
app/Contracts/ExportableReport.php Parādīt failu

@@ -8,7 +8,13 @@ interface ExportableReport
8 8
 
9 9
     public function getHeaders(): array;
10 10
 
11
-    public function getData(): array;
11
+    public function getCategories(): array;
12 12
 
13 13
     public function getOverallTotals(): array;
14
+
15
+    public function getRightAlignedColumns(): array;
16
+
17
+    public function getLeftAlignedColumns(): array;
18
+
19
+    public function getCenterAlignedColumns(): array;
14 20
 }

+ 6
- 9
app/Filament/Company/Pages/Reports/AccountBalances.php Parādīt failu

@@ -2,7 +2,7 @@
2 2
 
3 3
 namespace App\Filament\Company\Pages\Reports;
4 4
 
5
-use App\DTO\ReportDTO;
5
+use App\Contracts\ExportableReport;
6 6
 use App\Services\ExportService;
7 7
 use App\Services\ReportService;
8 8
 use App\Transformers\AccountBalanceReportTransformer;
@@ -20,7 +20,7 @@ class AccountBalances extends BaseReportPage
20 20
 
21 21
     protected ReportService $reportService;
22 22
 
23
-    public ReportDTO $accountBalanceReport;
23
+    public ExportableReport $accountBalanceReport;
24 24
 
25 25
     protected ExportService $exportService;
26 26
 
@@ -32,7 +32,8 @@ class AccountBalances extends BaseReportPage
32 32
 
33 33
     public function loadReportData(): void
34 34
     {
35
-        $this->accountBalanceReport = $this->reportService->buildAccountBalanceReport($this->startDate, $this->endDate);
35
+        $reportDTO = $this->reportService->buildAccountBalanceReport($this->startDate, $this->endDate);
36
+        $this->accountBalanceReport = new AccountBalanceReportTransformer($reportDTO);
36 37
     }
37 38
 
38 39
     public function form(Form $form): Form
@@ -49,15 +50,11 @@ class AccountBalances extends BaseReportPage
49 50
 
50 51
     public function exportCSV(): StreamedResponse
51 52
     {
52
-        $transformer = new AccountBalanceReportTransformer($this->accountBalanceReport);
53
-
54
-        return $this->exportService->exportToCsv($this->company, $transformer, $this->startDate, $this->endDate);
53
+        return $this->exportService->exportToCsv($this->company, $this->accountBalanceReport, $this->startDate, $this->endDate);
55 54
     }
56 55
 
57 56
     public function exportPDF(): StreamedResponse
58 57
     {
59
-        $transformer = new AccountBalanceReportTransformer($this->accountBalanceReport);
60
-
61
-        return $this->exportService->exportToPdf($this->company, $transformer, $this->startDate, $this->endDate);
58
+        return $this->exportService->exportToPdf($this->company, $this->accountBalanceReport, $this->startDate, $this->endDate);
62 59
     }
63 60
 }

+ 6
- 9
app/Filament/Company/Pages/Reports/TrialBalance.php Parādīt failu

@@ -2,7 +2,7 @@
2 2
 
3 3
 namespace App\Filament\Company\Pages\Reports;
4 4
 
5
-use App\DTO\ReportDTO;
5
+use App\Contracts\ExportableReport;
6 6
 use App\Services\ExportService;
7 7
 use App\Services\ReportService;
8 8
 use App\Transformers\TrialBalanceReportTransformer;
@@ -20,7 +20,7 @@ class TrialBalance extends BaseReportPage
20 20
 
21 21
     protected ReportService $reportService;
22 22
 
23
-    public ReportDTO $trialBalanceReport;
23
+    public ExportableReport $trialBalanceReport;
24 24
 
25 25
     protected ExportService $exportService;
26 26
 
@@ -32,7 +32,8 @@ class TrialBalance extends BaseReportPage
32 32
 
33 33
     public function loadReportData(): void
34 34
     {
35
-        $this->trialBalanceReport = $this->reportService->buildTrialBalanceReport($this->startDate, $this->endDate);
35
+        $reportDTO = $this->reportService->buildTrialBalanceReport($this->startDate, $this->endDate);
36
+        $this->trialBalanceReport = new TrialBalanceReportTransformer($reportDTO);
36 37
     }
37 38
 
38 39
     public function form(Form $form): Form
@@ -49,15 +50,11 @@ class TrialBalance extends BaseReportPage
49 50
 
50 51
     public function exportCSV(): StreamedResponse
51 52
     {
52
-        $transformer = new TrialBalanceReportTransformer($this->trialBalanceReport);
53
-
54
-        return $this->exportService->exportToCsv($this->company, $transformer, $this->startDate, $this->endDate);
53
+        return $this->exportService->exportToCsv($this->company, $this->trialBalanceReport, $this->startDate, $this->endDate);
55 54
     }
56 55
 
57 56
     public function exportPDF(): StreamedResponse
58 57
     {
59
-        $transformer = new TrialBalanceReportTransformer($this->trialBalanceReport);
60
-
61
-        return $this->exportService->exportToPdf($this->company, $transformer, $this->startDate, $this->endDate);
58
+        return $this->exportService->exportToPdf($this->company, $this->trialBalanceReport, $this->startDate, $this->endDate);
62 59
     }
63 60
 }

+ 9
- 2
app/Services/ExportService.php Parādīt failu

@@ -29,8 +29,15 @@ class ExportService
29 29
 
30 30
             fputcsv($file, $report->getHeaders());
31 31
 
32
-            foreach ($report->getData() as $row) {
33
-                fputcsv($file, $row);
32
+            foreach ($report->getCategories() as $category) {
33
+                fputcsv($file, $category['header']);
34
+
35
+                foreach ($category['data'] as $accountRow) {
36
+                    fputcsv($file, $accountRow);
37
+                }
38
+
39
+                fputcsv($file, $category['summary']);
40
+                fputcsv($file, []); // Empty row for spacing
34 41
             }
35 42
 
36 43
             fputcsv($file, $report->getOverallTotals());

+ 42
- 41
app/Transformers/AccountBalanceReportTransformer.php Parādīt failu

@@ -2,18 +2,10 @@
2 2
 
3 3
 namespace App\Transformers;
4 4
 
5
-use App\Contracts\ExportableReport;
6
-use App\DTO\ReportDTO;
5
+use App\DTO\AccountDTO;
7 6
 
8
-class AccountBalanceReportTransformer implements ExportableReport
7
+class AccountBalanceReportTransformer extends BaseReportTransformer
9 8
 {
10
-    protected ReportDTO $report;
11
-
12
-    public function __construct(ReportDTO $report)
13
-    {
14
-        $this->report = $report;
15
-    }
16
-
17 9
     public function getTitle(): string
18 10
     {
19 11
         return 'Account Balances';
@@ -21,46 +13,55 @@ class AccountBalanceReportTransformer implements ExportableReport
21 13
 
22 14
     public function getHeaders(): array
23 15
     {
24
-        return ['ACCOUNT CODE', 'ACCOUNT', 'STARTING BALANCE', 'DEBIT', 'CREDIT', 'NET MOVEMENT', 'ENDING BALANCE'];
16
+        return ['', 'Account', 'Starting Balance', 'Debit', 'Credit', 'Net Movement', 'Ending Balance'];
25 17
     }
26 18
 
27
-    public function getData(): array
19
+    public function getRightAlignedColumns(): array
28 20
     {
29
-        $data = [];
21
+        return [2, 3, 4, 5, 6];
22
+    }
30 23
 
31
-        foreach ($this->report->categories as $accountCategoryName => $accountCategory) {
32
-            // Category Header row
33
-            $data[] = ['', $accountCategoryName];
24
+    public function getLeftAlignedColumns(): array
25
+    {
26
+        return [1];
27
+    }
34 28
 
35
-            // Account rows
36
-            foreach ($accountCategory->accounts as $account) {
37
-                $data[] = [
38
-                    $account->accountCode,
39
-                    $account->accountName,
40
-                    $account->balance->startingBalance ?? '',
41
-                    $account->balance->debitBalance,
42
-                    $account->balance->creditBalance,
43
-                    $account->balance->netMovement,
44
-                    $account->balance->endingBalance ?? '',
45
-                ];
46
-            }
29
+    public function getCenterAlignedColumns(): array
30
+    {
31
+        return [0];
32
+    }
47 33
 
48
-            // Category Summary row
49
-            $data[] = [
50
-                '',
51
-                'Total ' . $accountCategoryName,
52
-                $accountCategory->summary->startingBalance ?? '',
53
-                $accountCategory->summary->debitBalance,
54
-                $accountCategory->summary->creditBalance,
55
-                $accountCategory->summary->netMovement,
56
-                $accountCategory->summary->endingBalance ?? '',
57
-            ];
34
+    public function getCategories(): array
35
+    {
36
+        $categories = [];
58 37
 
59
-            // Add an empty row after each category
60
-            $data[] = [''];
38
+        foreach ($this->report->categories as $accountCategoryName => $accountCategory) {
39
+            $categories[] = [
40
+                'header' => ['', $accountCategoryName, '', '', '', '', ''],
41
+                'data' => array_map(static function (AccountDTO $account) {
42
+                    return [
43
+                        $account->accountCode,
44
+                        $account->accountName,
45
+                        $account->balance->startingBalance ?? '',
46
+                        $account->balance->debitBalance,
47
+                        $account->balance->creditBalance,
48
+                        $account->balance->netMovement,
49
+                        $account->balance->endingBalance ?? '',
50
+                    ];
51
+                }, $accountCategory->accounts),
52
+                'summary' => [
53
+                    '',
54
+                    'Total ' . $accountCategoryName,
55
+                    $accountCategory->summary->startingBalance ?? '',
56
+                    $accountCategory->summary->debitBalance,
57
+                    $accountCategory->summary->creditBalance,
58
+                    $accountCategory->summary->netMovement,
59
+                    $accountCategory->summary->endingBalance ?? '',
60
+                ],
61
+            ];
61 62
         }
62 63
 
63
-        return $data;
64
+        return $categories;
64 65
     }
65 66
 
66 67
     public function getOverallTotals(): array

+ 50
- 0
app/Transformers/BaseReportTransformer.php Parādīt failu

@@ -0,0 +1,50 @@
1
+<?php
2
+
3
+namespace App\Transformers;
4
+
5
+use App\Contracts\ExportableReport;
6
+use App\DTO\ReportDTO;
7
+use Livewire\Wireable;
8
+
9
+abstract class BaseReportTransformer implements ExportableReport, Wireable
10
+{
11
+    protected ReportDTO $report;
12
+
13
+    public function __construct(ReportDTO $report)
14
+    {
15
+        $this->report = $report;
16
+    }
17
+
18
+    public function getAlignmentClass(int $index): string
19
+    {
20
+        if (in_array($index, $this->getRightAlignedColumns())) {
21
+            return 'text-right';
22
+        }
23
+
24
+        if (in_array($index, $this->getCenterAlignedColumns())) {
25
+            return 'text-center';
26
+        }
27
+
28
+        return 'text-left';
29
+    }
30
+
31
+    abstract public function getRightAlignedColumns(): array;
32
+
33
+    abstract public function getCenterAlignedColumns(): array;
34
+
35
+    abstract public function getLeftAlignedColumns(): array;
36
+
37
+    public function toLivewire(): array
38
+    {
39
+        return [
40
+            'report' => $this->report->toLivewire(),
41
+        ];
42
+    }
43
+
44
+    public static function fromLivewire($value): static
45
+    {
46
+        return new static(
47
+            ReportDTO::fromLivewire($value['report']),
48
+        );
49
+    }
50
+}

+ 36
- 35
app/Transformers/TrialBalanceReportTransformer.php Parādīt failu

@@ -2,18 +2,10 @@
2 2
 
3 3
 namespace App\Transformers;
4 4
 
5
-use App\Contracts\ExportableReport;
6
-use App\DTO\ReportDTO;
5
+use App\DTO\AccountDTO;
7 6
 
8
-class TrialBalanceReportTransformer implements ExportableReport
7
+class TrialBalanceReportTransformer extends BaseReportTransformer
9 8
 {
10
-    protected ReportDTO $report;
11
-
12
-    public function __construct(ReportDTO $report)
13
-    {
14
-        $this->report = $report;
15
-    }
16
-
17 9
     public function getTitle(): string
18 10
     {
19 11
         return 'Trial Balance';
@@ -21,40 +13,49 @@ class TrialBalanceReportTransformer implements ExportableReport
21 13
 
22 14
     public function getHeaders(): array
23 15
     {
24
-        return ['ACCOUNT CODE', 'ACCOUNT', 'DEBIT', 'CREDIT'];
16
+        return ['', 'Account', 'Debit', 'Credit'];
25 17
     }
26 18
 
27
-    public function getData(): array
19
+    public function getRightAlignedColumns(): array
28 20
     {
29
-        $data = [];
21
+        return [2, 3];
22
+    }
30 23
 
31
-        foreach ($this->report->categories as $accountCategoryName => $accountCategory) {
32
-            // Category Header row
33
-            $data[] = ['', $accountCategoryName];
24
+    public function getLeftAlignedColumns(): array
25
+    {
26
+        return [1];
27
+    }
34 28
 
35
-            // Account rows
36
-            foreach ($accountCategory->accounts as $account) {
37
-                $data[] = [
38
-                    $account->accountCode,
39
-                    $account->accountName,
40
-                    $account->balance->debitBalance,
41
-                    $account->balance->creditBalance,
42
-                ];
43
-            }
29
+    public function getCenterAlignedColumns(): array
30
+    {
31
+        return [0];
32
+    }
44 33
 
45
-            // Category Summary row
46
-            $data[] = [
47
-                '',
48
-                'Total ' . $accountCategoryName,
49
-                $accountCategory->summary->debitBalance,
50
-                $accountCategory->summary->creditBalance,
51
-            ];
34
+    public function getCategories(): array
35
+    {
36
+        $categories = [];
52 37
 
53
-            // Add an empty row after each category
54
-            $data[] = [''];
38
+        foreach ($this->report->categories as $accountCategoryName => $accountCategory) {
39
+            $categories[] = [
40
+                'header' => ['', $accountCategoryName, '', ''],
41
+                'data' => array_map(static function (AccountDTO $account) {
42
+                    return [
43
+                        $account->accountCode,
44
+                        $account->accountName,
45
+                        $account->balance->debitBalance,
46
+                        $account->balance->creditBalance,
47
+                    ];
48
+                }, $accountCategory->accounts),
49
+                'summary' => [
50
+                    '',
51
+                    'Total ' . $accountCategoryName,
52
+                    $accountCategory->summary->debitBalance,
53
+                    $accountCategory->summary->creditBalance,
54
+                ],
55
+            ];
55 56
         }
56 57
 
57
-        return $data;
58
+        return $categories;
58 59
     }
59 60
 
60 61
     public function getOverallTotals(): array

+ 55
- 55
composer.lock Parādīt failu

@@ -497,16 +497,16 @@
497 497
         },
498 498
         {
499 499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.308.3",
500
+            "version": "3.308.5",
501 501
             "source": {
502 502
                 "type": "git",
503 503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "7fa0625056fa1fcf6732f89ba37b3f630d78de59"
504
+                "reference": "81386b0d0fd18ae8015f279247f714c5d5acb696"
505 505
             },
506 506
             "dist": {
507 507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/7fa0625056fa1fcf6732f89ba37b3f630d78de59",
509
-                "reference": "7fa0625056fa1fcf6732f89ba37b3f630d78de59",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/81386b0d0fd18ae8015f279247f714c5d5acb696",
509
+                "reference": "81386b0d0fd18ae8015f279247f714c5d5acb696",
510 510
                 "shasum": ""
511 511
             },
512 512
             "require": {
@@ -586,9 +586,9 @@
586 586
             "support": {
587 587
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
588 588
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
589
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.308.3"
589
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.308.5"
590 590
             },
591
-            "time": "2024-05-24T18:29:40+00:00"
591
+            "time": "2024-05-29T18:08:33+00:00"
592 592
         },
593 593
         {
594 594
             "name": "aws/aws-sdk-php-laravel",
@@ -1985,16 +1985,16 @@
1985 1985
         },
1986 1986
         {
1987 1987
             "name": "filament/actions",
1988
-            "version": "v3.2.82",
1988
+            "version": "v3.2.83",
1989 1989
             "source": {
1990 1990
                 "type": "git",
1991 1991
                 "url": "https://github.com/filamentphp/actions.git",
1992
-                "reference": "889cb3538090cfe0eef1ca51ce7808646133b7ed"
1992
+                "reference": "fa17a8b9aecd68313cc027d05b47bb95e9d897ae"
1993 1993
             },
1994 1994
             "dist": {
1995 1995
                 "type": "zip",
1996
-                "url": "https://api.github.com/repos/filamentphp/actions/zipball/889cb3538090cfe0eef1ca51ce7808646133b7ed",
1997
-                "reference": "889cb3538090cfe0eef1ca51ce7808646133b7ed",
1996
+                "url": "https://api.github.com/repos/filamentphp/actions/zipball/fa17a8b9aecd68313cc027d05b47bb95e9d897ae",
1997
+                "reference": "fa17a8b9aecd68313cc027d05b47bb95e9d897ae",
1998 1998
                 "shasum": ""
1999 1999
             },
2000 2000
             "require": {
@@ -2034,20 +2034,20 @@
2034 2034
                 "issues": "https://github.com/filamentphp/filament/issues",
2035 2035
                 "source": "https://github.com/filamentphp/filament"
2036 2036
             },
2037
-            "time": "2024-05-23T12:08:12+00:00"
2037
+            "time": "2024-05-27T10:09:11+00:00"
2038 2038
         },
2039 2039
         {
2040 2040
             "name": "filament/filament",
2041
-            "version": "v3.2.82",
2041
+            "version": "v3.2.83",
2042 2042
             "source": {
2043 2043
                 "type": "git",
2044 2044
                 "url": "https://github.com/filamentphp/panels.git",
2045
-                "reference": "b73e49d6ef02dba8f118d2934435748ed4feffa2"
2045
+                "reference": "56cd6e4f88427dcf16b2f1728f74f5d9319e5d47"
2046 2046
             },
2047 2047
             "dist": {
2048 2048
                 "type": "zip",
2049
-                "url": "https://api.github.com/repos/filamentphp/panels/zipball/b73e49d6ef02dba8f118d2934435748ed4feffa2",
2050
-                "reference": "b73e49d6ef02dba8f118d2934435748ed4feffa2",
2049
+                "url": "https://api.github.com/repos/filamentphp/panels/zipball/56cd6e4f88427dcf16b2f1728f74f5d9319e5d47",
2050
+                "reference": "56cd6e4f88427dcf16b2f1728f74f5d9319e5d47",
2051 2051
                 "shasum": ""
2052 2052
             },
2053 2053
             "require": {
@@ -2099,20 +2099,20 @@
2099 2099
                 "issues": "https://github.com/filamentphp/filament/issues",
2100 2100
                 "source": "https://github.com/filamentphp/filament"
2101 2101
             },
2102
-            "time": "2024-05-23T12:08:29+00:00"
2102
+            "time": "2024-05-27T10:09:09+00:00"
2103 2103
         },
2104 2104
         {
2105 2105
             "name": "filament/forms",
2106
-            "version": "v3.2.82",
2106
+            "version": "v3.2.83",
2107 2107
             "source": {
2108 2108
                 "type": "git",
2109 2109
                 "url": "https://github.com/filamentphp/forms.git",
2110
-                "reference": "c97fb3c5a6e5dd0d4d9cdbaa8b43c99c0cc35a01"
2110
+                "reference": "c594707c89c7af2a7c70557640900781cd3a25c0"
2111 2111
             },
2112 2112
             "dist": {
2113 2113
                 "type": "zip",
2114
-                "url": "https://api.github.com/repos/filamentphp/forms/zipball/c97fb3c5a6e5dd0d4d9cdbaa8b43c99c0cc35a01",
2115
-                "reference": "c97fb3c5a6e5dd0d4d9cdbaa8b43c99c0cc35a01",
2114
+                "url": "https://api.github.com/repos/filamentphp/forms/zipball/c594707c89c7af2a7c70557640900781cd3a25c0",
2115
+                "reference": "c594707c89c7af2a7c70557640900781cd3a25c0",
2116 2116
                 "shasum": ""
2117 2117
             },
2118 2118
             "require": {
@@ -2155,20 +2155,20 @@
2155 2155
                 "issues": "https://github.com/filamentphp/filament/issues",
2156 2156
                 "source": "https://github.com/filamentphp/filament"
2157 2157
             },
2158
-            "time": "2024-05-23T12:08:13+00:00"
2158
+            "time": "2024-05-27T10:09:06+00:00"
2159 2159
         },
2160 2160
         {
2161 2161
             "name": "filament/infolists",
2162
-            "version": "v3.2.82",
2162
+            "version": "v3.2.83",
2163 2163
             "source": {
2164 2164
                 "type": "git",
2165 2165
                 "url": "https://github.com/filamentphp/infolists.git",
2166
-                "reference": "d473d1b11ad32c917cf6e3610411fd790b8c1e27"
2166
+                "reference": "601f9e456afea1f987a424e35a488dd1e960d95f"
2167 2167
             },
2168 2168
             "dist": {
2169 2169
                 "type": "zip",
2170
-                "url": "https://api.github.com/repos/filamentphp/infolists/zipball/d473d1b11ad32c917cf6e3610411fd790b8c1e27",
2171
-                "reference": "d473d1b11ad32c917cf6e3610411fd790b8c1e27",
2170
+                "url": "https://api.github.com/repos/filamentphp/infolists/zipball/601f9e456afea1f987a424e35a488dd1e960d95f",
2171
+                "reference": "601f9e456afea1f987a424e35a488dd1e960d95f",
2172 2172
                 "shasum": ""
2173 2173
             },
2174 2174
             "require": {
@@ -2206,11 +2206,11 @@
2206 2206
                 "issues": "https://github.com/filamentphp/filament/issues",
2207 2207
                 "source": "https://github.com/filamentphp/filament"
2208 2208
             },
2209
-            "time": "2024-05-23T12:08:25+00:00"
2209
+            "time": "2024-05-27T10:09:10+00:00"
2210 2210
         },
2211 2211
         {
2212 2212
             "name": "filament/notifications",
2213
-            "version": "v3.2.82",
2213
+            "version": "v3.2.83",
2214 2214
             "source": {
2215 2215
                 "type": "git",
2216 2216
                 "url": "https://github.com/filamentphp/notifications.git",
@@ -2262,7 +2262,7 @@
2262 2262
         },
2263 2263
         {
2264 2264
             "name": "filament/support",
2265
-            "version": "v3.2.82",
2265
+            "version": "v3.2.83",
2266 2266
             "source": {
2267 2267
                 "type": "git",
2268 2268
                 "url": "https://github.com/filamentphp/support.git",
@@ -2320,16 +2320,16 @@
2320 2320
         },
2321 2321
         {
2322 2322
             "name": "filament/tables",
2323
-            "version": "v3.2.82",
2323
+            "version": "v3.2.83",
2324 2324
             "source": {
2325 2325
                 "type": "git",
2326 2326
                 "url": "https://github.com/filamentphp/tables.git",
2327
-                "reference": "6c183a98ee19f491f229dbca732f0b00ad9e31be"
2327
+                "reference": "04d464ea199cf8f5551fadd6c2e14da04f64b7f5"
2328 2328
             },
2329 2329
             "dist": {
2330 2330
                 "type": "zip",
2331
-                "url": "https://api.github.com/repos/filamentphp/tables/zipball/6c183a98ee19f491f229dbca732f0b00ad9e31be",
2332
-                "reference": "6c183a98ee19f491f229dbca732f0b00ad9e31be",
2331
+                "url": "https://api.github.com/repos/filamentphp/tables/zipball/04d464ea199cf8f5551fadd6c2e14da04f64b7f5",
2332
+                "reference": "04d464ea199cf8f5551fadd6c2e14da04f64b7f5",
2333 2333
                 "shasum": ""
2334 2334
             },
2335 2335
             "require": {
@@ -2369,11 +2369,11 @@
2369 2369
                 "issues": "https://github.com/filamentphp/filament/issues",
2370 2370
                 "source": "https://github.com/filamentphp/filament"
2371 2371
             },
2372
-            "time": "2024-05-23T12:08:36+00:00"
2372
+            "time": "2024-05-27T10:09:23+00:00"
2373 2373
         },
2374 2374
         {
2375 2375
             "name": "filament/widgets",
2376
-            "version": "v3.2.82",
2376
+            "version": "v3.2.83",
2377 2377
             "source": {
2378 2378
                 "type": "git",
2379 2379
                 "url": "https://github.com/filamentphp/widgets.git",
@@ -3161,16 +3161,16 @@
3161 3161
         },
3162 3162
         {
3163 3163
             "name": "laravel/framework",
3164
-            "version": "v11.8.0",
3164
+            "version": "v11.9.1",
3165 3165
             "source": {
3166 3166
                 "type": "git",
3167 3167
                 "url": "https://github.com/laravel/framework.git",
3168
-                "reference": "ceb892a25817c888ef3df4d1a2af9cac53978300"
3168
+                "reference": "60167ce91c59ed5eea2ad4f2a7b6d686fb103ba7"
3169 3169
             },
3170 3170
             "dist": {
3171 3171
                 "type": "zip",
3172
-                "url": "https://api.github.com/repos/laravel/framework/zipball/ceb892a25817c888ef3df4d1a2af9cac53978300",
3173
-                "reference": "ceb892a25817c888ef3df4d1a2af9cac53978300",
3172
+                "url": "https://api.github.com/repos/laravel/framework/zipball/60167ce91c59ed5eea2ad4f2a7b6d686fb103ba7",
3173
+                "reference": "60167ce91c59ed5eea2ad4f2a7b6d686fb103ba7",
3174 3174
                 "shasum": ""
3175 3175
             },
3176 3176
             "require": {
@@ -3362,20 +3362,20 @@
3362 3362
                 "issues": "https://github.com/laravel/framework/issues",
3363 3363
                 "source": "https://github.com/laravel/framework"
3364 3364
             },
3365
-            "time": "2024-05-21T17:57:45+00:00"
3365
+            "time": "2024-05-28T18:16:41+00:00"
3366 3366
         },
3367 3367
         {
3368 3368
             "name": "laravel/prompts",
3369
-            "version": "v0.1.22",
3369
+            "version": "v0.1.23",
3370 3370
             "source": {
3371 3371
                 "type": "git",
3372 3372
                 "url": "https://github.com/laravel/prompts.git",
3373
-                "reference": "37f94de71758dbfbccc9d299b0e5eb76e02a40f5"
3373
+                "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400"
3374 3374
             },
3375 3375
             "dist": {
3376 3376
                 "type": "zip",
3377
-                "url": "https://api.github.com/repos/laravel/prompts/zipball/37f94de71758dbfbccc9d299b0e5eb76e02a40f5",
3378
-                "reference": "37f94de71758dbfbccc9d299b0e5eb76e02a40f5",
3377
+                "url": "https://api.github.com/repos/laravel/prompts/zipball/9bc4df7c699b0452c6b815e64a2d84b6d7f99400",
3378
+                "reference": "9bc4df7c699b0452c6b815e64a2d84b6d7f99400",
3379 3379
                 "shasum": ""
3380 3380
             },
3381 3381
             "require": {
@@ -3418,9 +3418,9 @@
3418 3418
             "description": "Add beautiful and user-friendly forms to your command-line applications.",
3419 3419
             "support": {
3420 3420
                 "issues": "https://github.com/laravel/prompts/issues",
3421
-                "source": "https://github.com/laravel/prompts/tree/v0.1.22"
3421
+                "source": "https://github.com/laravel/prompts/tree/v0.1.23"
3422 3422
             },
3423
-            "time": "2024-05-10T19:22:18+00:00"
3423
+            "time": "2024-05-27T13:53:20+00:00"
3424 3424
         },
3425 3425
         {
3426 3426
             "name": "laravel/sanctum",
@@ -4543,16 +4543,16 @@
4543 4543
         },
4544 4544
         {
4545 4545
             "name": "matomo/device-detector",
4546
-            "version": "6.3.1",
4546
+            "version": "6.3.2",
4547 4547
             "source": {
4548 4548
                 "type": "git",
4549 4549
                 "url": "https://github.com/matomo-org/device-detector.git",
4550
-                "reference": "8096093346917ee2477d802ab3b00c4c091c5cee"
4550
+                "reference": "fd4042cb6a7f3f985a81aedc075dd59e0b991a51"
4551 4551
             },
4552 4552
             "dist": {
4553 4553
                 "type": "zip",
4554
-                "url": "https://api.github.com/repos/matomo-org/device-detector/zipball/8096093346917ee2477d802ab3b00c4c091c5cee",
4555
-                "reference": "8096093346917ee2477d802ab3b00c4c091c5cee",
4554
+                "url": "https://api.github.com/repos/matomo-org/device-detector/zipball/fd4042cb6a7f3f985a81aedc075dd59e0b991a51",
4555
+                "reference": "fd4042cb6a7f3f985a81aedc075dd59e0b991a51",
4556 4556
                 "shasum": ""
4557 4557
             },
4558 4558
             "require": {
@@ -4608,7 +4608,7 @@
4608 4608
                 "source": "https://github.com/matomo-org/matomo",
4609 4609
                 "wiki": "https://dev.matomo.org/"
4610 4610
             },
4611
-            "time": "2024-04-12T12:16:21+00:00"
4611
+            "time": "2024-05-28T10:16:19+00:00"
4612 4612
         },
4613 4613
         {
4614 4614
             "name": "monolog/monolog",
@@ -11776,16 +11776,16 @@
11776 11776
         },
11777 11777
         {
11778 11778
             "name": "spatie/ignition",
11779
-            "version": "1.14.1",
11779
+            "version": "1.14.2",
11780 11780
             "source": {
11781 11781
                 "type": "git",
11782 11782
                 "url": "https://github.com/spatie/ignition.git",
11783
-                "reference": "c23cc018c5f423d2f413b99f84655fceb6549811"
11783
+                "reference": "5e11c11f675bb5251f061491a493e04a1a571532"
11784 11784
             },
11785 11785
             "dist": {
11786 11786
                 "type": "zip",
11787
-                "url": "https://api.github.com/repos/spatie/ignition/zipball/c23cc018c5f423d2f413b99f84655fceb6549811",
11788
-                "reference": "c23cc018c5f423d2f413b99f84655fceb6549811",
11787
+                "url": "https://api.github.com/repos/spatie/ignition/zipball/5e11c11f675bb5251f061491a493e04a1a571532",
11788
+                "reference": "5e11c11f675bb5251f061491a493e04a1a571532",
11789 11789
                 "shasum": ""
11790 11790
             },
11791 11791
             "require": {
@@ -11855,7 +11855,7 @@
11855 11855
                     "type": "github"
11856 11856
                 }
11857 11857
             ],
11858
-            "time": "2024-05-03T15:56:16+00:00"
11858
+            "time": "2024-05-29T08:10:20+00:00"
11859 11859
         },
11860 11860
         {
11861 11861
             "name": "spatie/laravel-ignition",

+ 9
- 9
package-lock.json Parādīt failu

@@ -931,9 +931,9 @@
931 931
             }
932 932
         },
933 933
         "node_modules/caniuse-lite": {
934
-            "version": "1.0.30001621",
935
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001621.tgz",
936
-            "integrity": "sha512-+NLXZiviFFKX0fk8Piwv3PfLPGtRqJeq2TiNoUff/qB5KJgwecJTvCXDpmlyP/eCI/GUEmp/h/y5j0yckiiZrA==",
934
+            "version": "1.0.30001625",
935
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001625.tgz",
936
+            "integrity": "sha512-4KE9N2gcRH+HQhpeiRZXd+1niLB/XNLAhSy4z7fI8EzcbcPoAqjNInxVHTiTwWfTIV4w096XG8OtCOCQQKPv3w==",
937 937
             "dev": true,
938 938
             "funding": [
939 939
                 {
@@ -1079,9 +1079,9 @@
1079 1079
             "dev": true
1080 1080
         },
1081 1081
         "node_modules/electron-to-chromium": {
1082
-            "version": "1.4.783",
1083
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.783.tgz",
1084
-            "integrity": "sha512-bT0jEz/Xz1fahQpbZ1D7LgmPYZ3iHVY39NcWWro1+hA2IvjiPeaXtfSqrQ+nXjApMvQRE2ASt1itSLRrebHMRQ==",
1082
+            "version": "1.4.784",
1083
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.784.tgz",
1084
+            "integrity": "sha512-9CZwh+sDrhDAeOEFh8s3PqwduzTyYIeYwZolc1b9ENAUt3ePu7R1sJSCWr/820ISssRxCJUyHI9Wb7j+0Uo1AA==",
1085 1085
             "dev": true
1086 1086
         },
1087 1087
         "node_modules/emoji-regex": {
@@ -2365,9 +2365,9 @@
2365 2365
             "dev": true
2366 2366
         },
2367 2367
         "node_modules/vite": {
2368
-            "version": "5.2.11",
2369
-            "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz",
2370
-            "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==",
2368
+            "version": "5.2.12",
2369
+            "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.12.tgz",
2370
+            "integrity": "sha512-/gC8GxzxMK5ntBwb48pR32GGhENnjtY30G4A0jemunsBkiEZFw60s8InGpN8gkhHEkjnRK1aSAxeQgwvFhUHAA==",
2371 2371
             "dev": true,
2372 2372
             "dependencies": {
2373 2373
                 "esbuild": "^0.20.1",

+ 83
- 57
resources/views/components/company/reports/report-pdf.blade.php Parādīt failu

@@ -12,27 +12,28 @@
12 12
 
13 13
         .header {
14 14
             color: #374151;
15
+            margin-bottom: 1rem;
15 16
         }
16 17
 
17
-        .table-class th,
18
-        .table-class td {
19
-            text-align: right;
20
-            color: #374151;
18
+        .table-head {
19
+            display: table-row-group;
21 20
         }
22 21
 
23
-        /* Align the first column header and data to the left */
24
-        .table-class th:first-child, .table-class td:first-child,
25
-        .table-class th:nth-child(2), .table-class td:nth-child(2) {
22
+        .text-left {
26 23
             text-align: left;
27 24
         }
28 25
 
29
-        .header {
30
-            margin-bottom: 1rem; /* Space between header and table */
26
+        .text-right {
27
+            text-align: right;
31 28
         }
32 29
 
33
-        /* Ensure category name is left-aligned */
34
-        .category-name-cell {
35
-            text-align: left;
30
+        .text-center {
31
+            text-align: center;
32
+        }
33
+
34
+        .table-class th,
35
+        .table-class td {
36
+            color: #374151;
36 37
         }
37 38
 
38 39
         .header .title,
@@ -41,9 +42,18 @@
41 42
             margin-bottom: 0.125rem; /* Uniform space between header elements */
42 43
         }
43 44
 
44
-        .title { font-size: 1.5rem; }
45
-        .company-name { font-size: 1.125rem; font-weight: 600; }
46
-        .date-range { font-size: 0.875rem; }
45
+        .title {
46
+            font-size: 1.5rem;
47
+        }
48
+
49
+        .company-name {
50
+            font-size: 1.125rem;
51
+            font-weight: 600;
52
+        }
53
+
54
+        .date-range {
55
+            font-size: 0.875rem;
56
+        }
47 57
 
48 58
         .table-class {
49 59
             width: 100%;
@@ -58,15 +68,20 @@
58 68
             border-bottom: 1px solid #d1d5db; /* Gray border for all rows */
59 69
         }
60 70
 
61
-        .category-row > td {
71
+        .category-header-row > td {
62 72
             background-color: #f3f4f6; /* Gray background for category names */
63 73
             font-weight: 600;
64 74
         }
65 75
 
66
-        .table-body tr { background-color: #ffffff; /* White background for other rows */ }
76
+        .table-body tr {
77
+            background-color: #ffffff; /* White background for other rows */
78
+        }
67 79
 
68
-        .spacer-row > td { height: 0.75rem; }
80
+        .spacer-row > td {
81
+            height: 0.75rem;
82
+        }
69 83
 
84
+        .category-summary-row > td,
70 85
         .table-footer-row > td {
71 86
             font-weight: 600;
72 87
             background-color: #ffffff; /* White background for footer */
@@ -74,49 +89,60 @@
74 89
     </style>
75 90
 </head>
76 91
 <body>
77
-    <div class="header">
78
-        <div class="title">{{ $report->getTitle() }}</div>
79
-        <div class="company-name">{{ $company->name }}</div>
80
-        <div class="date-range">Date Range: {{ $startDate }} to {{ $endDate }}</div>
81
-    </div>
82
-    <table class="table-class">
83
-        <thead class="table-head" style="display: table-row-group;">
92
+<div class="header">
93
+    <div class="title">{{ $report->getTitle() }}</div>
94
+    <div class="company-name">{{ $company->name }}</div>
95
+    <div class="date-range">Date Range: {{ $startDate }} to {{ $endDate }}</div>
96
+</div>
97
+<table class="table-class">
98
+    <thead class="table-head">
99
+    <tr>
100
+        @foreach($report->getHeaders() as $index => $header)
101
+            <th class="{{ $report->getAlignmentClass($index) }}">
102
+                {{ $header }}
103
+            </th>
104
+        @endforeach
105
+    </tr>
106
+    </thead>
107
+    @foreach($report->getCategories() as $category)
108
+        <tbody>
109
+        <tr class="category-header-row">
110
+            @foreach($category['header'] as $index => $header)
111
+                <td class="{{ $report->getAlignmentClass($index) }}">
112
+                    {{ $header }}
113
+                </td>
114
+            @endforeach
115
+        </tr>
116
+        @foreach($category['data'] as $account)
84 117
             <tr>
85
-                @foreach($report->getHeaders() as $header)
86
-                    <th>{{ $header }}</th>
118
+                @foreach($account as $index => $cell)
119
+                    <td class="{{ $report->getAlignmentClass($index) }}">
120
+                        {{ $cell }}
121
+                    </td>
87 122
                 @endforeach
88 123
             </tr>
89
-        </thead>
90
-        <tbody>
91
-            @foreach($report->getData() as $row)
92
-                @if (count($row) === 2 && empty($row[0]))
93
-                    <tr class="category-row">
94
-                        <td></td>
95
-                        <td class="category-name-cell">{{ $row[1] }}</td>
96
-                        @for ($i = 2; $i < count($report->getHeaders()); $i++)
97
-                            <td></td>
98
-                        @endfor
99
-                    </tr>
100
-                @elseif (count($row) > 2)
101
-                    <tr>
102
-                        @foreach ($row as $cell)
103
-                            <td>{{ $cell }}</td>
104
-                        @endforeach
105
-                    </tr>
106
-                @elseif ($row[0] === '')
107
-                    <tr class="spacer-row">
108
-                        <td colspan="{{ count($report->getHeaders()) }}"></td>
109
-                    </tr>
110
-                @endif
124
+        @endforeach
125
+        <tr class="category-summary-row">
126
+            @foreach($category['summary'] as $index => $cell)
127
+                <td class="{{ $report->getAlignmentClass($index) }}">
128
+                    {{ $cell }}
129
+                </td>
111 130
             @endforeach
131
+        </tr>
132
+        <tr class="spacer-row">
133
+            <td colspan="{{ count($report->getHeaders()) }}"></td>
134
+        </tr>
112 135
         </tbody>
113
-        <tfoot>
114
-            <tr class="table-footer-row">
115
-                @foreach ($report->getOverallTotals() as $total)
116
-                    <td>{{ $total }}</td>
117
-                @endforeach
118
-            </tr>
119
-        </tfoot>
120
-    </table>
136
+    @endforeach
137
+    <tfoot>
138
+    <tr class="table-footer-row">
139
+        @foreach ($report->getOverallTotals() as $index => $total)
140
+            <td class="{{ $report->getAlignmentClass($index) }}">
141
+                {{ $total }}
142
+            </td>
143
+        @endforeach
144
+    </tr>
145
+    </tfoot>
146
+</table>
121 147
 </body>
122 148
 </html>

+ 62
- 0
resources/views/components/company/tables/reports/detailed-report.blade.php Parādīt failu

@@ -0,0 +1,62 @@
1
+<table class="w-full table-auto divide-y divide-gray-200 text-start dark:divide-white/5">
2
+    <thead class="divide-y divide-gray-200 dark:divide-white/5">
3
+        <tr class="bg-gray-50 dark:bg-white/5">
4
+            @foreach($report->getHeaders() as $index => $header)
5
+                <th class="px-3 py-3.5 sm:first-of-type:ps-6 sm:last-of-type:pe-6 {{ $report->getAlignmentClass($index) }}">
6
+                    <span class="text-sm font-semibold text-gray-950 dark:text-white">
7
+                        {{ $header }}
8
+                    </span>
9
+                </th>
10
+            @endforeach
11
+        </tr>
12
+    </thead>
13
+    @foreach($report->getCategories() as $category)
14
+        <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
15
+        <tr class="bg-gray-50 dark:bg-white/5">
16
+            @foreach($category['header'] as $index => $header)
17
+                <x-filament-tables::cell class="{{ $report->getAlignmentClass($index) }}">
18
+                    <div class="px-3 py-2 text-sm font-semibold text-gray-950 dark:text-white">
19
+                        {{ $header }}
20
+                    </div>
21
+                </x-filament-tables::cell>
22
+            @endforeach
23
+        </tr>
24
+        @foreach($category['data'] as $account)
25
+            <tr>
26
+                @foreach($account as $index => $cell)
27
+                    <x-filament-tables::cell class="{{ $report->getAlignmentClass($index) }}">
28
+                        <div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">
29
+                            {{ $cell }}
30
+                        </div>
31
+                    </x-filament-tables::cell>
32
+                @endforeach
33
+            </tr>
34
+        @endforeach
35
+        <tr>
36
+            @foreach($category['summary'] as $index => $cell)
37
+                <x-filament-tables::cell class="{{ $report->getAlignmentClass($index) }}">
38
+                    <div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">
39
+                        {{ $cell }}
40
+                    </div>
41
+                </x-filament-tables::cell>
42
+            @endforeach
43
+        </tr>
44
+        <tr>
45
+            <x-filament-tables::cell colspan="{{ count($report->getHeaders()) }}">
46
+                <div class="px-3 py-2 leading-6 invisible">Hidden Text</div>
47
+            </x-filament-tables::cell>
48
+        </tr>
49
+        </tbody>
50
+    @endforeach
51
+    <tfoot>
52
+        <tr class="bg-gray-50 dark:bg-white/5">
53
+            @foreach($report->getOverallTotals() as $index => $total)
54
+                <x-filament-tables::cell class="{{ $report->getAlignmentClass($index) }}">
55
+                    <div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">
56
+                        {{ $total }}
57
+                    </div>
58
+                </x-filament-tables::cell>
59
+            @endforeach
60
+        </tr>
61
+    </tfoot>
62
+</table>

+ 1
- 54
resources/views/filament/company/pages/reports/account-balances.blade.php Parādīt failu

@@ -14,60 +14,7 @@
14 14
                 </form>
15 15
             </div>
16 16
             <div class="divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10">
17
-                <table class="w-full table-auto divide-y divide-gray-200 text-start dark:divide-white/5">
18
-                    <thead class="divide-y divide-gray-200 dark:divide-white/5">
19
-                        <tr class="bg-gray-50 dark:bg-white/5">
20
-                            <x-filament-tables::header-cell>Account</x-filament-tables::header-cell>
21
-                            <x-filament-tables::header-cell alignment="end">Starting Balance</x-filament-tables::header-cell>
22
-                            <x-filament-tables::header-cell alignment="end">Debit</x-filament-tables::header-cell>
23
-                            <x-filament-tables::header-cell alignment="end">Credit</x-filament-tables::header-cell>
24
-                            <x-filament-tables::header-cell alignment="end">Net Movement</x-filament-tables::header-cell>
25
-                            <x-filament-tables::header-cell alignment="end">Ending Balance</x-filament-tables::header-cell>
26
-                        </tr>
27
-                    </thead>
28
-                    @foreach($accountBalanceReport->categories as $accountCategoryName => $accountCategory)
29
-                        <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
30
-                        <tr class="bg-gray-50 dark:bg-white/5">
31
-                            <x-filament-tables::cell colspan="6">
32
-                                <div class="px-3 py-2 text-sm font-medium text-gray-950 dark:text-white">{{ $accountCategoryName }}</div>
33
-                            </x-filament-tables::cell>
34
-                        </tr>
35
-                        @foreach($accountCategory->accounts as $account)
36
-                            <x-filament-tables::row>
37
-                                <x-filament-tables::cell><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->accountName }}</div></x-filament-tables::cell>
38
-                                <x-filament-tables::cell class="text-right"><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->balance->startingBalance ?? '' }}</div></x-filament-tables::cell>
39
-                                <x-filament-tables::cell class="text-right"><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->balance->debitBalance }}</div></x-filament-tables::cell>
40
-                                <x-filament-tables::cell class="text-right"><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->balance->creditBalance }}</div></x-filament-tables::cell>
41
-                                <x-filament-tables::cell class="text-right"><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->balance->netMovement }}</div></x-filament-tables::cell>
42
-                                <x-filament-tables::cell class="text-right"><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->balance->endingBalance ?? '' }}</div></x-filament-tables::cell>
43
-                            </x-filament-tables::row>
44
-                        @endforeach
45
-                        <x-filament-tables::row>
46
-                            <x-filament-tables::cell><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">Total {{ $accountCategoryName }}</div></x-filament-tables::cell>
47
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountCategory->summary->startingBalance ?? '' }}</div></x-filament-tables::cell>
48
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountCategory->summary->debitBalance }}</div></x-filament-tables::cell>
49
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountCategory->summary->creditBalance }}</div></x-filament-tables::cell>
50
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountCategory->summary->netMovement }}</div></x-filament-tables::cell>
51
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountCategory->summary->endingBalance ?? '' }}</div></x-filament-tables::cell>
52
-                        </x-filament-tables::row>
53
-                        <x-filament-tables::row>
54
-                            <x-filament-tables::cell colspan="6">
55
-                                <div class="px-3 py-2 invisible">Hidden Text</div>
56
-                            </x-filament-tables::cell>
57
-                        </x-filament-tables::row>
58
-                        </tbody>
59
-                    @endforeach
60
-                    <tfoot>
61
-                        <tr class="bg-gray-50 dark:bg-white/5">
62
-                            <x-filament-tables::cell><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">Total for all accounts</div></x-filament-tables::cell>
63
-                            <x-filament-tables::cell><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white"></div></x-filament-tables::cell>
64
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountBalanceReport->overallTotal->debitBalance }}</div></x-filament-tables::cell>
65
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountBalanceReport->overallTotal->creditBalance }}</div></x-filament-tables::cell>
66
-                            <x-filament-tables::cell><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white"></div></x-filament-tables::cell>
67
-                            <x-filament-tables::cell><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white"></div></x-filament-tables::cell>
68
-                        </tr>
69
-                    </tfoot>
70
-                </table>
17
+                <x-company.tables.reports.detailed-report :report="$accountBalanceReport" />
71 18
             </div>
72 19
             <div class="es-table__footer-ctn border-t border-gray-200"></div>
73 20
         </x-filament-tables::container>

+ 1
- 42
resources/views/filament/company/pages/reports/trial-balance.blade.php Parādīt failu

@@ -14,48 +14,7 @@
14 14
                 </form>
15 15
             </div>
16 16
             <div class="divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10">
17
-                <table class="w-full table-auto divide-y divide-gray-200 text-start dark:divide-white/5">
18
-                    <thead class="divide-y divide-gray-200 dark:divide-white/5">
19
-                        <tr class="bg-gray-50 dark:bg-white/5">
20
-                            <x-filament-tables::header-cell>Account</x-filament-tables::header-cell>
21
-                            <x-filament-tables::header-cell alignment="end">Debit</x-filament-tables::header-cell>
22
-                            <x-filament-tables::header-cell alignment="end">Credit</x-filament-tables::header-cell>
23
-                        </tr>
24
-                    </thead>
25
-                    @foreach($trialBalanceReport->categories as $accountCategoryName => $accountCategory)
26
-                        <tbody class="divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
27
-                        <tr class="bg-gray-50 dark:bg-white/5">
28
-                            <x-filament-tables::cell colspan="3">
29
-                                <div class="px-3 py-2 text-sm font-medium text-gray-950 dark:text-white">{{ $accountCategoryName }}</div>
30
-                            </x-filament-tables::cell>
31
-                        </tr>
32
-                        @foreach($accountCategory->accounts as $account)
33
-                            <x-filament-tables::row>
34
-                                <x-filament-tables::cell><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->accountName }}</div></x-filament-tables::cell>
35
-                                <x-filament-tables::cell class="text-right"><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->balance->debitBalance ?? '' }}</div></x-filament-tables::cell>
36
-                                <x-filament-tables::cell class="text-right"><div class="px-3 py-4 text-sm leading-6 text-gray-950 dark:text-white">{{ $account->balance->creditBalance ?? '' }}</div></x-filament-tables::cell>
37
-                            </x-filament-tables::row>
38
-                        @endforeach
39
-                        <x-filament-tables::row>
40
-                            <x-filament-tables::cell><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">Total {{ $accountCategoryName }}</div></x-filament-tables::cell>
41
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountCategory->summary->debitBalance }}</div></x-filament-tables::cell>
42
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $accountCategory->summary->creditBalance }}</div></x-filament-tables::cell>
43
-                        </x-filament-tables::row>
44
-                        <x-filament-tables::row>
45
-                            <x-filament-tables::cell colspan="3">
46
-                                <div class="px-3 py-2 invisible">Hidden Text</div>
47
-                            </x-filament-tables::cell>
48
-                        </x-filament-tables::row>
49
-                        </tbody>
50
-                    @endforeach
51
-                    <tfoot>
52
-                        <tr class="bg-gray-50 dark:bg-white/5">
53
-                            <x-filament-tables::cell><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">Total for all accounts</div></x-filament-tables::cell>
54
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $trialBalanceReport->overallTotal->debitBalance }}</div></x-filament-tables::cell>
55
-                            <x-filament-tables::cell class="text-right"><div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">{{ $trialBalanceReport->overallTotal->creditBalance }}</div></x-filament-tables::cell>
56
-                        </tr>
57
-                    </tfoot>
58
-                </table>
17
+                <x-company.tables.reports.detailed-report :report="$trialBalanceReport" />
59 18
             </div>
60 19
             <div class="es-table__footer-ctn border-t border-gray-200"></div>
61 20
         </x-filament-tables::container>

Notiek ielāde…
Atcelt
Saglabāt