Andrew Wallo 2 个月前
父节点
当前提交
d2dbb84c6b

+ 1
- 3
app/Filament/Company/Clusters/Settings/Resources/AdjustmentResource.php 查看文件

@@ -81,10 +81,8 @@ class AdjustmentResource extends Resource
81 81
                     ->columns(),
82 82
                 Forms\Components\Section::make('Dates')
83 83
                     ->schema([
84
-                        Forms\Components\DateTimePicker::make('start_date')
85
-                            ->timezone(CompanySettingsService::getDefaultTimezone()),
84
+                        Forms\Components\DateTimePicker::make('start_date'),
86 85
                         Forms\Components\DateTimePicker::make('end_date')
87
-                            ->timezone(CompanySettingsService::getDefaultTimezone())
88 86
                             ->after('start_date'),
89 87
                     ])
90 88
                     ->columns()

+ 1
- 1
app/Models/Setting/Localization.php 查看文件

@@ -104,7 +104,7 @@ class Localization extends Model
104 104
 
105 105
     public function getDateTimeFormatAttribute(): string
106 106
     {
107
-        return $this->date_format . ' ' . $this->time_format;
107
+        return $this->date_format->value . ' ' . $this->time_format->value;
108 108
     }
109 109
 
110 110
     public static function getAllLanguages(): array

+ 2
- 1
app/Providers/Filament/CompanyPanelProvider.php 查看文件

@@ -282,7 +282,8 @@ class CompanyPanelProvider extends PanelProvider
282 282
         Tables\Actions\DeleteBulkAction::configureUsing(static fn (Tables\Actions\DeleteBulkAction $action) => FilamentComponentConfigurator::configureDeleteAction($action));
283 283
 
284 284
         Tables\Table::configureUsing(static function (Tables\Table $table): void {
285
-            $table::$defaultDateDisplayFormat = CompanySettingsService::getDefaultDateFormat(session('current_company_id') ?? auth()->user()->current_company_id);
285
+            $table::$defaultDateDisplayFormat = CompanySettingsService::getDefaultDateFormat();
286
+            $table::$defaultDateTimeDisplayFormat = CompanySettingsService::getDefaultDateTimeFormat();
286 287
 
287 288
             $table
288 289
                 ->paginationPageOptions([5, 10, 25, 50, 100])

+ 13
- 0
app/Services/CompanySettingsService.php 查看文件

@@ -3,6 +3,7 @@
3 3
 namespace App\Services;
4 4
 
5 5
 use App\Enums\Setting\DateFormat;
6
+use App\Enums\Setting\TimeFormat;
6 7
 use App\Enums\Setting\WeekStart;
7 8
 use App\Models\Company;
8 9
 use App\Models\Setting\Currency;
@@ -43,6 +44,7 @@ class CompanySettingsService
43 44
                 'default_timezone' => $company->locale->timezone ?? config('app.timezone'),
44 45
                 'default_currency' => $defaultCurrency,
45 46
                 'default_date_format' => $company->locale->date_format->value ?? DateFormat::DEFAULT,
47
+                'default_time_format' => $company->locale->time_format->value ?? TimeFormat::DEFAULT,
46 48
                 'default_week_start' => $company->locale->week_start->value ?? WeekStart::DEFAULT,
47 49
             ];
48 50
         });
@@ -68,6 +70,7 @@ class CompanySettingsService
68 70
             'default_timezone' => config('app.timezone'),
69 71
             'default_currency' => 'USD',
70 72
             'default_date_format' => DateFormat::DEFAULT,
73
+            'default_time_format' => TimeFormat::DEFAULT,
71 74
             'default_week_start' => WeekStart::DEFAULT,
72 75
         ];
73 76
     }
@@ -103,4 +106,14 @@ class CompanySettingsService
103 106
     {
104 107
         return self::getSpecificSetting($companyId, 'default_week_start', WeekStart::DEFAULT);
105 108
     }
109
+
110
+    public static function getDefaultTimeFormat(?int $companyId = null): string
111
+    {
112
+        return self::getSpecificSetting($companyId, 'default_time_format', TimeFormat::DEFAULT);
113
+    }
114
+
115
+    public static function getDefaultDateTimeFormat(?int $companyId = null): string
116
+    {
117
+        return self::getDefaultDateFormat($companyId) . ' ' . self::getDefaultTimeFormat($companyId);
118
+    }
106 119
 }

正在加载...
取消
保存