Andrew Wallo 10 months ago
parent
commit
cc9baaea4b

+ 51
- 33
app/Filament/Company/Resources/Sales/InvoiceResource/Pages/ViewInvoice.php View File

6
 use App\Filament\Company\Resources\Sales\InvoiceResource;
6
 use App\Filament\Company\Resources\Sales\InvoiceResource;
7
 use App\Models\Accounting\Invoice;
7
 use App\Models\Accounting\Invoice;
8
 use Filament\Actions;
8
 use Filament\Actions;
9
+use Filament\Infolists\Components\Grid;
9
 use Filament\Infolists\Components\Section;
10
 use Filament\Infolists\Components\Section;
10
 use Filament\Infolists\Components\TextEntry;
11
 use Filament\Infolists\Components\TextEntry;
12
+use Filament\Infolists\Components\ViewEntry;
11
 use Filament\Infolists\Infolist;
13
 use Filament\Infolists\Infolist;
12
 use Filament\Resources\Pages\ViewRecord;
14
 use Filament\Resources\Pages\ViewRecord;
13
 use Filament\Support\Enums\FontWeight;
15
 use Filament\Support\Enums\FontWeight;
14
 use Filament\Support\Enums\IconPosition;
16
 use Filament\Support\Enums\IconPosition;
15
 use Filament\Support\Enums\IconSize;
17
 use Filament\Support\Enums\IconSize;
18
+use Filament\Support\Enums\MaxWidth;
16
 
19
 
17
 class ViewInvoice extends ViewRecord
20
 class ViewInvoice extends ViewRecord
18
 {
21
 {
22
+    protected static string $view = 'filament.company.resources.sales.invoices.pages.view-invoice';
23
+
19
     protected static string $resource = InvoiceResource::class;
24
     protected static string $resource = InvoiceResource::class;
20
 
25
 
21
     protected $listeners = [
26
     protected $listeners = [
22
         'refresh' => '$refresh',
27
         'refresh' => '$refresh',
23
     ];
28
     ];
24
 
29
 
30
+    public function getMaxContentWidth(): MaxWidth | string | null
31
+    {
32
+        return MaxWidth::SixExtraLarge;
33
+    }
34
+
25
     protected function getHeaderActions(): array
35
     protected function getHeaderActions(): array
26
     {
36
     {
27
         return [
37
         return [
49
                 Section::make('Invoice Details')
59
                 Section::make('Invoice Details')
50
                     ->columns(4)
60
                     ->columns(4)
51
                     ->schema([
61
                     ->schema([
52
-                        TextEntry::make('invoice_number')
53
-                            ->label('Invoice #'),
54
-                        TextEntry::make('status')
55
-                            ->badge(),
56
-                        TextEntry::make('client.name')
57
-                            ->label('Client')
58
-                            ->color('primary')
59
-                            ->weight(FontWeight::SemiBold)
60
-                            ->url(static fn (Invoice $record) => ClientResource::getUrl('edit', ['record' => $record->client_id])),
61
-                        TextEntry::make('total')
62
-                            ->label('Total')
63
-                            ->money(),
64
-                        TextEntry::make('amount_due')
65
-                            ->label('Amount Due')
66
-                            ->money(),
67
-                        TextEntry::make('date')
68
-                            ->label('Date')
69
-                            ->date(),
70
-                        TextEntry::make('due_date')
71
-                            ->label('Due')
72
-                            ->asRelativeDay(),
73
-                        TextEntry::make('approved_at')
74
-                            ->label('Approved At')
75
-                            ->placeholder('Not Approved')
76
-                            ->date(),
77
-                        TextEntry::make('last_sent')
78
-                            ->label('Last Sent')
79
-                            ->placeholder('Never')
80
-                            ->date(),
81
-                        TextEntry::make('paid_at')
82
-                            ->label('Paid At')
83
-                            ->placeholder('Not Paid')
84
-                            ->date(),
62
+                        Grid::make(1)
63
+                            ->schema([
64
+                                TextEntry::make('invoice_number')
65
+                                    ->label('Invoice #'),
66
+                                TextEntry::make('status')
67
+                                    ->badge(),
68
+                                TextEntry::make('client.name')
69
+                                    ->label('Client')
70
+                                    ->color('primary')
71
+                                    ->weight(FontWeight::SemiBold)
72
+                                    ->url(static fn (Invoice $record) => ClientResource::getUrl('edit', ['record' => $record->client_id])),
73
+                                TextEntry::make('amount_due')
74
+                                    ->label('Amount Due')
75
+                                    ->money(),
76
+                                TextEntry::make('due_date')
77
+                                    ->label('Due')
78
+                                    ->asRelativeDay(),
79
+                                TextEntry::make('approved_at')
80
+                                    ->label('Approved At')
81
+                                    ->placeholder('Not Approved')
82
+                                    ->date(),
83
+                                TextEntry::make('last_sent')
84
+                                    ->label('Last Sent')
85
+                                    ->placeholder('Never')
86
+                                    ->date(),
87
+                                TextEntry::make('paid_at')
88
+                                    ->label('Paid At')
89
+                                    ->placeholder('Not Paid')
90
+                                    ->date(),
91
+                            ])->columnSpan(1),
92
+                        Grid::make()
93
+                            ->schema([
94
+                                ViewEntry::make('invoice-view')
95
+                                    ->label('View Invoice')
96
+                                    ->columnSpan(3)
97
+                                    ->view('filament.company.resources.sales.invoices.components.invoice-view')
98
+                                    ->viewData([
99
+                                        'invoice' => $this->record,
100
+                                    ]),
101
+                            ])
102
+                            ->columnSpan(3),
85
                     ]),
103
                     ]),
86
             ]);
104
             ]);
87
     }
105
     }

