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
                             ->columnSpan(2)
130
                             ->columnSpan(2)
131
                             ->hiddenLabel()
131
                             ->hiddenLabel()
132
                             ->visible(static fn (Get $get) => $get('template') === 'default')
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
                         Forms\Components\ViewField::make('preview.modern')
134
                         Forms\Components\ViewField::make('preview.modern')
135
                             ->columnSpan(2)
135
                             ->columnSpan(2)
136
                             ->hiddenLabel()
136
                             ->hiddenLabel()
137
                             ->visible(static fn (Get $get) => $get('template') === 'modern')
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
                         Forms\Components\ViewField::make('preview.classic')
139
                         Forms\Components\ViewField::make('preview.classic')
140
                             ->columnSpan(2)
140
                             ->columnSpan(2)
141
                             ->hiddenLabel()
141
                             ->hiddenLabel()
142
                             ->visible(static fn (Get $get) => $get('template') === 'classic')
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
                     ])->columnSpan(2),
144
                     ])->columnSpan(2),
145
             ])->columns(3);
145
             ])->columns(3);
146
     }
146
     }

+ 1
- 14
app/Filament/Company/Resources/Sales/EstimateResource/Pages/ViewEstimate.php 查看文件

34
     protected function getHeaderActions(): array
34
     protected function getHeaderActions(): array
35
     {
35
     {
36
         return [
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
             Actions\EditAction::make()
37
             Actions\EditAction::make()
52
                 ->label('Edit estimate')
38
                 ->label('Edit estimate')
53
                 ->outlined(),
39
                 ->outlined(),
57
                     Estimate::getMarkAsSentAction(),
43
                     Estimate::getMarkAsSentAction(),
58
                     Estimate::getMarkAsAcceptedAction(),
44
                     Estimate::getMarkAsAcceptedAction(),
59
                     Estimate::getMarkAsDeclinedAction(),
45
                     Estimate::getMarkAsDeclinedAction(),
46
+                    Estimate::getPrintDocumentAction(),
60
                     Estimate::getReplicateAction(),
47
                     Estimate::getReplicateAction(),
61
                     Estimate::getConvertToInvoiceAction(),
48
                     Estimate::getConvertToInvoiceAction(),
62
                 ])->dropdown(false),
49
                 ])->dropdown(false),

+ 1
- 14
app/Filament/Company/Resources/Sales/InvoiceResource/Pages/ViewInvoice.php 查看文件

34
     protected function getHeaderActions(): array
34
     protected function getHeaderActions(): array
