Skip to content

Commit 2474362

Browse files
committed
Merge branch 'develop'
2 parents d9fbb36 + 67006de commit 2474362

34 files changed

+545
-177
lines changed

app/Concerns/Enums/Comparable.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ trait Comparable
1111
*/
1212
public function is(mixed $enum): bool
1313
{
14-
1514
if ($enum instanceof static) {
1615
return $this->value === $enum->value;
1716
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Console\Commands;
6+
7+
use App\Models\Project;
8+
use App\Notifications\Ngo\ProjectEndingNotification;
9+
use Illuminate\Console\Command;
10+
11+
class EndProjectPeriod extends Command
12+
{
13+
/**
14+
* The name and signature of the console command.
15+
*
16+
* @var string
17+
*/
18+
protected $signature = 'app:notification-end-project-period {--days=7}';
19+
20+
/**
21+
* The console command description.
22+
*
23+
* @var string
24+
*/
25+
protected $description = 'Notify users that a project is ending in a number of days';
26+
27+
/**
28+
* Execute the console command.
29+
*/
30+
public function handle(): void
31+
{
32+
$this->info('Ending project period...');
33+
$daysBeforeEnding = (int) $this->option('days') ?? 7;
34+
$this->info("Ending period {$daysBeforeEnding}...");
35+
$projects = Project::withoutEagerLoads()->with(['organization'])
36+
->whereIsApproved()
37+
->whereDate('end', now()->addDays($daysBeforeEnding))
38+
->get();
39+
$projects->each(function (Project $project) use ($daysBeforeEnding) {
40+
41+
$users = $project->organization->load('users')->users->filter(function ($user) {
42+
return $user->hasVerifiedEmail();
43+
});
44+
\Notification::send($users, new ProjectEndingNotification($project, $daysBeforeEnding));
45+
46+
});
47+
}
48+
}

app/Console/Kernel.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ protected function schedule(Schedule $schedule): void
2424
->everyFourHours()
2525
->onOneServer()
2626
->sentryMonitor('process-authorized-transactions-job');
27+
28+
$schedule->command('app:notification-end-project-period', ['--days' => 10])
29+
->dailyAt('09:00')
30+
->onOneServer()
31+
->sentryMonitor('notification-end-project-period');
32+
33+
$schedule->command('app:notification-end-project-period', ['--days' => 2])
34+
->dailyAt('10:00')
35+
->onOneServer()
36+
->sentryMonitor('notification-end-project-period');
2737
}
2838

2939
/**

app/Filament/Resources/OrganizationResource/Actions/Tables/Activity/ViewActivityAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ protected function setUp(): void
5050
if (! $media) {
5151
return '-';
5252
}
53+
5354
return new HtmlString(\sprintf(
5455
'<a href="%s" target="_blank">%s</a>',
5556
$media->getTemporaryUrl(now()->addMinutes(30)),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace App\Filament\Resources\ProjectResource\Widgets;
66

7+
use App\Filament\Resources\ProjectResource;
78
use App\Filament\Resources\ProjectResource\Actions\Tables\Projects\RejectProjectAction;
89
use App\Models\Project;
910
use Filament\Tables\Actions\EditAction;
@@ -58,6 +59,7 @@ protected function getTableActions(): array
5859
->iconButton()
5960
->url($this->getTableRecordUrlUsing()),
6061
EditAction::make()
62+
->url(fn (Project $record) => ProjectResource::getUrl('edit', ['record' => $record]))
6163
->iconButton(),
6264
RejectProjectAction::make()
6365
->iconButton(),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ protected function getTableActions(): array
5151
ViewAction::make()->label(__('project.actions.view'))
5252
->iconButton()
5353
->url($this->getTableRecordUrlUsing()),
54-
EditAction::make()
54+
EditAction::make('edit')
55+
->url(fn (Project $record) => ProjectResource::getUrl('edit', ['record' => $record]))
5556
->iconButton(),
5657
ApproveProjectAction::make()
5758
->iconButton(),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace App\Filament\Resources\ProjectResource\Widgets;
66

7+
use App\Filament\Resources\ProjectResource;
78
use App\Filament\Resources\ProjectResource\Actions\Tables\Projects\ApproveProjectAction;
89
use App\Models\Project;
910
use Filament\Tables\Actions\EditAction;
@@ -55,6 +56,7 @@ protected function getTableActions(): array
5556
->iconButton()
5657
->url($this->getTableRecordUrlUsing()),
5758
EditAction::make()
59+
->url(fn (Project $record) => ProjectResource::getUrl('edit', ['record' => $record]))
5860
->iconButton(),
5961
ApproveProjectAction::make()
6062
->iconButton(),

app/Filament/Widgets/BaseDonationWidget.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected function getChartData(
2828
)
2929
->where('created_at', '>', $whereCreatedCondition)
3030
// TODO: add CAPTURE after pr #348
31-
->whereIn('status', [EuPlatescStatus::AUTHORIZED])
31+
->whereIn('status', [EuPlatescStatus::AUTHORIZED->value, EuPlatescStatus::CHARGED->value])
3232
->groupBy($chartInterval)
3333
->orderBy($chartInterval)
3434
->get();

app/Http/Controllers/Auth/PasswordController.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ public function update(Request $request): RedirectResponse
2323
'password' => [
2424
'required',
2525
Password::min(8)
26-
->mixedCase()
27-
->letters()
28-
->numbers()
29-
->symbols()
30-
->uncompromised(),
31-
'confirmed'
26+
->mixedCase()
27+
->letters()
28+
->numbers()
29+
->symbols()
30+
->uncompromised(),
31+
'confirmed',
3232
],
3333
]);
3434

app/Http/Controllers/Dashboard/VolunteerController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\Http\Controllers\Controller;
99
use App\Http\Resources\Collections\VolunteerCollection;
1010
use App\Models\VolunteerRequest;
11+
use App\Notifications\UserWasApprovedForVolunteering;
1112
use Illuminate\Http\Request;
1213
use Inertia\Inertia;
1314
use Spatie\QueryBuilder\QueryBuilder;
@@ -41,6 +42,7 @@ public function approve(Request $request, VolunteerRequest $volunteerRequest)
4142
{
4243
$this->authorize('update', $volunteerRequest);
4344
$volunteerRequest->markAsApproved();
45+
\Notification::send($volunteerRequest->volunteer->user, new UserWasApprovedForVolunteering());
4446

4547
return redirect()->back()
4648
->with('success', __('volunteer.messages.approved'));

0 commit comments

Comments
 (0)