Andrew Wallo vor 7 Monaten
Ursprung
Commit
78cd6b086a
1 geänderte Dateien mit 16 neuen und 7 gelöschten Zeilen
  1. 16
    7
      app/Filament/Company/Resources/Purchases/BillResource.php

+ 16
- 7
app/Filament/Company/Resources/Purchases/BillResource.php Datei anzeigen

@@ -44,6 +44,8 @@ class BillResource extends Resource
44 44
     {
45 45
         $company = Auth::user()->currentCompany;
46 46
 
47
+        $settings = $company->defaultBill;
48
+
47 49
         return $form
48 50
             ->schema([
49 51
                 Forms\Components\Section::make('Bill Details')
@@ -108,22 +110,29 @@ class BillResource extends Resource
108 110
                             ->relationship()
109 111
                             ->saveRelationshipsUsing(null)
110 112
                             ->dehydrated(true)
111
-                            ->headers(function (Forms\Get $get) {
113
+                            ->headers(function (Forms\Get $get) use ($settings) {
112 114
                                 $hasDiscounts = DocumentDiscountMethod::parse($get('discount_method'))->isPerLineItem();
113 115
 
114 116
                                 $headers = [
115
-                                    Header::make('Items')->width($hasDiscounts ? '15%' : '20%'),
116
-                                    Header::make('Description')->width($hasDiscounts ? '25%' : '30%'),  // Increase when no discounts
117
-                                    Header::make('Quantity')->width('10%'),
118
-                                    Header::make('Price')->width('10%'),
119
-                                    Header::make('Taxes')->width($hasDiscounts ? '15%' : '20%'),       // Increase when no discounts
117
+                                    Header::make($settings->resolveColumnLabel('item_name', 'Items'))
118
+                                        ->width($hasDiscounts ? '15%' : '20%'),
119
+                                    Header::make('Description')
120
+                                        ->width($hasDiscounts ? '25%' : '30%'),
121
+                                    Header::make($settings->resolveColumnLabel('unit_name', 'Quantity'))
122
+                                        ->width('10%'),
123
+                                    Header::make($settings->resolveColumnLabel('price_name', 'Price'))
124
+                                        ->width('10%'),
125
+                                    Header::make('Taxes')
126
+                                        ->width($hasDiscounts ? '15%' : '20%'),
120 127
                                 ];
121 128
 
122 129
                                 if ($hasDiscounts) {
123 130
                                     $headers[] = Header::make('Discounts')->width('15%');
124 131
                                 }
125 132
 
126
-                                $headers[] = Header::make('Amount')->width('10%')->align('right');
133
+                                $headers[] = Header::make($settings->resolveColumnLabel('amount_name', 'Amount'))
134
+                                    ->width('10%')
135
+                                    ->align('right');
127 136
 
128 137
                                 return $headers;
129 138
                             })

Laden…
Abbrechen
Speichern