+ 2
- 0
app/Filament/Company/Resources/Sales/InvoiceResource/RelationManagers/PaymentsRelationManager.php View File

28
 
28
 
29
     protected static ?string $modelLabel = 'Payment';
29
     protected static ?string $modelLabel = 'Payment';
30
 
30
 
31
+    protected static bool $isLazy = false;
32
+
31
     protected $listeners = [
33
     protected $listeners = [
32
         'refresh' => '$refresh',
34
         'refresh' => '$refresh',
33
     ];
35
     ];

+ 37
- 39
composer.lock View File

256
             "type": "library",
256
             "type": "library",
257
             "extra": {
257
             "extra": {
258
                 "laravel": {
258
                 "laravel": {
259
-                    "providers": [
260
-                        "Wallo\\Transmatic\\TransmaticServiceProvider"
261
-                    ],
262
                     "aliases": {
259
                     "aliases": {
263
                         "Transmatic": "Wallo\\Transmatic\\Facades\\Transmatic"
260
                         "Transmatic": "Wallo\\Transmatic\\Facades\\Transmatic"
264
-                    }
261
+                    },
262
+                    "providers": [
263
+                        "Wallo\\Transmatic\\TransmaticServiceProvider"
264
+                    ]
265
                 }
265
                 }
266
             },
266
             },
267
             "autoload": {
267
             "autoload": {
1317
         },
1317
         },
