Andrew Wallo 5 meses atrás
pai
commit
7ff767266c

+ 3
- 0
app/Enums/Setting/Template.php Ver arquivo

@@ -2,10 +2,13 @@
2 2
 
3 3
 namespace App\Enums\Setting;
4 4
 
5
+use App\Enums\Concerns\ParsesEnum;
5 6
 use Filament\Support\Contracts\HasLabel;
6 7
 
7 8
 enum Template: string implements HasLabel
8 9
 {
10
+    use ParsesEnum;
11
+
9 12
     case Default = 'default';
10 13
     case Modern = 'modern';
11 14
     case Classic = 'classic';

+ 5
- 18
app/Filament/Company/Clusters/Settings/Resources/DocumentDefaultResource.php Ver arquivo

@@ -9,6 +9,7 @@ use App\Enums\Setting\PaymentTerms;
9 9
 use App\Enums\Setting\Template;
10 10
 use App\Filament\Company\Clusters\Settings;
11 11
 use App\Filament\Company\Clusters\Settings\Resources\DocumentDefaultResource\Pages;
12
+use App\Filament\Forms\Components\DocumentPreview;
12 13
 use App\Models\Setting\DocumentDefault;
13 14
 use Filament\Forms;
14 15
 use Filament\Forms\Components\Component;
@@ -128,24 +129,10 @@ class DocumentDefaultResource extends Resource
128 129
                             ->options(Template::class),
129 130
                         ...static::getColumnLabelsSchema(),
130 131
                     ])->columnSpan(1),
131
-                Forms\Components\Grid::make()
132
-                    ->schema([
133
-                        Forms\Components\ViewField::make('preview.default')
134
-                            ->columnSpan(2)
135
-                            ->hiddenLabel()
136
-                            ->visible(static fn (Get $get) => $get('template') === 'default')
137
-                            ->view('filament.company.components.document-templates.default'),
138
-                        Forms\Components\ViewField::make('preview.modern')
139
-                            ->columnSpan(2)
140
-                            ->hiddenLabel()
141
-                            ->visible(static fn (Get $get) => $get('template') === 'modern')
142
-                            ->view('filament.company.components.document-templates.modern'),
143
-                        Forms\Components\ViewField::make('preview.classic')
144
-                            ->columnSpan(2)
145
-                            ->hiddenLabel()
146
-                            ->visible(static fn (Get $get) => $get('template') === 'classic')
147
-                            ->view('filament.company.components.document-templates.classic'),
148
-                    ])->columnSpan([
132
+                DocumentPreview::make()
133
+                    ->template(static fn (Get $get) => Template::parse($get('template')))
134
+                    ->preview()
135
+                    ->columnSpan([
149 136
                         'lg' => 2,
150 137
                     ]),
151 138
             ])->columns(3);

+ 45
- 0
app/Filament/Forms/Components/DocumentPreview.php Ver arquivo

@@ -0,0 +1,45 @@
1
+<?php
2
+
3
+namespace App\Filament\Forms\Components;
4
+
5
+use App\Enums\Setting\Template;
6
+use Closure;
7
+use Filament\Forms\Components\Grid;
8
+
9
+class DocumentPreview extends Grid
10
+{
11
+    protected string $view = 'filament.forms.components.document-preview';
12
+
13
+    protected bool | Closure $isPreview = false;
14
+
15
+    protected Template | Closure $template = Template::Default;
16
+
17
+    protected function setUp(): void
18
+    {
19
+        parent::setUp();
20
+    }
21
+
22
+    public function preview(bool | Closure $condition = true): static
23
+    {
24
+        $this->isPreview = $condition;
25
+
26
+        return $this;
27
+    }
28
+
29
+    public function template(Template | Closure $template): static
30
+    {
31
+        $this->template = $template;
32
+
33
+        return $this;
34
+    }
35
+
36
+    public function isPreview(): bool
37
+    {
38
+        return (bool) $this->evaluate($this->isPreview);
39
+    }
40
+
41
+    public function getTemplate(): Template
42
+    {
43
+        return $this->evaluate($this->template);
44
+    }
45
+}

+ 15
- 0
app/Filament/Infolists/Components/DocumentPreview.php Ver arquivo

@@ -5,6 +5,7 @@ namespace App\Filament\Infolists\Components;
5 5
 use App\Enums\Accounting\DocumentType;
6 6
 use App\Enums\Setting\Template;
7 7
 use App\Models\Setting\DocumentDefault;
8
+use Closure;
8 9
 use Filament\Infolists\Components\Grid;
9 10
 
10 11
 class DocumentPreview extends Grid
@@ -13,6 +14,8 @@ class DocumentPreview extends Grid
13 14
 
14 15
     protected DocumentType $documentType = DocumentType::Invoice;
15 16
 
17
+    protected bool | Closure $isPreview = false;
18
+
16 19
     protected function setUp(): void
17 20
     {
18 21
         parent::setUp();
@@ -31,11 +34,23 @@ class DocumentPreview extends Grid
31 34
         return $this;
32 35
     }
33 36
 
37
+    public function preview(bool | Closure $condition = true): static
38
+    {
39
+        $this->isPreview = $condition;
40
+
41
+        return $this;
42
+    }
43
+
34 44
     public function getType(): DocumentType
