瀏覽代碼

refactor

3.x
Andrew Wallo 7 月之前
父節點
當前提交
8cef0c897b

+ 2
- 0
app/Filament/Company/Resources/Purchases/BillResource.php 查看文件

@@ -164,12 +164,14 @@ class BillResource extends Resource
164 164
                                     ->required()
165 165
                                     ->numeric()
166 166
                                     ->live()
167
+                                    ->maxValue(9999999999.99)
167 168
                                     ->default(1),
168 169
                                 Forms\Components\TextInput::make('unit_price')
169 170
                                     ->label('Price')
170 171
                                     ->hiddenLabel()
171 172
                                     ->numeric()
172 173
                                     ->live()
174
+                                    ->maxValue(9999999999.99)
173 175
                                     ->default(0),
174 176
                                 Forms\Components\Select::make('purchaseTaxes')
175 177
                                     ->label('Taxes')

+ 2
- 0
app/Filament/Company/Resources/Sales/EstimateResource.php 查看文件

@@ -169,11 +169,13 @@ class EstimateResource extends Resource
169 169
                                     ->required()
170 170
                                     ->numeric()
171 171
                                     ->live()
172
+                                    ->maxValue(9999999999.99)
172 173
                                     ->default(1),
173 174
                                 Forms\Components\TextInput::make('unit_price')
174 175
                                     ->hiddenLabel()
175 176
                                     ->numeric()
176 177
                                     ->live()
178
+                                    ->maxValue(9999999999.99)
177 179
                                     ->default(0),
178 180
                                 Forms\Components\Select::make('salesTaxes')
179 181
                                     ->relationship('salesTaxes', 'name')

+ 2
- 0
app/Filament/Company/Resources/Sales/InvoiceResource.php 查看文件

@@ -183,11 +183,13 @@ class InvoiceResource extends Resource
183 183
                                     ->required()
184 184
                                     ->numeric()
185 185
                                     ->live()
186
+                                    ->maxValue(9999999999.99)
186 187
                                     ->default(1),
187 188
                                 Forms\Components\TextInput::make('unit_price')
188 189
                                     ->hiddenLabel()
189 190
                                     ->numeric()
190 191
                                     ->live()
192
+                                    ->maxValue(9999999999.99)
191 193
                                     ->default(0),
192 194
                                 Forms\Components\Select::make('salesTaxes')
193 195
                                     ->relationship('salesTaxes', 'name')

+ 2
- 0
app/Filament/Company/Resources/Sales/RecurringInvoiceResource.php 查看文件

@@ -153,11 +153,13 @@ class RecurringInvoiceResource extends Resource
153 153
                                     ->required()
154 154
                                     ->numeric()
155 155
                                     ->live()
156
+                                    ->maxValue(9999999999.99)
156 157
                                     ->default(1),
157 158
                                 Forms\Components\TextInput::make('unit_price')
158 159
                                     ->hiddenLabel()
159 160
                                     ->numeric()
160 161
                                     ->live()
162
+                                    ->maxValue(9999999999.99)
161 163
                                     ->default(0),
162 164
                                 Forms\Components\Select::make('salesTaxes')
163 165
                                     ->relationship('salesTaxes', 'name')

+ 7
- 1
app/Utilities/Currency/CurrencyConverter.php 查看文件

@@ -46,7 +46,13 @@ class CurrencyConverter
46 46
     {
47 47
         $currency ??= CurrencyAccessor::getDefaultCurrency();
48 48
 
49
-        return money($amount, $currency, true)->getAmount();
49
+        $amountInCents = money($amount, $currency, true)->getAmount();
50
+
51
+        if (is_float($amountInCents)) {
52
+            $amountInCents = (int) round($amountInCents);
53
+        }
54
+
55
+        return $amountInCents;
50 56
     }
51 57
 
52 58
     public static function formatCentsToMoney(int $amount, ?string $currency = null, bool $withCode = false): string

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

@@ -14,16 +14,16 @@
14 14
 <x-company.document-template.container class="classic-template-container" preview>
15 15
     <!-- Header Section -->
16 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">
18 18
             <div class="text-xs">
19
-                <h2 class="text-base font-semibold">{{ $document->company->name }}</h2>
19
+                <h2 class="text-xs font-semibold">{{ $document->company->name }}</h2>
20 20
                 @if($formattedAddress = $document->company->getFormattedAddressHtml())