1318
         {
1318
         {
1319
             "name": "doctrine/deprecations",
1319
             "name": "doctrine/deprecations",
1320
-            "version": "1.1.3",
1320
+            "version": "1.1.4",
1321
             "source": {
1321
             "source": {
1322
                 "type": "git",
1322
                 "type": "git",
1323
                 "url": "https://github.com/doctrine/deprecations.git",
1323
                 "url": "https://github.com/doctrine/deprecations.git",
1324
-                "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab"
1324
+                "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9"
1325
             },
1325
             },
1326
             "dist": {
1326
             "dist": {
1327
                 "type": "zip",
1327
                 "type": "zip",
1328
-                "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab",
1329
-                "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab",
1328
+                "url": "https://api.github.com/repos/doctrine/deprecations/zipball/31610dbb31faa98e6b5447b62340826f54fbc4e9",
1329
+                "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9",
1330
                 "shasum": ""
1330
                 "shasum": ""
1331
             },
1331
             },
1332
             "require": {
1332
             "require": {
1333
                 "php": "^7.1 || ^8.0"
1333
                 "php": "^7.1 || ^8.0"
1334
             },
1334
             },
1335
             "require-dev": {
1335
             "require-dev": {
1336
-                "doctrine/coding-standard": "^9",
1337
-                "phpstan/phpstan": "1.4.10 || 1.10.15",
1338
-                "phpstan/phpstan-phpunit": "^1.0",
1336
+                "doctrine/coding-standard": "^9 || ^12",
1337
+                "phpstan/phpstan": "1.4.10 || 2.0.3",
1338
+                "phpstan/phpstan-phpunit": "^1.0 || ^2",
1339
                 "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
1339
                 "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
1340
-                "psalm/plugin-phpunit": "0.18.4",
1341
-                "psr/log": "^1 || ^2 || ^3",
1342
-                "vimeo/psalm": "4.30.0 || 5.12.0"
1340
+                "psr/log": "^1 || ^2 || ^3"
1343
             },
1341
             },
1344
             "suggest": {
1342
             "suggest": {
1345
                 "psr/log": "Allows logging deprecations via PSR-3 logger implementation"
1343
                 "psr/log": "Allows logging deprecations via PSR-3 logger implementation"
1347
             "type": "library",
1345
             "type": "library",
1348
             "autoload": {
1346
             "autoload": {
1349
                 "psr-4": {
1347
                 "psr-4": {
1350
-                    "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"
1348
+                    "Doctrine\\Deprecations\\": "src"
1351
                 }
1349
                 }
1352
             },
1350
             },
1353
             "notification-url": "https://packagist.org/downloads/",
1351
             "notification-url": "https://packagist.org/downloads/",
1358
             "homepage": "https://www.doctrine-project.org/",
1356
             "homepage": "https://www.doctrine-project.org/",
1359
             "support": {
1357
             "support": {
1360
                 "issues": "https://github.com/doctrine/deprecations/issues",
1358
                 "issues": "https://github.com/doctrine/deprecations/issues",
1361
-                "source": "https://github.com/doctrine/deprecations/tree/1.1.3"
1359
+                "source": "https://github.com/doctrine/deprecations/tree/1.1.4"
1362
             },
1360
             },
1363
-            "time": "2024-01-30T19:34:25+00:00"
1361
+            "time": "2024-12-07T21:18:45+00:00"
1364
         },
1362
         },
1365
         {
1363
         {
1366
             "name": "doctrine/inflector",
1364
             "name": "doctrine/inflector",
3706
         },
3704
         },
3707
         {
3705
         {
3708
             "name": "league/csv",
3706
             "name": "league/csv",
3709
-            "version": "9.18.0",
3707
+            "version": "9.19.0",
3710
             "source": {
3708
             "source": {
3711
                 "type": "git",
3709
                 "type": "git",
3712
                 "url": "https://github.com/thephpleague/csv.git",
3710
                 "url": "https://github.com/thephpleague/csv.git",
3713
-                "reference": "b02d010e4055ae992247f6ffd1e7b103ef2a0790"
3711
+                "reference": "f81df48a012a9e86d077e74eaff666fd15bfab88"
3714
             },
3712
             },
3715
             "dist": {
3713
             "dist": {
3716
                 "type": "zip",
3714
                 "type": "zip",
3717
-                "url": "https://api.github.com/repos/thephpleague/csv/zipball/b02d010e4055ae992247f6ffd1e7b103ef2a0790",
3718
-                "reference": "b02d010e4055ae992247f6ffd1e7b103ef2a0790",
3715
+                "url": "https://api.github.com/repos/thephpleague/csv/zipball/f81df48a012a9e86d077e74eaff666fd15bfab88",
3716
+                "reference": "f81df48a012a9e86d077e74eaff666fd15bfab88",
3719
                 "shasum": ""
3717
                 "shasum": ""
3720
             },
3718
             },
3721
             "require": {
3719
             "require": {
3727
                 "ext-xdebug": "*",
3725
                 "ext-xdebug": "*",
3728
                 "friendsofphp/php-cs-fixer": "^3.64.0",
3726
                 "friendsofphp/php-cs-fixer": "^3.64.0",
3729
                 "phpbench/phpbench": "^1.3.1",
3727
                 "phpbench/phpbench": "^1.3.1",
3730
-                "phpstan/phpstan": "^1.12.6",
3728
+                "phpstan/phpstan": "^1.12.11",
3731
                 "phpstan/phpstan-deprecation-rules": "^1.2.1",
3729
                 "phpstan/phpstan-deprecation-rules": "^1.2.1",
3732
-                "phpstan/phpstan-phpunit": "^1.4.0",
3730
+                "phpstan/phpstan-phpunit": "^1.4.1",
3733
                 "phpstan/phpstan-strict-rules": "^1.6.1",
3731
                 "phpstan/phpstan-strict-rules": "^1.6.1",
3734
-                "phpunit/phpunit": "^10.5.16 || ^11.4.1",
3735
-                "symfony/var-dumper": "^6.4.8 || ^7.1.5"
3732
+                "phpunit/phpunit": "^10.5.16 || ^11.4.3",
3733
+                "symfony/var-dumper": "^6.4.8 || ^7.1.8"
3736
             },
3734
             },
3737
             "suggest": {
3735
             "suggest": {
3738
                 "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes",
3736
                 "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes",
3789
                     "type": "github"
3787
                     "type": "github"
3790
                 }
3788
                 }
3791
             ],
3789
             ],
3792
-            "time": "2024-10-18T08:14:48+00:00"
3790
+            "time": "2024-12-08T08:09:35+00:00"
3793
         },
3791
         },
