Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Dec 14, 2023
1 parent 3b75dfe commit c2eca5a
Show file tree
Hide file tree
Showing 16 changed files with 250 additions and 179 deletions.
2 changes: 1 addition & 1 deletion app/Filament/Admin/Resources/ServiceResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ServiceResource extends Resource
{
protected static ?string $model = Service::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationIcon = 'heroicon-o-view-columns';

public static function getNavigationGroup(): ?string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

class EditOrganizationProfile extends EditTenantProfile
{
protected static ?string $slug = 'organization';

public static function getLabel(): string
{
return __('organization.profile');
Expand Down
10 changes: 10 additions & 0 deletions app/Filament/Organizations/Resources/BeneficiaryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Filament\Organizations\Resources;

use App\Enums\CaseStatus;
use App\Filament\Organizations\Resources\BeneficiaryResource\Pages;
use App\Models\Beneficiary;
use Filament\Resources\Resource;
Expand All @@ -20,6 +21,8 @@ class BeneficiaryResource extends Resource

protected static ?string $slug = 'cases';

protected static ?int $navigationSort = 10;

public static function getNavigationGroup(): ?string
{
return __('navigation.beneficiaries._group');
Expand Down Expand Up @@ -88,6 +91,13 @@ public static function table(Table $table): Table
TextColumn::make('status')
->label(__('field.status'))
->badge()
->color(fn ($state) => match ($state) {
CaseStatus::ACTIVE => 'success',
CaseStatus::REACTIVATED => 'success',
CaseStatus::MONITORED => 'warning',
CaseStatus::CLOSED => 'gray',
default => dd($state)
})
->formatStateUsing(fn ($state) => $state?->label())
->extraHeaderAttributes([
'class' => 'w-1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class ListBeneficiaries extends ListRecords
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
Actions\CreateAction::make()
->label(__('beneficiary.action.create')),
];
}
}
152 changes: 6 additions & 146 deletions app/Filament/Organizations/Resources/CommunityProfileResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,19 @@

use App\Filament\Organizations\Resources\CommunityProfileResource\Pages;
use App\Models\CommunityProfile;
use Filament\Infolists\Components\Grid;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\SpatieMediaLibraryImageEntry;
use Filament\Infolists\Components\Split as InfolistSplit;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\Layout\Split;
use Filament\Tables\Columns\Layout\Stack;
use Filament\Tables\Columns\SpatieMediaLibraryImageColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Support\Str;

class CommunityProfileResource extends Resource
{
protected static ?string $model = CommunityProfile::class;

protected static ?string $navigationIcon = 'heroicon-o-globe-alt';
protected static ?string $navigationIcon = 'heroicon-o-at-symbol';

protected static bool $isScopedToTenant = false;

protected static ?string $slug = 'community';
protected static ?string $slug = 'community-profile';

protected static ?int $navigationSort = 21;

public static function getNavigationGroup(): ?string
{
Expand All @@ -40,140 +27,13 @@ public static function getNavigationGroup(): ?string

public static function getNavigationLabel(): string
{
return __('navigation.community.network');
}

public static function getModelLabel(): string
{
return __('beneficiary.label.singular');
}

public static function getPluralModelLabel(): string
{
return __('beneficiary.label.plural');
}

public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
Section::make()
->schema([
Grid::make()
->extraAttributes([
'class' => 'items-center',
])
->schema([
TextEntry::make('description')
->hiddenLabel()
->size('sm')
->html(),

SpatieMediaLibraryImageEntry::make('logo')
->hiddenLabel()
->collection('logo')
->conversion('large')
->extraAttributes([
'class' => 'justify-center',
])
->extraImgAttributes([
'class' => 'max-w-full max-h-24 md:max-h-48 p-4 ',
])
->size('100%')
->alignCenter(),
]),

InfolistSplit::make([

TextEntry::make('website')
->icon('heroicon-o-link')
->hiddenLabel()
->url(fn (string $state) => $state)
->openUrlInNewTab(),

TextEntry::make('email')
->icon('heroicon-o-envelope')
->hiddenLabel()
->url(fn (string $state) => "mailto:{$state}")
->openUrlInNewTab(),

TextEntry::make('phone')
->icon('heroicon-o-phone')
->hiddenLabel()
->url(fn (string $state) => "tel:{$state}")
->openUrlInNewTab(),

]),
]),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Split::make([
Stack::make([
TextColumn::make('counties.name')
->size('sm')
->color('gray'),

TextColumn::make('name')
->searchable()
->size('text-3xl')
->weight('normal')
->extraAttributes([
'class' => 'mt-2.5 mb-6',
]),

TextColumn::make('description')
->size('text-sm line-clamp-4')
->formatStateUsing(
fn (string $state) => Str::of($state)
->stripTags()
->limit(300, '...')
),
])
->columnSpan(2),

SpatieMediaLibraryImageColumn::make('logo')
->collection('logo')
->conversion('large')
->extraImgAttributes([
'class' => 'max-w-full max-h-24 md:max-h-48 p-4',
])
->size('100%')
->alignCenter(),

])
->from('md'),
])
->filters([
SelectFilter::make('county')
->relationship('counties', 'name')
->label(__('organization.filter.county.label'))
->placeholder(__('organization.filter.county.placeholder')),
])
->filtersLayout(FiltersLayout::AboveContent)
->actions([
Tables\Actions\ViewAction::make()
->hidden(),
]);
}

public static function getRelations(): array
{
return [
//
];
return __('navigation.community.profile');
}

public static function getPages(): array
{
return [
'index' => Pages\ListCommunityProfiles::route('/'),
'profile' => Pages\EditCommunityProfile::route('/profile'),
'view' => Pages\ViewCommunityProfile::route('/{record}'),
'index' => Pages\EditCommunityProfile::route('/'),
];
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit c2eca5a

Please sign in to comment.