diff --git a/app/Filament/Resources/VolunteerResource.php b/app/Filament/Resources/VolunteerResource.php index 047ada8f..def34c3c 100644 --- a/app/Filament/Resources/VolunteerResource.php +++ b/app/Filament/Resources/VolunteerResource.php @@ -175,7 +175,7 @@ private static function getProjectLink(VolunteerRequest $record): HtmlString { if ($record->model_type === 'App\Models\Project') { $url = route('filament.resources.projects.view', $record->model_id); - $name = Str::words($record->model?->name, 3, '...'); + $name = Str::words($record->model->name, 3, '...'); return new HtmlString(sprintf('%s', $url, $name)); } diff --git a/app/Http/Controllers/OrganizationController.php b/app/Http/Controllers/OrganizationController.php index c4c8bccd..1e88cc06 100644 --- a/app/Http/Controllers/OrganizationController.php +++ b/app/Http/Controllers/OrganizationController.php @@ -43,6 +43,8 @@ public function index(Request $request) public function show(Organization $organization) { + $this->authorize('view', $organization); + return Inertia::render('Public/Organizations/Show', [ 'organization' => new ShowOrganizationResource( $organization->loadMissing([ diff --git a/app/Policies/OrganizationPolicy.php b/app/Policies/OrganizationPolicy.php index e558bb5e..248f6cb0 100644 --- a/app/Policies/OrganizationPolicy.php +++ b/app/Policies/OrganizationPolicy.php @@ -4,6 +4,7 @@ namespace App\Policies; +use App\Enums\OrganizationStatus; use App\Models\Organization; use App\Models\User; @@ -24,7 +25,11 @@ public function viewAny(User $user): bool public function view(User $user, Organization $organization): bool { /* Anyone can see the details of an organization. */ - return true; + if ($organization->isActive()) + { + return true; + } + return $user->isSuperUser() || $user->isOrganizationAdmin($organization); } /** diff --git a/config/filament.php b/config/filament.php index 10b1aa17..eec45426 100644 --- a/config/filament.php +++ b/config/filament.php @@ -240,7 +240,7 @@ 'footer' => [ 'should_show_logo' => false, ], - 'max_content_width' => null, + 'max_content_width' => 'full', 'notifications' => [ 'vertical_alignment' => 'top', 'alignment' => 'right', diff --git a/database/factories/OrganizationFactory.php b/database/factories/OrganizationFactory.php index b94a8e6a..8b21c103 100644 --- a/database/factories/OrganizationFactory.php +++ b/database/factories/OrganizationFactory.php @@ -114,7 +114,7 @@ public function configure(): static ->count(2) ->hasAttached( Volunteer::factory() - ->count(17), + ->count(1), fn () => [ 'status' => fake()->randomElement(VolunteerStatus::cases()), ] @@ -122,7 +122,7 @@ public function configure(): static ->hasAttached( Volunteer::factory() ->withUser() - ->count(3), + ->count(2), fn () => [ 'status' => fake()->randomElement(VolunteerStatus::cases()), ] @@ -143,14 +143,14 @@ public function configure(): static $organization->volunteers()->attach( Volunteer::factory() - ->count(10) + ->count(1) ->create(), ['status' => VolunteerStatus::PENDING] ); $organization->volunteers()->attach( Volunteer::factory() - ->count(10) + ->count(1) ->withUser() ->create(), ['status' => VolunteerStatus::PENDING] diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 0e33274d..ed9977b4 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -40,7 +40,7 @@ public function run(): void ->create(); User::factory() - ->count(50) + ->count(5) ->donor() ->create(); @@ -65,12 +65,12 @@ public function run(): void ->create(); Organization::factory() - ->count(5) + ->count(1) ->rejected() ->create(); Organization::factory() - ->count(5) + ->count(1) ->pending() ->create(); diff --git a/resources/js/Pages/Public/Organizations/Show.vue b/resources/js/Pages/Public/Organizations/Show.vue index bd89a200..99b39297 100644 --- a/resources/js/Pages/Public/Organizations/Show.vue +++ b/resources/js/Pages/Public/Organizations/Show.vue @@ -80,8 +80,8 @@
- {{ organization.street_address }},
- {{ organization.county_name }}, {{ organization.city_name }}
+ {{ organization.street_address }}
{{ organization.location }}
+