3794
         {
3792
         {
3795
             "name": "league/flysystem",
3793
             "name": "league/flysystem",
4057
         },
4055
         },
4058
         {
4056
         {
4059
             "name": "league/uri",
4057
             "name": "league/uri",
4060
-            "version": "7.4.1",
4058
+            "version": "7.5.1",
4061
             "source": {
4059
             "source": {
4062
                 "type": "git",
4060
                 "type": "git",
4063
                 "url": "https://github.com/thephpleague/uri.git",
4061
                 "url": "https://github.com/thephpleague/uri.git",
4064
-                "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4"
4062
+                "reference": "81fb5145d2644324614cc532b28efd0215bda430"
4065
             },
4063
             },
4066
             "dist": {
4064
             "dist": {
4067
                 "type": "zip",
4065
                 "type": "zip",
4068
-                "url": "https://api.github.com/repos/thephpleague/uri/zipball/bedb6e55eff0c933668addaa7efa1e1f2c417cc4",
4069
-                "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4",
4066
+                "url": "https://api.github.com/repos/thephpleague/uri/zipball/81fb5145d2644324614cc532b28efd0215bda430",
4067
+                "reference": "81fb5145d2644324614cc532b28efd0215bda430",
4070
                 "shasum": ""
4068
                 "shasum": ""
4071
             },
4069
             },
4072
             "require": {
4070
             "require": {
4073
-                "league/uri-interfaces": "^7.3",
4071
+                "league/uri-interfaces": "^7.5",
4074
                 "php": "^8.1"
4072
                 "php": "^8.1"
4075
             },
4073
             },
4076
             "conflict": {
4074
             "conflict": {
4135
                 "docs": "https://uri.thephpleague.com",
4133
                 "docs": "https://uri.thephpleague.com",
4136
                 "forum": "https://thephpleague.slack.com",
4134
                 "forum": "https://thephpleague.slack.com",
4137
                 "issues": "https://github.com/thephpleague/uri-src/issues",
4135
                 "issues": "https://github.com/thephpleague/uri-src/issues",
4138
-                "source": "https://github.com/thephpleague/uri/tree/7.4.1"
4136
+                "source": "https://github.com/thephpleague/uri/tree/7.5.1"
4139
             },
4137
             },
4140
             "funding": [
4138
             "funding": [
4141
                 {
4139
                 {
4143
                     "type": "github"
4141
                     "type": "github"
4144
                 }
4142
                 }
4145
             ],
4143
             ],
4146
-            "time": "2024-03-23T07:42:40+00:00"
4144
+            "time": "2024-12-08T08:40:02+00:00"
4147
         },
4145
         },
