Andrew Wallo 2 月之前
父節點
當前提交
d2dbb84c6b

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

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

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

104
 
104
 
105
     public function getDateTimeFormatAttribute(): string
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
     public static function getAllLanguages(): array
110
     public static function getAllLanguages(): array

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

282
         Tables\Actions\DeleteBulkAction::configureUsing(static fn (Tables\Actions\DeleteBulkAction $action) => FilamentComponentConfigurator::configureDeleteAction($action));
282
         Tables\Actions\DeleteBulkAction::configureUsing(static fn (Tables\Actions\DeleteBulkAction $action) => FilamentComponentConfigurator::configureDeleteAction($action));
283
 
283
 
284
         Tables\Table::configureUsing(static function (Tables\Table $table): void {
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
             $table
288
             $table
288
                 ->paginationPageOptions([5, 10, 25, 50, 100])
289
                 ->paginationPageOptions([5, 10, 25, 50, 100])

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

3
 namespace App\Services;
3
 namespace App\Services;
4
 
4
 
5
 use App\Enums\Setting\DateFormat;
5
 use App\Enums\Setting\DateFormat;
6
+use App\Enums\Setting\TimeFormat;
6
 use App\Enums\Setting\WeekStart;
7
 use App\Enums\Setting\WeekStart;
7
 use App\Models\Company;
8
 use App\Models\Company;
8
 use App\Models\Setting\Currency;
9
 use App\Models\Setting\Currency;
43
                 'default_timezone' => $company->locale->timezone ?? config('app.timezone'),
44
                 'default_timezone' => $company->locale->timezone ?? config('app.timezone'),
44
                 'default_currency' => $defaultCurrency,
45
                 'default_currency' => $defaultCurrency,
45
                 'default_date_format' => $company->locale->date_format->value ?? DateFormat::DEFAULT,
46
                 'default_date_format' => $company->locale->date_format->value ?? DateFormat::DEFAULT,
47
+                'default_time_format' => $company->locale->time_format->value ?? TimeFormat::DEFAULT,
46
                 'default_week_start' => $company->locale->week_start->value ?? WeekStart::DEFAULT,
48
                 'default_week_start' => $company->locale->week_start->value ?? WeekStart::DEFAULT,
47
             ];
49
             ];
48
         });
50
         });
68
             'default_timezone' => config('app.timezone'),
70
             'default_timezone' => config('app.timezone'),
69
             'default_currency' => 'USD',
71
             'default_currency' => 'USD',
70
             'default_date_format' => DateFormat::DEFAULT,
72
             'default_date_format' => DateFormat::DEFAULT,
73
+            'default_time_format' => TimeFormat::DEFAULT,
71
             'default_week_start' => WeekStart::DEFAULT,
74
             'default_week_start' => WeekStart::DEFAULT,
72
         ];
75
         ];
73
     }
76
     }
103
     {
106
     {
104
         return self::getSpecificSetting($companyId, 'default_week_start', WeekStart::DEFAULT);
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
 }

Loading…
取消
儲存