Andrew Wallo пре 7 месеци
родитељ
комит
4945634a2e
25 измењених фајлова са 122 додато и 169 уклоњено
  1. 3
    3
      app/Filament/Company/Clusters/Settings/Resources/DocumentDefaultResource.php
  2. 1
    14
      app/Filament/Company/Resources/Sales/EstimateResource/Pages/ViewEstimate.php
  3. 1
    14
      app/Filament/Company/Resources/Sales/InvoiceResource/Pages/ViewInvoice.php
  4. 1
    14
      app/Filament/Company/Resources/Sales/RecurringInvoiceResource/Pages/ViewRecurringInvoice.php
  5. 18
    0
      app/Models/Accounting/Document.php
  6. 2
    2
      resources/views/components/company/document-template/container.blade.php
  7. 3
    0
      resources/views/components/company/document-template/footer.blade.php
  8. 3
    0
      resources/views/components/company/document-template/header.blade.php
  9. 3
    0
      resources/views/components/company/document-template/line-items.blade.php
  10. 1
    1
      resources/views/components/company/document-template/logo.blade.php
  11. 3
    0
      resources/views/components/company/document-template/metadata.blade.php
  12. 0
    3
      resources/views/components/company/invoice/footer.blade.php
  13. 0
    3
      resources/views/components/company/invoice/header.blade.php
  14. 0
    3
      resources/views/components/company/invoice/line-items.blade.php
  15. 0
    3
      resources/views/components/company/invoice/metadata.blade.php
  16. 0
    10
      resources/views/components/icons/decor-border-left.blade.php
  17. 0
    10
      resources/views/components/icons/decor-border-right.blade.php
  18. 12
    12
      resources/views/filament/company/components/document-templates/classic.blade.php
  19. 12
    12
      resources/views/filament/company/components/document-templates/default.blade.php
  20. 12
    12
      resources/views/filament/company/components/document-templates/modern.blade.php
  21. 1
    1
      resources/views/filament/infolists/components/document-preview.blade.php
  22. 11
    11
      resources/views/filament/infolists/components/document-templates/classic.blade.php
  23. 11
    11
      resources/views/filament/infolists/components/document-templates/default.blade.php
  24. 11
    11
      resources/views/filament/infolists/components/document-templates/modern.blade.php
  25. 13
    19
      resources/views/print-document.blade.php

+ 3
- 3
app/Filament/Company/Clusters/Settings/Resources/DocumentDefaultResource.php Прегледај датотеку

@@ -130,17 +130,17 @@ class DocumentDefaultResource extends Resource
130 130
                             ->columnSpan(2)
131 131
                             ->hiddenLabel()
132 132
                             ->visible(static fn (Get $get) => $get('template') === 'default')
133
-                            ->view('filament.company.components.invoice-layouts.default'),
133
+                            ->view('filament.company.components.document-templates.default'),
134 134
                         Forms\Components\ViewField::make('preview.modern')
135 135
                             ->columnSpan(2)
136 136
                             ->hiddenLabel()
137 137
                             ->visible(static fn (Get $get) => $get('template') === 'modern')
138
-                            ->view('filament.company.components.invoice-layouts.modern'),
138
+                            ->view('filament.company.components.document-templates.modern'),
139 139
                         Forms\Components\ViewField::make('preview.classic')
140 140
                             ->columnSpan(2)
141 141
                             ->hiddenLabel()
142 142
                             ->visible(static fn (Get $get) => $get('template') === 'classic')
143
-                            ->view('filament.company.components.invoice-layouts.classic'),
143
+                            ->view('filament.company.components.document-templates.classic'),
144 144
                     ])->columnSpan(2),
145 145
             ])->columns(3);
146 146
     }

+ 1
- 14
app/Filament/Company/Resources/Sales/EstimateResource/Pages/ViewEstimate.php Прегледај датотеку

@@ -34,20 +34,6 @@ class ViewEstimate extends ViewRecord
34 34
     protected function getHeaderActions(): array
35 35
     {
36 36
         return [
37
-            Actions\Action::make('printPdf')
38
-                ->label('Export PDF')
39
-                ->icon('heroicon-o-document-arrow-down')
40
-                ->outlined()
41
-                ->action(function (Estimate $record) {
42
-                    $url = route('documents.print', [
43
-                        'documentType' => $record::documentType(),
44
-                        'id' => $record->id,
45
-                    ]);
46
-
47
-                    $title = 'Print Estimate';
48
-
49
-                    $this->js("window.printPdf('{$url}', '{$title}')");
50
-                }),
51 37
             Actions\EditAction::make()
52 38
                 ->label('Edit estimate')
53 39
                 ->outlined(),
@@ -57,6 +43,7 @@ class ViewEstimate extends ViewRecord
57 43
                     Estimate::getMarkAsSentAction(),
58 44
                     Estimate::getMarkAsAcceptedAction(),
59 45
                     Estimate::getMarkAsDeclinedAction(),
46
+                    Estimate::getPrintDocumentAction(),
60 47
                     Estimate::getReplicateAction(),
61 48
                     Estimate::getConvertToInvoiceAction(),
62 49
                 ])->dropdown(false),

