Andrew Wallo 7 місяці тому
джерело
коміт
8cef0c897b

+ 2
- 0
app/Filament/Company/Resources/Purchases/BillResource.php Переглянути файл

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

+ 2
- 0
app/Filament/Company/Resources/Sales/EstimateResource.php Переглянути файл

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

+ 2
- 0
app/Filament/Company/Resources/Sales/InvoiceResource.php Переглянути файл

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

+ 2
- 0
app/Filament/Company/Resources/Sales/RecurringInvoiceResource.php Переглянути файл

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

+ 7
- 1
app/Utilities/Currency/CurrencyConverter.php Переглянути файл

46
     {
46
     {
47
         $currency ??= CurrencyAccessor::getDefaultCurrency();
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
     public static function formatCentsToMoney(int $amount, ?string $currency = null, bool $withCode = false): string
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
 <x-company.document-template.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.document-template.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">
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-xs font-semibold">{{ $document->company->name }}</h2>
20
                 @if($formattedAddress = $document->company->getFormattedAddressHtml())
20
                 @if($formattedAddress = $document->company->getFormattedAddressHtml())
21
                     {!! $formattedAddress !!}
21
                     {!! $formattedAddress !!}
22
                 @endif
22
                 @endif
23
             </div>
23
             </div>
24
         </div>
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
             @if($document->logo && $document->showLogo)
27
             @if($document->logo && $document->showLogo)
28
                 <x-company.document-template.logo :src="$document->logo"/>
28
                 <x-company.document-template.logo :src="$document->logo"/>
29
             @endif
29
             @endif
40
             />
40
             />
41
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
41
             <hr class="grow-[2] py-0.5 border-solid border-y-2" style="border-color: {{ $document->accentColor }};">
42
         </div>
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
         <div class="flex justify-between items-end">
45
         <div class="flex justify-between items-end">
46
             <!-- Billing Details -->
46
             <!-- Billing Details -->
47
             <div class="text-xs">
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
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
50
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
51
                     {!! $formattedAddress !!}
51
                     {!! $formattedAddress !!}
52
                 @endif
52
                 @endif
80
     <!-- Line Items -->
80
     <!-- Line Items -->
81
     <x-company.document-template.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-xs leading-8">
84
             <tr>
84
             <tr>
85
                 <th class="text-left">{{ $document->columnLabel->items }}</th>
85
                 <th class="text-left">{{ $document->columnLabel->items }}</th>
86
                 <th class="text-center">{{ $document->columnLabel->units }}</th>
86
                 <th class="text-center">{{ $document->columnLabel->units }}</th>
139
     </x-company.document-template.line-items>
139
     </x-company.document-template.line-items>
140
 
140
 
141
     <!-- Footer -->
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
         <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.document-template.footer>
145
     </x-company.document-template.footer>

+ 9
- 7
resources/views/filament/company/components/document-templates/default.blade.php Переглянути файл

32
 
32
 
33
     <x-company.document-template.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-2xl font-light uppercase">{{ $document->header }}</h1>
36
             @if ($document->subheader)
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
             @endif
38
             @endif
39
         </div>
39
         </div>
40
 
40
 
41
         <div class="flex justify-between items-end">
41
         <div class="flex justify-between items-end">
42
             <!-- Billing Details -->
42
             <!-- Billing Details -->
43
             <div class="text-xs">
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
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
46
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
47
                     {!! $formattedAddress !!}
47
                     {!! $formattedAddress !!}
48
                 @endif
48
                 @endif
76
     <!-- Line Items Table -->
76
     <!-- Line Items Table -->
77
     <x-company.document-template.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-xs leading-8" style="background: {{ $document->accentColor }}">
80
             <tr class="text-white">
80
             <tr class="text-white">
81
                 <th class="text-left pl-6">{{ $document->columnLabel->items }}</th>
81
                 <th class="text-left pl-6">{{ $document->columnLabel->items }}</th>
82
                 <th class="text-center">{{ $document->columnLabel->units }}</th>
82
                 <th class="text-center">{{ $document->columnLabel->units }}</th>
117
             </tr>
117
             </tr>
118
             <tr>
118
             <tr>
119
                 <td class="pl-6" colspan="2"></td>
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
                 <td class="text-right border-t-4 border-double pr-6">{{ $document->amountDue }}</td>
123
                 <td class="text-right border-t-4 border-double pr-6">{{ $document->amountDue }}</td>
122
             </tr>
124
             </tr>
123
             </tfoot>
125
             </tfoot>
125
     </x-company.document-template.line-items>
127
     </x-company.document-template.line-items>
126
 
128
 
127
     <!-- Footer Notes -->
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
         <p class="px-6">{{ $document->footer }}</p>
131
         <p class="px-6">{{ $document->footer }}</p>
130
         <span class="border-t-2 my-2 border-gray-300 block w-full"></span>
132
         <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>
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
     <!-- Company Details -->
34
     <!-- Company Details -->
35
     <x-company.document-template.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-xs font-semibold">{{ $document->company->name }}</h2>
38
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
38
             @if($formattedAddress = $document->company->getFormattedAddressHtml())
39
                 {!! $formattedAddress !!}
39
                 {!! $formattedAddress !!}
40
             @endif
40
             @endif
42
 
42
 
43
         <div class="flex justify-between items-end">
43
         <div class="flex justify-between items-end">
44
             <!-- Billing Details -->
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
                    style="color: {{ $document->accentColor }}">{{ $document->client->name }}</p>
48
                    style="color: {{ $document->accentColor }}">{{ $document->client->name }}</p>
49
 
49
 
50
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
50
                 @if($formattedAddress = $document->client->getFormattedAddressHtml())
52
                 @endif
52
                 @endif
53
             </div>
53
             </div>
54
 
54
 
55
-            <div class="text-xs tracking-tight">
55
+            <div class="text-xs">
56
                 <table class="min-w-full">
56
                 <table class="min-w-full">
57
                     <tbody>
57
                     <tbody>
58
                     <tr>
58
                     <tr>
82
     <!-- Line Items Table -->
82
     <!-- Line Items Table -->
83
     <x-company.document-template.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-xs leading-8">
86
             <tr class="text-gray-600 dark:text-gray-400">
86
             <tr class="text-gray-600 dark:text-gray-400">
87
                 <th class="text-left pl-6 w-[50%]">{{ $document->columnLabel->items }}</th>
87
                 <th class="text-left pl-6 w-[50%]">{{ $document->columnLabel->items }}</th>
88
                 <th class="text-center w-[10%]">{{ $document->columnLabel->units }}</th>
88
                 <th class="text-center w-[10%]">{{ $document->columnLabel->units }}</th>
90
                 <th class="text-right pr-6 w-[20%]">{{ $document->columnLabel->amount }}</th>
90
                 <th class="text-right pr-6 w-[20%]">{{ $document->columnLabel->amount }}</th>
91
             </tr>
91
             </tr>
92
             </thead>
92
             </thead>
93
-            <tbody class="text-xs tracking-tight border-y-2">
93
+            <tbody class="text-xs border-y-2">
94
             @foreach($document->lineItems as $index => $item)
94
             @foreach($document->lineItems as $index => $item)
95
                 <tr @class(['bg-gray-100 dark:bg-gray-800' => $index % 2 === 0])>
95
                 <tr @class(['bg-gray-100 dark:bg-gray-800' => $index % 2 === 0])>
96
                     <td class="text-left pl-6 font-semibold py-2">
96
                     <td class="text-left pl-6 font-semibold py-2">
105
                 </tr>
105
                 </tr>
106
             @endforeach
106
             @endforeach
107
             </tbody>
107
             </tbody>
108
-            <tfoot class="text-xs tracking-tight">
108
+            <tfoot class="text-xs">
109
             <tr>
109
             <tr>
110
                 <td class="pl-6 py-1" colspan="2"></td>
110
                 <td class="pl-6 py-1" colspan="2"></td>
111
                 <td class="text-right font-semibold py-1">Subtotal:</td>
111
                 <td class="text-right font-semibold py-1">Subtotal:</td>
146
     </x-company.document-template.line-items>
146
     </x-company.document-template.line-items>
147
 
147
 
148
     <!-- Footer Notes -->
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
         <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">

Завантаження…
Відмінити
Зберегти