浏览代码

add deferred filter logic

3.x
Andrew Wallo 1年前
父节点
当前提交
bb17776829

+ 1
- 2
app/Filament/Company/Pages/Reports/AccountBalances.php 查看文件

67
         ];
67
         ];
68
     }
68
     }
69
 
69
 
70
-    public function form(Form $form): Form
70
+    public function filtersForm(Form $form): Form
71
     {
71
     {
72
         return $form
72
         return $form
73
             ->inlineLabel()
73
             ->inlineLabel()
74
             ->columns()
74
             ->columns()
75
-            ->live()
76
             ->schema([
75
             ->schema([
77
                 $this->getDateRangeFormComponent(),
76
                 $this->getDateRangeFormComponent(),
78
                 Cluster::make([
77
                 Cluster::make([

+ 13
- 9
app/Filament/Company/Pages/Reports/AccountTransactions.php 查看文件

18
 use Guava\FilamentClusters\Forms\Cluster;
18
 use Guava\FilamentClusters\Forms\Cluster;
19
 use Illuminate\Contracts\Support\Htmlable;
19
 use Illuminate\Contracts\Support\Htmlable;
20
 use Illuminate\Support\Collection;
20
 use Illuminate\Support\Collection;
21
-use Livewire\Attributes\Url;
22
 use Symfony\Component\HttpFoundation\StreamedResponse;
21
 use Symfony\Component\HttpFoundation\StreamedResponse;
23
 
22
 
24
 class AccountTransactions extends BaseReportPage
23
 class AccountTransactions extends BaseReportPage
33
 
32
 
34
     protected ExportService $exportService;
33
     protected ExportService $exportService;
35
 
34
 
36
-    #[Url]
37
-    public ?string $selectedAccount = 'all';
38
-
39
     public function boot(ReportService $reportService, ExportService $exportService): void
35
     public function boot(ReportService $reportService, ExportService $exportService): void
40
     {
36
     {
41
         $this->reportService = $reportService;
37
         $this->reportService = $reportService;
42
         $this->exportService = $exportService;
38
         $this->exportService = $exportService;
43
     }
39
     }
44
 
40
 
41
+    protected function initializeDefaultFilters(): void
42
+    {
43
+        if (! $this->getFilterState('selectedAccount')) {
44
+            $this->setFilterState('selectedAccount', 'all');
45
+        }
46
+    }
47
+
45
     /**
48
     /**
46
      * @return array<Column>
49
      * @return array<Column>
47
      */
50
      */
67
         ];
70
         ];
68
     }
71
     }
69
 
72
 
70
-    public function form(Form $form): Form
73
+    public function filtersForm(Form $form): Form
71
     {
74
     {
72
         return $form
75
         return $form
73
             ->columns(4)
76
             ->columns(4)
83
                     $this->getEndDateFormComponent(),
86
                     $this->getEndDateFormComponent(),
84
                 ])->label("\u{200B}"), // its too bad hiddenLabel removes spacing of the label
87
                 ])->label("\u{200B}"), // its too bad hiddenLabel removes spacing of the label
85
                 Actions::make([
88
                 Actions::make([
86
-                    Actions\Action::make('loadReportData')
89
+                    Actions\Action::make('applyFilters')
87
                         ->label('Update Report')
90
                         ->label('Update Report')
88
-                        ->submit('loadReportData')
89
-                        ->keyBindings(['mod+s']),
91
+                        ->action('applyFilters')
92
+                        ->keyBindings(['mod+s'])
93
+                        ->button(),
90
                 ])->alignEnd()->verticallyAlignEnd(),
94
                 ])->alignEnd()->verticallyAlignEnd(),
91
             ]);
95
             ]);
92
     }
96
     }
108
 
112
 
109
     protected function buildReport(array $columns): ReportDTO
113
     protected function buildReport(array $columns): ReportDTO
110
     {
114
     {
111
-        return $this->reportService->buildAccountTransactionsReport($this->getFormattedStartDate(), $this->getFormattedEndDate(), $columns, $this->selectedAccount);
115
+        return $this->reportService->buildAccountTransactionsReport($this->getFormattedStartDate(), $this->getFormattedEndDate(), $columns, $this->getFilterState('selectedAccount'));
112
     }
116
     }
113
 
117
 
114
     protected function getTransformer(ReportDTO $reportDTO): ExportableReport
118
     protected function getTransformer(ReportDTO $reportDTO): ExportableReport

+ 54
- 27
app/Filament/Company/Pages/Reports/BaseReportPage.php 查看文件

6
 use App\DTO\ReportDTO;
6
 use App\DTO\ReportDTO;
7
 use App\Filament\Forms\Components\DateRangeSelect;
7
 use App\Filament\Forms\Components\DateRangeSelect;
8
 use App\Models\Company;
8
 use App\Models\Company;
9
+use App\Services\DateRangeService;
9
 use App\Support\Column;
10
 use App\Support\Column;
10
 use Filament\Actions\Action;
11
 use Filament\Actions\Action;
11
 use Filament\Actions\ActionGroup;
12
 use Filament\Actions\ActionGroup;
39
      */
40
      */
40
     public ?array $deferredFilters = null;
41
     public ?array $deferredFilters = null;
41
 
42
 
42
-    public string $fiscalYearStartDate = '';
43
+    public string $fiscalYearStartDate;
43
 
44
 
44
-    public string $fiscalYearEndDate = '';
45
+    public string $fiscalYearEndDate;
45
 
46
 
46
     public Company $company;
47
     public Company $company;
47
 
48
 
69
 
70
 
70
         $this->loadDefaultDateRange();
71
         $this->loadDefaultDateRange();
71
 
72
 
73
+        $this->initializeDefaultFilters();
74
+
72
         $this->initializeFilters();
75
         $this->initializeFilters();
73
 
76
 
74
         $this->loadDefaultTableColumnToggleState();
77
         $this->loadDefaultTableColumnToggleState();
75
     }
78
     }
76
 
79
 
80
+    protected function initializeDefaultFilters(): void
81
+    {
82
+        //
83
+    }
84
+
77
     public function initializeFilters(): void
85
     public function initializeFilters(): void
78
     {
86
     {
79
         if (! count($this->filters ?? [])) {
87
         if (! count($this->filters ?? [])) {
80
             $this->filters = null;
88
             $this->filters = null;
81
         }
89
         }
82
 
90
 
83
-        $this->getFiltersForm()->fill($this->filters);
91
+        $filtersForForm = $this->filters !== null
92
+            ? $this->convertDatesToDateTimeString($this->filters)
93
+            : [];
94
+
95
+        $this->getFiltersForm()->fill($filtersForForm);
96
+
97
+        if ($this->filters !== null) {
98
+            $this->filters = $this->normalizeFilters($this->filters);
99
+        }
100
+    }
101
+
102
+    protected function convertDatesToDateTimeString(array $filters): array
103
+    {
104
+        if (isset($filters['startDate'])) {
105
+            $filters['startDate'] = Carbon::parse($filters['startDate'])->startOfDay()->toDateTimeString();
106
+        }
107
+
108
+        if (isset($filters['endDate'])) {
109
+            $filters['endDate'] = Carbon::parse($filters['endDate'])->endOfDay()->toDateTimeString();
110
+        }
84
 
111
 
85
-        $this->applyFilters();
112
+        return $filters;
86
     }
113
     }
87
 
114
 
88
     protected function getForms(): array
115
     protected function getForms(): array
123
 
150
 
124
     public function applyFilters(): void
151
     public function applyFilters(): void