+ 1
- 14
app/Filament/Company/Resources/Sales/InvoiceResource/Pages/ViewInvoice.php Прегледај датотеку

@@ -34,20 +34,6 @@ class ViewInvoice extends ViewRecord
34 34
     protected function getHeaderActions(): array
35 35
     {
36 36
         return [
37
-            Actions\Action::make('printPdf')
38
-                ->label('Export PDF')
39
-                ->icon('heroicon-o-document-arrow-down')
40
-                ->outlined()
41
-                ->action(function (Invoice $record) {
42
-                    $url = route('documents.print', [
43
-                        'documentType' => $record::documentType(),
44
-                        'id' => $record->id,
45
-                    ]);
46
-
47
-                    $title = 'Print Invoice';
48
-
49
-                    $this->js("window.printPdf('{$url}', '{$title}')");
50
-                }),
51 37
             Actions\EditAction::make()
52 38
                 ->label('Edit invoice')
53 39
                 ->outlined(),
@@ -55,6 +41,7 @@ class ViewInvoice extends ViewRecord
55 41
                 Actions\ActionGroup::make([
56 42
                     Invoice::getApproveDraftAction(),
57 43
                     Invoice::getMarkAsSentAction(),
44
+                    Invoice::getPrintDocumentAction(),
58 45
                     Invoice::getReplicateAction(),
59 46
                 ])->dropdown(false),
60 47
                 Actions\DeleteAction::make(),

+ 1
- 14
app/Filament/Company/Resources/Sales/RecurringInvoiceResource/Pages/ViewRecurringInvoice.php Прегледај датотеку

@@ -34,20 +34,6 @@ class ViewRecurringInvoice extends ViewRecord
34 34
     protected function getHeaderActions(): array
35 35
     {
36 36
         return [
37
-            Actions\Action::make('printPdf')
38
-                ->label('Export PDF')
39
-                ->icon('heroicon-o-document-arrow-down')
40
-                ->outlined()
41
-                ->action(function (RecurringInvoice $record) {
42
-                    $url = route('documents.print', [
43
-                        'documentType' => $record::documentType(),
44
-                        'id' => $record->id,
45
-                    ]);
46
-
47
-                    $title = 'Print Recurring Invoice';
48
-
49
-                    $this->js("window.printPdf('{$url}', '{$title}')");
50
-                }),
51 37
             Actions\EditAction::make()
52 38
                 ->label('Edit recurring invoice')
53 39
                 ->outlined(),
@@ -55,6 +41,7 @@ class ViewRecurringInvoice extends ViewRecord
55 41
                 Actions\ActionGroup::make([
56 42
                     RecurringInvoice::getManageScheduleAction(),
57 43
                     RecurringInvoice::getApproveDraftAction(),
44
+                    RecurringInvoice::getPrintDocumentAction(),
58 45
                 ])->dropdown(false),
59 46
                 Actions\DeleteAction::make(),
60 47
             ])

+ 18
- 0
app/Models/Accounting/Document.php Прегледај датотеку

@@ -6,10 +6,13 @@ use App\Concerns\Blamable;
6 6
 use App\Concerns\CompanyOwned;
7 7
 use App\Enums\Accounting\DocumentType;
8 8
 use App\Models\Setting\Currency;
9
+use Filament\Actions\Action;
10
+use Filament\Actions\MountableAction;
9 11
 use Illuminate\Database\Eloquent\Factories\HasFactory;
10 12
 use Illuminate\Database\Eloquent\Model;
11 13
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
12 14
 use Illuminate\Database\Eloquent\Relations\MorphMany;
15
+use Livewire\Component;
13 16
 
14 17
 abstract class Document extends Model
15 18
 {
@@ -32,6 +35,21 @@ abstract class Document extends Model
32 35
         return $this->lineItems()->exists();
33 36
     }
34 37
 
38
+    public static function getPrintDocumentAction(string $action = Action::class): MountableAction
39
+    {
40
+        return $action::make('printPdf')
41
+            ->label('Print')
42
+            ->icon('heroicon-m-printer')
43
+            ->action(function (self $record, Component $livewire) {
44
+                $url = route('documents.print', [
45
+                    'documentType' => $record::documentType(),
46
+                    'id' => $record->id,
47
+                ]);
48
+
49
+                $livewire->js("window.printPdf('{$url}')");
50
+            });
51
+    }
52
+
35 53
     abstract public static function documentType(): DocumentType;
36 54
 
37 55
     abstract public function documentNumber(): ?string;

resources/views/components/company/invoice/container.blade.php → resources/views/components/company/document-template/container.blade.php Прегледај датотеку

@@ -2,10 +2,10 @@
2 2
     'preview' => false,
3 3
 ])
