Andrew Wallo 6 meses atrás
pai
commit
e32d52c1b3

+ 8
- 7
app/Filament/Company/Resources/Accounting/BudgetResource.php Ver arquivo

@@ -8,6 +8,7 @@ use App\Filament\Forms\Components\CustomSection;
8 8
 use App\Filament\Forms\Components\CustomTableRepeater;
9 9
 use App\Models\Accounting\Account;
10 10
 use App\Models\Accounting\Budget;
11
+use App\Models\Accounting\BudgetAllocation;
11 12
 use App\Models\Accounting\BudgetItem;
12 13
 use App\Utilities\Currency\CurrencyConverter;
13 14
 use Awcodes\TableRepeater\Header;
@@ -269,8 +270,8 @@ class BudgetResource extends Resource
269 270
                             ];
270 271
 
271 272
                             foreach ($periods as $period) {
272
-                                $headers[] = Header::make($period)
273
-                                    ->label($period)
273
+                                $headers[] = Header::make($period->period)
274
+                                    ->label($period->period)
274 275
                                     ->width('120px')
275 276
                                     ->align(Alignment::Right);
276 277
                             }
@@ -294,7 +295,7 @@ class BudgetResource extends Resource
294 295
                                                 $total = 0;
295 296
                                                 // Calculate the total for this budget item across all periods
296 297
                                                 foreach ($periods as $period) {
297
-                                                    $allocation = $record->allocations->firstWhere('period', $period);
298
+                                                    $allocation = $record->allocations->firstWhere('period', $period->period);
298 299
                                                     $total += $allocation ? $allocation->getRawOriginal('amount') : 0;
299 300
                                                 }
300 301
                                                 $component->state(CurrencyConverter::convertCentsToFormatSimple($total));
@@ -321,20 +322,20 @@ class BudgetResource extends Resource
321 322
                                                     foreach ($periods as $index => $period) {
322 323
                                                         $amount = $baseAmount + ($index === 0 ? $remainder : 0);
323 324
                                                         $formattedAmount = CurrencyConverter::convertCentsToFormatSimple($amount);
324
-                                                        $set("allocations.{$period}", $formattedAmount);
325
+                                                        $set("allocations.{$period->period}", $formattedAmount);
325 326
                                                     }
326 327
                                                 }),
327 328
                                         ]),
328 329
 
329 330
                                         // Create a field for each period
330
-                                        ...collect($periods)->map(function ($period) {
331
-                                            return Forms\Components\TextInput::make("allocations.{$period}")
331
+                                        ...collect($periods)->map(function (BudgetAllocation $period) {
332
+                                            return Forms\Components\TextInput::make("allocations.{$period->period}")
332 333
                                                 ->mask(RawJs::make('$money($input)'))
333 334
                                                 ->stripCharacters(',')
334 335
                                                 ->numeric()
335 336
                                                 ->afterStateHydrated(function ($component, $state, BudgetItem $record) use ($period) {
336 337
                                                     // Find the allocation for this period
337
-                                                    $allocation = $record->allocations->firstWhere('period', $period);
338
+                                                    $allocation = $record->allocations->firstWhere('period', $period->period);
338 339
                                                     $component->state($allocation ? $allocation->amount : 0);
339 340
                                                 })
340 341
                                                 ->dehydrated(false); // We'll handle saving manually

+ 1
- 1
app/Filament/Company/Resources/Accounting/BudgetResource/Pages/ViewBudget.php Ver arquivo

@@ -24,7 +24,7 @@ class ViewBudget extends ViewRecord
24 24
         ];
25 25
     }
26 26
 
27
-    public function getRelationManagers(): array
27
+    protected function getAllRelationManagers(): array
28 28
     {
29 29
         return [
30 30
             BudgetResource\RelationManagers\BudgetItemsRelationManager::class,

+ 1
- 1
app/Filament/Company/Resources/Purchases/VendorResource/Pages/ViewVendor.php Ver arquivo

@@ -20,7 +20,7 @@ class ViewVendor extends ViewRecord
20 20
 {
21 21
     protected static string $resource = VendorResource::class;
22 22
 
23
-    public function getRelationManagers(): array
23
+    protected function getAllRelationManagers(): array
24 24
     {
25 25
         return [
26 26
             RelationManagers\BillsRelationManager::class,

+ 1
- 1
app/Filament/Company/Resources/Sales/ClientResource/Pages/ViewClient.php Ver arquivo

@@ -23,7 +23,7 @@ class ViewClient extends ViewRecord
23 23
 {
24 24
     protected static string $resource = ClientResource::class;
25 25
 
26
-    public function getRelationManagers(): array
26
+    protected function getAllRelationManagers(): array
27 27
     {
28 28
         return [
29 29
             RelationManagers\InvoicesRelationManager::class,

Carregando…
Cancelar
Salvar