35
     {
35
     {
36
         return [
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
             Actions\EditAction::make()
37
             Actions\EditAction::make()
52
                 ->label('Edit invoice')
38
                 ->label('Edit invoice')
53
                 ->outlined(),
39
                 ->outlined(),
55
                 Actions\ActionGroup::make([
41
                 Actions\ActionGroup::make([
56
                     Invoice::getApproveDraftAction(),
42
                     Invoice::getApproveDraftAction(),
57
                     Invoice::getMarkAsSentAction(),
43
                     Invoice::getMarkAsSentAction(),
44
+                    Invoice::getPrintDocumentAction(),
58
                     Invoice::getReplicateAction(),
45
                     Invoice::getReplicateAction(),
59
                 ])->dropdown(false),
46
                 ])->dropdown(false),
60
                 Actions\DeleteAction::make(),
47
                 Actions\DeleteAction::make(),

+ 1
- 14
app/Filament/Company/Resources/Sales/RecurringInvoiceResource/Pages/ViewRecurringInvoice.php 查看文件

34
     protected function getHeaderActions(): array
34
     protected function getHeaderActions(): array
35
     {
35
     {
36
         return [
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
             Actions\EditAction::make()
37
             Actions\EditAction::make()
52
                 ->label('Edit recurring invoice')
38
                 ->label('Edit recurring invoice')
53
                 ->outlined(),
39
                 ->outlined(),
55
                 Actions\ActionGroup::make([
41
                 Actions\ActionGroup::make([
56
                     RecurringInvoice::getManageScheduleAction(),
42
                     RecurringInvoice::getManageScheduleAction(),
57
                     RecurringInvoice::getApproveDraftAction(),
43
                     RecurringInvoice::getApproveDraftAction(),
44
+                    RecurringInvoice::getPrintDocumentAction(),
58
                 ])->dropdown(false),
45
                 ])->dropdown(false),
59
                 Actions\DeleteAction::make(),
46
                 Actions\DeleteAction::make(),
60
             ])
47
             ])

+ 18
- 0
app/Models/Accounting/Document.php 查看文件

6
 use App\Concerns\CompanyOwned;
6
 use App\Concerns\CompanyOwned;
7
 use App\Enums\Accounting\DocumentType;
7
 use App\Enums\Accounting\DocumentType;
8
 use App\Models\Setting\Currency;
8
 use App\Models\Setting\Currency;
9
+use Filament\Actions\Action;
10
+use Filament\Actions\MountableAction;
9
 use Illuminate\Database\Eloquent\Factories\HasFactory;
11
 use Illuminate\Database\Eloquent\Factories\HasFactory;
10
 use Illuminate\Database\Eloquent\Model;
12
 use Illuminate\Database\Eloquent\Model;
11
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
13
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
12
 use Illuminate\Database\Eloquent\Relations\MorphMany;
14
 use Illuminate\Database\Eloquent\Relations\MorphMany;
15
+use Livewire\Component;
13
 
16
 
14
 abstract class Document extends Model
17
 abstract class Document extends Model
15
 {
18
 {
32
         return $this->lineItems()->exists();
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
     abstract public static function documentType(): DocumentType;
53
     abstract public static function documentType(): DocumentType;
36
 
54
 
37
     abstract public function documentNumber(): ?string;
55
     abstract public function documentNumber(): ?string;

resources/views/components/company/invoice/container.blade.php → resources/views/components/company/document-template/container.blade.php 查看文件

2
     'preview' => false,
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
     <div
6
     <div
7
         @class([
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
             'w-full max-w-[820px] max-h-[1024px] overflow-y-auto' => $preview === false,
9
             'w-full max-w-[820px] max-h-[1024px] overflow-y-auto' => $preview === false,
10
             'w-[38.25rem] h-[49.5rem] overflow-hidden' => $preview === true,
10
             'w-[38.25rem] h-[49.5rem] overflow-hidden' => $preview === true,
11
         ])
11
         ])

+ 3
- 0
resources/views/components/company/document-template/footer.blade.php 查看文件

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 查看文件

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 查看文件

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

+ 3
- 0
resources/views/components/company/document-template/metadata.blade.php 查看文件

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
-<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
-<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
-<div {{ $attributes->class(['inv-line-items py-6']) }}>
2
-    {{ $slot }}
3
-</div>

+ 0
- 3
resources/views/components/company/invoice/metadata.blade.php 查看文件

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
-@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
-@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
 {!! $document->getFontHtml() !!}
6
 {!! $document->getFontHtml() !!}
7
 
7
 
8
 <style>
8
 <style>
9
-    .inv-paper {
9
+    .doc-template-paper {
10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
11
     }
11
     }
12
 </style>
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
     <!-- Header Section -->
15
     <!-- Header Section -->
16
-    <x-company.invoice.header class="default-template-header">
16
+    <x-company.document-template.header class="default-template-header">
17
         <div class="w-2/3 text-left ml-6">
17
         <div class="w-2/3 text-left ml-6">
18
             <div class="text-xs">
18
             <div class="text-xs">
19
                 <h2 class="text-base font-semibold">{{ $document->company->name }}</h2>
19
                 <h2 class="text-base font-semibold">{{ $document->company->name }}</h2>
25
 
25
 
26
         <div class="w-1/3 flex justify-end mr-6">
26
         <div class="w-1/3 flex justify-end mr-6">
27
             @if($document->logo && $document->showLogo)
27
             @if($document->logo && $document->showLogo)
28
-                <x-company.invoice.logo :src="$document->logo"/>
28
+                <x-company.document-template.logo :src="$document->logo"/>
29
             @endif
29
             @endif
30
         </div>
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
         <div class="items-center flex">
34
         <div class="items-center flex">
35
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
35
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
36
             <x-icons.document-header-decoration
36
             <x-icons.document-header-decoration
75
                 </table>
75
                 </table>
76
             </div>
76
             </div>
77
         </div>
77
         </div>
78
-    </x-company.invoice.metadata>
78
+    </x-company.document-template.metadata>
79
 
79
 
80
     <!-- Line Items -->
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
         <table class="w-full text-left table-fixed">
82
         <table class="w-full text-left table-fixed">
83
             <thead class="text-sm leading-8">
83
             <thead class="text-sm leading-8">
84
             <tr>
84
             <tr>
136
                 </table>
136
                 </table>
137
             </div>
137
             </div>
138
         </div>
138
         </div>
139
-    </x-company.invoice.line-items>
139
+    </x-company.document-template.line-items>
140
 
140
 
141
     <!-- Footer -->
141
     <!-- Footer -->
142
-    <x-company.invoice.footer class="classic-template-footer">
142
+    <x-company.document-template.footer class="classic-template-footer">
143
         <h4 class="font-semibold px-6 mb-2">Terms & Conditions</h4>
143
         <h4 class="font-semibold px-6 mb-2">Terms & Conditions</h4>
144
         <p class="px-6 break-words line-clamp-4">{{ $document->terms }}</p>
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
 {!! $document->getFontHtml() !!}
6
 {!! $document->getFontHtml() !!}
7
 
7
 
8
 <style>
8
 <style>
9
-    .inv-paper {
9
+    .doc-template-paper {
10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
11
     }
11
     }
12
 </style>
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
         <div class="w-2/3">
17
         <div class="w-2/3">
18
             @if($document->logo && $document->showLogo)
18
             @if($document->logo && $document->showLogo)
19
-                <x-company.invoice.logo :src="$document->logo"/>
19
+                <x-company.document-template.logo :src="$document->logo"/>
20
             @endif
20
             @endif
21
         </div>
21
         </div>
22
 
22
 
28
                 @endif
28
                 @endif
29
             </div>
29
             </div>
30
         </div>
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
         <div>
34
         <div>
35
             <h1 class="text-3xl font-light uppercase">{{ $document->header }}</h1>
35
             <h1 class="text-3xl font-light uppercase">{{ $document->header }}</h1>
36
             @if ($document->subheader)
36
             @if ($document->subheader)
71
                 </table>
71
                 </table>
72
             </div>
72
             </div>
73
         </div>
73
         </div>
74
-    </x-company.invoice.metadata>
74
+    </x-company.document-template.metadata>
75
 
75
 
76
     <!-- Line Items Table -->
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
         <table class="w-full text-left table-fixed">
78
         <table class="w-full text-left table-fixed">
79
             <thead class="text-sm leading-8" style="background: {{ $document->accentColor }}">
79
             <thead class="text-sm leading-8" style="background: {{ $document->accentColor }}">
80
             <tr class="text-white">
80
             <tr class="text-white">
122
             </tr>
122
             </tr>
123
             </tfoot>
123
             </tfoot>
124
         </table>
124
         </table>
125
-    </x-company.invoice.line-items>
125
+    </x-company.document-template.line-items>
126
 
126
 
127
     <!-- Footer Notes -->
127
     <!-- Footer Notes -->
128
-    <x-company.invoice.footer class="default-template-footer">
128
+    <x-company.document-template.footer class="default-template-footer">
129
         <p class="px-6">{{ $document->footer }}</p>
129
         <p class="px-6">{{ $document->footer }}</p>
130
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
130
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
131
         <h4 class="font-semibold px-6 mb-2">Terms & Conditions</h4>
131
         <h4 class="font-semibold px-6 mb-2">Terms & Conditions</h4>
132
         <p class="px-6 break-words line-clamp-4">{{ $document->terms }}</p>
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
 {!! $document->getFontHtml() !!}
6
 {!! $document->getFontHtml() !!}
7
 
7
 
8
 <style>
8
 <style>
9
-    .inv-paper {
9
+    .doc-template-paper {
10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
11
     }
11
     }
12
 </style>
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
     <!-- Colored Header with Logo -->
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
         <!-- Logo -->
18
         <!-- Logo -->
19
         <div class="w-2/3">
19
         <div class="w-2/3">
20
             @if($document->logo && $document->showLogo)
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
             @endif
22
             @endif
23
         </div>
23
         </div>
24
 
24
 
29
                 <h1 class="text-3xl font-bold text-white text-center uppercase">{{ $document->header }}</h1>
29
                 <h1 class="text-3xl font-bold text-white text-center uppercase">{{ $document->header }}</h1>
30
             @endif
30
             @endif
31
         </div>
31
         </div>
32
-    </x-company.invoice.header>
32
+    </x-company.document-template.header>
33
 
33
 
34
     <!-- Company Details -->
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
         <div class="text-xs">
36
         <div class="text-xs">
37
             <h2 class="text-base font-semibold">{{ $document->company->name }}</h2>
37
             <h2 class="text-base font-semibold">{{ $document->company->name }}</h2>
38
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
38
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
77
                 </table>
77
                 </table>
78
             </div>
78
             </div>
79
         </div>
79
         </div>
80
-    </x-company.invoice.metadata>
80
+    </x-company.document-template.metadata>
81
 
81
 
82
     <!-- Line Items Table -->
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
         <table class="w-full text-left table-fixed">
84
         <table class="w-full text-left table-fixed">
85
             <thead class="text-sm leading-8">
85
             <thead class="text-sm leading-8">
86
             <tr class="text-gray-600 dark:text-gray-400">
86
             <tr class="text-gray-600 dark:text-gray-400">
143
             @endif
143
             @endif
144
             </tfoot>
144
             </tfoot>
145
         </table>
145
         </table>
146
-    </x-company.invoice.line-items>
146
+    </x-company.document-template.line-items>
147
 
147
 
148
     <!-- Footer Notes -->
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
         <h4 class="font-semibold px-6" style="color: {{ $document->accentColor }}">Terms & Conditions</h4>
150
         <h4 class="font-semibold px-6" style="color: {{ $document->accentColor }}">Terms & Conditions</h4>
151
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
151
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
152
         <div class="flex justify-between space-x-4 px-6">
152
         <div class="flex justify-between space-x-4 px-6">
153
             <p class="w-1/2 break-words line-clamp-4">{{ $document->terms }}</p>
153
             <p class="w-1/2 break-words line-clamp-4">{{ $document->terms }}</p>
154
             <p class="w-1/2 break-words line-clamp-4">{{ $document->footer }}</p>
154
             <p class="w-1/2 break-words line-clamp-4">{{ $document->footer }}</p>
155
         </div>
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
 {!! $document->getFontHtml() !!}
6
 {!! $document->getFontHtml() !!}
7
 
7
 
8
 <style>
8
 <style>
9
-    .inv-paper {
9
+    .doc-template-paper {
10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
10
         font-family: '{{ $document->font->getLabel() }}', sans-serif;
11
     }
11
     }
12
 </style>
12
 </style>

+ 11
- 11
resources/views/filament/infolists/components/document-templates/classic.blade.php 查看文件

1
-<x-company.invoice.container class="classic-template-container">
1
+<x-company.document-template.container class="classic-template-container">
2
     <!-- Header Section -->
2
     <!-- Header Section -->
3
-    <x-company.invoice.header class="default-template-header">
3
+    <x-company.document-template.header class="default-template-header">
4
         <div class="w-2/3 text-left ml-6">
4
         <div class="w-2/3 text-left ml-6">
5
             <div class="text-sm tracking-tight">
5
             <div class="text-sm tracking-tight">
6
                 <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
6
                 <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
12
 
12
 
13
         <div class="w-1/3 flex justify-end mr-6">
13
         <div class="w-1/3 flex justify-end mr-6">
14
             @if($document->logo && $document->showLogo)
14
             @if($document->logo && $document->showLogo)
15
-                <x-company.invoice.logo :src="$document->logo"/>
15
+                <x-company.document-template.logo :src="$document->logo"/>
16
             @endif
16
             @endif
17
         </div>
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
         <div class="items-center flex">
21
         <div class="items-center flex">
22
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
22
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
23
             <x-icons.document-header-decoration
23
             <x-icons.document-header-decoration
62
                 </table>
62
                 </table>
63
             </div>
63
             </div>
64
         </div>
64
         </div>
65
-    </x-company.invoice.metadata>
65
+    </x-company.document-template.metadata>
66
 
66
 
67
     <!-- Line Items -->
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
         <table class="w-full text-left table-fixed">
69
         <table class="w-full text-left table-fixed">
70
             <thead class="text-sm leading-relaxed">
70
             <thead class="text-sm leading-relaxed">
71
             <tr>
71
             <tr>
138
                 </table>
138
                 </table>
139
             </div>
139
             </div>
140
         </div>
140
         </div>
141
-    </x-company.invoice.line-items>
141
+    </x-company.document-template.line-items>
142
 
142
 
143
     <!-- Footer -->
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
         <h4 class="font-semibold px-6 mb-2 text-sm">Terms & Conditions</h4>
145
         <h4 class="font-semibold px-6 mb-2 text-sm">Terms & Conditions</h4>
146
         <p class="px-6 break-words line-clamp-4 text-sm">{{ $document->terms }}</p>
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
-<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
         <div class="w-2/3">
4
         <div class="w-2/3">
5
             @if($document->logo && $document->showLogo)
5
             @if($document->logo && $document->showLogo)
6
-                <x-company.invoice.logo :src="$document->logo"/>
6
+                <x-company.document-template.logo :src="$document->logo"/>
7
             @endif
7
             @endif
8
         </div>
8
         </div>
9
 
9
 
15
                 @endif
15
                 @endif
16
             </div>
16
             </div>
17
         </div>
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
         <div>
21
         <div>
22
             <h1 class="text-4xl font-light uppercase">{{ $document->header }}</h1>
22
             <h1 class="text-4xl font-light uppercase">{{ $document->header }}</h1>
23
             @if ($document->subheader)
23
             @if ($document->subheader)
60
                 </table>
60
                 </table>
61
             </div>
61
             </div>
62
         </div>
62
         </div>
63
-    </x-company.invoice.metadata>
63
+    </x-company.document-template.metadata>
64
 
64
 
65
     <!-- Line Items Table -->
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
         <table class="w-full text-left table-fixed">
67
         <table class="w-full text-left table-fixed">
68
             <thead class="text-sm leading-relaxed" style="background: {{ $document->accentColor }}">
68
             <thead class="text-sm leading-relaxed" style="background: {{ $document->accentColor }}">
69
             <tr class="text-white">
69
             <tr class="text-white">
126
             @endif
126
             @endif
127
             </tfoot>
127
             </tfoot>
128
         </table>
128
         </table>
129
-    </x-company.invoice.line-items>
129
+    </x-company.document-template.line-items>
130
 
130
 
131
     <!-- Footer Notes -->
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
         <p class="px-6 text-sm">{{ $document->footer }}</p>
133
         <p class="px-6 text-sm">{{ $document->footer }}</p>
134
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
134
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
135
         <h4 class="font-semibold px-6 mb-2 text-sm">Terms & Conditions</h4>
135
         <h4 class="font-semibold px-6 mb-2 text-sm">Terms & Conditions</h4>
136
         <p class="px-6 break-words line-clamp-4 text-sm">{{ $document->terms }}</p>
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
-<x-company.invoice.container class="modern-template-container">
1
+<x-company.document-template.container class="modern-template-container">
2
     <!-- Colored Header with Logo -->
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
         <!-- Logo -->
4
         <!-- Logo -->
5
         <div class="w-2/3">
5
         <div class="w-2/3">
6
             @if($document->logo && $document->showLogo)
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
             @endif
8
             @endif
9
         </div>
9
         </div>
10
 
10
 
15
                 <h1 class="text-4xl font-bold text-white text-center uppercase">{{ $document->header }}</h1>
15
                 <h1 class="text-4xl font-bold text-white text-center uppercase">{{ $document->header }}</h1>
16
             @endif
16
             @endif
17
         </div>
17
         </div>
18
-    </x-company.invoice.header>
18
+    </x-company.document-template.header>
19
 
19
 
20
     <!-- Company Details -->
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
         <div class="text-sm">
22
         <div class="text-sm">
23
             <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
23
             <h2 class="text-lg font-semibold">{{ $document->company->name }}</h2>
24
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
24
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
63
                 </table>
63
                 </table>
64
             </div>
64
             </div>
65
         </div>
65
         </div>
66
-    </x-company.invoice.metadata>
66
+    </x-company.document-template.metadata>
67
 
67
 
68
     <!-- Line Items Table -->
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
         <table class="w-full text-left table-fixed">
70
         <table class="w-full text-left table-fixed">
71
             <thead class="text-sm leading-relaxed">
71
             <thead class="text-sm leading-relaxed">
72
             <tr class="text-gray-600 dark:text-gray-400">
72
             <tr class="text-gray-600 dark:text-gray-400">
129
             @endif
129
             @endif
130
             </tfoot>
130
             </tfoot>
131
         </table>
131
         </table>
132
-    </x-company.invoice.line-items>
132
+    </x-company.document-template.line-items>
133
 
133
 
134
     <!-- Footer Notes -->
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
         <h4 class="font-semibold px-6 text-sm" style="color: {{ $document->accentColor }}">
136
         <h4 class="font-semibold px-6 text-sm" style="color: {{ $document->accentColor }}">
137
             Terms & Conditions
137
             Terms & Conditions
138
         </h4>
138
         </h4>
141
             <p class="w-1/2 break-words line-clamp-4">{{ $document->terms }}</p>
141
             <p class="w-1/2 break-words line-clamp-4">{{ $document->terms }}</p>
142
             <p class="w-1/2 break-words line-clamp-4">{{ $document->footer }}</p>
142
             <p class="w-1/2 break-words line-clamp-4">{{ $document->footer }}</p>
143
         </div>
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
     <title>Invoice #{{ $document->number }}</title>
4
     <title>Invoice #{{ $document->number }}</title>
5
     <meta charset="utf-8">
5
     <meta charset="utf-8">
6
     <meta name="viewport" content="width=device-width, initial-scale=1">
6
     <meta name="viewport" content="width=device-width, initial-scale=1">
7
-    <meta name="color-scheme" content="light">
8
 
7
 
9
     <!-- Include Tailwind -->
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
     {!! $document->getFontHtml() !!}
11
     {!! $document->getFontHtml() !!}
18
 
12
 
19
     <style>
13
     <style>
20
-        :root {
21
-            color-scheme: light;
22
-        }
23
-
24
         body {
14
         body {
25
             background-color: white;
15
             background-color: white;
26
             color: black;
16
             color: black;
27
         }
17
         }
28
 
18
 
29
-        .inv-paper {
19
+        .doc-template-paper {
30
             font-family: '{{ $document->font->getLabel() }}', sans-serif;
20
             font-family: '{{ $document->font->getLabel() }}', sans-serif;
31
         }
21
         }
32
 
22
 
40
 
30
 
41
             @page {
31
             @page {
42
                 size: auto;
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
                 padding: 0 !important;
41
                 padding: 0 !important;
48
                 margin: 0 !important;
42
                 margin: 0 !important;
49
             }
43
             }
50
 
44
 
51
-            .inv-paper {
45
+            .doc-template-paper {
52
                 box-shadow: none !important;
46
                 box-shadow: none !important;
53
                 border-radius: 0 !important;
47
                 border-radius: 0 !important;
54
                 overflow: hidden !important;
48
                 overflow: hidden !important;
55
                 max-height: none !important;
49
                 max-height: none !important;
56
             }
50
             }
57
 
51
 
58
-            .inv-line-items .summary-section {
52
+            .doc-template-line-items .summary-section {
59
                 display: table-row-group;
53
                 display: table-row-group;
60
                 page-break-inside: avoid;
54
                 page-break-inside: avoid;
61
             }
55
             }
62
 
56
 
63
-            .inv-line-items tr {
57
+            .doc-template-line-items tr {
64
                 page-break-inside: avoid;
58
                 page-break-inside: avoid;
65
                 page-break-after: auto;
59
                 page-break-after: auto;
66
             }
60
             }
67
 
61
 
68
-            .inv-footer {
62
+            .doc-template-footer {
69
                 page-break-inside: avoid;
63
                 page-break-inside: avoid;
70
                 page-break-before: auto;
64
                 page-break-before: auto;
71
             }
65
             }
72
         }
66
         }
73
     </style>
67
     </style>
74
 </head>
68
 </head>
75
-<body class="bg-white">
69
+<body>
76
     @include("filament.infolists.components.document-templates.{$template->value}", [
70
     @include("filament.infolists.components.document-templates.{$template->value}", [
77
         'document' => $document,
71
         'document' => $document,
78
         'preview' => false,
72
         'preview' => false,

Loading…
取消
儲存