Andrew Wallo 4 månader sedan
förälder
incheckning
1c4b07ac3a

+ 0
- 5
app/Concerns/HasTransactionAction.php Visa fil

@@ -14,8 +14,6 @@ use Awcodes\TableRepeater\Header;
14 14
 use Filament\Forms;
15 15
 use Filament\Forms\Components\Actions\Action as FormAction;
16 16
 use Filament\Forms\Form;
17
-use Filament\Support\Enums\IconPosition;
18
-use Filament\Support\Enums\IconSize;
19 17
 use Illuminate\Contracts\View\View;
20 18
 use Illuminate\Support\Str;
21 19
 
@@ -359,12 +357,9 @@ trait HasTransactionAction
359 357
         $typeLabel = $type->getLabel();
360 358
 
361 359
         return FormAction::make("add{$typeLabel}Entry")
362
-            ->label("Add {$typeLabel} entry")
363 360
             ->button()
364 361
             ->outlined()
365 362
             ->color($type->isDebit() ? 'primary' : 'gray')
366
-            ->iconSize(IconSize::Small)
367
-            ->iconPosition(IconPosition::Before)
368 363
             ->action(function (CustomTableRepeater $component) use ($type) {
369 364
                 $state = $component->getState();
370 365
                 $newUuid = (string) Str::uuid();

+ 32
- 36
app/Filament/Company/Pages/Accounting/AccountChart.php Visa fil

@@ -48,7 +48,7 @@ class AccountChart extends Page
48 48
     }
49 49
 
50 50
     #[Computed]
51
-    public function categories(): Collection
51
+    public function accountCategories(): Collection
52 52
     {
53 53
         return AccountSubtype::withCount('accounts')
54 54
             ->with(['accounts' => function ($query) {
@@ -58,42 +58,39 @@ class AccountChart extends Page
58 58
             ->groupBy('category');
59 59
     }
60 60
 
61
-    public function editChartAction(): Action
61
+    public function editAccountAction(): Action
62 62
     {
63
-        return EditAction::make()
64
-            ->iconButton()
65
-            ->name('editChart')
63
+        return EditAction::make('editAccount')
66 64
             ->label('Edit account')
67
-            ->modalHeading('Edit Account')
65
+            ->iconButton()
68 66
             ->icon('heroicon-m-pencil-square')
69
-            ->record(fn (array $arguments) => Account::find($arguments['chart']))
70
-            ->form(fn (Form $form) => $this->getChartForm($form)->operation('edit'));
67
+            ->record(fn (array $arguments) => Account::find($arguments['account']))
68
+            ->form(fn (Form $form) => $this->getAccountForm($form)->operation('edit'));
71 69
     }
72 70
 
73
-    public function createChartAction(): Action
71
+    public function createAccountAction(): Action
74 72
     {
75
-        return CreateAction::make()
73
+        return CreateAction::make('createAccount')
76 74
             ->link()
77
-            ->name('createChart')
78 75
             ->model(Account::class)
79 76
             ->label('Add a new account')
80 77
             ->icon('heroicon-o-plus-circle')
81
-            ->form(fn (Form $form) => $this->getChartForm($form)->operation('create'))
82
-            ->fillForm(fn (array $arguments): array => $this->getChartFormDefaults($arguments['subtype']));
78
+            ->form(fn (Form $form) => $this->getAccountForm($form)->operation('create'))
79
+            ->fillForm(fn (array $arguments): array => $this->getAccountFormDefaults($arguments['accountSubtype']));
83 80
     }
84 81
 
85
-    private function getChartFormDefaults(int $subtypeId): array
82
+    private function getAccountFormDefaults(int $accountSubtypeId): array
86 83
     {
87
-        $accountSubtype = AccountSubtype::find($subtypeId);
84
+        $accountSubtype = AccountSubtype::find($accountSubtypeId);
88 85
         $generatedCode = AccountCode::generate($accountSubtype);
89 86
 
90 87
         return [
91
-            'subtype_id' => $subtypeId,
88
+            'subtype_id' => $accountSubtypeId,
92 89
             'code' => $generatedCode,
93 90
         ];
94 91
     }
95 92
 
96
-    private function getChartForm(Form $form, bool $useActiveTab = true): Form
93
+    private function getAccountForm(Form $form, bool $useActiveTab = true): Form
97 94
     {
98 95
         return $form
99 96
             ->schema([
@@ -115,7 +112,7 @@ class AccountChart extends Page
115 112
             ->live()
116 113
             ->disabledOn('edit')
117 114
             ->searchable()
118
-            ->options($this->getChartSubtypeOptions($useActiveTab))
115
+            ->options($this->getAccountSubtypeOptions($useActiveTab))
119 116
             ->afterStateUpdated(static function (?string $state, Set $set): void {
120 117
                 if ($state) {
121 118
                     $accountSubtype = AccountSubtype::find($state);
@@ -150,12 +147,12 @@ class AccountChart extends Page
150 147
                         return false;
151 148
                     }
152 149
 
153
-                    $subtype = $get('subtype_id');
154
-                    if (empty($subtype)) {
150
+                    $accountSubtypeId = $get('subtype_id');
151
+                    if (empty($accountSubtypeId)) {
155 152
                         return false;
156 153
                     }
157 154
 
158
-                    $accountSubtype = AccountSubtype::find($subtype);
155
+                    $accountSubtype = AccountSubtype::find($accountSubtypeId);
159 156
 
160 157
                     if (! $accountSubtype) {
161 158
                         return false;
@@ -168,22 +165,22 @@ class AccountChart extends Page
168 165
                 })
169 166
                 ->afterStateUpdated(static function ($state, Get $get, Set $set) {
170 167
                     if ($state) {
171
-                        $subtypeId = $get('subtype_id');
168
+                        $accountSubtypeId = $get('subtype_id');
172 169
 
173
-                        if (empty($subtypeId)) {
170
+                        if (empty($accountSubtypeId)) {
174 171
                             return;
175 172
                         }
176 173
 
177
-                        $subtype = AccountSubtype::find($subtypeId);
174
+                        $accountSubtype = AccountSubtype::find($accountSubtypeId);
178 175
 
179
-                        if (! $subtype) {
176
+                        if (! $accountSubtype) {
180 177
                             return;
181 178
                         }
182 179
 
183 180
                         // Set default bank account type based on account category
184
-                        if ($subtype->category === AccountCategory::Asset) {
181
+                        if ($accountSubtype->category === AccountCategory::Asset) {
185 182
                             $set('bankAccount.type', BankAccountType::Depository->value);
186
-                        } elseif ($subtype->category === AccountCategory::Liability) {
183
+                        } elseif ($accountSubtype->category === AccountCategory::Liability) {
187 184
                             $set('bankAccount.type', BankAccountType::Credit->value);
188 185
                         }
189 186
                     } else {
@@ -198,13 +195,13 @@ class AccountChart extends Page
198 195
                     Select::make('type')
199 196
                         ->label('Bank account type')
200 197
                         ->options(function (Get $get) {
201
-                            $subtype = $get('../subtype_id');
198
+                            $accountSubtypeId = $get('../subtype_id');
202 199
 
203
-                            if (empty($subtype)) {
200
+                            if (empty($accountSubtypeId)) {
204 201
                                 return [];
205 202
                             }
206 203
 
207
-                            $accountSubtype = AccountSubtype::find($subtype);
204
+                            $accountSubtype = AccountSubtype::find($accountSubtypeId);
208 205
 
209 206
                             if (! $accountSubtype) {
210 207
                                 return [];
@@ -287,14 +284,14 @@ class AccountChart extends Page
287 284
             ->hiddenOn('create');
288 285
     }
289 286
 
290
-    private function getChartSubtypeOptions($useActiveTab = true): array
287
+    private function getAccountSubtypeOptions($useActiveTab = true): array
291 288
     {
292
-        $subtypes = $useActiveTab ?
289
+        $accountSubtypes = $useActiveTab ?
293 290
             AccountSubtype::where('category', $this->activeTab)->get() :
294 291
             AccountSubtype::all();
295 292
 
296
-        return $subtypes->groupBy(fn (AccountSubtype $subtype) => $subtype->type->getLabel())
297
-            ->map(fn (Collection $subtypes, string $type) => $subtypes->mapWithKeys(static fn (AccountSubtype $subtype) => [$subtype->id => $subtype->name]))
293
+        return $accountSubtypes->groupBy(fn (AccountSubtype $accountSubtype) => $accountSubtype->type->getLabel())
294
+            ->map(fn (Collection $accountSubtypes, string $type) => $accountSubtypes->mapWithKeys(static fn (AccountSubtype $accountSubtype) => [$accountSubtype->id => $accountSubtype->name]))
298 295
             ->toArray();
299 296
     }
300 297
 
@@ -303,9 +300,8 @@ class AccountChart extends Page
303 300
         return [
304 301
             CreateAction::make()
305 302
                 ->button()
306
-                ->label('Add new account')
307 303
                 ->model(Account::class)
308
-                ->form(fn (Form $form) => $this->getChartForm($form, false)->operation('create')),
304
+                ->form(fn (Form $form) => $this->getAccountForm($form, false)->operation('create')),
309 305
         ];
310 306
     }
311 307
 

+ 0
- 2
app/Filament/Company/Pages/Reports/BaseReportPage.php Visa fil

@@ -17,7 +17,6 @@ use Filament\Forms\Components\DatePicker;
17 17
 use Filament\Forms\Set;
18 18
 use Filament\Pages\Page;
19 19
 use Filament\Support\Enums\IconPosition;
20
-use Filament\Support\Enums\IconSize;
21 20
 use Illuminate\Support\Arr;
22 21
 use Illuminate\Support\Carbon;
23 22
 use Livewire\Attributes\Computed;
@@ -236,7 +235,6 @@ abstract class BaseReportPage extends Page
236 235
                 ->dropdownWidth('max-w-[7rem]')
237 236
                 ->dropdownPlacement('bottom-end')
238 237
                 ->icon('heroicon-m-chevron-down')
239
-                ->iconSize(IconSize::Small)
240 238
                 ->iconPosition(IconPosition::After),
241 239
         ];
242 240
     }

+ 9
- 5
app/Filament/Company/Resources/Accounting/TransactionResource/Pages/ListTransactions.php Visa fil

@@ -28,16 +28,20 @@ class ListTransactions extends ListRecords
28 28
     {
29 29
         return [
30 30
             Actions\ActionGroup::make([
31
-                CreateTransactionAction::make('addDeposit')
31
+                CreateTransactionAction::make('createDeposit')
32
+                    ->label('Deposit')
32 33
                     ->type(TransactionType::Deposit),
33
-                CreateTransactionAction::make('addWithdrawal')
34
+                CreateTransactionAction::make('createWithdrawal')
35
+                    ->label('Withdrawal')
34 36
                     ->type(TransactionType::Withdrawal),
35
-                CreateTransactionAction::make('addTransfer')
37
+                CreateTransactionAction::make('createTransfer')
38
+                    ->label('Transfer')
36 39
                     ->type(TransactionType::Transfer),
37
-                CreateTransactionAction::make('addJournalEntry')
40
+                CreateTransactionAction::make('createJournalEntry')
41
+                    ->label('Journal entry')
38 42
                     ->type(TransactionType::Journal),
39 43
             ])
40
-                ->label('Add transaction')
44
+                ->label('New transaction')
41 45
                 ->button()
42 46
                 ->dropdownPlacement('bottom-end')
43 47
                 ->icon('heroicon-m-chevron-down')

+ 0
- 2
app/Filament/Company/Resources/Purchases/BillResource/Pages/ViewBill.php Visa fil

@@ -12,7 +12,6 @@ use Filament\Infolists\Infolist;
12 12
 use Filament\Resources\Pages\ViewRecord;
13 13
 use Filament\Support\Enums\FontWeight;
14 14
 use Filament\Support\Enums\IconPosition;
15
-use Filament\Support\Enums\IconSize;
16 15
 
17 16
 class ViewBill extends ViewRecord
18 17
 {
@@ -39,7 +38,6 @@ class ViewBill extends ViewRecord
39 38
                 ->outlined()
40 39
                 ->dropdownPlacement('bottom-end')
41 40
                 ->icon('heroicon-m-chevron-down')
42
-                ->iconSize(IconSize::Small)
43 41
                 ->iconPosition(IconPosition::After),
44 42
         ];
45 43
     }

+ 0
- 2
app/Filament/Company/Resources/Purchases/VendorResource/Pages/ViewVendor.php Visa fil

@@ -14,7 +14,6 @@ use Filament\Infolists\Components\TextEntry;
14 14
 use Filament\Infolists\Infolist;
15 15
 use Filament\Resources\Pages\ViewRecord;
16 16
 use Filament\Support\Enums\IconPosition;
17
-use Filament\Support\Enums\IconSize;
18 17
 
19 18
 class ViewVendor extends ViewRecord
20 19
 {
@@ -52,7 +51,6 @@ class ViewVendor extends ViewRecord
52 51
                 ->outlined()
53 52
                 ->dropdownPlacement('bottom-end')
54 53
                 ->icon('heroicon-m-chevron-down')
55
-                ->iconSize(IconSize::Small)
56 54
                 ->iconPosition(IconPosition::After),
57 55
         ];
58 56
     }

+ 0
- 2
app/Filament/Company/Resources/Sales/ClientResource/Pages/ViewClient.php Visa fil

@@ -16,7 +16,6 @@ use Filament\Infolists\Components\TextEntry;
16 16
 use Filament\Infolists\Infolist;
17 17
 use Filament\Resources\Pages\ViewRecord;
18 18
 use Filament\Support\Enums\IconPosition;
19
-use Filament\Support\Enums\IconSize;
20 19
 use Illuminate\Contracts\Support\Htmlable;
21 20
 
22 21
 class ViewClient extends ViewRecord
@@ -65,7 +64,6 @@ class ViewClient extends ViewRecord
65 64
                 ->outlined()
66 65
                 ->dropdownPlacement('bottom-end')
67 66
                 ->icon('heroicon-m-chevron-down')
68
-                ->iconSize(IconSize::Small)
69 67
                 ->iconPosition(IconPosition::After),
70 68
         ];
71 69
     }

+ 0
- 2
app/Filament/Company/Resources/Sales/EstimateResource/Pages/ViewEstimate.php Visa fil

@@ -16,7 +16,6 @@ use Filament\Infolists\Infolist;
16 16
 use Filament\Resources\Pages\ViewRecord;
17 17
 use Filament\Support\Enums\FontWeight;
18 18
 use Filament\Support\Enums\IconPosition;
19
-use Filament\Support\Enums\IconSize;
20 19
 use Illuminate\Support\HtmlString;
21 20
 
22 21
 class ViewEstimate extends ViewRecord
@@ -50,7 +49,6 @@ class ViewEstimate extends ViewRecord
50 49
                 ->outlined()
51 50
                 ->dropdownPlacement('bottom-end')
52 51
                 ->icon('heroicon-m-chevron-down')
53
-                ->iconSize(IconSize::Small)
54 52
                 ->iconPosition(IconPosition::After),
55 53
         ];
56 54
     }

+ 0
- 2
app/Filament/Company/Resources/Sales/InvoiceResource/Pages/ViewInvoice.php Visa fil

@@ -16,7 +16,6 @@ use Filament\Infolists\Infolist;
16 16
 use Filament\Resources\Pages\ViewRecord;
17 17
 use Filament\Support\Enums\FontWeight;
18 18
 use Filament\Support\Enums\IconPosition;
19
-use Filament\Support\Enums\IconSize;
20 19
 use Illuminate\Support\HtmlString;
21 20
 
22 21
 class ViewInvoice extends ViewRecord
@@ -47,7 +46,6 @@ class ViewInvoice extends ViewRecord
47 46
                 ->outlined()
48 47
                 ->dropdownPlacement('bottom-end')
49 48
                 ->icon('heroicon-m-chevron-down')
50
-                ->iconSize(IconSize::Small)
51 49
                 ->iconPosition(IconPosition::After),
52 50
         ];
53 51
     }

+ 0
- 2
app/Filament/Company/Resources/Sales/RecurringInvoiceResource/Pages/ViewRecurringInvoice.php Visa fil

@@ -18,7 +18,6 @@ use Filament\Infolists\Infolist;
18 18
 use Filament\Resources\Pages\ViewRecord;
19 19
 use Filament\Support\Enums\FontWeight;
20 20
 use Filament\Support\Enums\IconPosition;
21
-use Filament\Support\Enums\IconSize;
22 21
 use Illuminate\Support\HtmlString;
23 22
 use Illuminate\Support\Str;
24 23
 
@@ -45,7 +44,6 @@ class ViewRecurringInvoice extends ViewRecord
45 44
                 ->outlined()
46 45
                 ->dropdownPlacement('bottom-end')
47 46
                 ->icon('heroicon-m-chevron-down')
48
-                ->iconSize(IconSize::Small)
49 47
                 ->iconPosition(IconPosition::After),
50 48
         ];
51 49
     }

+ 10
- 10
resources/views/filament/company/pages/accounting/chart.blade.php Visa fil

@@ -1,19 +1,19 @@
1 1
 <x-filament-panels::page>
2 2
     <div class="flex flex-col gap-y-6">
3 3
         <x-filament::tabs>
4
-            @foreach($this->categories as $categoryValue => $subtypes)
4
+            @foreach($this->accountCategories as $categoryValue => $accountSubtypes)
5 5
                 <x-filament::tabs.item
6 6
                     wire:key="tab-item-{{ $categoryValue }}"
7 7
                     :active="$activeTab === $categoryValue"
8 8
                     wire:click="$set('activeTab', '{{ $categoryValue }}')"
9
-                    :badge="$subtypes->sum('accounts_count')"
9
+                    :badge="$accountSubtypes->sum('accounts_count')"
10 10
                 >
11 11
                     {{ $this->getCategoryLabel($categoryValue) }}
12 12
                 </x-filament::tabs.item>
13 13
             @endforeach
14 14
         </x-filament::tabs>
15 15
 
16
-        @foreach($this->categories as $categoryValue => $subtypes)
16
+        @foreach($this->accountCategories as $categoryValue => $accountSubtypes)
17 17
             @if($activeTab === $categoryValue)
18 18
                 <div
19 19
                     class="es-table__container overflow-hidden rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:divide-white/10 dark:bg-gray-900 dark:ring-white/10">
@@ -29,7 +29,7 @@
29 29
                                 <col span="1" style="width: 10%;">
30 30
                                 <col span="1" style="width: 7.5%;">
31 31
                             </colgroup>
32
-                            @foreach($subtypes as $subtype)
32
+                            @foreach($accountSubtypes as $accountSubtype)
33 33
                                 <tbody
34 34
                                     class="es-table__rowgroup divide-y divide-gray-200 whitespace-nowrap dark:divide-white/5">
35 35
                                 <!-- Subtype Name Header Row -->
@@ -38,10 +38,10 @@
38 38
                                         <div class="es-table__row-content flex items-center space-x-2">
39 39
                                             <span
40 40
                                                 class="es-table__row-title text-gray-800 dark:text-gray-200 font-semibold tracking-wider">
41
-                                                {{ $subtype->name }}
41
+                                                {{ $accountSubtype->name }}
42 42
                                             </span>
43 43
                                             <x-tooltip
44
-                                                text="{!! $subtype->description !!}"
44
+                                                text="{!! $accountSubtype->description !!}"
45 45
                                                 icon="heroicon-o-question-mark-circle"
46 46
                                                 placement="right"
47 47
                                                 maxWidth="300"
@@ -51,7 +51,7 @@
51 51
                                 </tr>
52 52
 
53 53
                                 <!-- Chart Rows -->
54
-                                @forelse($subtype->accounts as $account)
54
+                                @forelse($accountSubtype->accounts as $account)
55 55
                                     <tr class="es-table__row">
56 56
                                         <td colspan="1" class="es-table__cell px-4 py-4">{{ $account->code }}</td>
57 57
                                         <td colspan="1" class="es-table__cell px-4 py-4">
@@ -78,7 +78,7 @@
78 78
                                         <td colspan="1" class="es-table__cell px-4 py-4">
79 79
                                             <div>
80 80
                                                 @if($account->default === false && !$account->adjustment)
81
-                                                    {{ ($this->editChartAction)(['chart' => $account->id]) }}
81
+                                                    {{ ($this->editAccountAction)(['account' => $account->id]) }}
82 82
                                                 @endif
83 83
                                             </div>
84 84
                                         </td>
@@ -88,7 +88,7 @@
88 88
                                     <tr class="es-table__row">
89 89
                                         <td colspan="5"
90 90
                                             class="es-table__cell px-4 py-4 italic text-xs text-gray-500 dark:text-gray-400">
91
-                                            {{ __("You haven't added any {$subtype->name} accounts yet.") }}
91
+                                            {{ __("You haven't added any {$accountSubtype->name} accounts yet.") }}
92 92
                                         </td>
93 93
                                     </tr>
94 94
                                 @endforelse
@@ -96,7 +96,7 @@
96 96
                                 <!-- Add New Account Row -->
97 97
                                 <tr class="es-table__row">
98 98
                                     <td colspan="5" class="es-table__cell px-4 py-4">
99
-                                        {{ ($this->createChartAction)(['subtype' => $subtype->id]) }}
99
+                                        {{ ($this->createAccountAction)(['accountSubtype' => $accountSubtype->id]) }}
100 100
                                     </td>
101 101
                                 </tr>
102 102
                                 </tbody>

Laddar…
Avbryt
Spara