Skip to content

Commit

Permalink
Show main information in lead overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
lukacavic committed Oct 12, 2024
1 parent 0aa7135 commit ecaf146
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 2 deletions.
74 changes: 72 additions & 2 deletions app/Filament/Resources/LeadResource/Pages/LeadOverview.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,93 @@

use App\Filament\Resources\LeadResource;
use AymanAlhattami\FilamentPageWithSidebar\Traits\HasPageSidebar;
use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Infolists\Components\Fieldset;
use Filament\Infolists\Components\Grid;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Concerns\InteractsWithInfolists;
use Filament\Infolists\Contracts\HasInfolists;
use Filament\Infolists\Infolist;
use Filament\Resources\Pages\Concerns\InteractsWithRecord;
use Filament\Resources\Pages\Page;
use Illuminate\Contracts\Support\Htmlable;

class LeadOverview extends Page
class LeadOverview extends Page implements HasInfolists
{
use HasPageSidebar, InteractsWithRecord;
use HasPageSidebar, InteractsWithRecord, InteractsWithInfolists;

protected static string $resource = LeadResource::class;

protected static string $view = 'filament.resources.lead-resource.pages.lead-overview';

private static function generalInformationSection()
{
return Fieldset::make('General Information')
->columnSpan(1)
->columns(1)
->schema([
TextEntry::make('status.name')
->badge()
->label(__('Status')),

TextEntry::make('source.name')
->label(__('Source')),

TextEntry::make('assignedUser.full_name')
->label(__('Assigned User'))
]);
}

private static function leadInformationSection()
{
return Fieldset::make('Lead Information')
->columnSpan(1)
->columns(1)
->schema([
TextEntry::make('company')
]);
}

public function getTitle(): string|Htmlable
{
return __('Overview');
}

public function leadInformationInfolist(Infolist $infolist): Infolist
{
return $infolist
->record($this->record)
->schema([
Grid::make(2)->schema([
self::leadInformationSection(),
self::generalInformationSection()
])
]);
}

protected function getHeaderActions(): array
{
return [
Action::make('convert')
->label(__('Convert to client'))
->icon('heroicon-o-user')
->color('success'),

EditAction::make()
->hiddenLabel()
->icon('heroicon-o-pencil')
->form(function ($form) {
return LeadResource::form($form);
}),

DeleteAction::make()
->hiddenLabel()
->icon('heroicon-o-trash')
];
}

public function mount(int|string $record): void
{
$this->record = $this->resolveRecord($record);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<x-filament-panels::page>
{{ $this->leadInformationInfolist }}

<x-filament-actions::modals/>
</x-filament-panels::page>

0 comments on commit ecaf146

Please sign in to comment.