125
     {
152
     {
126
-        $normalizedFilters = $this->deferredFilters;
127
-
128
-        $this->normalizeFilters($normalizedFilters);
129
-
130
-        $this->filters = $normalizedFilters;
153
+        $this->filters = $this->normalizeFilters($this->deferredFilters);
131
 
154
 
132
         $this->handleFilterUpdates();
155
         $this->handleFilterUpdates();
133
 
156
 
134
         $this->loadReportData();
157
         $this->loadReportData();
135
     }
158
     }
136
 
159
 
137
-    protected function normalizeFilters(array &$filters): void
160
+    protected function normalizeFilters(array $filters): array
138
     {
161
     {
139
         foreach ($filters as $name => &$value) {
162
         foreach ($filters as $name => &$value) {
140
             if ($name === 'dateRange') {
163
             if ($name === 'dateRange') {
141
                 unset($filters[$name]);
164
                 unset($filters[$name]);
142
             } elseif ($this->isValidDate($value)) {
165
             } elseif ($this->isValidDate($value)) {
143
-                $filters[$name] = Carbon::parse($value)->toDateString();
166
+                $value = Carbon::parse($value)->toDateString();
144
             }
167
             }
145
         }
168
         }
169
+
170
+        return $filters;
146
     }
171
     }
147
 
172
 
148
     public function getFiltersApplyAction(): Action
173
     public function getFiltersApplyAction(): Action
149
     {
174
     {
150
         return Action::make('applyFilters')
175
         return Action::make('applyFilters')
151
-            ->label(__('filament-tables::table.filters.actions.apply.label'))
176
+            ->label('Update Report')
152
             ->action('applyFilters')
177
             ->action('applyFilters')
178
+            ->keyBindings(['mod+s'])
153
             ->button();
179
             ->button();
154
     }
180
     }
155
 
181
 
182
 
208
 
183
     protected function loadDefaultDateRange(): void
209
     protected function loadDefaultDateRange(): void
184
     {
210
     {
185
-        if (! $this->getDeferredFilterState('dateRange')) {
211
+        $startDate = $this->getFilterState('startDate');
212
+        $endDate = $this->getFilterState('endDate');
213
+
214
+        if ($this->isValidDate($startDate) && $this->isValidDate($endDate)) {
215
+            $matchingDateRange = app(DateRangeService::class)->getMatchingDateRangeOption(Carbon::parse($startDate), Carbon::parse($endDate));
216
+            $this->setFilterState('dateRange', $matchingDateRange);
217
+        } else {
186
             $this->setFilterState('dateRange', $this->getDefaultDateRange());
218
             $this->setFilterState('dateRange', $this->getDefaultDateRange());
187
             $this->setDateRange(Carbon::parse($this->fiscalYearStartDate), Carbon::parse($this->fiscalYearEndDate));
219
             $this->setDateRange(Carbon::parse($this->fiscalYearStartDate), Carbon::parse($this->fiscalYearEndDate));
188
         }
220
         }
191
     public function loadReportData(): void
223
     public function loadReportData(): void
192
     {
224
     {
193
         unset($this->report);
225
         unset($this->report);
226
+
194
         $this->reportLoaded = true;
227
         $this->reportLoaded = true;
195
     }
228
     }
196
 
229
 
198
     {
231
     {
199
         $tableColumns = $this->getTable();
232
         $tableColumns = $this->getTable();
200
 
233
 
201
-        if (empty($this->toggledTableColumns)) {
202
-            foreach ($tableColumns as $column) {
234
+        foreach ($tableColumns as $column) {
235
+            $columnName = $column->getName();
236
+
237
+            if (empty($this->toggledTableColumns)) {
203
                 if ($column->isToggleable()) {
238
                 if ($column->isToggleable()) {
204
-                    if ($column->isToggledHiddenByDefault()) {
205
-                        $this->toggledTableColumns[$column->getName()] = false;
206
-                    } else {
207
-                        $this->toggledTableColumns[$column->getName()] = true;
208
-                    }
239
+                    $this->toggledTableColumns[$columnName] = ! $column->isToggledHiddenByDefault();
209
                 } else {
240
                 } else {
210
-                    $this->toggledTableColumns[$column->getName()] = true;
241
+                    $this->toggledTableColumns[$columnName] = true;
211
                 }
242
                 }
212
             }
243
             }
213
-        }
214
 
244
 
215
-        foreach ($tableColumns as $column) {
216
-            $columnName = $column->getName();
245
+            // Handle cases where the toggle state needs to be reset
217
             if (! $column->isToggleable()) {
246
             if (! $column->isToggleable()) {
218
                 $this->toggledTableColumns[$columnName] = true;
247
                 $this->toggledTableColumns[$columnName] = true;
219
-            }
220
-
221
-            if ($column->isToggleable() && $column->isToggledHiddenByDefault() && isset($this->toggledTableColumns[$columnName]) && $this->toggledTableColumns[$columnName]) {
248
+            } elseif ($column->isToggleable() && $column->isToggledHiddenByDefault() && isset($this->toggledTableColumns[$columnName]) && $this->toggledTableColumns[$columnName]) {
222
                 $this->toggledTableColumns[$columnName] = false;
249
                 $this->toggledTableColumns[$columnName] = false;
223
             }
250
             }
224
         }
251
         }

+ 2
- 6
app/Filament/Company/Pages/Reports/TrialBalance.php 查看文件

50
         ];
50
         ];
51
     }
51
     }
52
 
52
 