21 21
                     {!! $formattedAddress !!}
22 22
                 @endif
23 23
             </div>
24 24
         </div>
25 25
 
26
-        <div class="w-1/3 flex justify-end mr-6">
26
+        <div class="w-1/3 flex justify-end">
27 27
             @if($document->logo && $document->showLogo)
28 28
                 <x-company.document-template.logo :src="$document->logo"/>
29 29
             @endif
@@ -40,13 +40,13 @@
40 40
             />
41 41
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
42 42
         </div>
43
-        <div class="mt-2 text-sm text-center text-gray-600 dark:text-gray-400">{{ $document->subheader }}</div>
43
+        <div class="mt-2 text-xs text-center text-gray-600 dark:text-gray-400">{{ $document->subheader }}</div>
44 44
 
45 45
         <div class="flex justify-between items-end">
46 46
             <!-- Billing Details -->
47 47
             <div class="text-xs">
48
-                <h3 class="text-gray-600 dark:text-gray-400 font-medium tracking-tight mb-1">BILL TO</h3>
49
-                <p class="text-base font-bold">{{ $document->client->name }}</p>
48
+                <h3 class="text-gray-600 dark:text-gray-400 font-medium mb-1">BILL TO</h3>
49
+                <p class="text-xs font-bold">{{ $document->client->name }}</p>
50 50
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
51 51
                     {!! $formattedAddress !!}
52 52
                 @endif
@@ -80,7 +80,7 @@
80 80
     <!-- Line Items -->
81 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
-            <thead class="text-sm leading-8">
83
+            <thead class="text-xs leading-8">
84 84
             <tr>
85 85
                 <th class="text-left">{{ $document->columnLabel->items }}</th>
86 86
                 <th class="text-center">{{ $document->columnLabel->units }}</th>
@@ -139,7 +139,7 @@
139 139
     </x-company.document-template.line-items>
140 140
 
141 141
     <!-- Footer -->
142
-    <x-company.document-template.footer class="classic-template-footer">
142
+    <x-company.document-template.footer class="classic-template-footer text-xs">
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 145
     </x-company.document-template.footer>

+ 9
- 7
resources/views/filament/company/components/document-templates/default.blade.php 查看文件

@@ -32,17 +32,17 @@
32 32
 
33 33
     <x-company.document-template.metadata class="default-template-metadata space-y-6">
34 34
         <div>
35
-            <h1 class="text-3xl font-light uppercase">{{ $document->header }}</h1>
35
+            <h1 class="text-2xl font-light uppercase">{{ $document->header }}</h1>
36 36
             @if ($document->subheader)
37
-                <h2 class="text-sm text-gray-600 dark:text-gray-400">{{ $document->subheader }}</h2>
37
+                <h2 class="text-xs text-gray-600 dark:text-gray-400">{{ $document->subheader }}</h2>
38 38
             @endif
39 39
         </div>
40 40
 
41 41
         <div class="flex justify-between items-end">
42 42
             <!-- Billing Details -->
43 43
             <div class="text-xs">
44
-                <h3 class="text-gray-600 dark:text-gray-400 font-medium tracking-tight mb-1">BILL TO</h3>
45
-                <p class="text-base font-bold">{{ $document->client->name }}</p>
44
+                <h3 class="text-gray-600 dark:text-gray-400 font-medium mb-1">BILL TO</h3>
45
+                <p class="text-xs font-bold">{{ $document->client->name }}</p>
46 46
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
47 47
                     {!! $formattedAddress !!}
48 48
                 @endif
@@ -76,7 +76,7 @@
76 76
     <!-- Line Items Table -->
77 77
     <x-company.document-template.line-items class="default-template-line-items">
78 78
         <table class="w-full text-left table-fixed">
79
-            <thead class="text-sm leading-8" style="background: {{ $document->accentColor }}">
79
+            <thead class="text-xs leading-8" style="background: {{ $document->accentColor }}">
80 80
             <tr class="text-white">
81 81
                 <th class="text-left pl-6">{{ $document->columnLabel->items }}</th>
82 82
                 <th class="text-center">{{ $document->columnLabel->units }}</th>
@@ -117,7 +117,9 @@
117 117
             </tr>
118 118
             <tr>
119 119
                 <td class="pl-6" colspan="2"></td>