4 4
 
5
-<div class="inv-container flex justify-center p-6">
5
+<div class="doc-template-container flex justify-center p-6">
6 6
     <div
7 7
         @class([
8
-            'inv-paper bg-[#ffffff] dark:bg-gray-800 rounded-sm shadow-xl',
8
+            'doc-template-paper bg-[#ffffff] dark:bg-gray-800 rounded-sm shadow-xl',
9 9
             'w-full max-w-[820px] max-h-[1024px] overflow-y-auto' => $preview === false,
10 10
             'w-[38.25rem] h-[49.5rem] overflow-hidden' => $preview === true,
11 11
         ])

+ 3
- 0
resources/views/components/company/document-template/footer.blade.php Прегледај датотеку

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

+ 3
- 0
resources/views/components/company/document-template/header.blade.php Прегледај датотеку

@@ -0,0 +1,3 @@
1
+<header {{ $attributes->class(['doc-template-header flex py-2 relative']) }}>
2
+    {{ $slot }}
3
+</header>

+ 3
- 0
resources/views/components/company/document-template/line-items.blade.php Прегледај датотеку

@@ -0,0 +1,3 @@
1
+<div {{ $attributes->class(['doc-template-line-items py-6']) }}>
2
+    {{ $slot }}
3
+</div>

resources/views/components/company/invoice/logo.blade.php → resources/views/components/company/document-template/logo.blade.php Прегледај датотеку

