Skip to content

Commit c517b20

Browse files
fix issue 33 with filter
1 parent 0a9a0c3 commit c517b20

File tree

6 files changed

+14
-29
lines changed

6 files changed

+14
-29
lines changed

app/Filament/Resources/ProjectResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public static function getWidgetColumns(): array
257257
TextColumn::make('target_budget')
258258
->label(__('project.labels.target_budget'))
259259
->formatStateUsing(
260-
fn (Project $record) => number_format($record->target_budget, 2, ',', '.')
260+
fn (Project $record) => number_format($record->target_budget ?? 0, 2, ',', '.')
261261
),
262262

263263
TextColumn::make('status_updated_at')

app/Filament/Resources/ProjectResource/Actions/ExportAction.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ protected function setUp(): void
2525

2626
$this->color('secondary');
2727

28-
$fileName = sprintf(
29-
'%s-%s-%s',
30-
now()->format('Y_m_d-H_i_s'),
31-
Str::slug(ProjectResource::getPluralModelLabel()),
32-
$this->name ?? ''
33-
);
34-
3528
try {
3629
$this->exports([
3730
ExcelExportWithNotificationInDB::make()
38-
->withFilename($fileName)
31+
->withFilename(fn () => sprintf(
32+
'%s-%s-%s',
33+
now()->format('Y_m_d-H_i_s'),
34+
Str::slug(ProjectResource::getPluralModelLabel()),
35+
$this->name ?? ''
36+
))
3937
->fromTable()
4038
->modifyQueryUsing(fn (Builder $query): Builder => $query->addSelect([
4139
'start',

app/Filament/Resources/ProjectResource/Widgets/ApprovedProject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function (Project $record) {
118118

119119
TextColumn::make('target_budget')
120120
->formatStateUsing(
121-
fn (Project $record) => number_format($record->target_budget, 2, ',', '.')
121+
fn (Project $record) => number_format($record->target_budget ?? 0, 2, ',', '.')
122122
)
123123
->label(__('project.labels.target_budget')),
124124

app/Filament/Resources/ProjectResource/Widgets/BaseProjectWidget.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use App\Enums\ProjectStatus;
88
use App\Filament\Resources\ProjectResource;
9+
use App\Filament\Resources\ProjectResource\Actions\ExportAction;
910
use App\Models\Project;
1011
use Filament\Tables\Actions\Action;
1112
use Filament\Widgets\TableWidget as BaseWidget;
@@ -114,7 +115,7 @@ protected function paginateTableQuery(Builder $query): Paginator
114115
protected function getTableHeaderActions(): array
115116
{
116117
return [
117-
ProjectResource\Actions\ExportAction::make($this->getTableQueryStringIdentifier()),
118+
ExportAction::make($this->getTableQueryStringIdentifier()),
118119
];
119120
}
120121
}

app/Traits/HasProjectStatus.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function isPublished(): bool
4141

4242
public function isOpen(): bool
4343
{
44-
return $this->isPublished() && $this->start->isPast() && $this->end->isFuture();
44+
return $this->isPublished() && $this->start?->isPast() && $this->end?->isFuture();
4545
}
4646

4747
public function isArchived(): bool
@@ -52,13 +52,13 @@ public function isArchived(): bool
5252
public function isStartingSoon(): bool
5353
{
5454
return $this->isPublished()
55-
&& ! $this->end->isPast()
56-
&& ($this->start->isFuture() || ! $this->organization->EuPlatescIsActive());
55+
&& ! $this->end?->isPast()
56+
&& ($this->start?->isFuture() || ! $this->organization->EuPlatescIsActive());
5757
}
5858

5959
public function isClose(): bool
6060
{
61-
return $this->isPublished() && $this->end->isPast();
61+
return $this->isPublished() && $this->end?->isPast();
6262
}
6363

6464
public function scopeWhereIsPending(Builder $query): Builder

config/filesystems.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,6 @@
7878
'visibility' => 'private',
7979
],
8080

81-
// 'filament-excel' => [
82-
// 'driver' => 's3',
83-
// 'key' => env('AWS_ACCESS_KEY_ID'),
84-
// 'secret' => env('AWS_SECRET_ACCESS_KEY'),
85-
// 'token' => env('AWS_SESSION_TOKEN'),
86-
// 'region' => env('AWS_DEFAULT_REGION'),
87-
// 'bucket' => env('AWS_BUCKET'),
88-
// 'url' => env('AWS_URL'),
89-
// 'endpoint' => env('AWS_ENDPOINT'),
90-
// 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
91-
// 'throw' => false,
92-
// 'root' => env('AWS_PUBLIC_BUCKET_ROOT', 'filament-excel'),
93-
// 'visibility' => 'private',
94-
// ],
9581

9682
],
9783

0 commit comments

Comments
 (0)