120
-                <td class="text-right font-semibold border-t-4 border-double">{{ $document->label->amountDue }} ({{ $document->currencyCode }}):</td>
120
+                <td class="text-right font-semibold border-t-4 border-double">{{ $document->label->amountDue }}
121
+                    ({{ $document->currencyCode }}):
122
+                </td>
121 123
                 <td class="text-right border-t-4 border-double pr-6">{{ $document->amountDue }}</td>
122 124
             </tr>
123 125
             </tfoot>
@@ -125,7 +127,7 @@
125 127
     </x-company.document-template.line-items>
126 128
 
127 129
     <!-- Footer Notes -->
128
-    <x-company.document-template.footer class="default-template-footer">
130
+    <x-company.document-template.footer class="default-template-footer text-xs">
129 131
         <p class="px-6">{{ $document->footer }}</p>
130 132
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
131 133
         <h4 class="font-semibold px-6 mb-2">Terms & Conditions</h4>

+ 9
- 9
resources/views/filament/company/components/document-templates/modern.blade.php 查看文件

@@ -34,7 +34,7 @@
34 34
     <!-- Company Details -->
35 35
     <x-company.document-template.metadata class="modern-template-metadata space-y-6">
36 36
         <div class="text-xs">
37
-            <h2 class="text-base font-semibold">{{ $document->company->name }}</h2>
37
+            <h2 class="text-xs font-semibold">{{ $document->company->name }}</h2>
38 38
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
39 39
                 {!! $formattedAddress !!}
40 40
             @endif
@@ -42,9 +42,9 @@
42 42
 
43 43
         <div class="flex justify-between items-end">
44 44
             <!-- Billing Details -->
45
-            <div class="text-xs tracking-tight">
46
-                <h3 class="text-gray-600 dark:text-gray-400 font-medium tracking-tight mb-1">BILL TO</h3>
47
-                <p class="text-base font-bold"
45
+            <div class="text-xs">
46
+                <h3 class="text-gray-600 dark:text-gray-400 font-medium mb-1">BILL TO</h3>
47
+                <p class="text-xs font-bold"
48 48
                    style="color: {{ $document->accentColor }}">{{ $document->client->name }}</p>
49 49
 
50 50
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
@@ -52,7 +52,7 @@
52 52
                 @endif
53 53
             </div>
54 54
 
55
-            <div class="text-xs tracking-tight">
55
+            <div class="text-xs">
56 56
                 <table class="min-w-full">
57 57
                     <tbody>
58 58
                     <tr>
@@ -82,7 +82,7 @@
82 82
     <!-- Line Items Table -->
83 83
     <x-company.document-template.line-items class="modern-template-line-items">
84 84
         <table class="w-full text-left table-fixed">
85
-            <thead class="text-sm leading-8">
85
+            <thead class="text-xs leading-8">
86 86
             <tr class="text-gray-600 dark:text-gray-400">
87 87
                 <th class="text-left pl-6 w-[50%]">{{ $document->columnLabel->items }}</th>
88 88
                 <th class="text-center w-[10%]">{{ $document->columnLabel->units }}</th>
@@ -90,7 +90,7 @@
90 90
                 <th class="text-right pr-6 w-[20%]">{{ $document->columnLabel->amount }}</th>
91 91
             </tr>
92 92
             </thead>
93
-            <tbody class="text-xs tracking-tight border-y-2">
93
+            <tbody class="text-xs border-y-2">
94 94
             @foreach($document->lineItems as $index => $item)
95 95
                 <tr @class(['bg-gray-100 dark:bg-gray-800' => $index % 2 === 0])>
96 96
                     <td class="text-left pl-6 font-semibold py-2">
@@ -105,7 +105,7 @@
105 105
                 </tr>
106 106
             @endforeach
107 107
             </tbody>
108
-            <tfoot class="text-xs tracking-tight">
108
+            <tfoot class="text-xs">
109 109
             <tr>
110 110
                 <td class="pl-6 py-1" colspan="2"></td>
111 111
                 <td class="text-right font-semibold py-1">Subtotal:</td>
@@ -146,7 +146,7 @@
146 146
     </x-company.document-template.line-items>
147 147
 
148 148
     <!-- Footer Notes -->
149
-    <x-company.document-template.footer class="modern-template-footer tracking-tight">
149
+    <x-company.document-template.footer class="modern-template-footer text-xs">
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">

Loading…
取消
儲存