-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de34007
commit dbab3f8
Showing
26 changed files
with
901 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
app/Filament/Resources/ProjectResource/Actions/Pages/ApproveProjectAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\ProjectResource\Actions\Pages; | ||
|
||
use App\Models\Organization; | ||
use App\Models\Project; | ||
use Filament\Pages\Actions\Action; | ||
|
||
class ApproveProjectAction extends Action | ||
{ | ||
public static function getDefaultName(): ?string | ||
{ | ||
return 'approve'; | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->color('success'); | ||
|
||
$this->icon('heroicon-s-check'); | ||
|
||
$this->label(__('project.actions.approve')); | ||
|
||
$this->requiresConfirmation(); | ||
|
||
$this->modalHeading(__('project.approve_modal.heading')); | ||
|
||
$this->modalSubheading( | ||
fn (Project $record) => __('project.approve_modal.subheading', [ | ||
'name' => $record->name, | ||
]) | ||
); | ||
|
||
$this->modalButton(__('project.actions.approve')); | ||
|
||
$this->action(function (Project $record) { | ||
$record->markAsApproved(); | ||
}); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
app/Filament/Resources/ProjectResource/Actions/Pages/DeactivateProjectAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\ProjectResource\Actions\Pages; | ||
|
||
use App\Models\Project; | ||
use Filament\Pages\Actions\Action; | ||
|
||
class DeactivateProjectAction extends Action | ||
{ | ||
public static function getDefaultName(): ?string | ||
{ | ||
return 'deactivate'; | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->color('danger'); | ||
|
||
$this->icon('heroicon-s-x'); | ||
|
||
$this->label(__('project.actions.deactivate')); | ||
|
||
$this->requiresConfirmation(); | ||
|
||
$this->modalHeading(__('project.deactivate_modal.heading')); | ||
|
||
$this->modalSubheading( | ||
fn (Project $record) => __('project.deactivate_modal.subheading', [ | ||
'name' => $record->name, | ||
]) | ||
); | ||
|
||
$this->modalButton(__('project.actions.deactivate')); | ||
|
||
$this->action(function (Project $record) { | ||
$record->markAsRejected(); | ||
}); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
app/Filament/Resources/ProjectResource/Actions/Pages/ReactivateProjectAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\ProjectResource\Actions\Pages; | ||
|
||
use App\Models\Organization; | ||
use App\Models\Project; | ||
use Filament\Pages\Actions\Action; | ||
|
||
class ReactivateProjectAction extends Action | ||
{ | ||
public static function getDefaultName(): ?string | ||
{ | ||
return 'reactivate'; | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->color('success'); | ||
|
||
$this->icon('heroicon-s-check'); | ||
|
||
$this->label(__('project.actions.reactivate')); | ||
|
||
$this->requiresConfirmation(); | ||
|
||
$this->modalHeading(__('project.reactivate_modal.heading')); | ||
|
||
$this->modalSubheading( | ||
fn (Project $record) => __('project.reactivate_modal.subheading', [ | ||
'name' => $record->name, | ||
]) | ||
); | ||
|
||
$this->modalButton(__('project.actions.reactivate')); | ||
|
||
$this->action(function (Project $record) { | ||
$record->markAsApproved(); | ||
}); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
app/Filament/Resources/ProjectResource/Actions/Pages/RejectProjectAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\ProjectResource\Actions\Pages; | ||
|
||
use App\Models\Organization; | ||
use App\Models\Project; | ||
use Filament\Forms\Components\Textarea; | ||
use Filament\Pages\Actions\Action; | ||
|
||
class RejectProjectAction extends Action | ||
{ | ||
public static function getDefaultName(): ?string | ||
{ | ||
return 'reject'; | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->color('danger'); | ||
|
||
$this->icon('heroicon-s-x'); | ||
|
||
$this->label(__('project.actions.reject')); | ||
|
||
$this->requiresConfirmation(); | ||
|
||
$this->modalHeading(__('project.reject_modal.heading')); | ||
|
||
$this->modalSubheading( | ||
fn (Project $record) => __('project.reject_modal.subheading', [ | ||
'name' => $record->name, | ||
]) | ||
); | ||
|
||
$this->form([ | ||
Textarea::make('reason') | ||
->label(__('project.reject_modal.reason')) | ||
->required(), | ||
]); | ||
|
||
$this->modalButton(__('project.actions.reject')); | ||
|
||
$this->action(function (Project $record, array $data) { | ||
$reason = strip_tags($data['reason']); | ||
|
||
$record->markAsRejected($reason); | ||
}); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/Filament/Resources/ProjectResource/Actions/Tables/Activity/ApproveActivityAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\ProjectResource\Actions\Tables\Activity; | ||
|
||
use App\Models\Activity; | ||
use Filament\Tables\Actions\Action as BaseAction; | ||
|
||
class ApproveActivityAction extends BaseAction | ||
{ | ||
public static function getDefaultName(): ?string | ||
{ | ||
return 'approve'; | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->label(__('activity.actions.approve')); | ||
|
||
$this->icon('heroicon-s-check'); | ||
|
||
$this->color('success'); | ||
|
||
$this->action(fn (Activity $record) => $record->approve()); | ||
|
||
$this->visible(fn (Activity $record) => $record->isPending()); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
app/Filament/Resources/ProjectResource/Actions/Tables/Activity/RejectActivityAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\ProjectResource\Actions\Tables\Activity; | ||
|
||
use App\Models\Activity; | ||
use Filament\Forms\Components\Textarea; | ||
use Filament\Tables\Actions\Action as BaseAction; | ||
|
||
class RejectActivityAction extends BaseAction | ||
{ | ||
public static function getDefaultName(): ?string | ||
{ | ||
return 'reject'; | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->label(__('activity.actions.reject')); | ||
|
||
$this->icon('heroicon-s-x'); | ||
|
||
$this->color('danger'); | ||
|
||
$this->requiresConfirmation(); | ||
|
||
$this->modalHeading(__('activity.reject_modal.heading')); | ||
|
||
$this->modalSubheading( | ||
fn (Activity $record) => __('activity.reject_modal.subheading', [ | ||
'name' => __('project.labels.' . $record->changed_field), | ||
'resource' => $record->subject->name, | ||
]) | ||
); | ||
|
||
$this->form([ | ||
Textarea::make('reason') | ||
->label(__('activity.reject_modal.reason')) | ||
->default(function (Activity $record) { | ||
return $record->subject->name; | ||
}) | ||
->required(), | ||
]); | ||
|
||
$this->modalButton(__('activity.actions.reject')); | ||
|
||
$this->action(function (Activity $record, array $data) { | ||
$reason = strip_tags($data['reason']); | ||
|
||
$record->reject($reason); | ||
}); | ||
|
||
$this->visible(fn (Activity $record) => $record->isPending()); | ||
} | ||
} |
Oops, something went wrong.