Browse Source

account transactions report wip

3.x
Andrew Wallo 1 year ago
parent
commit
41d284b73b

+ 2
- 0
app/Contracts/ExportableReport.php View File

18
     public function getOverallTotals(): array;
18
     public function getOverallTotals(): array;
19
 
19
 
20
     public function getColumns(): array;
20
     public function getColumns(): array;
21
+
22
+    public function getPdfView(): string;
21
 }
23
 }

+ 1
- 1
app/DTO/ReportCategoryDTO.php View File

7
     public function __construct(
7
     public function __construct(
8
         public array $header,
8
         public array $header,
9
         public array $data,
9
         public array $data,
10
-        public array $summary,
10
+        public array $summary = [],
11
     ) {}
11
     ) {}
12
 }
12
 }

+ 5
- 0
app/Filament/Company/Pages/Reports/BaseReportPage.php View File

178
             ->statePath('toggledTableColumns');
178
             ->statePath('toggledTableColumns');
179
     }
179
     }
180
 
180
 
181
+    protected function hasToggleableColumns(): bool
182
+    {
183
+        return ! empty($this->getTableColumnToggleFormSchema());
184
+    }
185
+
181
     /**
186
     /**
182
      * @return array<Checkbox>
187
      * @return array<Checkbox>
183
      */
188
      */

+ 17
- 6
app/Services/ExportService.php View File

10
 
10
 
11
 class ExportService
11
 class ExportService