35 45
     {
36 46
         return $this->documentType;
37 47
     }
38 48
 
49
+    public function isPreview(): bool
50
+    {
51
+        return (bool) $this->evaluate($this->isPreview);
52
+    }
53
+
39 54
     public function getTemplate(): Template
40 55
     {
41 56
         if ($this->documentType === DocumentType::RecurringInvoice) {

+ 25
- 0
resources/css/filament/company/theme.css Ver arquivo

@@ -105,3 +105,28 @@
105 105
 .doc-template-container {
106 106
     color: initial;
107 107
 }
108
+
109
+.doc-template-container .overflow-x-auto,
110
+.doc-template-paper {
111
+    scrollbar-width: thin;
112
+}
113
+
114
+.doc-template-paper.preview {
115
+    zoom: 0.5;
116
+}
117
+
118
+@media (min-width: 1024px) {
119
+    .doc-template-paper.preview {
120
+        zoom: 0.85;
121
+    }
122
+}
123
+
124
+.doc-template-paper:not(.preview) {
125
+    zoom: 0.65;
126
+}
127
+
128
+@media (min-width: 1024px) {
129
+    .doc-template-paper:not(.preview) {
130
+        zoom: 1;
131
+    }
132
+}

+ 4
- 8
resources/views/components/company/document-template/container.blade.php Ver arquivo

@@ -5,18 +5,14 @@
5 5
 <div
6 6
     @class([
7 7
         'doc-template-container flex justify-center',
8
-        'scale-[0.85] origin-top' => $preview === true,
9 8
     ])
10 9
 >
11
-    <div class="overflow-auto">
10
+    <div class="max-w-full overflow-x-auto shadow-xl ring-1 ring-gray-950/5 dark:ring-white/10">
12 11
         <div
13 12
             @class([
14
-                'doc-template-paper bg-[#ffffff] shadow-xl ring-1 ring-gray-950/5 dark:ring-white/10',
15
-                'w-[51.25rem] h-[64rem]' => $preview === false,
16
-                'w-[48rem] h-[61.75rem]' => $preview === true,
17
-            ])
18
-            @style([
19
-                'scrollbar-width: thin;' => $preview === false,
13
+                'doc-template-paper bg-[#ffffff] overflow-y-auto',
14
+                'w-[51.25rem] h-[64rem]' => ! $preview,
15
+                'w-[48rem] min-h-[61.75rem] preview' => $preview,
20 16
             ])
21 17
         >
22 18
             {{ $slot }}

+ 1
- 1
resources/views/components/company/document-template/footer.blade.php Ver arquivo

@@ -1,3 +1,3 @@
1
-<footer {{ $attributes->class(['doc-template-footer']) }}>
1
+<footer {{ $attributes->class(['doc-template-footer min-h-48']) }}>
2 2
     {{ $slot }}
3 3
 </footer>

+ 13
- 26
resources/views/filament/company/components/document-templates/classic.blade.php Ver arquivo

@@ -1,22 +1,9 @@
1
-@php
2
-    $data = $this->form->getRawState();
3
-    $document = \App\DTO\DocumentPreviewDTO::fromSettings($this->record, $data);
4
-@endphp
5
-
6
-{!! $document->getFontHtml() !!}
7
-
8
-<style>
9
-    .doc-template-paper {
10
-        font-family: '{{ $document->font->getLabel() }}', sans-serif;
11
-    }
12
-</style>
13
-
14
-<x-company.document-template.container class="classic-template-container" preview>
1
+<x-company.document-template.container class="classic-template-container" :preview="$preview">
15 2
     <!-- Header Section -->
16 3
     <x-company.document-template.header class="classic-template-header">
17 4
         <div class="w-2/3 text-left">
18
-            <div class="text-xs">
19
-                <strong class="text-xs block">{{ $document->company->name }}</strong>
5
+            <div class="text-sm">
6
+                <strong class="text-sm block">{{ $document->company->name }}</strong>
20 7
                 @if($formattedAddress = $document->company->getFormattedAddressHtml())
21 8
                     {!! $formattedAddress !!}
22 9
                 @endif
@@ -36,25 +23,25 @@
36 23
             <x-icons.document-header-decoration
37 24
                 color="{{ $document->accentColor }}"
38 25
                 text="{{ $document->header }}"
39
-                class="w-48"
26
+                class="w-60"
40 27
             />
41 28
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
42 29
         </div>
43 30
         @if ($document->subheader)
44
-            <p class="text-xs text-center text-gray-600">{{ $document->subheader }}</p>
31
+            <p class="text-sm text-center text-gray-600">{{ $document->subheader }}</p>
45 32
         @endif
46 33
 
47 34
         <div class="flex justify-between items-end">
48 35
             <!-- Billing Details -->
49
-            <div class="text-xs">
36
+            <div class="text-sm">
50 37
                 <h3 class="text-gray-600 font-medium mb-1">BILL TO</h3>
51
-                <p class="text-xs font-bold">{{ $document->client->name }}</p>
38
+                <p class="text-sm font-bold">{{ $document->client->name }}</p>
52 39
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
53 40
                     {!! $formattedAddress !!}
54 41
                 @endif
55 42
             </div>
56 43
 
57
-            <div class="text-xs">
44
+            <div class="text-sm">
58 45
                 <table class="min-w-full">
59 46
                     <tbody>
60 47
                     <tr>
@@ -84,7 +71,7 @@
84 71
     <!-- Line Items -->
85 72
     <x-company.document-template.line-items class="classic-template-line-items px-6">
86 73
         <table class="w-full text-left table-fixed">
87
-            <thead class="text-xs leading-relaxed">
74
+            <thead class="text-sm leading-relaxed">
88 75
             <tr>
89 76
                 <th class="text-left w-[50%] py-4">{{ $document->columnLabel->items }}</th>
90 77
                 <th class="text-center w-[10%] py-4">{{ $document->columnLabel->units }}</th>
@@ -92,7 +79,7 @@
92 79
                 <th class="text-right w-[20%] py-4">{{ $document->columnLabel->amount }}</th>
93 80
             </tr>
94 81
             </thead>
95
-            <tbody class="text-xs border-y-2 border-dotted border-gray-300">
82
+            <tbody class="text-sm border-y-2 border-dotted border-gray-300">
96 83
             @foreach($document->lineItems as $item)
97 84
                 <tr>
98 85
                     <td class="text-left font-semibold py-3">
@@ -110,7 +97,7 @@
110 97
         </table>
111 98
 
112 99
         <!-- Financial Details and Notes -->
113
-        <div class="flex justify-between text-xs space-x-1 pt-4">
100
+        <div class="flex justify-between text-sm space-x-1 pt-4">
114 101
             <!-- Notes Section -->
115 102
             <div class="w-[60%] py-2">
116 103
                 <p class="font-semibold">{{ $document->footer }}</p>
@@ -119,7 +106,7 @@
119 106
             <!-- Financial Summary -->
120 107
             <div class="w-[40%]">
121 108
                 <table class="w-full table-fixed whitespace-nowrap">
122
-                    <tbody class="text-xs">
109
+                    <tbody class="text-sm">
123 110
                     @if($document->subtotal)
124 111
                         <tr>
125 112
                             <td class="text-right font-semibold py-2">Subtotal:</td>
@@ -159,7 +146,7 @@
159 146
     </x-company.document-template.line-items>
160 147
 
161 148
     <!-- Footer -->
162
-    <x-company.document-template.footer class="classic-template-footer p-6 text-xs">
149
+    <x-company.document-template.footer class="classic-template-footer p-6 text-sm">
163 150
         <h4 class="font-semibold mb-2">Terms & Conditions</h4>
164 151
         <p class="break-words line-clamp-4">{{ $document->terms }}</p>
165 152
     </x-company.document-template.footer>

+ 11
- 24
resources/views/filament/company/components/document-templates/default.blade.php Ver arquivo

@@ -1,17 +1,4 @@
1
-@php
2
-    $data = $this->form->getRawState();
3
-    $document = \App\DTO\DocumentPreviewDTO::fromSettings($this->record, $data);
4
-@endphp
5
-
6
-{!! $document->getFontHtml() !!}
7
-
8
-<style>
9
-    .doc-template-paper {
10
-        font-family: '{{ $document->font->getLabel() }}', sans-serif;
11
-    }
12
-</style>
13
-
14
-<x-company.document-template.container class="default-template-container" preview>
1
+<x-company.document-template.container class="default-template-container" :preview="$preview">
15 2
 
16 3
     <x-company.document-template.header class="default-template-header border-b">
17 4
         <div class="w-1/3">
@@ -25,11 +12,11 @@
25 12
                 <div>
26 13
                     <h1 class="text-3xl font-light uppercase">{{ $document->header }}</h1>
27 14
                     @if ($document->subheader)
28
-                        <p class="text-xs text-gray-600">{{ $document->subheader }}</p>
15
+                        <p class="text-sm text-gray-600">{{ $document->subheader }}</p>
29 16
                     @endif
30 17
                 </div>
31
-                <div class="text-xs">
32
-                    <strong class="text-xs block">{{ $document->company->name }}</strong>
18
+                <div class="text-sm">
19
+                    <strong class="text-sm block">{{ $document->company->name }}</strong>
33 20
                     @if($formattedAddress = $document->company->getFormattedAddressHtml())
34 21
                         {!! $formattedAddress !!}
35 22
                     @endif
@@ -41,15 +28,15 @@
41 28
     <x-company.document-template.metadata class="default-template-metadata space-y-4">
42 29
         <div class="flex justify-between items-end">
43 30
             <!-- Billing Details -->
44
-            <div class="text-xs">
31
+            <div class="text-sm">
45 32
                 <h3 class="text-gray-600 font-medium mb-1">BILL TO</h3>
46
-                <p class="text-xs font-bold">{{ $document->client->name }}</p>
33
+                <p class="text-sm font-bold">{{ $document->client->name }}</p>
47 34
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
48 35
                     {!! $formattedAddress !!}
49 36
                 @endif
50 37
             </div>
51 38
 
52
-            <div class="text-xs">
39
+            <div class="text-sm">
53 40
                 <table class="min-w-full">
54 41
                     <tbody>
55 42
                     <tr>
@@ -79,7 +66,7 @@
79 66
     <!-- Line Items Table -->
80 67
     <x-company.document-template.line-items class="default-template-line-items">
81 68
         <table class="w-full text-left table-fixed">
82
-            <thead class="text-xs leading-relaxed" style="background: {{ $document->accentColor }}">
69
+            <thead class="text-sm leading-relaxed" style="background: {{ $document->accentColor }}">
83 70
             <tr class="text-white">
84 71
                 <th class="text-left pl-6 w-[50%] py-2">{{ $document->columnLabel->items }}</th>
85 72
                 <th class="text-center w-[10%] py-2">{{ $document->columnLabel->units }}</th>
@@ -87,7 +74,7 @@
87 74
                 <th class="text-right pr-6 w-[20%] py-2">{{ $document->columnLabel->amount }}</th>
88 75
             </tr>
89 76
             </thead>
90
-            <tbody class="text-xs border-b-2 border-gray-300">
77
+            <tbody class="text-sm border-b-2 border-gray-300">
91 78
             @foreach($document->lineItems as $item)
92 79
                 <tr>
93 80
                     <td class="text-left pl-6 font-semibold py-3">
@@ -102,7 +89,7 @@
102 89
                 </tr>
103 90
             @endforeach
104 91
             </tbody>
105
-            <tfoot class="text-xs summary-section">
92
+            <tfoot class="text-sm summary-section">
106 93
             @if($document->subtotal)
107 94
                 <tr>
108 95
                     <td class="pl-6 py-2" colspan="2"></td>
@@ -145,7 +132,7 @@
145 132
     </x-company.document-template.line-items>
146 133
 
147 134
     <!-- Footer Notes -->
148
-    <x-company.document-template.footer class="classic-template-footer flex flex-col text-xs p-6">
135
+    <x-company.document-template.footer class="default-template-footer flex flex-col text-sm p-6">
149 136
         <div>
150 137
             <h4 class="font-semibold mb-2">Terms & Conditions</h4>
151 138
             <p class="break-words line-clamp-4">{{ $document->terms }}</p>

+ 2
- 15
resources/views/filament/company/components/document-templates/modern.blade.php Ver arquivo

@@ -1,17 +1,4 @@
1
-@php
2
-    $data = $this->form->getRawState();
3
-    $document = \App\DTO\DocumentPreviewDTO::fromSettings($this->record, $data);
4
-@endphp
5
-
6
-{!! $document->getFontHtml() !!}
7
-
8
-<style>
9
-    .doc-template-paper {
10
-        font-family: '{{ $document->font->getLabel() }}', sans-serif;
11
-    }
12
-</style>
13
-
14
-<x-company.document-template.container class="modern-template-container" preview>
1
+<x-company.document-template.container class="modern-template-container" :preview="$preview">
15 2
     <!-- Colored Header with Logo -->
16 3
     <x-company.document-template.header class="bg-gray-800 h-24">
17 4
         <!-- Logo -->
@@ -33,7 +20,7 @@
33 20
     <!-- Company Details -->
34 21
     <x-company.document-template.metadata class="modern-template-metadata space-y-8">
35 22
         <div class="text-sm">
36
-            <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
23
+            <strong class="text-sm block">{{ $document->company->name }}</strong>
37 24
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
38 25
                 {!! $formattedAddress !!}
39 26
             @endif

+ 21
- 0
resources/views/filament/forms/components/document-preview.blade.php Ver arquivo

@@ -0,0 +1,21 @@
1
+@php
2
+    $data = $this->form->getRawState();
3
+    $document = \App\DTO\DocumentPreviewDTO::fromSettings($this->record, $data);
4
+    $template = $getTemplate();
5
+    $preview = $isPreview();
6
+@endphp
7
+
8
+{!! $document->getFontHtml() !!}
9
+
10
+<style>
11
+    .doc-template-paper {
12
+        font-family: '{{ $document->font->getLabel() }}', sans-serif;
13
+    }
14
+</style>
15
+
16
+<div {{ $attributes }}>
17
+    @include("filament.company.components.document-templates.{$template->value}", [
18
+        'document' => $document,
19
+        'preview' => $preview,
20
+    ])
21
+</div>

+ 3
- 2
resources/views/filament/infolists/components/document-preview.blade.php Ver arquivo

@@ -1,6 +1,7 @@
1 1
 @php
2 2
     $document = \App\DTO\DocumentDTO::fromModel($getRecord());
3 3
     $template = $getTemplate();
4
+    $preview = $isPreview();
4 5
 @endphp
5 6
 
6 7
 {!! $document->getFontHtml() !!}
@@ -12,8 +13,8 @@
12 13
 </style>
13 14
 
14 15
 <div {{ $attributes }}>
15
-    @include("filament.infolists.components.document-templates.{$template->value}", [
16
+    @include("filament.company.components.document-templates.{$template->value}", [
16 17
         'document' => $document,
17
-        'preview' => false,
18
+        'preview' => $preview,
18 19
     ])
19 20
 </div>

+ 0
- 153
resources/views/filament/infolists/components/document-templates/classic.blade.php Ver arquivo

@@ -1,153 +0,0 @@
1
-<x-company.document-template.container class="classic-template-container">
2
-    <!-- Header Section -->
3
-    <x-company.document-template.header class="classic-template-header">
4
-        <div class="w-2/3 text-left">
5
-            <div class="text-sm">
6
-                <strong class="text-sm block">{{ $document->company->name }}</strong>
7
-                @if($formattedAddress = $document->company->getFormattedAddressHtml())
8
-                    {!! $formattedAddress !!}
9
-                @endif
10
-            </div>
11
-        </div>
12
-
13
-        <div class="w-1/3 flex justify-end">
14
-            @if($document->logo && $document->showLogo)
15
-                <x-company.document-template.logo :src="$document->logo"/>
16
-            @endif
17
-        </div>
18
-    </x-company.document-template.header>
19
-
20
-    <x-company.document-template.metadata class="classic-template-metadata space-y-4">
21
-        <div class="items-center flex">
22
-            <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
23
-            <x-icons.document-header-decoration
24
-                color="{{ $document->accentColor }}"
25
-                text="{{ $document->header }}"
26
-                class="w-60"
27
-            />
28
-            <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
29
-        </div>
30
-        @if ($document->subheader)
31
-            <p class="text-sm text-center text-gray-600">{{ $document->subheader }}</p>
32
-        @endif
33
-
34
-        <div class="flex justify-between items-end">
35
-            <!-- Billing Details -->
36
-            <div class="text-sm">
37
-                <h3 class="text-gray-600 font-medium mb-1">BILL TO</h3>
38
-                <p class="text-sm font-bold">{{ $document->client->name }}</p>
39
-                @if($formattedAddress = $document->client->getFormattedAddressHtml())
40
-                    {!! $formattedAddress !!}
41
-                @endif
42
-            </div>
43
-
44
-            <div class="text-sm">
45
-                <table class="min-w-full">
46
-                    <tbody>
47
-                    <tr>
48
-                        <td class="font-semibold text-right pr-2">{{ $document->label->number }}:</td>
49
-                        <td class="text-left pl-2">{{ $document->number }}</td>
50
-                    </tr>
51
-                    @if($document->referenceNumber)
52
-                        <tr>
53
-                            <td class="font-semibold text-right pr-2">{{ $document->label->referenceNumber }}:</td>
54
-                            <td class="text-left pl-2">{{ $document->referenceNumber }}</td>
55
-                        </tr>
56
-                    @endif
57
-                    <tr>
58
-                        <td class="font-semibold text-right pr-2">{{ $document->label->date }}:</td>
59
-                        <td class="text-left pl-2">{{ $document->date }}</td>
60
-                    </tr>
61
-                    <tr>
62
-                        <td class="font-semibold text-right pr-2">{{ $document->label->dueDate }}:</td>
63
-                        <td class="text-left pl-2">{{ $document->dueDate }}</td>
64
-                    </tr>
65
-                    </tbody>
66
-                </table>
67
-            </div>
68
-        </div>
69
-    </x-company.document-template.metadata>
70
-
71
-    <!-- Line Items -->
72
-    <x-company.document-template.line-items class="classic-template-line-items px-6">
73
-        <table class="w-full text-left table-fixed">
74
-            <thead class="text-sm leading-relaxed">
75
-            <tr>
76
-                <th class="text-left w-[50%] py-4">{{ $document->columnLabel->items }}</th>
77
-                <th class="text-center w-[10%] py-4">{{ $document->columnLabel->units }}</th>
78
-                <th class="text-right w-[20%] py-4">{{ $document->columnLabel->price }}</th>
79
-                <th class="text-right w-[20%] py-4">{{ $document->columnLabel->amount }}</th>
80
-            </tr>
81
-            </thead>
82
-            <tbody class="text-sm border-y-2 border-dotted border-gray-300">
83
-            @foreach($document->lineItems as $item)
84
-                <tr>
85
-                    <td class="text-left font-semibold py-3">
86
-                        {{ $item->name }}
87
-                        @if($item->description)
88
-                            <div class="text-gray-600 font-normal line-clamp-2 mt-1">{{ $item->description }}</div>
89
-                        @endif
90
-                    </td>
91
-                    <td class="text-center py-3">{{ $item->quantity }}</td>
92
-                    <td class="text-right py-3">{{ $item->unitPrice }}</td>
93
-                    <td class="text-right py-3">{{ $item->subtotal }}</td>
94
-                </tr>
95
-            @endforeach
96
-            </tbody>
97
-        </table>
98
-
99
-        <!-- Financial Details and Notes -->
100
-        <div class="flex justify-between text-sm space-x-1 pt-4">
101
-            <!-- Notes Section -->
102
-            <div class="w-[60%] py-2">
103
-                <p class="font-semibold">{{ $document->footer }}</p>
104
-            </div>
105
-
106
-            <!-- Financial Summary -->
107
-            <div class="w-[40%]">
108
-                <table class="w-full table-fixed whitespace-nowrap">
109
-                    <tbody class="text-sm">
110
-                    @if($document->subtotal)
111
-                        <tr>
112
-                            <td class="text-right font-semibold py-2">Subtotal:</td>
113
-                            <td class="text-right py-2">{{ $document->subtotal }}</td>
114
-                        </tr>
115
-                    @endif
116
-                    @if($document->discount)
117
-                        <tr class="text-success-800">
118
-                            <td class="text-right py-2">Discount:</td>
119
-                            <td class="text-right py-2">
120
-                                ({{ $document->discount }})
121
-                            </td>
122
-                        </tr>
123
-                    @endif
124
-                    @if($document->tax)
125
-                        <tr>
126
-                            <td class="text-right py-2">Tax:</td>
127
-                            <td class="text-right py-2">{{ $document->tax }}</td>
128
-                        </tr>
129
-                    @endif
130
-                    <tr>
131
-                        <td class="text-right font-semibold border-t py-2">Total:</td>
132
-                        <td class="text-right border-t py-2">{{ $document->total }}</td>
133
-                    </tr>
134
-                    @if($document->amountDue)
135
-                        <tr>
136
-                            <td class="text-right font-semibold border-t-4 border-double py-2">{{ $document->label->amountDue }}
137
-                                ({{ $document->currencyCode }}):
138
-                            </td>
139
-                            <td class="text-right border-t-4 border-double py-2">{{ $document->amountDue }}</td>
140
-                        </tr>
141
-                    @endif
142
-                    </tbody>
143
-                </table>
144
-            </div>
145
-        </div>
146
-    </x-company.document-template.line-items>
147
-
148
-    <!-- Footer -->
149
-    <x-company.document-template.footer class="classic-template-footer min-h-48 p-6 text-sm">
150
-        <h4 class="font-semibold mb-2">Terms & Conditions</h4>
151
-        <p class="break-words line-clamp-4">{{ $document->terms }}</p>
152
-    </x-company.document-template.footer>
153
-</x-company.document-template.container>

+ 0
- 147
resources/views/filament/infolists/components/document-templates/default.blade.php Ver arquivo

@@ -1,147 +0,0 @@
1
-<x-company.document-template.container class="default-template-container">
2
-
3
-    <x-company.document-template.header class="default-template-header border-b">
4
-        <div class="w-1/3">
5
-            @if($document->logo && $document->showLogo)
6
-                <x-company.document-template.logo :src="$document->logo"/>
7
-            @endif
8
-        </div>
9
-
10
-        <div class="w-2/3 text-right">
11
-            <div class="space-y-4">
12
-                <div>
13
-                    <h1 class="text-3xl font-light uppercase">{{ $document->header }}</h1>
14
-                    @if ($document->subheader)
15
-                        <p class="text-sm text-gray-600">{{ $document->subheader }}</p>
16
-                    @endif
17
-                </div>
18
-                <div class="text-sm">
19
-                    <strong class="text-sm block">{{ $document->company->name }}</strong>
20
-                    @if($formattedAddress = $document->company->getFormattedAddressHtml())
21
-                        {!! $formattedAddress !!}
22
-                    @endif
23
-                </div>
24
-            </div>
25
-        </div>
26
-    </x-company.document-template.header>
27
-
28
-    <x-company.document-template.metadata class="default-template-metadata space-y-4">
29
-        <div class="flex justify-between items-end">
30
-            <!-- Billing Details -->
31
-            <div class="text-sm">
32
-                <h3 class="text-gray-600 font-medium mb-1">BILL TO</h3>
33
-                <p class="text-sm font-bold">{{ $document->client->name }}</p>
34
-                @if($formattedAddress = $document->client->getFormattedAddressHtml())
35
-                    {!! $formattedAddress !!}
36
-                @endif
37
-            </div>
38
-
39
-            <div class="text-sm">
40
-                <table class="min-w-full">
41
-                    <tbody>
42
-                    <tr>
43
-                        <td class="font-semibold text-right pr-2">{{ $document->label->number }}:</td>
44
-                        <td class="text-left pl-2">{{ $document->number }}</td>
45
-                    </tr>
46
-                    @if($document->referenceNumber)
47
-                        <tr>
48
-                            <td class="font-semibold text-right pr-2">{{ $document->label->referenceNumber }}:</td>
49
-                            <td class="text-left pl-2">{{ $document->referenceNumber }}</td>
50
-                        </tr>
51
-                    @endif
52
-                    <tr>
53
-                        <td class="font-semibold text-right pr-2">{{ $document->label->date }}:</td>
54
-                        <td class="text-left pl-2">{{ $document->date }}</td>
55
-                    </tr>
56
-                    <tr>
57
-                        <td class="font-semibold text-right pr-2">{{ $document->label->dueDate }}:</td>
58
-                        <td class="text-left pl-2">{{ $document->dueDate }}</td>
59
-                    </tr>
60
-                    </tbody>
61
-                </table>
62
-            </div>
63
-        </div>
64
-    </x-company.document-template.metadata>
65
-
66
-    <!-- Line Items Table -->
67
-    <x-company.document-template.line-items class="default-template-line-items">
68
-        <table class="w-full text-left table-fixed">
69
-            <thead class="text-sm leading-relaxed" style="background: {{ $document->accentColor }}">
70
-            <tr class="text-white">
71
-                <th class="text-left pl-6 w-[50%] py-2">{{ $document->columnLabel->items }}</th>
72
-                <th class="text-center w-[10%] py-2">{{ $document->columnLabel->units }}</th>
73
-                <th class="text-right w-[20%] py-2">{{ $document->columnLabel->price }}</th>
74
-                <th class="text-right pr-6 w-[20%] py-2">{{ $document->columnLabel->amount }}</th>
75
-            </tr>
76
-            </thead>
77
-            <tbody class="text-sm border-b-2 border-gray-300">
78
-            @foreach($document->lineItems as $item)
79
-                <tr>
80
-                    <td class="text-left pl-6 font-semibold py-3">
81
-                        {{ $item->name }}
82
-                        @if($item->description)
83
-                            <div class="text-gray-600 font-normal line-clamp-2 mt-1">{{ $item->description }}</div>
84
-                        @endif
85
-                    </td>
86
-                    <td class="text-center py-3">{{ $item->quantity }}</td>
87
-                    <td class="text-right py-3">{{ $item->unitPrice }}</td>
88
-                    <td class="text-right pr-6 py-3">{{ $item->subtotal }}</td>
89
-                </tr>
90
-            @endforeach
91
-            </tbody>
92
-            <tfoot class="text-sm summary-section">
93
-            @if($document->subtotal)
94
-                <tr>
95
-                    <td class="pl-6 py-2" colspan="2"></td>
96
-                    <td class="text-right font-semibold py-2">Subtotal:</td>
97
-                    <td class="text-right pr-6 py-2">{{ $document->subtotal }}</td>
98
-                </tr>
99
-            @endif
100
-            @if($document->discount)
101
-                <tr class="text-success-800">
102
-                    <td class="pl-6 py-2" colspan="2"></td>
103
-                    <td class="text-right py-2">Discount:</td>
104
-                    <td class="text-right pr-6 py-2">
105
-                        ({{ $document->discount }})
106
-                    </td>
107
-                </tr>
108
-            @endif
109
-            @if($document->tax)
110
-                <tr>
111
-                    <td class="pl-6 py-2" colspan="2"></td>
112
-                    <td class="text-right py-2">Tax:</td>
113
-                    <td class="text-right pr-6 py-2">{{ $document->tax }}</td>
114
-                </tr>
115
-            @endif
116
-            <tr>
117
-                <td class="pl-6 py-2" colspan="2"></td>
118
-                <td class="text-right font-semibold border-t py-2">Total:</td>
119
-                <td class="text-right border-t pr-6 py-2">{{ $document->total }}</td>
120
-            </tr>
121
-            @if($document->amountDue)
122
-                <tr>
123
-                    <td class="pl-6 py-2" colspan="2"></td>
124
-                    <td class="text-right font-semibold border-t-4 border-double py-2">{{ $document->label->amountDue }}
125
-                        ({{ $document->currencyCode }}):
126
-                    </td>
127
-                    <td class="text-right border-t-4 border-double pr-6 py-2">{{ $document->amountDue }}</td>
128
-                </tr>
129
-            @endif
130
-            </tfoot>
131
-        </table>
132
-    </x-company.document-template.line-items>
133
-
134
-    <!-- Footer Notes -->
135
-    <x-company.document-template.footer class="classic-template-footer min-h-48 flex flex-col text-sm p-6">
136
-        <div>
137
-            <h4 class="font-semibold mb-2">Terms & Conditions</h4>
138
-            <p class="break-words line-clamp-4">{{ $document->terms }}</p>
139
-        </div>
140
-
141
-        @if($document->footer)
142
-            <div class="mt-auto text-center py-4">
143
-                <p class="font-semibold">{{ $document->footer }}</p>
144
-            </div>
145
-        @endif
146
-    </x-company.document-template.footer>
147
-</x-company.document-template.container>

+ 0
- 147
resources/views/filament/infolists/components/document-templates/modern.blade.php Ver arquivo

@@ -1,147 +0,0 @@
1
-<x-company.document-template.container class="modern-template-container">
2
-    <!-- Colored Header with Logo -->
3
-    <x-company.document-template.header class="bg-gray-800 h-24">
4
-        <!-- Logo -->
5
-        <div class="w-2/3">
6
-            @if($document->logo && $document->showLogo)
7
-                <x-company.document-template.logo class="ml-8" :src="$document->logo"/>
8
-            @endif
9
-        </div>
10
-
11
-        <!-- Ribbon Container -->
12
-        <div class="w-1/3 absolute right-0 top-0 p-3 h-32 flex flex-col justify-end rounded-bl-sm"
13
-             style="background: {{ $document->accentColor }};">
14
-            @if($document->header)
15
-                <h1 class="text-4xl font-bold text-white text-center uppercase">{{ $document->header }}</h1>
16
-            @endif
17
-        </div>
18
-    </x-company.document-template.header>
19
-
20
-    <!-- Company Details -->
21
-    <x-company.document-template.metadata class="modern-template-metadata space-y-8">
22
-        <div class="text-sm">
23
-            <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
24
-            @if($formattedAddress = $document->company->getFormattedAddressHtml())
25
-                {!! $formattedAddress !!}
26
-            @endif
27
-        </div>
28
-
29
-        <div class="flex justify-between items-end">
30
-            <!-- Billing Details -->
31
-            <div class="text-sm">
32
-                <h3 class="text-gray-600 font-medium mb-1">BILL TO</h3>
33
-                <p class="text-sm font-bold"
34
-                   style="color: {{ $document->accentColor }}">{{ $document->client->name }}</p>
35
-
36
-                @if($formattedAddress = $document->client->getFormattedAddressHtml())
37
-                    {!! $formattedAddress !!}
38
-                @endif
39
-            </div>
40
-
41
-            <div class="text-sm">
42
-                <table class="min-w-full">
43
-                    <tbody>
44
-                    <tr>
45
-                        <td class="font-semibold text-right pr-2">{{ $document->label->number }}:</td>
46
-                        <td class="text-left pl-2">{{ $document->number }}</td>
47
-                    </tr>
48
-                    @if($document->referenceNumber)
49
-                        <tr>
50
-                            <td class="font-semibold text-right pr-2">{{ $document->label->referenceNumber }}:</td>
51
-                            <td class="text-left pl-2">{{ $document->referenceNumber }}</td>
52
-                        </tr>
53
-                    @endif
54
-                    <tr>
55
-                        <td class="font-semibold text-right pr-2">{{ $document->label->date }}:</td>
56
-                        <td class="text-left pl-2">{{ $document->date }}</td>
57
-                    </tr>
58
-                    <tr>
59
-                        <td class="font-semibold text-right pr-2">{{ $document->label->dueDate }}:</td>
60
-                        <td class="text-left pl-2">{{ $document->dueDate }}</td>
61
-                    </tr>
62
-                    </tbody>
63
-                </table>
64
-            </div>
65
-        </div>
66
-    </x-company.document-template.metadata>
67
-
68
-    <!-- Line Items Table -->
69
-    <x-company.document-template.line-items class="modern-template-line-items">
70
-        <table class="w-full text-left table-fixed">
71
-            <thead class="text-sm leading-relaxed">
72
-            <tr class="text-gray-600">
73
-                <th class="text-left pl-6 w-[50%] py-4">{{ $document->columnLabel->items }}</th>
74
-                <th class="text-center w-[10%] py-4">{{ $document->columnLabel->units }}</th>
75
-                <th class="text-right w-[20%] py-4">{{ $document->columnLabel->price }}</th>
76
-                <th class="text-right pr-6 w-[20%] py-4">{{ $document->columnLabel->amount }}</th>
77
-            </tr>
78
-            </thead>
79
-            <tbody class="text-sm border-y-2">
80
-            @foreach($document->lineItems as $index => $item)
81
-                <tr @class(['bg-gray-100' => $index % 2 === 0])>
82
-                    <td class="text-left pl-6 font-semibold py-3">
83
-                        {{ $item->name }}
84
-                        @if($item->description)
85
-                            <div class="text-gray-600 font-normal line-clamp-2 mt-1">{{ $item->description }}</div>
86
-                        @endif
87
-                    </td>
88
-                    <td class="text-center py-3">{{ $item->quantity }}</td>
89
-                    <td class="text-right py-3">{{ $item->unitPrice }}</td>
90
-                    <td class="text-right pr-6 py-3">{{ $item->subtotal }}</td>
91
-                </tr>
92
-            @endforeach
93
-            </tbody>
94
-            <tfoot class="text-sm summary-section">
95
-            @if($document->subtotal)
96
-                <tr>
97
-                    <td class="pl-6 py-2" colspan="2"></td>
98
-                    <td class="text-right font-semibold py-2">Subtotal:</td>
99
-                    <td class="text-right pr-6 py-2">{{ $document->subtotal }}</td>
100
-                </tr>
101
-            @endif
102
-            @if($document->discount)
103
-                <tr class="text-success-800">
104
-                    <td class="pl-6 py-2" colspan="2"></td>
105
-                    <td class="text-right py-2">Discount:</td>
106
-                    <td class="text-right pr-6 py-2">
107
-                        ({{ $document->discount }})
108
-                    </td>
109
-                </tr>
110
-            @endif
111
-            @if($document->tax)
112
-                <tr>
113
-                    <td class="pl-6 py-2" colspan="2"></td>
114
-                    <td class="text-right py-2">Tax:</td>
115
-                    <td class="text-right pr-6 py-2">{{ $document->tax }}</td>
116
-                </tr>
117
-            @endif
118
-            <tr>
119
-                <td class="pl-6 py-2" colspan="2"></td>
120
-                <td class="text-right font-semibold border-t py-2">Total:</td>
121
-                <td class="text-right border-t pr-6 py-2">{{ $document->total }}</td>
122
-            </tr>
123
-            @if($document->amountDue)
124
-                <tr>
125
-                    <td class="pl-6 py-2" colspan="2"></td>
126
-                    <td class="text-right font-semibold border-t-4 border-double py-2">{{ $document->label->amountDue }}
127
-                        ({{ $document->currencyCode }}):
128
-                    </td>
129
-                    <td class="text-right border-t-4 border-double pr-6 py-2">{{ $document->amountDue }}</td>
130
-                </tr>
131
-            @endif
132
-            </tfoot>
133
-        </table>
134
-    </x-company.document-template.line-items>
135
-
136
-    <!-- Footer Notes -->
137
-    <x-company.document-template.footer class="modern-template-footer">
138
-        <h4 class="font-semibold px-6 text-sm" style="color: {{ $document->accentColor }}">
139
-            Terms & Conditions
140
-        </h4>
141
-        <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
142
-        <div class="flex justify-between space-x-4 px-6 text-sm">
143
-            <p class="w-1/2 break-words line-clamp-4">{{ $document->terms }}</p>
144
-            <p class="w-1/2 break-words line-clamp-4">{{ $document->footer }}</p>
145
-        </div>
146
-    </x-company.document-template.footer>
147
-</x-company.document-template.container>

Carregando…
Cancelar
Salvar