4148
         {
4146
         {
4149
             "name": "league/uri-interfaces",
4147
             "name": "league/uri-interfaces",
4150
-            "version": "7.4.1",
4148
+            "version": "7.5.0",
4151
             "source": {
4149
             "source": {
4152
                 "type": "git",
4150
                 "type": "git",
4153
                 "url": "https://github.com/thephpleague/uri-interfaces.git",
4151
                 "url": "https://github.com/thephpleague/uri-interfaces.git",
4154
-                "reference": "8d43ef5c841032c87e2de015972c06f3865ef718"
4152
+                "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742"
4155
             },
4153
             },
4156
             "dist": {
4154
             "dist": {
4157
                 "type": "zip",
4155
                 "type": "zip",
4158
-                "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/8d43ef5c841032c87e2de015972c06f3865ef718",
4159
-                "reference": "8d43ef5c841032c87e2de015972c06f3865ef718",
4156
+                "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/08cfc6c4f3d811584fb09c37e2849e6a7f9b0742",
4157
+                "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742",
4160
                 "shasum": ""
4158
                 "shasum": ""
4161
             },
4159
             },
4162
             "require": {
4160
             "require": {
4219
                 "docs": "https://uri.thephpleague.com",
4217
                 "docs": "https://uri.thephpleague.com",
4220
                 "forum": "https://thephpleague.slack.com",
4218
                 "forum": "https://thephpleague.slack.com",
4221
                 "issues": "https://github.com/thephpleague/uri-src/issues",
4219
                 "issues": "https://github.com/thephpleague/uri-src/issues",
4222
-                "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.1"
4220
+                "source": "https://github.com/thephpleague/uri-interfaces/tree/7.5.0"
4223
             },
4221
             },
4224
             "funding": [
4222
             "funding": [
4225
                 {
4223
                 {
4227
                     "type": "github"
4225
                     "type": "github"
4228
                 }
4226
                 }
4229
             ],
4227
             ],
4230
-            "time": "2024-03-23T07:42:40+00:00"
4228
+            "time": "2024-12-08T08:18:47+00:00"
4231
         },
4229
         },
4232
         {
4230
         {
4233
             "name": "livewire/livewire",
4231
             "name": "livewire/livewire",

+ 11
- 1
resources/views/components/company/invoice/container.blade.php View File

1
+@props([
2
+    'preview' => false,
3
+])
4
+
1
 <div class="inv-container flex justify-center p-6">
5
 <div class="inv-container flex justify-center p-6">
2
-    <div class="inv-paper bg-[#ffffff] dark:bg-gray-800 rounded-sm shadow-xl w-[38.25rem] h-[49.5rem] overflow-hidden">
6
+    <div
7
+        @class([
8
+            'inv-paper bg-[#ffffff] dark:bg-gray-800 rounded-sm shadow-xl',
9
+            'w-full max-w-[820px] min-h-[1024px]' => $preview === false,
10
+            'w-[38.25rem] h-[49.5rem] overflow-hidden' => $preview === true,
11
+        ])
12
+    >
3
         {{ $slot }}
13
         {{ $slot }}
4
     </div>
14
     </div>
5
 </div>
15
 </div>

+ 1
- 1
resources/views/components/company/invoice/footer.blade.php View File

1
-<footer {{ $attributes->class(['inv-footer text-xs text-gray-600 dark:text-gray-300']) }}>
1
+<footer {{ $attributes->class(['inv-footer text-xs text-gray-600 dark:text-gray-300 min-h-60']) }}>
2
     {{ $slot }}
2
     {{ $slot }}
3
 </footer>
3
 </footer>

+ 1
- 1
resources/views/filament/company/components/invoice-layouts/classic.blade.php View File

13
     }
13
     }
14
 </style>
14
 </style>
15
 
15
 
16
-<x-company.invoice.container class="classic-template-container">
16
+<x-company.invoice.container class="classic-template-container" preview>
17
     <!-- Header Section -->
17
     <!-- Header Section -->
18
     <x-company.invoice.header class="default-template-header">
18
     <x-company.invoice.header class="default-template-header">