12
 {
12
 {
13
-    public function exportToCsv(Company $company, ExportableReport $report, string $startDate, string $endDate): StreamedResponse
13
+    public function exportToCsv(Company $company, ExportableReport $report, string $startDate, string $endDate, bool $separateCategoryHeaders = false): StreamedResponse
14
     {
14
     {
15
         $formattedStartDate = Carbon::parse($startDate)->format('Y-m-d');
15
         $formattedStartDate = Carbon::parse($startDate)->format('Y-m-d');
16
         $formattedEndDate = Carbon::parse($endDate)->format('Y-m-d');
16
         $formattedEndDate = Carbon::parse($endDate)->format('Y-m-d');
24
             'Content-Disposition' => 'attachment; filename="' . $filename . '"',
24
             'Content-Disposition' => 'attachment; filename="' . $filename . '"',
25
         ];
25
         ];
26
 
26
 
27
-        $callback = function () use ($report, $company, $formattedStartDate, $formattedEndDate) {
27
+        $callback = function () use ($report, $company, $formattedStartDate, $formattedEndDate, $separateCategoryHeaders) {
28
             $file = fopen('php://output', 'wb');
28
             $file = fopen('php://output', 'wb');
29
 
29
 
30
             fputcsv($file, [$report->getTitle()]);
30
             fputcsv($file, [$report->getTitle()]);
35
             fputcsv($file, $report->getHeaders());
35
             fputcsv($file, $report->getHeaders());
36
 
36
 
37
             foreach ($report->getCategories() as $category) {
37
             foreach ($report->getCategories() as $category) {
38
-                fputcsv($file, $category->header);
38
+                if (isset($category->header[0]) && is_array($category->header[0])) {
39
+                    foreach ($category->header as $headerRow) {
40
+                        fputcsv($file, $headerRow);
41
+                    }
42
+                } else {
43
+                    fputcsv($file, $category->header);
44
+                }
39
 
45
 
40
                 foreach ($category->data as $accountRow) {
46
                 foreach ($category->data as $accountRow) {
41
                     fputcsv($file, $accountRow);
47
                     fputcsv($file, $accountRow);
42
                 }
48
                 }
43
 
49
 
44
-                fputcsv($file, $category->summary);
50
+                if (filled($category->summary)) {
51
+                    fputcsv($file, $category->summary);
52
+                }
53
+
45
                 fputcsv($file, []); // Empty row for spacing
54
                 fputcsv($file, []); // Empty row for spacing
46
             }
55
             }
47
 
56
 
48
-            fputcsv($file, $report->getOverallTotals());
57
+            if (filled($report->getOverallTotals())) {
58
+                fputcsv($file, $report->getOverallTotals());
59
+            }
49
 
60
 
50
             fclose($file);
61
             fclose($file);
51
         };
62
         };
62
 
73
 
63
         $filename = $company->name . ' ' . $report->getTitle() . ' ' . $formattedStartDate . ' to ' . $formattedEndDate . ' ' . $timestamp . '.pdf';
74
         $filename = $company->name . ' ' . $report->getTitle() . ' ' . $formattedStartDate . ' to ' . $formattedEndDate . ' ' . $timestamp . '.pdf';
64
 
75
 
65
-        $pdf = Pdf::loadView('components.company.reports.report-pdf', [
76
+        $pdf = Pdf::loadView($report->getPdfView(), [
66
             'company' => $company,
77
             'company' => $company,
67
             'report' => $report,
78
             'report' => $report,
68
             'startDate' => Carbon::parse($startDate)->format('M d, Y'),
79
             'startDate' => Carbon::parse($startDate)->format('M d, Y'),

+ 1
- 2
app/Services/ReportService.php View File

9
 use App\DTO\ReportDTO;
9
 use App\DTO\ReportDTO;
10
 use App\Enums\Accounting\AccountCategory;
10
 use App\Enums\Accounting\AccountCategory;
11
 use App\Models\Accounting\Account;
11
 use App\Models\Accounting\Account;
12
-use App\Models\Accounting\JournalEntry;
13
 use App\Support\Column;
12
 use App\Support\Column;
14
 use App\Utilities\Currency\CurrencyAccessor;
13
 use App\Utilities\Currency\CurrencyAccessor;
15
 use Illuminate\Database\Eloquent\Builder;
14
 use Illuminate\Database\Eloquent\Builder;
173
 
172
 
174
             $reportCategories[] = [
173
             $reportCategories[] = [
175
                 'category' => $account->name,
174
                 'category' => $account->name,
176
-                'under' => 'Under: ' . $account->category->getLabel() . ' > ' . $account->subtype->name,
175
+                'under' => $account->category->getLabel() . ' > ' . $account->subtype->name,
177
                 'transactions' => $accountTransactions,
176
                 'transactions' => $accountTransactions,
178
             ];
177
             ];
179
         }
178
         }

+ 15
- 17
app/Transformers/AccountTransactionReportTransformer.php View File

2
 
2
 
3
 namespace App\Transformers;
3
 namespace App\Transformers;
4
 
4
 
5
-use App\DTO\AccountDTO;
6
 use App\DTO\AccountTransactionDTO;
5
 use App\DTO\AccountTransactionDTO;
7
 use App\DTO\ReportCategoryDTO;
6
 use App\DTO\ReportCategoryDTO;
8
 use App\Support\Column;
7
 use App\Support\Column;
9
 
8
 
10
 class AccountTransactionReportTransformer extends BaseReportTransformer
9
 class AccountTransactionReportTransformer extends BaseReportTransformer
11
 {
10
 {
11
+    public function getPdfView(): string
12
+    {
13
+        return 'components.company.reports.account-transactions-report-pdf';
14
+    }
15
+
12
     public function getTitle(): string
16
     public function getTitle(): string
13
     {
17
     {
14
         return 'Account Transactions';
18
         return 'Account Transactions';
28
 
32
 
29
         foreach ($this->report->categories as $categoryData) {
33
         foreach ($this->report->categories as $categoryData) {
30
             // Initialize header with account and category information
34
             // Initialize header with account and category information
35
+
31
             $header = [
36
             $header = [
32
-                [
33
-                    'column' => 'category',
34
-                    'value' => $categoryData['category'],
35
-                ],
36
-                [
37
-                    'column' => 'under',
38
-                    'value' => $categoryData['under'],
39
-                ],
37
+                array_fill(0, count($this->getColumns()), ''),
38
+                array_fill(0, count($this->getColumns()), ''),
40
             ];
39
             ];
41
 
40
 
41
+            foreach ($this->getColumns() as $index => $column) {
42
+                if ($column->getName() === 'date') {
43
+                    $header[0][$index] = $categoryData['category'];
44
+                    $header[1][$index] = $categoryData['under'];
45
+                }
46
+            }
47
+
42
             // Map transaction data
48
             // Map transaction data
43
             $data = array_map(function (AccountTransactionDTO $transaction) {
49
             $data = array_map(function (AccountTransactionDTO $transaction) {
44
                 $row = [];
50
                 $row = [];
57
                 return $row;
63
                 return $row;
58
             }, $categoryData['transactions']);
64
             }, $categoryData['transactions']);
59
 
65
 
60
-            // Extract summary from the last transaction if it's "Totals and Ending Balance"
61
-            $summary = [];
62
-            if (count($data) > 1) {
63
-                $summaryTransaction = end($data);
64
-                $summary = array_slice($summaryTransaction, 1); // Skip the first element, which is the date
65
-            }
66
-
67
             $categories[] = new ReportCategoryDTO(
66
             $categories[] = new ReportCategoryDTO(
68
                 header: $header,
67
                 header: $header,
69
                 data: $data,
68
                 data: $data,
70
-                summary: $summary
71
             );
69
             );
72
         }
70
         }
73
 
71
 

+ 5
- 0
app/Transformers/BaseReportTransformer.php View File

21
         return $this->report->fields;
21
         return $this->report->fields;
22
     }
22
     }
23
 
23
 
24
+    public function getPdfView(): string
25
+    {
26
+        return 'components.company.reports.report-pdf';
27
+    }
28
+
24
     public function getAlignmentClass(int $index): string
29
     public function getAlignmentClass(int $index): string
25
     {
30
     {
26
         $column = $this->getColumns()[$index];
31
         $column = $this->getColumns()[$index];

+ 24
- 24
composer.lock View File

497
         },
497
         },
498
         {
498
         {
499
             "name": "aws/aws-sdk-php",
499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.315.4",
500
+            "version": "3.315.5",
501
             "source": {
501
             "source": {
502
                 "type": "git",
502
                 "type": "git",
503
                 "url": "https://github.com/aws/aws-sdk-php.git",
503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "8d2cf34e22262b983ce3d7e38d11667c5792b93f"
504
+                "reference": "3e6d619d45d8e1a8681dd58de61ddfe90e8341e6"
505
             },
505
             },
506
             "dist": {
506
             "dist": {
507
                 "type": "zip",
507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/8d2cf34e22262b983ce3d7e38d11667c5792b93f",
509
-                "reference": "8d2cf34e22262b983ce3d7e38d11667c5792b93f",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3e6d619d45d8e1a8681dd58de61ddfe90e8341e6",
509
+                "reference": "3e6d619d45d8e1a8681dd58de61ddfe90e8341e6",
510
                 "shasum": ""
510
                 "shasum": ""
511
             },
511
             },
512
             "require": {
512
             "require": {
586
             "support": {
586
             "support": {
587
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
587
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
588
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
588
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
589
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.315.4"
589
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.315.5"
590
             },
590
             },
591
-            "time": "2024-07-02T18:09:03+00:00"
591
+            "time": "2024-07-03T18:12:51+00:00"
592
         },
592
         },
593
         {
593
         {
594
             "name": "aws/aws-sdk-php-laravel",
594
             "name": "aws/aws-sdk-php-laravel",
4401
         },
4401
         },
4402
         {
4402
         {
4403
             "name": "livewire/livewire",
4403
             "name": "livewire/livewire",
4404
-            "version": "v3.5.1",
4404
+            "version": "v3.5.2",
4405
             "source": {
4405
             "source": {
4406
                 "type": "git",
4406
                 "type": "git",
4407
                 "url": "https://github.com/livewire/livewire.git",
4407
                 "url": "https://github.com/livewire/livewire.git",
4408
-                "reference": "da044261bb5c5449397f18fda3409f14acf47c0a"
4408
+                "reference": "636725c1f87bc7844dd80277488268db27eec1aa"
4409
             },
4409
             },
4410
             "dist": {
4410
             "dist": {
4411
                 "type": "zip",
4411
                 "type": "zip",
4412
-                "url": "https://api.github.com/repos/livewire/livewire/zipball/da044261bb5c5449397f18fda3409f14acf47c0a",
4413
-                "reference": "da044261bb5c5449397f18fda3409f14acf47c0a",
4412
+                "url": "https://api.github.com/repos/livewire/livewire/zipball/636725c1f87bc7844dd80277488268db27eec1aa",
4413
+                "reference": "636725c1f87bc7844dd80277488268db27eec1aa",
4414
                 "shasum": ""
4414
                 "shasum": ""
4415
             },
4415
             },
4416
             "require": {
4416
             "require": {
4465
             "description": "A front-end framework for Laravel.",
4465
             "description": "A front-end framework for Laravel.",
4466
             "support": {
4466
             "support": {
4467
                 "issues": "https://github.com/livewire/livewire/issues",
4467
                 "issues": "https://github.com/livewire/livewire/issues",
4468
-                "source": "https://github.com/livewire/livewire/tree/v3.5.1"
4468
+                "source": "https://github.com/livewire/livewire/tree/v3.5.2"
4469
             },
4469
             },
4470
             "funding": [
4470
             "funding": [
4471
                 {
4471
                 {
4473
                     "type": "github"
4473
                     "type": "github"
4474
                 }
4474
                 }
4475
             ],
4475
             ],
4476
-            "time": "2024-06-18T11:10:42+00:00"
4476
+            "time": "2024-07-03T17:22:45+00:00"
4477
         },
4477
         },
4478
         {
4478
         {
4479
             "name": "masterminds/html5",
4479
             "name": "masterminds/html5",
10816
         },
10816
         },
10817
         {
10817
         {
10818
             "name": "phpunit/phpunit",
10818
             "name": "phpunit/phpunit",
10819
-            "version": "10.5.24",
10819
+            "version": "10.5.25",
10820
             "source": {
10820
             "source": {
10821
                 "type": "git",
10821
                 "type": "git",
10822
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
10822
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
10823
-                "reference": "5f124e3e3e561006047b532fd0431bf5bb6b9015"
10823
+                "reference": "831bf82312be6037e811833ddbea0b8de60ea314"
10824
             },
10824
             },
10825
             "dist": {
10825
             "dist": {
10826
                 "type": "zip",
10826
                 "type": "zip",
10827
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5f124e3e3e561006047b532fd0431bf5bb6b9015",
10828
-                "reference": "5f124e3e3e561006047b532fd0431bf5bb6b9015",
10827
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/831bf82312be6037e811833ddbea0b8de60ea314",
10828
+                "reference": "831bf82312be6037e811833ddbea0b8de60ea314",
10829
                 "shasum": ""
10829
                 "shasum": ""
10830
             },
10830
             },
10831
             "require": {
10831
             "require": {
10897
             "support": {
10897
             "support": {
10898
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
10898
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
10899
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
10899
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
10900
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.24"
10900
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.25"
10901
             },
10901
             },
10902
             "funding": [
10902
             "funding": [
10903
                 {
10903
                 {
10913
                     "type": "tidelift"
10913
                     "type": "tidelift"
10914
                 }
10914
                 }
10915
             ],
10915
             ],
10916
-            "time": "2024-06-20T13:09:54+00:00"
10916
+            "time": "2024-07-03T05:49:17+00:00"
10917
         },
10917
         },
10918
         {
10918
         {
10919
             "name": "rector/rector",
10919
             "name": "rector/rector",
12272
         },
12272
         },
12273
         {
12273
         {
12274
             "name": "spatie/laravel-ray",
12274
             "name": "spatie/laravel-ray",
12275
-            "version": "1.36.3",
12275
+            "version": "1.37.0",
12276
             "source": {
12276
             "source": {
12277
                 "type": "git",
12277
                 "type": "git",
12278
                 "url": "https://github.com/spatie/laravel-ray.git",
12278
                 "url": "https://github.com/spatie/laravel-ray.git",
12279
-                "reference": "9becea4bf279d9bc5e11f89ef36894239d2be60e"
12279
+                "reference": "f57b294a3815be37effa9d13f54f2fbe5a2fff37"
12280
             },
12280
             },
12281
             "dist": {
12281
             "dist": {
12282
                 "type": "zip",
12282
                 "type": "zip",
12283
-                "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/9becea4bf279d9bc5e11f89ef36894239d2be60e",
12284
-                "reference": "9becea4bf279d9bc5e11f89ef36894239d2be60e",
12283
+                "url": "https://api.github.com/repos/spatie/laravel-ray/zipball/f57b294a3815be37effa9d13f54f2fbe5a2fff37",
12284
+                "reference": "f57b294a3815be37effa9d13f54f2fbe5a2fff37",
12285
                 "shasum": ""
12285
                 "shasum": ""
12286
             },
12286
             },
12287
             "require": {
12287
             "require": {
12343
             ],
12343
             ],
12344
             "support": {
12344
             "support": {
12345
                 "issues": "https://github.com/spatie/laravel-ray/issues",
12345
                 "issues": "https://github.com/spatie/laravel-ray/issues",
12346
-                "source": "https://github.com/spatie/laravel-ray/tree/1.36.3"
12346
+                "source": "https://github.com/spatie/laravel-ray/tree/1.37.0"
12347
             },
12347
             },
12348
             "funding": [
12348
             "funding": [
12349
                 {
12349
                 {
12355
                     "type": "other"
12355
                     "type": "other"
12356
                 }
12356
                 }
12357
             ],
12357
             ],
12358
-            "time": "2024-07-02T13:33:54+00:00"
12358
+            "time": "2024-07-03T08:48:44+00:00"
12359
         },
12359
         },
12360
         {
12360
         {
12361
             "name": "spatie/macroable",
12361
             "name": "spatie/macroable",

+ 7
- 7
package-lock.json View File

931
             }
931
             }
932
         },
932
         },
933
         "node_modules/caniuse-lite": {
933
         "node_modules/caniuse-lite": {
934
-            "version": "1.0.30001639",
935
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001639.tgz",
936
-            "integrity": "sha512-eFHflNTBIlFwP2AIKaYuBQN/apnUoKNhBdza8ZnW/h2di4LCZ4xFqYlxUxo+LQ76KFI1PGcC1QDxMbxTZpSCAg==",
934
+            "version": "1.0.30001640",
935
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001640.tgz",
936
+            "integrity": "sha512-lA4VMpW0PSUrFnkmVuEKBUovSWKhj7puyCg8StBChgu298N1AtuF1sKWEvfDuimSEDbhlb/KqPKC3fs1HbuQUA==",
937
             "dev": true,
937
             "dev": true,
938
             "funding": [
938
             "funding": [
939
                 {
939
                 {
2375
             "dev": true
2375
             "dev": true
2376
         },
2376
         },
2377
         "node_modules/vite": {
2377
         "node_modules/vite": {
2378
-            "version": "5.3.2",
2379
-            "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.2.tgz",
2380
-            "integrity": "sha512-6lA7OBHBlXUxiJxbO5aAY2fsHHzDr1q7DvXYnyZycRs2Dz+dXBWuhpWHvmljTRTpQC2uvGmUFFkSHF2vGo90MA==",
2378
+            "version": "5.3.3",
2379
+            "resolved": "https://registry.npmjs.org/vite/-/vite-5.3.3.tgz",
2380
+            "integrity": "sha512-NPQdeCU0Dv2z5fu+ULotpuq5yfCS1BzKUIPhNbP3YBfAMGJXbt2nS+sbTFu+qchaqWTD+H3JK++nRwr6XIcp6A==",
2381
             "dev": true,
2381
             "dev": true,
2382
             "dependencies": {
2382
             "dependencies": {
2383
                 "esbuild": "^0.21.3",
2383
                 "esbuild": "^0.21.3",
2384
-                "postcss": "^8.4.38",
2384
+                "postcss": "^8.4.39",
2385
                 "rollup": "^4.13.0"
2385
                 "rollup": "^4.13.0"
2386
             },
2386
             },
2387
             "bin": {
2387
             "bin": {

+ 143
- 0
resources/views/components/company/reports/account-transactions-report-pdf.blade.php View File

1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+    <meta name="viewport" content="width=device-width, initial-scale=1">
6
+    <title>{{ $report->getTitle() }}</title>
7
+    <style>
8
+        @page {
9
+            size: auto;
10
+            margin: 10mm 7.5mm;
11
+        }
12
+
13
+        .header {
14
+            color: #374151;
15
+            margin-bottom: 1rem;
16
+        }
17
+
18
+        .header > * + * {
19
+            margin-top: 0.5rem;
20
+        }
21
+
22
+        .table-head {
23
+            display: table-row-group;
24
+        }
25
+
26
+        .text-left {
27
+            text-align: left;
28
+        }
29
+
30
+        .text-right {
31
+            text-align: right;
32
+        }
33
+
34
+        .text-center {
35
+            text-align: center;
36
+        }
37
+
38
+        .table-class th,
39
+        .table-class td {
40
+            color: #374151;
41
+        }
42
+
43
+        .title {
44
+            font-size: 1.5rem;
45
+        }
46
+
47
+        .company-name {
48
+            font-size: 1.125rem;
49
+            font-weight: 600;
50
+        }
51
+
52
+        .date-range {
53
+            font-size: 0.875rem;
54
+        }
55
+
56
+        .table-class {
57
+            width: 100%;
58
+            border-collapse: collapse;
59
+        }
60
+
61
+        .table-class th,
62
+        .table-class td {
63
+            padding: 0.75rem;
64
+            font-size: 0.75rem;
65
+            line-height: 1rem;
66
+            border-bottom: 1px solid #d1d5db; /* Gray border for all rows */
67
+        }
68
+
69
+        .category-header-row > td {
70
+            background-color: #f3f4f6; /* Gray background for category names */
71
+            font-weight: 600;
72
+        }
73
+
74
+        .table-body tr {
75
+            background-color: #ffffff; /* White background for other rows */
76
+        }
77
+
78
+        .spacer-row > td {
79
+            height: 0.75rem;
80
+        }
81
+
82
+        .category-summary-row > td,
83
+        .table-footer-row > td {
84
+            font-weight: 600;
85
+            background-color: #ffffff; /* White background for footer */
86
+        }
87
+    </style>
88
+</head>
89
+<body>
90
+<div class="header">
91
+    <div class="title">{{ $report->getTitle() }}</div>
92
+    <div class="company-name">{{ $company->name }}</div>
93
+    <div class="date-range">Date Range: {{ $startDate }} to {{ $endDate }}</div>
94
+</div>
95
+<table class="table-class">
96
+    <thead class="table-head">
97
+    <tr>
98
+        @foreach($report->getHeaders() as $index => $header)
99
+            <th class="{{ $report->getAlignmentClass($index) }}">
100
+                {{ $header }}
101
+            </th>
102
+        @endforeach
103
+    </tr>
104
+    </thead>
105
+    @foreach($report->getCategories() as $category)
106
+        <tbody>
107
+        <tr class="category-header-row">
108
+            <td colspan="{{ count($report->getHeaders()) }}">
109
+                <div>
110
+                    @foreach($category->header as $headerRow)
111
+                        <div>
112
+                            @foreach($headerRow as $headerValue)
113
+                                @if (!empty($headerValue))
114
+                                    {{ $headerValue }}
115
+                                @endif
116
+                            @endforeach
117
+                        </div>
118
+                    @endforeach
119
+                </div>
120
+            </td>
121
+        </tr>
122
+        @foreach($category->data as $dataIndex => $transaction)
123
+            <tr
124
+                @class([
125
+                    'category-header-row' => $loop->first || $loop->last || $loop->remaining === 1,
126
+                ])>
127
+                @foreach($transaction as $cellIndex => $cell)
128
+                    <td class="{{ $report->getAlignmentClass($cellIndex) }}">
129
+                        {{ $cell }}
130
+                    </td>
131
+                @endforeach
132
+            </tr>
133
+        @endforeach
134
+        @unless($loop->last)
135
+            <tr class="spacer-row">
136
+                <td colspan="{{ count($report->getHeaders()) }}"></td>
137
+            </tr>
138
+        @endunless
139
+        </tbody>
140
+    @endforeach
141
+</table>
142
+</body>
143
+</html>

+ 9
- 19
resources/views/components/company/tables/reports/account-transactions.blade.php View File

16
             <tr class="bg-gray-50 dark:bg-white/5">
16
             <tr class="bg-gray-50 dark:bg-white/5">
17
                 <x-filament-tables::cell colspan="{{ count($report->getHeaders()) }}" class="text-left">
17
                 <x-filament-tables::cell colspan="{{ count($report->getHeaders()) }}" class="text-left">
18
                     <div class="px-3 py-2">
18
                     <div class="px-3 py-2">
19
-                        <div class="text-sm font-semibold text-gray-950 dark:text-white">
20
-                            {{ $category->header[0]['value'] }}
21
-                        </div>
22
-                        <div class="text-sm text-gray-700 dark:text-gray-300">
23
-                            {{ $category->header[1]['value'] }}
24
-                        </div>
19
+                        @foreach ($category->header as $headerRow)
20
+                            <div class="text-sm {{ $loop->first ? 'font-semibold text-gray-950 dark:text-white' : 'text-gray-500 dark:text-white/50' }}">
21
+                                @foreach ($headerRow as $headerValue)
22
+                                    @if (!empty($headerValue))
23
+                                        {{ $headerValue }}
24
+                                    @endif
25
+                                @endforeach
26
+                            </div>
27
+                        @endforeach
25
                     </div>
28
                     </div>
26
                 </x-filament-tables::cell>
29
                 </x-filament-tables::cell>
27
             </tr>
30
             </tr>
54
             @endunless
57
             @endunless
55
         </tbody>
58
         </tbody>
56
     @endforeach
59
     @endforeach
57
-    @if (filled($report->getOverallTotals()))
58
-        <tfoot>
59
-            <tr class="bg-gray-50 dark:bg-white/5">
60
-                @foreach($report->getOverallTotals() as $index => $total)
61
-                    <x-filament-tables::cell wire:key="footer-total-{{ $index }}" class="{{ $report->getAlignmentClass($index) }}">
62
-                        <div class="px-3 py-2 text-sm leading-6 font-semibold text-gray-950 dark:text-white">
63
-                            {{ $total }}
64
-                        </div>
65
-                    </x-filament-tables::cell>
66
-                @endforeach
67
-            </tr>
68
-        </tfoot>
69
-    @endif
70
 </table>
60
 </table>

+ 7
- 5
resources/views/filament/company/pages/reports/account-transactions.blade.php View File

5
                 <form wire:submit.prevent="loadReportData">
5
                 <form wire:submit.prevent="loadReportData">
6
                     <div class="flex flex-col lg:flex-row items-start lg:items-center justify-center gap-4 lg:gap-12">
6
                     <div class="flex flex-col lg:flex-row items-start lg:items-center justify-center gap-4 lg:gap-12">
7
                         {{ $this->form }}
7
                         {{ $this->form }}
8
-                        <x-filament-tables::column-toggle.dropdown
9
-                            class="my-auto"
10
-                            :form="$this->toggleTableColumnForm"
11
-                            :trigger-action="$this->toggleColumnsAction"
12
-                        />
8
+                        @if($this->hasToggleableColumns())
9
+                            <x-filament-tables::column-toggle.dropdown
10
+                                class="my-auto"
11
+                                :form="$this->toggleTableColumnForm"
12
+                                :trigger-action="$this->toggleColumnsAction"
13
+                            />
14
+                        @endif
13
                         <x-filament::button type="submit" class="flex-shrink-0">
15
                         <x-filament::button type="submit" class="flex-shrink-0">
14
                             Update Report
16
                             Update Report
15
                         </x-filament::button>
17
                         </x-filament::button>

+ 7
- 5
resources/views/filament/company/pages/reports/detailed-report.blade.php View File

5
                 <form wire:submit.prevent="loadReportData">
5
                 <form wire:submit.prevent="loadReportData">
6
                     <div class="flex flex-col lg:flex-row items-start lg:items-center justify-center gap-4 lg:gap-12">
6
                     <div class="flex flex-col lg:flex-row items-start lg:items-center justify-center gap-4 lg:gap-12">
7
                         {{ $this->form }}
7
                         {{ $this->form }}
8
-                        <x-filament-tables::column-toggle.dropdown
9
-                            class="my-auto"
10
-                            :form="$this->toggleTableColumnForm"
11
-                            :trigger-action="$this->toggleColumnsAction"
12
-                        />
8
+                        @if($this->hasToggleableColumns())
9
+                            <x-filament-tables::column-toggle.dropdown
10
+                                class="my-auto"
11
+                                :form="$this->toggleTableColumnForm"
12
+                                :trigger-action="$this->toggleColumnsAction"
13
+                            />
14
+                        @endif
13
                         <x-filament::button type="submit" class="flex-shrink-0">
15
                         <x-filament::button type="submit" class="flex-shrink-0">
14
                             Update Report
16
                             Update Report
15
                         </x-filament::button>
17
                         </x-filament::button>

Loading…
Cancel
Save