@@ -6,7 +6,7 @@
6 6
 <img {{
7 7
     $attributes
8 8
         ->class([
9
-            'inv-logo object-contain',
9
+            'doc-template-logo object-contain',
10 10
             match ($size) {
11 11
                 'sm' => 'max-h-8',
12 12
                 'md' => 'max-h-16',

+ 3
- 0
resources/views/components/company/document-template/metadata.blade.php Прегледај датотеку

@@ -0,0 +1,3 @@
1
+<section {{ $attributes->class(['doc-template-metadata px-6 pt-4']) }}>
2
+    {{ $slot }}
3
+</section>

+ 0
- 3
resources/views/components/company/invoice/footer.blade.php Прегледај датотеку

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

+ 0
- 3
resources/views/components/company/invoice/header.blade.php Прегледај датотеку

@@ -1,3 +0,0 @@
1
-<header {{ $attributes->class(['inv-header flex py-2 relative']) }}>
2
-    {{ $slot }}
3
-</header>

+ 0
- 3
resources/views/components/company/invoice/line-items.blade.php Прегледај датотеку

@@ -1,3 +0,0 @@
1
-<div {{ $attributes->class(['inv-line-items py-6']) }}>
2
-    {{ $slot }}
3
-</div>

+ 0
- 3
resources/views/components/company/invoice/metadata.blade.php Прегледај датотеку

@@ -1,3 +0,0 @@
1
-<section {{ $attributes->class(['inv-metadata px-6 pt-4']) }}>
2
-    {{ $slot }}
3
-</section>

+ 0
- 10
resources/views/components/icons/decor-border-left.blade.php Прегледај датотеку

@@ -1,10 +0,0 @@
1
-@props([
2
-    'color' => 'currentColor',
3
-])
4
-
5
-<svg xmlns="http://www.w3.org/2000/svg" height="72" width="28" viewBox="0 0 28 72" aria-hidden="true" {{ $attributes }}>
6
-    <g fill="none" stroke-width="2" stroke="{{ $color }}">
7
-        <path d="M183 57.038v-42.076c-.33.025-.664.038-1 .038-7.18 0-13-5.82-13-13 0-.336.013-.67.038-1h-154.076c.025.33.038.664.038 1 0 7.18-5.82 13-13 13-.336 0-.67-.013-1-.038v42.076c.33-.025.664-.038 1-.038 7.18 0 13 5.82 13 13 0 .336-.013.67-.038 1h154.076c-.025-.33-.038-.664-.038-1 0-7.18 5.82-13 13-13 .336 0 .67.013 1 .038z" />
8
-        <path d="M177 51.503v-31.007c-.33.024-.664.037-1 .037-7.18 0-13-5.626-13-12.567 0-.325.013-.648.038-.967h-142.076c.025.319.038.641.038.967 0 6.94-5.82 12.567-13 12.567-.336 0-.67-.012-1-.037v31.007c.33-.024.664-.037 1-.037 7.18 0 13 5.626 13 12.567 0 .325-.013.648-.038.967h142.076c-.025-.319-.038-.641-.038-.967 0-6.94 5.82-12.567 13-12.567.336 0 .67.012 1 .037z" />
9
-    </g>
10
-</svg>

+ 0
- 10
resources/views/components/icons/decor-border-right.blade.php Прегледај датотеку

@@ -1,10 +0,0 @@
1
-@props([
2
-    'color' => 'currentColor',
3
-])
4
-
5
-<svg xmlns="http://www.w3.org/2000/svg" height="72" width="28" viewBox="0 0 28 72" aria-hidden="true" {{ $attributes }}>
6
-    <g fill="none" stroke-width="2" stroke="{{ $color }}">
7
-        <path d="M27 57.038v-42.076c-.33.025-.664.038-1 .038-7.18 0-13-5.82-13-13 0-.336.013-.67.038-1h-154.076c.025.33.038.664.038 1 0 7.18-5.82 13-13 13-.336 0-.67-.013-1-.038v42.076c.33-.025.664-.038 1-.038 7.18 0 13 5.82 13 13 0 .336-.013.67-.038 1h154.076c-.025-.33-.038-.664-.038-1 0-7.18 5.82-13 13-13 .336 0 .67.013 1 .038z"></path>
8
-        <path d="M21 51.503v-31.007c-.33.024-.664.037-1 .037-7.18 0-13-5.626-13-12.567 0-.325.013-.648.038-.967h-142.076c.025.319.038.641.038.967 0 6.94-5.82 12.567-13 12.567-.336 0-.67-.012-1-.037v31.007c.33-.024.664-.037 1-.037 7.18 0 13 5.626 13 12.567 0 .325-.013.648-.038.967h142.076c-.025-.319-.038-.641-.038-.967 0-6.94 5.82-12.567 13-12.567.336 0 .67.012 1 .037z"></path>
9
-    </g>
10
-</svg>

resources/views/filament/company/components/invoice-layouts/classic.blade.php → resources/views/filament/company/components/document-templates/classic.blade.php Прегледај датотеку

@@ -6,14 +6,14 @@
6 6
 {!! $document->getFontHtml() !!}
7 7
 
8 8
 <style>
9
-    .inv-paper {
9
+    .doc-template-paper {
10 10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
11 11
     }
12 12
 </style>
13 13
 
14
-<x-company.invoice.container class="classic-template-container" preview>
14
+<x-company.document-template.container class="classic-template-container" preview>
15 15
     <!-- Header Section -->
16
-    <x-company.invoice.header class="default-template-header">
16
+    <x-company.document-template.header class="default-template-header">
17 17
         <div class="w-2/3 text-left ml-6">
18 18
             <div class="text-xs">
19 19
                 <h2 class="text-base font-semibold">{{ $document->company->name }}</h2>
@@ -25,12 +25,12 @@
25 25
 
26 26
         <div class="w-1/3 flex justify-end mr-6">
27 27
             @if($document->logo && $document->showLogo)
28
-                <x-company.invoice.logo :src="$document->logo"/>
28
+                <x-company.document-template.logo :src="$document->logo"/>
29 29
             @endif
30 30
         </div>
31
-    </x-company.invoice.header>
31
+    </x-company.document-template.header>
32 32
 
33
-    <x-company.invoice.metadata class="classic-template-metadata">
33
+    <x-company.document-template.metadata class="classic-template-metadata">
34 34
         <div class="items-center flex">
35 35
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
36 36
             <x-icons.document-header-decoration
@@ -75,10 +75,10 @@
75 75
                 </table>
76 76
             </div>
77 77
         </div>
78
-    </x-company.invoice.metadata>
78
+    </x-company.document-template.metadata>
79 79
 
80 80
     <!-- Line Items -->
81
-    <x-company.invoice.line-items class="classic-template-line-items px-6">
81
+    <x-company.document-template.line-items class="classic-template-line-items px-6">
82 82
         <table class="w-full text-left table-fixed">
83 83
             <thead class="text-sm leading-8">
84 84
             <tr>
@@ -136,11 +136,11 @@
136 136
                 </table>
137 137
             </div>
138 138
         </div>
139
-    </x-company.invoice.line-items>
139
+    </x-company.document-template.line-items>
140 140
 
141 141
     <!-- Footer -->
142
-    <x-company.invoice.footer class="classic-template-footer">
142
+    <x-company.document-template.footer class="classic-template-footer">
143 143
         <h4 class="font-semibold px-6 mb-2">Terms & Conditions</h4>
144 144
         <p class="px-6 break-words line-clamp-4">{{ $document->terms }}</p>
145
-    </x-company.invoice.footer>
146
-</x-company.invoice.container>
145
+    </x-company.document-template.footer>
146
+</x-company.document-template.container>

resources/views/filament/company/components/invoice-layouts/default.blade.php → resources/views/filament/company/components/document-templates/default.blade.php Прегледај датотеку

@@ -6,17 +6,17 @@
6 6
 {!! $document->getFontHtml() !!}
7 7
 
8 8
 <style>
9
-    .inv-paper {
9
+    .doc-template-paper {
10 10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
11 11
     }
12 12
 </style>
13 13
 
14
-<x-company.invoice.container class="default-template-container" preview>
14
+<x-company.document-template.container class="default-template-container" preview>
15 15
 
16
-    <x-company.invoice.header class="default-template-header border-b-2 p-6 pb-4">
16
+    <x-company.document-template.header class="default-template-header border-b-2 p-6 pb-4">
17 17
         <div class="w-2/3">
18 18
             @if($document->logo && $document->showLogo)
19
-                <x-company.invoice.logo :src="$document->logo"/>
19
+                <x-company.document-template.logo :src="$document->logo"/>
20 20
             @endif
21 21
         </div>
22 22
 
@@ -28,9 +28,9 @@
28 28
                 @endif
29 29
             </div>
30 30
         </div>
31
-    </x-company.invoice.header>
31
+    </x-company.document-template.header>
32 32
 
33
-    <x-company.invoice.metadata class="default-template-metadata space-y-6">
33
+    <x-company.document-template.metadata class="default-template-metadata space-y-6">
34 34
         <div>
35 35
             <h1 class="text-3xl font-light uppercase">{{ $document->header }}</h1>
36 36
             @if ($document->subheader)
@@ -71,10 +71,10 @@
71 71
                 </table>
72 72
             </div>
73 73
         </div>
74
-    </x-company.invoice.metadata>
74
+    </x-company.document-template.metadata>
75 75
 
76 76
     <!-- Line Items Table -->
77
-    <x-company.invoice.line-items class="default-template-line-items">
77
+    <x-company.document-template.line-items class="default-template-line-items">
78 78
         <table class="w-full text-left table-fixed">
79 79
             <thead class="text-sm leading-8" style="background: {{ $document->accentColor }}">
80 80
             <tr class="text-white">
@@ -122,13 +122,13 @@
122 122
             </tr>
123 123
             </tfoot>
124 124
         </table>
125
-    </x-company.invoice.line-items>
125
+    </x-company.document-template.line-items>
126 126
 
127 127
     <!-- Footer Notes -->
128
-    <x-company.invoice.footer class="default-template-footer">
128
+    <x-company.document-template.footer class="default-template-footer">
129 129
         <p class="px-6">{{ $document->footer }}</p>
130 130
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
131 131
         <h4 class="font-semibold px-6 mb-2">Terms & Conditions</h4>
132 132
         <p class="px-6 break-words line-clamp-4">{{ $document->terms }}</p>
133
-    </x-company.invoice.footer>
134
-</x-company.invoice.container>
133
+    </x-company.document-template.footer>
134
+</x-company.document-template.container>

resources/views/filament/company/components/invoice-layouts/modern.blade.php → resources/views/filament/company/components/document-templates/modern.blade.php Прегледај датотеку

@@ -6,19 +6,19 @@
6 6
 {!! $document->getFontHtml() !!}
7 7
 
8 8
 <style>
9
-    .inv-paper {
9
+    .doc-template-paper {
10 10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
11 11
     }
12 12
 </style>
13 13
 
14
-<x-company.invoice.container class="modern-template-container" preview>
14
+<x-company.document-template.container class="modern-template-container" preview>
15 15
 
16 16
     <!-- Colored Header with Logo -->
17
-    <x-company.invoice.header class="bg-gray-800 h-20">
17
+    <x-company.document-template.header class="bg-gray-800 h-20">
18 18
         <!-- Logo -->
19 19
         <div class="w-2/3">
20 20
             @if($document->logo && $document->showLogo)
21
-                <x-company.invoice.logo class="ml-6" :src="$document->logo"/>
21
+                <x-company.document-template.logo class="ml-6" :src="$document->logo"/>
22 22
             @endif
23 23
         </div>
24 24
 
@@ -29,10 +29,10 @@
29 29
                 <h1 class="text-3xl font-bold text-white text-center uppercase">{{ $document->header }}</h1>
30 30
             @endif
31 31
         </div>
32
-    </x-company.invoice.header>
32
+    </x-company.document-template.header>
33 33
 
34 34
     <!-- Company Details -->
35
-    <x-company.invoice.metadata class="modern-template-metadata space-y-6">
35
+    <x-company.document-template.metadata class="modern-template-metadata space-y-6">
36 36
         <div class="text-xs">
37 37
             <h2 class="text-base font-semibold">{{ $document->company->name }}</h2>
38 38
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
@@ -77,10 +77,10 @@
77 77
                 </table>
78 78
             </div>
79 79
         </div>
80
-    </x-company.invoice.metadata>
80
+    </x-company.document-template.metadata>
81 81
 
82 82
     <!-- Line Items Table -->
83
-    <x-company.invoice.line-items class="modern-template-line-items">
83
+    <x-company.document-template.line-items class="modern-template-line-items">
84 84
         <table class="w-full text-left table-fixed">
85 85
             <thead class="text-sm leading-8">
86 86
             <tr class="text-gray-600 dark:text-gray-400">
@@ -143,15 +143,15 @@
143 143
             @endif
144 144
             </tfoot>
145 145
         </table>
146
-    </x-company.invoice.line-items>
146
+    </x-company.document-template.line-items>
147 147
 
148 148
     <!-- Footer Notes -->
149
-    <x-company.invoice.footer class="modern-template-footer tracking-tight">
149
+    <x-company.document-template.footer class="modern-template-footer tracking-tight">
150 150
         <h4 class="font-semibold px-6" style="color: {{ $document->accentColor }}">Terms & Conditions</h4>
151 151
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
152 152
         <div class="flex justify-between space-x-4 px-6">
153 153
             <p class="w-1/2 break-words line-clamp-4">{{ $document->terms }}</p>
154 154
             <p class="w-1/2 break-words line-clamp-4">{{ $document->footer }}</p>
155 155
         </div>
156
-    </x-company.invoice.footer>
157
-</x-company.invoice.container>
156
+    </x-company.document-template.footer>
157
+</x-company.document-template.container>

+ 1
- 1
resources/views/filament/infolists/components/document-preview.blade.php Прегледај датотеку

@@ -6,7 +6,7 @@
6 6
 {!! $document->getFontHtml() !!}
7 7
 
8 8
 <style>
9
-    .inv-paper {
9
+    .doc-template-paper {
10 10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
11 11
     }
12 12
 </style>

+ 11
- 11
resources/views/filament/infolists/components/document-templates/classic.blade.php Прегледај датотеку

@@ -1,6 +1,6 @@
1
-<x-company.invoice.container class="classic-template-container">
1
+<x-company.document-template.container class="classic-template-container">
2 2
     <!-- Header Section -->
3
-    <x-company.invoice.header class="default-template-header">
3
+    <x-company.document-template.header class="default-template-header">
4 4
         <div class="w-2/3 text-left ml-6">
5 5
             <div class="text-sm tracking-tight">
6 6
                 <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
@@ -12,12 +12,12 @@
12 12
 
13 13
         <div class="w-1/3 flex justify-end mr-6">
14 14
             @if($document->logo && $document->showLogo)
15
-                <x-company.invoice.logo :src="$document->logo"/>
15
+                <x-company.document-template.logo :src="$document->logo"/>
16 16
             @endif
17 17
         </div>
18
-    </x-company.invoice.header>
18
+    </x-company.document-template.header>
19 19
 
20
-    <x-company.invoice.metadata class="classic-template-metadata space-y-8">
20
+    <x-company.document-template.metadata class="classic-template-metadata space-y-8">
21 21
         <div class="items-center flex">
22 22
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
23 23
             <x-icons.document-header-decoration
@@ -62,10 +62,10 @@
62 62
                 </table>
63 63
             </div>
64 64
         </div>
65
-    </x-company.invoice.metadata>
65
+    </x-company.document-template.metadata>
66 66
 
67 67
     <!-- Line Items -->
68
-    <x-company.invoice.line-items class="classic-template-line-items">
68
+    <x-company.document-template.line-items class="classic-template-line-items">
69 69
         <table class="w-full text-left table-fixed">
70 70
             <thead class="text-sm leading-relaxed">
71 71
             <tr>
@@ -138,11 +138,11 @@
138 138
                 </table>
139 139
             </div>
140 140
         </div>
141
-    </x-company.invoice.line-items>
141
+    </x-company.document-template.line-items>
142 142
 
143 143
     <!-- Footer -->
144
-    <x-company.invoice.footer class="classic-template-footer tracking-tight min-h-48">
144
+    <x-company.document-template.footer class="classic-template-footer tracking-tight min-h-48">
145 145
         <h4 class="font-semibold px-6 mb-2 text-sm">Terms & Conditions</h4>
146 146
         <p class="px-6 break-words line-clamp-4 text-sm">{{ $document->terms }}</p>
147
-    </x-company.invoice.footer>
148
-</x-company.invoice.container>
147
+    </x-company.document-template.footer>
148
+</x-company.document-template.container>

+ 11
- 11
resources/views/filament/infolists/components/document-templates/default.blade.php Прегледај датотеку

@@ -1,9 +1,9 @@
1
-<x-company.invoice.container class="default-template-container">
1
+<x-company.document-template.container class="default-template-container">
2 2
 
3
-    <x-company.invoice.header class="default-template-header border-b-2 p-6 pb-4">
3
+    <x-company.document-template.header class="default-template-header border-b-2 p-6 pb-4">
4 4
         <div class="w-2/3">
5 5
             @if($document->logo && $document->showLogo)
6
-                <x-company.invoice.logo :src="$document->logo"/>
6
+                <x-company.document-template.logo :src="$document->logo"/>
7 7
             @endif
8 8
         </div>
9 9
 
@@ -15,9 +15,9 @@
15 15
                 @endif
16 16
             </div>
17 17
         </div>
18
-    </x-company.invoice.header>
18
+    </x-company.document-template.header>
19 19
 
20
-    <x-company.invoice.metadata class="default-template-metadata space-y-8">
20
+    <x-company.document-template.metadata class="default-template-metadata space-y-8">
21 21
         <div>
22 22
             <h1 class="text-4xl font-light uppercase">{{ $document->header }}</h1>
23 23
             @if ($document->subheader)
@@ -60,10 +60,10 @@
60 60
                 </table>
61 61
             </div>
62 62
         </div>
63
-    </x-company.invoice.metadata>
63
+    </x-company.document-template.metadata>
64 64
 
65 65
     <!-- Line Items Table -->
66
-    <x-company.invoice.line-items class="default-template-line-items">
66
+    <x-company.document-template.line-items class="default-template-line-items">
67 67
         <table class="w-full text-left table-fixed">
68 68
             <thead class="text-sm leading-relaxed" style="background: {{ $document->accentColor }}">
69 69
             <tr class="text-white">
@@ -126,13 +126,13 @@
126 126
             @endif
127 127
             </tfoot>
128 128
         </table>
129
-    </x-company.invoice.line-items>
129
+    </x-company.document-template.line-items>
130 130
 
131 131
     <!-- Footer Notes -->
132
-    <x-company.invoice.footer class="default-template-footer tracking-tight">
132
+    <x-company.document-template.footer class="default-template-footer tracking-tight">
133 133
         <p class="px-6 text-sm">{{ $document->footer }}</p>
134 134
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
135 135
         <h4 class="font-semibold px-6 mb-2 text-sm">Terms & Conditions</h4>
136 136
         <p class="px-6 break-words line-clamp-4 text-sm">{{ $document->terms }}</p>
137
-    </x-company.invoice.footer>
138
-</x-company.invoice.container>
137
+    </x-company.document-template.footer>
138
+</x-company.document-template.container>

+ 11
- 11
resources/views/filament/infolists/components/document-templates/modern.blade.php Прегледај датотеку

@@ -1,10 +1,10 @@
1
-<x-company.invoice.container class="modern-template-container">
1
+<x-company.document-template.container class="modern-template-container">
2 2
     <!-- Colored Header with Logo -->
3
-    <x-company.invoice.header class="bg-gray-800 h-24">
3
+    <x-company.document-template.header class="bg-gray-800 h-24">
4 4
         <!-- Logo -->
5 5
         <div class="w-2/3">
6 6
             @if($document->logo && $document->showLogo)
7
-                <x-company.invoice.logo class="ml-8" :src="$document->logo"/>
7
+                <x-company.document-template.logo class="ml-8" :src="$document->logo"/>
8 8
             @endif
9 9
         </div>
10 10
 
@@ -15,10 +15,10 @@
15 15
                 <h1 class="text-4xl font-bold text-white text-center uppercase">{{ $document->header }}</h1>
16 16
             @endif
17 17
         </div>
18
-    </x-company.invoice.header>
18
+    </x-company.document-template.header>
19 19
 
20 20
     <!-- Company Details -->
21
-    <x-company.invoice.metadata class="modern-template-metadata space-y-8">
21
+    <x-company.document-template.metadata class="modern-template-metadata space-y-8">
22 22
         <div class="text-sm">
23 23
             <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
24 24
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
@@ -63,10 +63,10 @@
63 63
                 </table>
64 64
             </div>
65 65
         </div>
66
-    </x-company.invoice.metadata>
66
+    </x-company.document-template.metadata>
67 67
 
68 68
     <!-- Line Items Table -->
69
-    <x-company.invoice.line-items class="modern-template-line-items">
69
+    <x-company.document-template.line-items class="modern-template-line-items">
70 70
         <table class="w-full text-left table-fixed">
71 71
             <thead class="text-sm leading-relaxed">
72 72
             <tr class="text-gray-600 dark:text-gray-400">
@@ -129,10 +129,10 @@
129 129
             @endif
130 130
             </tfoot>
131 131
         </table>
132
-    </x-company.invoice.line-items>
132
+    </x-company.document-template.line-items>
133 133
 
134 134
     <!-- Footer Notes -->
135
-    <x-company.invoice.footer class="modern-template-footer tracking-tight">
135
+    <x-company.document-template.footer class="modern-template-footer tracking-tight">
136 136
         <h4 class="font-semibold px-6 text-sm" style="color: {{ $document->accentColor }}">
137 137
             Terms & Conditions
138 138
         </h4>
@@ -141,5 +141,5 @@
141 141
             <p class="w-1/2 break-words line-clamp-4">{{ $document->terms }}</p>
142 142
             <p class="w-1/2 break-words line-clamp-4">{{ $document->footer }}</p>
143 143
         </div>
144
-    </x-company.invoice.footer>
145
-</x-company.invoice.container>
144
+    </x-company.document-template.footer>
145
+</x-company.document-template.container>

+ 13
- 19
resources/views/print-document.blade.php Прегледај датотеку

@@ -4,29 +4,19 @@
4 4
     <title>Invoice #{{ $document->number }}</title>
5 5
     <meta charset="utf-8">
6 6
     <meta name="viewport" content="width=device-width, initial-scale=1">
7
-    <meta name="color-scheme" content="light">
8 7
 
9 8
     <!-- Include Tailwind -->
10
-    <script src="https://cdn.tailwindcss.com?plugins=typography"></script>
11
-    <script>
12
-        tailwind.config = {
13
-            darkMode: 'class'
14
-        }
15
-    </script>
9
+    <script src="https://cdn.tailwindcss.com"></script>
16 10
 
17 11
     {!! $document->getFontHtml() !!}
18 12
 
19 13
     <style>
20
-        :root {
21
-            color-scheme: light;
22
-        }
23
-
24 14
         body {
25 15
             background-color: white;
26 16
             color: black;
27 17
         }
28 18
 
29
-        .inv-paper {
19
+        .doc-template-paper {
30 20
             font-family: '{{ $document->font->getLabel() }}', sans-serif;
31 21
         }
32 22
 
@@ -40,39 +30,43 @@
40 30
 
41 31
             @page {
42 32
                 size: auto;
43
-                margin: 0;
33
+                margin: 7.5mm 0;
34
+            }
35
+
36
+            @page:first {
37
+                margin-top: 0;
44 38
             }
45 39
 
46
-            .inv-container {
40
+            .doc-template-container {
47 41
                 padding: 0 !important;
48 42
                 margin: 0 !important;
49 43
             }
50 44
 
51
-            .inv-paper {
45
+            .doc-template-paper {
52 46
                 box-shadow: none !important;
53 47
                 border-radius: 0 !important;
54 48
                 overflow: hidden !important;
55 49
                 max-height: none !important;
56 50
             }
57 51
 
58
-            .inv-line-items .summary-section {
52
+            .doc-template-line-items .summary-section {
59 53
                 display: table-row-group;
60 54
                 page-break-inside: avoid;
61 55
             }
62 56
 
63
-            .inv-line-items tr {
57
+            .doc-template-line-items tr {
64 58
                 page-break-inside: avoid;
65 59
                 page-break-after: auto;
66 60
             }
67 61
 
68
-            .inv-footer {
62
+            .doc-template-footer {
69 63
                 page-break-inside: avoid;
70 64
                 page-break-before: auto;
71 65
             }
72 66
         }
73 67
     </style>
74 68
 </head>
75
-<body class="bg-white">
69
+<body>
76 70
     @include("filament.infolists.components.document-templates.{$template->value}", [
77 71
         'document' => $document,
78 72
         'preview' => false,

Loading…
Откажи
Сачувај