19
         <div class="w-2/3 text-left ml-6">
19
         <div class="w-2/3 text-left ml-6">

+ 1
- 1
resources/views/filament/company/components/invoice-layouts/default.blade.php View File

13
     }
13
     }
14
 </style>
14
 </style>
15
 
15
 
16
-<x-company.invoice.container class="default-template-container">
16
+<x-company.invoice.container class="default-template-container" preview>
17
 
17
 
18
     <x-company.invoice.header class="default-template-header border-b-2 p-6 pb-4">
18
     <x-company.invoice.header class="default-template-header border-b-2 p-6 pb-4">
19
         <div class="w-2/3">
19
         <div class="w-2/3">

+ 1
- 1
resources/views/filament/company/components/invoice-layouts/modern.blade.php View File

13
     }
13
     }
14
 </style>
14
 </style>
15
 
15
 
16
-<x-company.invoice.container class="modern-template-container">
16
+<x-company.invoice.container class="modern-template-container" preview>
17
 
17
 
18
     <!-- Colored Header with Logo -->
18
     <!-- Colored Header with Logo -->
19
     <x-company.invoice.header class="bg-gray-800 h-20">
19
     <x-company.invoice.header class="bg-gray-800 h-20">

+ 169
- 0
resources/views/filament/company/resources/sales/invoices/components/invoice-view.blade.php View File

