value; protected static ?string $navigationGroup = 'Financial'; protected static ?int $navigationSort = 2; public static function form(Form $form): Form { return $form ->schema([ Section::make([ DatePicker::make('date') ->default(today()) ->columnSpan(2), Select::make('customer_id') ->relationship('customer', 'company_name') ->required() ->searchable() ->hidden(fn ($livewire) => $livewire::class === ListInvoices::class) ->preload() ->columnSpan(2), TextInput::make('amount') ->required() ->prefix('$') ->rules('numeric') ->minValue(0) ->maxValue(99999999) ->columnSpan(1), TextInput::make('check_number') ->columnSpan(3), Textarea::make('notes') ->columnSpan(4), ])->columns(4), ]); } public static function table(Table $table, ?bool $showSearchable = true): Table { return $table ->columns([ TextColumn::make('created_at') ->label('Date') ->date('Y-m-d') ->searchable($showSearchable), TextColumn::make('customer.company_name') ->hidden(fn ($livewire) => $livewire::class !== Pages\ListPayments::class) ->searchable($showSearchable), TextColumn::make('check_number') ->searchable($showSearchable) ->extraHeaderAttributes(['class' => 'w-full']), TextColumn::make('amount') ->searchable($showSearchable) ->alignRight() ->money(), TextColumn::make('unapplied_amount') ->searchable($showSearchable) ->label('Balance') ->alignRight() ->money(), ]) ->actions([ \Filament\Tables\Actions\EditAction::make(), ]); } public static function paymentRelationManagerTable(Table $table): Table { return $table ->columns([ TextColumn::make('id') ->color('primary'), TextColumn::make('created_at') ->label('Date') ->date('Y-m-d'), TextColumn::make('check_number') ->extraHeaderAttributes(['class' => 'w-full']), TextColumn::make('applied_amount') ->alignRight() ->money(), ]); } public static function canAccess(): bool { return auth()->user()->is_admin ?? false; } public static function getRelations(): array { return [ InvoicesRelationManager::class, ]; } public static function getPages(): array { return [ 'index' => Pages\ListPayments::route('/'), 'edit' => Pages\EditPayment::route('/{record}/edit'), ]; } }