53
-    public function form(Form $form): Form
53
+    public function filtersForm(Form $form): Form
54
     {
54
     {
55
         return $form
55
         return $form
56
             ->inlineLabel()
56
             ->inlineLabel()
57
-            ->columns([
58
-                'lg' => 1,
59
-                '2xl' => 2,
60
-            ])
61
-            ->live()
57
+            ->columns()
62
             ->schema([
58
             ->schema([
63
                 $this->getDateRangeFormComponent(),
59
                 $this->getDateRangeFormComponent(),
64
                 Cluster::make([
60
                 Cluster::make([

+ 12
- 62
app/Filament/Forms/Components/DateRangeSelect.php 查看文件

2
 
2
 
3
 namespace App\Filament\Forms\Components;
3
 namespace App\Filament\Forms\Components;
4
 
4
 
5
-use App\Facades\Accounting;
6
-use App\Models\Company;
7
-use Carbon\CarbonPeriod;
5
+use App\Services\DateRangeService;
8
 use Filament\Forms\Components\Select;
6
 use Filament\Forms\Components\Select;
9
 use Filament\Forms\Set;
7
 use Filament\Forms\Set;
10
 use Illuminate\Support\Carbon;
8
 use Illuminate\Support\Carbon;
11
 
9
 
12
 class DateRangeSelect extends Select
10
 class DateRangeSelect extends Select
13
 {
11
 {
14
-    public string $fiscalYearStartDate = '';
12
+    public string $fiscalYearStartDate;
15
 
13
 
16
-    public string $fiscalYearEndDate = '';
14
+    public string $fiscalYearEndDate;
17
 
15
 
18
-    public string $startDateField = '';
16
+    public ?string $startDateField = null;
19
 
17
 
20
-    public string $endDateField = '';
21
-
22
-    public Company $company;
18
+    public ?string $endDateField = null;
23
 
19
 
24
     protected function setUp(): void
20
     protected function setUp(): void
25
     {
21
     {
26
         parent::setUp();
22
         parent::setUp();
27
 
23
 
28
-        $this->company = auth()->user()->currentCompany;
29
-        $this->fiscalYearStartDate = $this->company->locale->fiscalYearStartDate();
30
-        $this->fiscalYearEndDate = $this->company->locale->fiscalYearEndDate();
24
+        $company = auth()->user()->currentCompany;
25
+        $this->fiscalYearStartDate = $company->locale->fiscalYearStartDate();
26
+        $this->fiscalYearEndDate = $company->locale->fiscalYearEndDate();
31
 
27
 
32
-        $this->options($this->getDateRangeOptions())
28
+        $this->options(app(DateRangeService::class)->getDateRangeOptions())
33
             ->live()
29
             ->live()
34
             ->afterStateUpdated(function ($state, Set $set) {
30
             ->afterStateUpdated(function ($state, Set $set) {
35
-                $this->updateDateRange($state, $set);
31
+                if ($this->startDateField && $this->endDateField) {
32
+                    $this->updateDateRange($state, $set);
33
+                }
36
             });
34
             });
37
     }
35
     }
38
 
36
 
50
         return $this;
48
         return $this;
51
     }
49
     }
52
 
50
 
53
-    public function getDateRangeOptions(): array
54
-    {
55
-        $earliestDate = Carbon::parse(Accounting::getEarliestTransactionDate());
56
-        $currentDate = now();
57
-        $fiscalYearStartCurrent = Carbon::parse($this->fiscalYearStartDate);
58
-
59
-        $options = [
60
-            'Fiscal Year' => [],
61
-            'Fiscal Quarter' => [],
62
-            'Calendar Year' => [],
63
-            'Calendar Quarter' => [],
64
-            'Month' => [],
65
-            'Custom' => [],
66
-        ];
67
-
68
-        $period = CarbonPeriod::create($earliestDate, '1 month', $currentDate);
69
-
70
-        foreach ($period as $date) {
71
-            $options['Fiscal Year']['FY-' . $date->year] = $date->year;
72
-
73
-            $fiscalYearStart = $fiscalYearStartCurrent->copy()->subYears($currentDate->year - $date->year);
74
-
75
-            for ($i = 0; $i < 4; $i++) {
76
-                $quarterNumber = $i + 1;
77
-                $quarterStart = $fiscalYearStart->copy()->addMonths(($quarterNumber - 1) * 3);
78
-                $quarterEnd = $quarterStart->copy()->addMonths(3)->subDay();
79
-
80
-                if ($quarterStart->lessThanOrEqualTo($currentDate) && $quarterEnd->greaterThanOrEqualTo($earliestDate)) {
81
-                    $options['Fiscal Quarter']['FQ-' . $quarterNumber . '-' . $date->year] = 'Q' . $quarterNumber . ' ' . $date->year;
82
-                }
83
-            }
84
-
85
-            $options['Calendar Year']['Y-' . $date->year] = $date->year;
86
-            $quarterKey = 'Q-' . $date->quarter . '-' . $date->year;
87
-            $options['Calendar Quarter'][$quarterKey] = 'Q' . $date->quarter . ' ' . $date->year;
88
-            $options['Month']['M-' . $date->format('Y-m')] = $date->format('F Y');
89
-            $options['Custom']['Custom'] = 'Custom';
90
-        }
91
-
92
-        $options['Fiscal Year'] = array_reverse($options['Fiscal Year'], true);
93
-        $options['Fiscal Quarter'] = array_reverse($options['Fiscal Quarter'], true);
94
-        $options['Calendar Year'] = array_reverse($options['Calendar Year'], true);
95
-        $options['Calendar Quarter'] = array_reverse($options['Calendar Quarter'], true);
96
-        $options['Month'] = array_reverse($options['Month'], true);
97
-
98
-        return $options;
99
-    }
100
-
101
     public function updateDateRange($state, Set $set): void
51
     public function updateDateRange($state, Set $set): void
102
     {
52
     {
103
         if ($state === null) {
53
         if ($state === null) {

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

83
 
83
 
84
     public function fiscalYearStartDate(): string
84
     public function fiscalYearStartDate(): string
85
     {
85
     {
86
-        return Carbon::parse($this->fiscalYearEndDate())->subYear()->addDay()->toDateString();
86
+        return once(function () {
87
+            return Carbon::parse($this->fiscalYearEndDate())->subYear()->addDay()->toDateString();
88
+        });
87
     }
89
     }
88
 
90
 
89
     public function fiscalYearEndDate(): string
91
     public function fiscalYearEndDate(): string
90
     {
92
     {
91
-        $today = now();
92
-        $fiscalYearEndThisYear = Carbon::createFromDate($today->year, $this->fiscal_year_end_month, $this->fiscal_year_end_day);
93
+        return once(function () {
94
+            $today = now();
95
+            $fiscalYearEndThisYear = Carbon::createFromDate($today->year, $this->fiscal_year_end_month, $this->fiscal_year_end_day);
93
 
96
 
94
-        if ($today->gt($fiscalYearEndThisYear)) {
95
-            return $fiscalYearEndThisYear->copy()->addYear()->toDateString();
96
-        }
97
+            if ($today->gt($fiscalYearEndThisYear)) {
98
+                return $fiscalYearEndThisYear->copy()->addYear()->toDateString();
99
+            }
97
 
100
 
98
-        return $fiscalYearEndThisYear->toDateString();
101
+            return $fiscalYearEndThisYear->toDateString();
102
+        });
99
     }
103
     }
100
 
104
 
101
     public function getDateTimeFormatAttribute(): string
105
     public function getDateTimeFormatAttribute(): string

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

4
 
4
 
5
 use App\Contracts\AccountHandler;
5
 use App\Contracts\AccountHandler;
6
 use App\Services\AccountService;
6
 use App\Services\AccountService;
7
+use App\Services\DateRangeService;
7
 use BezhanSalleh\PanelSwitch\PanelSwitch;
8
 use BezhanSalleh\PanelSwitch\PanelSwitch;
8
 use Filament\Notifications\Livewire\Notifications;
9
 use Filament\Notifications\Livewire\Notifications;
9
 use Filament\Support\Assets\Js;
10
 use Filament\Support\Assets\Js;
25
      */
26
      */
26
     public function register(): void
27
     public function register(): void
27
     {
28
     {
28
-        //
29
+        $this->app->singleton(DateRangeService::class);
29
     }
30
     }
30
 
31
 
31
     /**
32
     /**

+ 145
- 0
app/Services/DateRangeService.php 查看文件

1
+<?php
2
+
3
+namespace App\Services;
4
+
5
+use App\Facades\Accounting;
6
+use Carbon\CarbonPeriod;
7
+use Illuminate\Support\Carbon;
8
+
9
+class DateRangeService
10
+{
11
+    protected string $fiscalYearStartDate = '';
12
+
13
+    protected string $fiscalYearEndDate = '';
14
+
15
+    public function __construct()
16
+    {
17
+        $company = auth()->user()->currentCompany;
18
+        $this->fiscalYearStartDate = $company->locale->fiscalYearStartDate();
19
+        $this->fiscalYearEndDate = $company->locale->fiscalYearEndDate();
20
+    }
21
+
22
+    public function getDateRangeOptions(): array
23
+    {
24
+        return once(function () {
25
+            return $this->generateDateRangeOptions();
26
+        });
27
+    }
28
+
29
+    private function generateDateRangeOptions(): array
30
+    {
31
+        $earliestDate = Carbon::parse(Accounting::getEarliestTransactionDate());
32
+        $currentDate = now();
33
+        $fiscalYearStartCurrent = Carbon::parse($this->fiscalYearStartDate);
34
+
35
+        $options = [
36
+            'Fiscal Year' => [],
37
+            'Fiscal Quarter' => [],
38
+            'Calendar Year' => [],
39
+            'Calendar Quarter' => [],
40
+            'Month' => [],
41
+            'Custom' => [],
42
+        ];
43
+
44
+        $period = CarbonPeriod::create($earliestDate, '1 month', $currentDate);
45
+
46
+        foreach ($period as $date) {
47
+            $options['Fiscal Year']['FY-' . $date->year] = $date->year;
48
+
49
+            $fiscalYearStart = $fiscalYearStartCurrent->copy()->subYears($currentDate->year - $date->year);
50
+
51
+            for ($i = 0; $i < 4; $i++) {
52
+                $quarterNumber = $i + 1;
53
+                $quarterStart = $fiscalYearStart->copy()->addMonths(($quarterNumber - 1) * 3);
54
+                $quarterEnd = $quarterStart->copy()->addMonths(3)->subDay();
55
+
56
+                if ($quarterStart->lessThanOrEqualTo($currentDate) && $quarterEnd->greaterThanOrEqualTo($earliestDate)) {
57
+                    $options['Fiscal Quarter']['FQ-' . $quarterNumber . '-' . $date->year] = 'Q' . $quarterNumber . ' ' . $date->year;
58
+                }
59
+            }
60
+
61
+            $options['Calendar Year']['Y-' . $date->year] = $date->year;
62
+            $quarterKey = 'Q-' . $date->quarter . '-' . $date->year;
63
+            $options['Calendar Quarter'][$quarterKey] = 'Q' . $date->quarter . ' ' . $date->year;
64
+            $options['Month']['M-' . $date->format('Y-m')] = $date->format('F Y');
65
+            $options['Custom']['Custom'] = 'Custom';
66
+        }
67
+
68
+        $options['Fiscal Year'] = array_reverse($options['Fiscal Year'], true);
69
+        $options['Fiscal Quarter'] = array_reverse($options['Fiscal Quarter'], true);
70
+        $options['Calendar Year'] = array_reverse($options['Calendar Year'], true);
71
+        $options['Calendar Quarter'] = array_reverse($options['Calendar Quarter'], true);
72
+        $options['Month'] = array_reverse($options['Month'], true);
73
+
74
+        return $options;
75
+    }
76
+
77
+    public function getMatchingDateRangeOption(Carbon $startDate, Carbon $endDate): string
78
+    {
79
+        $options = $this->getDateRangeOptions();
80
+
81
+        foreach ($options as $type => $ranges) {
82
+            foreach ($ranges as $key => $label) {
83
+                [$expectedStart, $expectedEnd] = $this->getExpectedDateRange($type, $key);
84
+
85
+                if ($expectedStart === null || $expectedEnd === null) {
86
+                    continue;
87
+                }
88
+
89
+                $expectedEnd = $expectedEnd->isFuture() ? now()->startOfDay() : $expectedEnd;
90
+
91
+                if ($startDate->eq($expectedStart) && $endDate->eq($expectedEnd)) {
92
+                    return $key; // Return the matching range key (e.g., "FY-2024")
93
+                }
94
+            }
95
+        }
96
+
97
+        return 'Custom'; // Return "Custom" if no matching range is found
98
+    }
99
+
100
+    private function getExpectedDateRange(string $type, string $key): array
101
+    {
102
+        switch ($type) {
103
+            case 'Fiscal Year':
104
+                $year = (int) substr($key, 3);
105
+                $start = Carbon::parse($this->fiscalYearStartDate)->subYears(now()->year - $year)->startOfDay();
106
+                $end = Carbon::parse($this->fiscalYearEndDate)->subYears(now()->year - $year)->startOfDay();
107
+
108
+                break;
109
+
110
+            case 'Fiscal Quarter':
111
+                [$quarter, $year] = explode('-', substr($key, 3));
112
+                $start = Carbon::parse($this->fiscalYearStartDate)->subYears(now()->year - $year)->addMonths(($quarter - 1) * 3)->startOfDay();
113
+                $end = $start->copy()->addMonths(3)->subDay()->startOfDay();
114
+
115
+                break;
116
+
117
+            case 'Calendar Year':
118
+                $year = (int) substr($key, 2);
119
+                $start = Carbon::createFromDate($year)->startOfYear()->startOfDay();
120
+                $end = Carbon::createFromDate($year)->endOfYear()->startOfDay();
121
+
122
+                break;
123
+
124
+            case 'Calendar Quarter':
125
+                [$quarter, $year] = explode('-', substr($key, 2));
126
+                $month = ($quarter - 1) * 3 + 1;
127
+                $start = Carbon::createFromDate($year, $month, 1)->startOfDay();
128
+                $end = $start->copy()->endOfQuarter()->startOfDay();
129
+
130
+                break;
131
+
132
+            case 'Month':
133
+                $yearMonth = substr($key, 2);
134
+                $start = Carbon::parse($yearMonth)->startOfMonth()->startOfDay();
135
+                $end = Carbon::parse($yearMonth)->endOfMonth()->startOfDay();
136
+
137
+                break;
138
+
139
+            default:
140
+                return [null, null];
141
+        }
142
+
143
+        return [$start, $end];
144
+    }
145
+}

+ 57
- 57
composer.lock 查看文件

497
         },
497
         },
498
         {
498
         {
499
             "name": "aws/aws-sdk-php",
499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.321.2",
500
+            "version": "3.321.4",
501
             "source": {
501
             "source": {
502
                 "type": "git",
502
                 "type": "git",
503
                 "url": "https://github.com/aws/aws-sdk-php.git",
503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "c04f8f30891cee8480c132778cd4cc486467e77a"
504
+                "reference": "986326efde1d0598ec9fc1b185716550be8ef522"
505
             },
505
             },
506
             "dist": {
506
             "dist": {
507
                 "type": "zip",
507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c04f8f30891cee8480c132778cd4cc486467e77a",
509
-                "reference": "c04f8f30891cee8480c132778cd4cc486467e77a",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/986326efde1d0598ec9fc1b185716550be8ef522",
509
+                "reference": "986326efde1d0598ec9fc1b185716550be8ef522",
510
                 "shasum": ""
510
                 "shasum": ""
511
             },
511
             },
512
             "require": {
512
             "require": {
589
             "support": {
589
             "support": {
590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
591
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
591
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
592
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.321.2"
592
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.321.4"
593
             },
593
             },
594
-            "time": "2024-08-30T18:14:40+00:00"
594
+            "time": "2024-09-04T18:09:31+00:00"
595
         },
595
         },
596
         {
596
         {
597
             "name": "aws/aws-sdk-php-laravel",
597
             "name": "aws/aws-sdk-php-laravel",
1287
         },
1287
         },
1288
         {
1288
         {
1289
             "name": "doctrine/dbal",
1289
             "name": "doctrine/dbal",
1290
-            "version": "4.1.0",
1290
+            "version": "4.1.1",
1291
             "source": {
1291
             "source": {
1292
                 "type": "git",
1292
                 "type": "git",
1293
                 "url": "https://github.com/doctrine/dbal.git",
1293
                 "url": "https://github.com/doctrine/dbal.git",
1294
-                "reference": "2377cd41609aa51bee822c8d207317a3f363a558"
1294
+                "reference": "7a8252418689feb860ea8dfeab66d64a56a64df8"
1295
             },
1295
             },
1296
             "dist": {
1296
             "dist": {
1297
                 "type": "zip",
1297
                 "type": "zip",
1298
-                "url": "https://api.github.com/repos/doctrine/dbal/zipball/2377cd41609aa51bee822c8d207317a3f363a558",
1299
-                "reference": "2377cd41609aa51bee822c8d207317a3f363a558",
1298
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/7a8252418689feb860ea8dfeab66d64a56a64df8",
1299
+                "reference": "7a8252418689feb860ea8dfeab66d64a56a64df8",
1300
                 "shasum": ""
1300
                 "shasum": ""
1301
             },
1301
             },
1302
             "require": {
1302
             "require": {
1309
                 "doctrine/coding-standard": "12.0.0",
1309
                 "doctrine/coding-standard": "12.0.0",
1310
                 "fig/log-test": "^1",
1310
                 "fig/log-test": "^1",
1311
                 "jetbrains/phpstorm-stubs": "2023.2",
1311
                 "jetbrains/phpstorm-stubs": "2023.2",
1312
-                "phpstan/phpstan": "1.11.7",
1312
+                "phpstan/phpstan": "1.12.0",
1313
                 "phpstan/phpstan-phpunit": "1.4.0",
1313
                 "phpstan/phpstan-phpunit": "1.4.0",
1314
                 "phpstan/phpstan-strict-rules": "^1.6",
1314
                 "phpstan/phpstan-strict-rules": "^1.6",
1315
-                "phpunit/phpunit": "10.5.28",
1315
+                "phpunit/phpunit": "10.5.30",
1316
                 "psalm/plugin-phpunit": "0.19.0",
1316
                 "psalm/plugin-phpunit": "0.19.0",
1317
                 "slevomat/coding-standard": "8.13.1",
1317
                 "slevomat/coding-standard": "8.13.1",
1318
                 "squizlabs/php_codesniffer": "3.10.2",
1318
                 "squizlabs/php_codesniffer": "3.10.2",
1319
                 "symfony/cache": "^6.3.8|^7.0",
1319
                 "symfony/cache": "^6.3.8|^7.0",
1320
                 "symfony/console": "^5.4|^6.3|^7.0",
1320
                 "symfony/console": "^5.4|^6.3|^7.0",
1321
-                "vimeo/psalm": "5.24.0"
1321
+                "vimeo/psalm": "5.25.0"
1322
             },
1322
             },
1323
             "suggest": {
1323
             "suggest": {
1324
                 "symfony/console": "For helpful console commands such as SQL execution and import of files."
1324
                 "symfony/console": "For helpful console commands such as SQL execution and import of files."
1375
             ],
1375
             ],
1376
             "support": {
1376
             "support": {
1377
                 "issues": "https://github.com/doctrine/dbal/issues",
1377
                 "issues": "https://github.com/doctrine/dbal/issues",
1378
-                "source": "https://github.com/doctrine/dbal/tree/4.1.0"
1378
+                "source": "https://github.com/doctrine/dbal/tree/4.1.1"
1379
             },
1379
             },
1380
             "funding": [
1380
             "funding": [
1381
                 {
1381
                 {
1391
                     "type": "tidelift"
1391
                     "type": "tidelift"
1392
                 }
1392
                 }
1393
             ],
1393
             ],
1394
-            "time": "2024-08-15T07:37:07+00:00"
1394
+            "time": "2024-09-03T08:58:39+00:00"
1395
         },
1395
         },
1396
         {
1396
         {
1397
             "name": "doctrine/deprecations",
1397
             "name": "doctrine/deprecations",
2981
         },
2981
         },
2982
         {
2982
         {
2983
             "name": "laravel/framework",
2983
             "name": "laravel/framework",
2984
-            "version": "v11.21.0",
2984
+            "version": "v11.22.0",
2985
             "source": {
2985
             "source": {
2986
                 "type": "git",
2986
                 "type": "git",
2987
                 "url": "https://github.com/laravel/framework.git",
2987
                 "url": "https://github.com/laravel/framework.git",
2988
-                "reference": "9d9d36708d56665b12185493f684abce38ad2d30"
2988
+                "reference": "868c75beacc47d0f361b919bbc155c0b619bf3d5"
2989
             },
2989
             },
2990
             "dist": {
2990
             "dist": {
2991
                 "type": "zip",
2991
                 "type": "zip",
2992
-                "url": "https://api.github.com/repos/laravel/framework/zipball/9d9d36708d56665b12185493f684abce38ad2d30",
2993
-                "reference": "9d9d36708d56665b12185493f684abce38ad2d30",
2992
+                "url": "https://api.github.com/repos/laravel/framework/zipball/868c75beacc47d0f361b919bbc155c0b619bf3d5",
2993
+                "reference": "868c75beacc47d0f361b919bbc155c0b619bf3d5",
2994
                 "shasum": ""
2994
                 "shasum": ""
2995
             },
2995
             },
2996
             "require": {
2996
             "require": {
3183
                 "issues": "https://github.com/laravel/framework/issues",
3183
                 "issues": "https://github.com/laravel/framework/issues",
3184
                 "source": "https://github.com/laravel/framework"
3184
                 "source": "https://github.com/laravel/framework"
3185
             },
3185
             },
3186
-            "time": "2024-08-20T15:00:52+00:00"
3186
+            "time": "2024-09-03T15:27:15+00:00"
3187
         },
3187
         },
3188
         {
3188
         {
3189
             "name": "laravel/prompts",
3189
             "name": "laravel/prompts",
3370
         },
3370
         },
3371
         {
3371
         {
3372
             "name": "laravel/socialite",
3372
             "name": "laravel/socialite",
3373
-            "version": "v5.15.1",
3373
+            "version": "v5.16.0",
3374
             "source": {
3374
             "source": {
3375
                 "type": "git",
3375
                 "type": "git",
3376
                 "url": "https://github.com/laravel/socialite.git",
3376
                 "url": "https://github.com/laravel/socialite.git",
3377
-                "reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029"
3377
+                "reference": "40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf"
3378
             },
3378
             },
3379
             "dist": {
3379
             "dist": {
3380
                 "type": "zip",
3380
                 "type": "zip",
3381
-                "url": "https://api.github.com/repos/laravel/socialite/zipball/cc02625f0bd1f95dc3688eb041cce0f1e709d029",
3382
-                "reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029",
3381
+                "url": "https://api.github.com/repos/laravel/socialite/zipball/40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf",
3382
+                "reference": "40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf",
3383
                 "shasum": ""
3383
                 "shasum": ""
3384
             },
3384
             },
3385
             "require": {
3385
             "require": {
3438
                 "issues": "https://github.com/laravel/socialite/issues",
3438
                 "issues": "https://github.com/laravel/socialite/issues",
3439
                 "source": "https://github.com/laravel/socialite"
3439
                 "source": "https://github.com/laravel/socialite"
3440
             },
3440
             },
3441
-            "time": "2024-06-28T20:09:34+00:00"
3441
+            "time": "2024-09-03T09:46:57+00:00"
3442
         },
3442
         },
3443
         {
3443
         {
3444
             "name": "laravel/tinker",
3444
             "name": "laravel/tinker",
4535
         },
4535
         },
4536
         {
4536
         {
4537
             "name": "mtdowling/jmespath.php",
4537
             "name": "mtdowling/jmespath.php",
4538
-            "version": "2.7.0",
4538
+            "version": "2.8.0",
4539
             "source": {
4539
             "source": {
4540
                 "type": "git",
4540
                 "type": "git",
4541
                 "url": "https://github.com/jmespath/jmespath.php.git",
4541
                 "url": "https://github.com/jmespath/jmespath.php.git",
4542
-                "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b"
4542
+                "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc"
4543
             },
4543
             },
4544
             "dist": {
4544
             "dist": {
4545
                 "type": "zip",
4545
                 "type": "zip",
4546
-                "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/bbb69a935c2cbb0c03d7f481a238027430f6440b",
4547
-                "reference": "bbb69a935c2cbb0c03d7f481a238027430f6440b",
4546
+                "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/a2a865e05d5f420b50cc2f85bb78d565db12a6bc",
4547
+                "reference": "a2a865e05d5f420b50cc2f85bb78d565db12a6bc",
4548
                 "shasum": ""
4548
                 "shasum": ""
4549
             },
4549
             },
4550
             "require": {
4550
             "require": {
4561
             "type": "library",
4561
             "type": "library",
4562
             "extra": {
4562
             "extra": {
4563
                 "branch-alias": {
4563
                 "branch-alias": {
4564
-                    "dev-master": "2.7-dev"
4564
+                    "dev-master": "2.8-dev"
4565
                 }
4565
                 }
4566
             },
4566
             },
4567
             "autoload": {
4567
             "autoload": {
4595
             ],
4595
             ],
4596
             "support": {
4596
             "support": {
4597
                 "issues": "https://github.com/jmespath/jmespath.php/issues",
4597
                 "issues": "https://github.com/jmespath/jmespath.php/issues",
4598
-                "source": "https://github.com/jmespath/jmespath.php/tree/2.7.0"
4598
+                "source": "https://github.com/jmespath/jmespath.php/tree/2.8.0"
4599
             },
4599
             },
4600
-            "time": "2023-08-25T10:54:48+00:00"
4600
+            "time": "2024-09-04T18:46:31+00:00"
4601
         },
4601
         },
4602
         {
4602
         {
4603
             "name": "mustangostang/spyc",
4603
             "name": "mustangostang/spyc",
9488
         },
9488
         },
9489
         {
9489
         {
9490
             "name": "laravel/pint",
9490
             "name": "laravel/pint",
9491
-            "version": "v1.17.2",
9491
+            "version": "v1.17.3",
9492
             "source": {
9492
             "source": {
9493
                 "type": "git",
9493
                 "type": "git",
9494
                 "url": "https://github.com/laravel/pint.git",
9494
                 "url": "https://github.com/laravel/pint.git",
9495
-                "reference": "e8a88130a25e3f9d4d5785e6a1afca98268ab110"
9495
+                "reference": "9d77be916e145864f10788bb94531d03e1f7b482"
9496
             },
9496
             },
9497
             "dist": {
9497
             "dist": {
9498
                 "type": "zip",
9498
                 "type": "zip",
9499
-                "url": "https://api.github.com/repos/laravel/pint/zipball/e8a88130a25e3f9d4d5785e6a1afca98268ab110",
9500
-                "reference": "e8a88130a25e3f9d4d5785e6a1afca98268ab110",
9499
+                "url": "https://api.github.com/repos/laravel/pint/zipball/9d77be916e145864f10788bb94531d03e1f7b482",
9500
+                "reference": "9d77be916e145864f10788bb94531d03e1f7b482",
9501
                 "shasum": ""
9501
                 "shasum": ""
9502
             },
9502
             },
9503
             "require": {
9503
             "require": {
9508
                 "php": "^8.1.0"
9508
                 "php": "^8.1.0"
9509
             },
9509
             },
9510
             "require-dev": {
9510
             "require-dev": {
9511
-                "friendsofphp/php-cs-fixer": "^3.61.1",
9512
-                "illuminate/view": "^10.48.18",
9511
+                "friendsofphp/php-cs-fixer": "^3.64.0",
9512
+                "illuminate/view": "^10.48.20",
9513
                 "larastan/larastan": "^2.9.8",
9513
                 "larastan/larastan": "^2.9.8",
9514
                 "laravel-zero/framework": "^10.4.0",
9514
                 "laravel-zero/framework": "^10.4.0",
9515
                 "mockery/mockery": "^1.6.12",
9515
                 "mockery/mockery": "^1.6.12",
9516
                 "nunomaduro/termwind": "^1.15.1",
9516
                 "nunomaduro/termwind": "^1.15.1",
9517
-                "pestphp/pest": "^2.35.0"
9517
+                "pestphp/pest": "^2.35.1"
9518
             },
9518
             },
9519
             "bin": [
9519
             "bin": [
9520
                 "builds/pint"
9520
                 "builds/pint"
9550
                 "issues": "https://github.com/laravel/pint/issues",
9550
                 "issues": "https://github.com/laravel/pint/issues",
9551
                 "source": "https://github.com/laravel/pint"
9551
                 "source": "https://github.com/laravel/pint"
9552
             },
9552
             },
9553
-            "time": "2024-08-06T15:11:54+00:00"
9553
+            "time": "2024-09-03T15:00:28+00:00"
9554
         },
9554
         },
9555
         {
9555
         {
9556
             "name": "laravel/sail",
9556
             "name": "laravel/sail",
9557
-            "version": "v1.31.1",
9557
+            "version": "v1.31.3",
9558
             "source": {
9558
             "source": {
9559
                 "type": "git",
9559
                 "type": "git",
9560
                 "url": "https://github.com/laravel/sail.git",
9560
                 "url": "https://github.com/laravel/sail.git",
9561
-                "reference": "3d06dd18cee8059baa7b388af00ba47f6d96bd85"
9561
+                "reference": "0a7e2891a85eba2d448a9ffc6fc5ce367e924bc1"
9562
             },
9562
             },
9563
             "dist": {
9563
             "dist": {
9564
                 "type": "zip",
9564
                 "type": "zip",
9565
-                "url": "https://api.github.com/repos/laravel/sail/zipball/3d06dd18cee8059baa7b388af00ba47f6d96bd85",
9566
-                "reference": "3d06dd18cee8059baa7b388af00ba47f6d96bd85",
9565
+                "url": "https://api.github.com/repos/laravel/sail/zipball/0a7e2891a85eba2d448a9ffc6fc5ce367e924bc1",
9566
+                "reference": "0a7e2891a85eba2d448a9ffc6fc5ce367e924bc1",
9567
                 "shasum": ""
9567
                 "shasum": ""
9568
             },
9568
             },
9569
             "require": {
9569
             "require": {
9613
                 "issues": "https://github.com/laravel/sail/issues",
9613
                 "issues": "https://github.com/laravel/sail/issues",
9614
                 "source": "https://github.com/laravel/sail"
9614
                 "source": "https://github.com/laravel/sail"
9615
             },
9615
             },
9616
-            "time": "2024-08-02T07:45:47+00:00"
9616
+            "time": "2024-09-03T20:05:33+00:00"
9617
         },
9617
         },
9618
         {
9618
         {
9619
             "name": "mockery/mockery",
9619
             "name": "mockery/mockery",
10103
         },
10103
         },
10104
         {
10104
         {
10105
             "name": "phpstan/phpstan",
10105
             "name": "phpstan/phpstan",
10106
-            "version": "1.12.0",
10106
+            "version": "1.12.1",
10107
             "source": {
10107
             "source": {
10108
                 "type": "git",
10108
                 "type": "git",
10109
                 "url": "https://github.com/phpstan/phpstan.git",
10109
                 "url": "https://github.com/phpstan/phpstan.git",
10110
-                "reference": "384af967d35b2162f69526c7276acadce534d0e1"
10110
+                "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2"
10111
             },
10111
             },
10112
             "dist": {
10112
             "dist": {
10113
                 "type": "zip",
10113
                 "type": "zip",
10114
-                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1",
10115
-                "reference": "384af967d35b2162f69526c7276acadce534d0e1",
10114
+                "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2",
10115
+                "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2",
10116
                 "shasum": ""
10116
                 "shasum": ""
10117
             },
10117
             },
10118
             "require": {
10118
             "require": {
10157
                     "type": "github"
10157
                     "type": "github"
10158
                 }
10158
                 }
10159
             ],
10159
             ],
10160
-            "time": "2024-08-27T09:18:05+00:00"
10160
+            "time": "2024-09-03T19:55:22+00:00"
10161
         },
10161
         },
10162
         {
10162
         {
10163
             "name": "phpunit/php-code-coverage",
10163
             "name": "phpunit/php-code-coverage",
10482
         },
10482
         },
10483
         {
10483
         {
10484
             "name": "phpunit/phpunit",
10484
             "name": "phpunit/phpunit",
10485
-            "version": "10.5.30",
10485
+            "version": "10.5.32",
10486
             "source": {
10486
             "source": {
10487
                 "type": "git",
10487
                 "type": "git",
10488
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
10488
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
10489
-                "reference": "b15524febac0153876b4ba9aab3326c2ee94c897"
10489
+                "reference": "f069f46840445d37a4e6f0de8c5879598f9c4327"
10490
             },
10490
             },
10491
             "dist": {
10491
             "dist": {
10492
                 "type": "zip",
10492
                 "type": "zip",
10493
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b15524febac0153876b4ba9aab3326c2ee94c897",
10494
-                "reference": "b15524febac0153876b4ba9aab3326c2ee94c897",
10493
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f069f46840445d37a4e6f0de8c5879598f9c4327",
10494
+                "reference": "f069f46840445d37a4e6f0de8c5879598f9c4327",
10495
                 "shasum": ""
10495
                 "shasum": ""
10496
             },
10496
             },
10497
             "require": {
10497
             "require": {
10505
                 "phar-io/manifest": "^2.0.4",
10505
                 "phar-io/manifest": "^2.0.4",
10506
                 "phar-io/version": "^3.2.1",
10506
                 "phar-io/version": "^3.2.1",
10507
                 "php": ">=8.1",
10507
                 "php": ">=8.1",
10508
-                "phpunit/php-code-coverage": "^10.1.15",
10508
+                "phpunit/php-code-coverage": "^10.1.16",
10509
                 "phpunit/php-file-iterator": "^4.1.0",
10509
                 "phpunit/php-file-iterator": "^4.1.0",
10510
                 "phpunit/php-invoker": "^4.0.0",
10510
                 "phpunit/php-invoker": "^4.0.0",
10511
                 "phpunit/php-text-template": "^3.0.1",
10511
                 "phpunit/php-text-template": "^3.0.1",
10563
             "support": {
10563
             "support": {
10564
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
10564
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
10565
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
10565
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
10566
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.30"
10566
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.32"
10567
             },
10567
             },
10568
             "funding": [
10568
             "funding": [
10569
                 {
10569
                 {
10579
                     "type": "tidelift"
10579
                     "type": "tidelift"
10580
                 }
10580
                 }
10581
             ],
10581
             ],
10582
-            "time": "2024-08-13T06:09:37+00:00"
10582
+            "time": "2024-09-04T13:33:39+00:00"
10583
         },
10583
         },
10584
         {
10584
         {
10585
             "name": "rector/rector",
10585
             "name": "rector/rector",

+ 19
- 19
package-lock.json 查看文件

900
             }
900
             }
901
         },
901
         },
902
         "node_modules/axios": {
902
         "node_modules/axios": {
903
-            "version": "1.7.6",
904
-            "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.6.tgz",
905
-            "integrity": "sha512-Ekur6XDwhnJ5RgOCaxFnXyqlPALI3rVeukZMwOdfghW7/wGz784BYKiQq+QD8NPcr91KRo30KfHOchyijwWw7g==",
903
+            "version": "1.7.7",
904
+            "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz",
905
+            "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==",
906
             "dev": true,
906
             "dev": true,
907
             "license": "MIT",
907
             "license": "MIT",
908
             "dependencies": {
908
             "dependencies": {
1275
             }
1275
             }
1276
         },
1276
         },
1277
         "node_modules/follow-redirects": {
1277
         "node_modules/follow-redirects": {
1278
-            "version": "1.15.6",
1279
-            "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
1280
-            "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
1278
+            "version": "1.15.8",
1279
+            "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.8.tgz",
1280
+            "integrity": "sha512-xgrmBhBToVKay1q2Tao5LI26B83UhrB/vM1avwVSDzt8rx3rO6AizBAaF46EgksTVr+rFTQaqZZ9MVBfUe4nig==",
1281
             "dev": true,
1281
             "dev": true,
1282
             "funding": [
1282
             "funding": [
1283
                 {
1283
                 {
1786
             }
1786
             }
1787
         },
1787
         },
1788
         "node_modules/picocolors": {
1788
         "node_modules/picocolors": {
1789
-            "version": "1.0.1",
1790
-            "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
1791
-            "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==",
1789
+            "version": "1.1.0",
1790
+            "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz",
1791
+            "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==",
1792
             "dev": true,
1792
             "dev": true,
1793
             "license": "ISC"
1793
             "license": "ISC"
1794
         },
1794
         },
1826
             }
1826
             }
1827
         },
1827
         },
1828
         "node_modules/postcss": {
1828
         "node_modules/postcss": {
1829
-            "version": "8.4.42",
1830
-            "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.42.tgz",
1831
-            "integrity": "sha512-hywKUQB9Ra4dR1mGhldy5Aj1X3MWDSIA1cEi+Uy0CjheLvP6Ual5RlwMCh8i/X121yEDLDIKBsrCQ8ba3FDMfQ==",
1829
+            "version": "8.4.45",
1830
+            "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.45.tgz",
1831
+            "integrity": "sha512-7KTLTdzdZZYscUc65XmjFiB73vBhBfbPztCYdUNvlaso9PrzjzcmjqBPR0lNGkcVlcO4BjiO5rK/qNz+XAen1Q==",
1832
             "dev": true,
1832
             "dev": true,
1833
             "funding": [
1833
             "funding": [
1834
                 {
1834
                 {
2550
             "license": "MIT"
2550
             "license": "MIT"
2551
         },
2551
         },
2552
         "node_modules/vite": {
2552
         "node_modules/vite": {
2553
-            "version": "5.4.2",
2554
-            "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.2.tgz",
2555
-            "integrity": "sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==",
2553
+            "version": "5.4.3",
2554
+            "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.3.tgz",
2555
+            "integrity": "sha512-IH+nl64eq9lJjFqU+/yrRnrHPVTlgy42/+IzbOdaFDVlyLgI/wDlf+FCobXLX1cT0X5+7LMyH1mIy2xJdLfo8Q==",
2556
             "dev": true,
2556
             "dev": true,
2557
             "license": "MIT",
2557
             "license": "MIT",
2558
             "dependencies": {
2558
             "dependencies": {
2559
                 "esbuild": "^0.21.3",
2559
                 "esbuild": "^0.21.3",
2560
-                "postcss": "^8.4.41",
2560
+                "postcss": "^8.4.43",
2561
                 "rollup": "^4.20.0"
2561
                 "rollup": "^4.20.0"
2562
             },
2562
             },
2563
             "bin": {
2563
             "bin": {
2735
             }
2735
             }
2736
         },
2736
         },
2737
         "node_modules/yaml": {
2737
         "node_modules/yaml": {
2738
-            "version": "2.5.0",
2739
-            "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz",
2740
-            "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==",
2738
+            "version": "2.5.1",
2739
+            "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz",
2740
+            "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==",
2741
             "dev": true,
2741
             "dev": true,
2742
             "license": "ISC",
2742
             "license": "ISC",
2743
             "bin": {
2743
             "bin": {

+ 4
- 6
resources/views/filament/company/pages/reports/account-transactions.blade.php 查看文件

1
 <x-filament-panels::page>
1
 <x-filament-panels::page>
2
     <x-filament::section>
2
     <x-filament::section>
3
-        <form wire:submit="loadReportData">
4
-            {{ $this->form }}
5
-        </form>
3
+        {{ $this->getFiltersForm() }}
6
     </x-filament::section>
4
     </x-filament::section>
7
 
5
 
8
     <x-filament-tables::container>
6
     <x-filament-tables::container>
9
         <div class="es-table__header-ctn"></div>
7
         <div class="es-table__header-ctn"></div>
10
         <div
8
         <div
11
             class="relative divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10 min-h-64">
9
             class="relative divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10 min-h-64">
12
-            <div wire:init="loadReportData" class="flex items-center justify-center w-full h-full absolute">
13
-                <div wire:loading wire:target="loadReportData">
10
+            <div wire:init="applyFilters" class="flex items-center justify-center w-full h-full absolute">
11
+                <div wire:loading wire:target="applyFilters">
14
                     <x-filament::loading-indicator class="p-6 text-primary-700 dark:text-primary-300"/>
12
                     <x-filament::loading-indicator class="p-6 text-primary-700 dark:text-primary-300"/>
15
                 </div>
13
                 </div>
16
             </div>
14
             </div>
17
 
15
 
18
             @if($this->reportLoaded)
16
             @if($this->reportLoaded)
19
-                <div wire:loading.remove wire:target="loadReportData">
17
+                <div wire:loading.remove wire:target="applyFilters">
20
                     @if($this->report && !$this->tableHasEmptyState())
18
                     @if($this->report && !$this->tableHasEmptyState())
21
                         <x-company.tables.reports.account-transactions :report="$this->report"/>
19
                         <x-company.tables.reports.account-transactions :report="$this->report"/>
22
                     @else
20
                     @else

+ 18
- 20
resources/views/filament/company/pages/reports/detailed-report.blade.php 查看文件

1
 <x-filament-panels::page>
1
 <x-filament-panels::page>
2
     <x-filament::section>
2
     <x-filament::section>
3
-        <form wire:submit="loadReportData">
4
-            <div class="flex flex-col md:flex-row items-start md:items-center justify-between gap-4 md:gap-8">
5
-                <div class="flex-grow">
6
-                    {{ $this->form }}
7
-                </div>
3
+        <div class="flex flex-col md:flex-row items-start md:items-center justify-between gap-4 md:gap-8">
4
+            <!-- Form Container -->
5
+            <div class="flex-grow">
6
+                {{ $this->getFiltersForm() }}
7
+            </div>
8
 
8
 
9
-                <div class="flex flex-col md:flex-row items-start md:items-center gap-4 md:gap-8 flex-shrink-0">
10
-                    @if($this->hasToggleableColumns())
11
-                        <x-filament-tables::column-toggle.dropdown
12
-                            :form="$this->toggleTableColumnForm"
13
-                            :trigger-action="$this->toggleColumnsAction"
14
-                        />
15
-                    @endif
16
-                    <x-filament::button type="submit" wire:target="loadReportData" class="flex-shrink-0">
17
-                        Update Report
18
-                    </x-filament::button>
19
-                </div>
9
+            <!-- Grouping Button and Column Toggle -->
10
+            <div class="flex flex-col md:flex-row items-start md:items-center gap-4 md:gap-8 flex-shrink-0">
11
+                @if($this->hasToggleableColumns())
12
+                    <x-filament-tables::column-toggle.dropdown
13
+                        :form="$this->toggleTableColumnForm"
14
+                        :trigger-action="$this->toggleColumnsAction"
15
+                    />
16
+                @endif
17
+                {{ $this->getFiltersApplyAction() }}
20
             </div>
18
             </div>
21
-        </form>
19
+        </div>
22
     </x-filament::section>
20
     </x-filament::section>
23
 
21
 
24
     <x-filament-tables::container>
22
     <x-filament-tables::container>
25
         <div class="es-table__header-ctn"></div>
23
         <div class="es-table__header-ctn"></div>
26
         <div
24
         <div
27
             class="relative divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10 min-h-64">
25
             class="relative divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10 min-h-64">
28
-            <div wire:init="loadReportData" class="flex items-center justify-center w-full h-full absolute">
29
-                <div wire:loading wire:target="loadReportData">
26
+            <div wire:init="applyFilters" class="flex items-center justify-center w-full h-full absolute">
27
+                <div wire:loading wire:target="applyFilters">
30
                     <x-filament::loading-indicator class="p-6 text-primary-700 dark:text-primary-300"/>
28
                     <x-filament::loading-indicator class="p-6 text-primary-700 dark:text-primary-300"/>
31
                 </div>
29
                 </div>
32
             </div>
30
             </div>
33
 
31
 
34
             @if($this->reportLoaded)
32
             @if($this->reportLoaded)
35
-                <div wire:loading.remove wire:target="loadReportData">
33
+                <div wire:loading.remove wire:target="applyFilters">
36
                     @if($this->report)
34
                     @if($this->report)
37
                         <x-company.tables.reports.detailed-report :report="$this->report"/>
35
                         <x-company.tables.reports.detailed-report :report="$this->report"/>
38
                     @endif
36
                     @endif

+ 8
- 8
resources/views/filament/company/pages/reports/income-statement.blade.php 查看文件

59
 
59
 
60
     <x-filament-tables::container>
60
     <x-filament-tables::container>
61
         <div class="es-table__header-ctn"></div>
61
         <div class="es-table__header-ctn"></div>
62
-        <div wire:init="applyFilters"
63
-             class="relative divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10 min-h-64">
62
+        <div
63
+            class="relative divide-y divide-gray-200 overflow-x-auto dark:divide-white/10 dark:border-t-white/10 min-h-64">
64
+            <div wire:init="applyFilters" class="flex items-center justify-center w-full h-full absolute">
65
+                <div wire:loading wire:target="applyFilters">
66
+                    <x-filament::loading-indicator class="p-6 text-primary-700 dark:text-primary-300"/>
67
+                </div>
68
+            </div>
69
+
64
             @if($this->reportLoaded)
70
             @if($this->reportLoaded)
65
                 <div wire:loading.remove wire:target="applyFilters">
71
                 <div wire:loading.remove wire:target="applyFilters">
66
                     @if($this->report)
72
                     @if($this->report)
67
                         <x-company.tables.reports.detailed-report :report="$this->report"/>
73
                         <x-company.tables.reports.detailed-report :report="$this->report"/>
68
                     @endif
74
                     @endif
69
                 </div>
75
                 </div>
70
-            @else
71
-                <div class="absolute inset-0 flex items-center justify-center">
72
-                    <div wire:loading wire:target="applyFilters">
73
-                        <x-filament::loading-indicator class="p-6 text-primary-700 dark:text-primary-300"/>
74
-                    </div>
75
-                </div>
76
             @endif
76
             @endif
77
         </div>
77
         </div>
78
         <div class="es-table__footer-ctn border-t border-gray-200"></div>
78
         <div class="es-table__footer-ctn border-t border-gray-200"></div>

正在加载...
取消
保存