1
+@php
2
+    /** @var \App\Models\Accounting\Invoice $invoice */
3
+    $invoiceSettings = $invoice->company->defaultInvoice;
4
+
5
+    $company = $invoice->company;
6
+
7
+    use App\Utilities\Currency\CurrencyConverter;
8
+@endphp
9
+
10
+<x-company.invoice.container class="modern-template-container">
11
+    <!-- Colored Header with Logo -->
12
+    <x-company.invoice.header class="bg-gray-800 h-24">
13
+        <!-- Logo -->
14
+        <div class="w-2/3">
15
+            @if($invoice->logo && $invoiceSettings->show_logo)
16
+                <x-company.invoice.logo class="ml-8" :src="$invoice->logo"/>
17
+            @endif
18
+        </div>
19
+
20
+        <!-- Ribbon Container -->
21
+        <div class="w-1/3 absolute right-0 top-0 p-3 h-32 flex flex-col justify-end rounded-bl-sm"
22
+             style="background: {{ $invoiceSettings->accent_color }};">
23
+            @if($invoice->header)
24
+                <h1 class="text-4xl font-bold text-white text-center uppercase">{{ $invoice->header }}</h1>
25
+            @endif
26
+        </div>
27
+    </x-company.invoice.header>
28
+
29
+    <!-- Company Details -->
30
+    <x-company.invoice.metadata class="modern-template-metadata space-y-8">
31
+        <div class="text-sm">
32
+            <h2 class="text-lg font-semibold">{{ $company->name }}</h2>
33
+            @if($company->profile->address && $company->profile->city?->name && $company->profile->state?->name && $company->profile?->zip_code)
34
+                <p>{{ $company->profile->address }}</p>
35
+                <p>{{ $company->profile->city->name }}
36
+                    , {{ $company->profile->state->name }} {{ $company->profile->zip_code }}</p>
37
+                <p>{{ $company->profile->state->country->name }}</p>
38
+            @endif
39
+        </div>
40
+
41
+        <div class="flex justify-between items-end">
42
+            <!-- Billing Details -->
43
+            <div class="text-sm tracking-tight">
44
+                <h3 class="text-gray-600 dark:text-gray-400 font-medium tracking-tight mb-1">BILL TO</h3>
45
+                <p class="text-base font-bold"
46
+                   style="color: {{ $invoiceSettings->accent_color }}">{{ $invoice->client->name }}</p>
47
+
48
+                @if($invoice->client->billingAddress)
49
+                    @php
50
+                        $address = $invoice->client->billingAddress;
51
+                    @endphp
52
+                    @if($address->address_line_1)
53
+                        <p>{{ $address->address_line_1 }}</p>
54
+                    @endif
55
+                    @if($address->address_line_2)
56
+                        <p>{{ $address->address_line_2 }}</p>
57
+                    @endif
58
+                    <p>
59
+                        {{ $address->city }}{{ $address->state ? ', ' . $address->state : '' }}
60
+                        {{ $address->postal_code }}
61
+                    </p>
62
+                    @if($address->country)
63
+                        <p>{{ $address->country }}</p>
64
+                    @endif
65
+                @endif
66
+            </div>
67
+
68
+            <div class="text-sm tracking-tight">
69
+                <table class="min-w-full">
70
+                    <tbody>
71
+                    <tr>
72
+                        <td class="font-semibold text-right pr-2">Invoice Number:</td>
73
+                        <td class="text-left pl-2">{{ $invoice->invoice_number }}</td>
74
+                    </tr>
75
+                    @if($invoice->order_number)
76
+                        <tr>
77
+                            <td class="font-semibold text-right pr-2">P.O/S.O Number:</td>
78
+                            <td class="text-left pl-2">{{ $invoice->order_number }}</td>
79
+                        </tr>
80
+                    @endif
81
+                    <tr>
82
+                        <td class="font-semibold text-right pr-2">Invoice Date:</td>
83
+                        <td class="text-left pl-2">{{ $invoice->date->toDefaultDateFormat() }}</td>
84
+                    </tr>
85
+                    <tr>
86
+                        <td class="font-semibold text-right pr-2">Payment Due:</td>
87
+                        <td class="text-left pl-2">{{ $invoice->due_date->toDefaultDateFormat() }}</td>
88
+                    </tr>
89
+                    </tbody>
90
+                </table>
91
+            </div>
92
+        </div>
93
+    </x-company.invoice.metadata>
94
+
95
+    <!-- Line Items Table -->
96
+    <x-company.invoice.line-items class="modern-template-line-items">
97
+        <table class="w-full text-left table-fixed">
98
+            <thead class="text-sm leading-relaxed">
99
+            <tr class="text-gray-600 dark:text-gray-400">
100
+                <th class="text-left pl-6 w-[45%] py-4">Items</th>
101
+                <th class="text-center w-[15%] py-4">Quantity</th>
102
+                <th class="text-right w-[20%] py-4">Price</th>
103
+                <th class="text-right pr-6 w-[20%] py-4">Amount</th>
104
+            </tr>
105
+            </thead>
106
+            <tbody class="text-sm tracking-tight border-y-2">
107
+            @foreach($invoice->lineItems as $index => $item)
108
+                <tr @class(['bg-gray-100 dark:bg-gray-800' => $index % 2 === 0])>
109
+                    <td class="text-left pl-6 font-semibold py-3">
110
+                        {{ $item->offering->name }}
111
+                        @if($item->description)
112
+                            <div class="text-gray-600 font-normal line-clamp-2 mt-1">{{ $item->description }}</div>
113
+                        @endif
114
+                    </td>
115
+                    <td class="text-center py-3">{{ $item->quantity }}</td>
116
+                    <td class="text-right py-3">{{ CurrencyConverter::formatToMoney($item->unit_price) }}</td>
117
+                    <td class="text-right pr-6 py-3">{{ CurrencyConverter::formatToMoney($item->subtotal) }}</td>
118
+                </tr>
119
+            @endforeach
120
+            </tbody>
121
+            <tfoot class="text-sm tracking-tight">
122
+            <tr>
123
+                <td class="pl-6 py-2" colspan="2"></td>
124
+                <td class="text-right font-semibold py-2">Subtotal:</td>
125
+                <td class="text-right pr-6 py-2">{{ CurrencyConverter::formatToMoney($invoice->subtotal) }}</td>
126
+            </tr>
127
+            @if($invoice->discount_total)
128
+                <tr class="text-success-800 dark:text-success-600">
129
+                    <td class="pl-6 py-2" colspan="2"></td>
130
+                    <td class="text-right py-2">Discount:</td>
131
+                    <td class="text-right pr-6 py-2">
132
+                        ({{ CurrencyConverter::formatToMoney($invoice->discount_total) }})
133
+                    </td>
134
+                </tr>
135
+            @endif
136
+            @if($invoice->tax_total)
137
+                <tr>
138
+                    <td class="pl-6 py-2" colspan="2"></td>
139
+                    <td class="text-right py-2">Tax:</td>
140
+                    <td class="text-right pr-6 py-2">{{ CurrencyConverter::formatToMoney($invoice->tax_total) }}</td>
141
+                </tr>
142
+            @endif
143
+            <tr>
144
+                <td class="pl-6 py-2" colspan="2"></td>
145
+                <td class="text-right font-semibold border-t py-2">Total:</td>
146
+                <td class="text-right border-t pr-6 py-2">{{ CurrencyConverter::formatToMoney($invoice->total) }}</td>
147
+            </tr>
148
+            <tr>
149
+                <td class="pl-6 py-2" colspan="2"></td>
150
+                <td class="text-right font-semibold border-t-4 border-double py-2">Amount Due
151
+                    ({{ $invoice->currency_code }}):
152
+                </td>
153
+                <td class="text-right border-t-4 border-double pr-6 py-2">{{ CurrencyConverter::formatToMoney($invoice->amount_due) }}</td>
154
+            </tr>
155
+            </tfoot>
156
+        </table>
157
+    </x-company.invoice.line-items>
158
+
159
+    <!-- Footer Notes -->
160
+    <x-company.invoice.footer class="modern-template-footer tracking-tight">
161
+        <h4 class="font-semibold px-6 text-sm" style="color: {{ $invoiceSettings->accent_color }}">Terms &
162
+            Conditions</h4>
163
+        <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
164
+        <div class="flex justify-between space-x-4 px-6 text-sm">
165
+            <p class="w-1/2 break-words line-clamp-4">{{ $invoice->terms }}</p>
166
+            <p class="w-1/2 break-words line-clamp-4">{{ $invoice->footer }}</p>
167
+        </div>
168
+    </x-company.invoice.footer>
169
+</x-company.invoice.container>

+ 47
- 0
resources/views/filament/company/resources/sales/invoices/pages/view-invoice.blade.php View File

1
+<x-filament-panels::page
2
+    @class([
3
+        'fi-resource-view-record-page',
4
+        'fi-resource-' . str_replace('/', '-', $this->getResource()::getSlug()),
5
+        'fi-resource-record-' . $record->getKey(),
6
+    ])
7
+>
8
+    @php
9
+        $relationManagers = $this->getRelationManagers();
10
+        $hasCombinedRelationManagerTabsWithContent = $this->hasCombinedRelationManagerTabsWithContent();
11
+    @endphp
12
+
13
+    @if ((! $hasCombinedRelationManagerTabsWithContent) || (! count($relationManagers)))
14
+        @if ($this->hasInfolist())
15
+            {{ $this->infolist }}
16
+        @else
17
+            <div
18
+                wire:key="{{ $this->getId() }}.forms.{{ $this->getFormStatePath() }}"
19
+            >
20
+                {{ $this->form }}
21
+            </div>
22
+        @endif
23
+    @endif
24
+
25
+    @if (count($relationManagers))
26
+        <x-filament-panels::resources.relation-managers
27
+            :active-locale="isset($activeLocale) ? $activeLocale : null"
28
+            :active-manager="$this->activeRelationManager ?? ($hasCombinedRelationManagerTabsWithContent ? null : array_key_first($relationManagers))"
29
+            :content-tab-label="$this->getContentTabLabel()"
30
+            :content-tab-icon="$this->getContentTabIcon()"
31
+            :content-tab-position="$this->getContentTabPosition()"
32
+            :managers="$relationManagers"
33
+            :owner-record="$record"
34
+            :page-class="static::class"
35
+        >
36
+            @if ($hasCombinedRelationManagerTabsWithContent)
37
+                <x-slot name="content">
38
+                    @if ($this->hasInfolist())
39
+                        {{ $this->infolist }}
40
+                    @else
41
+                        {{ $this->form }}
42
+                    @endif
43
+                </x-slot>
44
+            @endif
45
+        </x-filament-panels::resources.relation-managers>
46
+    @endif
47
+</x-filament-panels::page>

Loading…
Cancel
Save