DivDax
DivDax
FFilament
Created by DivDax on 1/12/2024 in #❓┊help
Action inside Resource ViewAction blade view
Hey! I have a ViewAction on my ClientResource Table. Inside the show-client view, I load the client-info Livewire component with an action. When I click the button for the first time, nothing happens, but a Livewire update request is fired. On the second click, the modal opens. Do you have any ideas on how to fix that?
ViewAction::make()
->slideOver()
->modalWidth('w-full sm:max-w-7xl')
->modalHeading(fn($record) => __('Client') . ': ' . $record->full_name)
->extraModalFooterActions([
(new ClientEditAction())->editAction(),
])
->form([])
->modalContent(fn($record) => view('show-client', ['client' => $record])),
ViewAction::make()
->slideOver()
->modalWidth('w-full sm:max-w-7xl')
->modalHeading(fn($record) => __('Client') . ': ' . $record->full_name)
->extraModalFooterActions([
(new ClientEditAction())->editAction(),
])
->form([])
->modalContent(fn($record) => view('show-client', ['client' => $record])),
show-client.blade.php
<div>
<livewire:client-info :$client />
</div>
<div>
<livewire:client-info :$client />
</div>
client-info.blade.php
<div>
{{ $this->createAppointmentAction() }}

<x-filament-actions::modals />
</div>
<div>
{{ $this->createAppointmentAction() }}

<x-filament-actions::modals />
</div>
ClientInfo.php
class ClientInfo extends Component implements HasActions, HasForms, HasTable, HasInfolists
{
use InteractsWithActions;
use InteractsWithInfolists;
use InteractsWithForms;
use InteractsWithTable;

public Client $client;

public function createAppointmentAction(): CreateAction
{
return CreateAction::make('createAppointment')
->form([
AppointmentForm::make(),
]);
}
}
class ClientInfo extends Component implements HasActions, HasForms, HasTable, HasInfolists
{
use InteractsWithActions;
use InteractsWithInfolists;
use InteractsWithForms;
use InteractsWithTable;

public Client $client;

public function createAppointmentAction(): CreateAction
{
return CreateAction::make('createAppointment')
->form([
AppointmentForm::make(),
]);
}
}
2 replies
FFilament
Created by DivDax on 12/29/2023 in #❓┊help
EditAction inside Action
Hey! I try to open an edit action from an action:
return Action::make('showAction')
->slideOver()
->modalWidth('w-11/12 md:w-3/4')
->modalContent(fn (Action $action) => view(
'livewire.appointment-show-action',
[
'action' => $action,
'appointment' => $appointment,
]
))
->registerModalActions([
EditAction::make('editClient')
->record($appointment->client)
->form([ClientForm::make()])
->slideOver(),
])
return Action::make('showAction')
->slideOver()
->modalWidth('w-11/12 md:w-3/4')
->modalContent(fn (Action $action) => view(
'livewire.appointment-show-action',
[
'action' => $action,
'appointment' => $appointment,
]
))
->registerModalActions([
EditAction::make('editClient')
->record($appointment->client)
->form([ClientForm::make()])
->slideOver(),
])
When i click the edit button inside my slideover i get this error: Error:
Filament\Actions\EditAction::Filament\Actions\{closure}(): Argument #2 ($record) must be of type Illuminate\Database\Eloquent\Model, null given, called in /var/www/app/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
Filament\Actions\EditAction::Filament\Actions\{closure}(): Argument #2 ($record) must be of type Illuminate\Database\Eloquent\Model, null given, called in /var/www/app/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
any ideas?
2 replies
FFilament
Created by DivDax on 12/6/2023 in #❓┊help
spatie tags problem
No description
4 replies
FFilament
Created by DivDax on 11/9/2023 in #❓┊help
Consistent forms when using filament components
Hey, what is your approach when using filament forms and custom forms to match the style? I don't want to use the form component for simple forms. How do you get a consistent form style? Copying the filament input & button classes just feels wrong.
3 replies
FFilament
Created by DivDax on 8/27/2023 in #❓┊help
Open action modal with javascript?
I use FullCalendar within a Livewire component. When I move an event, the moved() function is called. How can I trigger a modal to open when moving the event, so that the user has to confirm the action? I there any way to open the action modal instead of clicking the action button?
2 replies
FFilament
Created by DivDax on 8/25/2023 in #❓┊help
Trigger action from javascript?
In my Livewire component, I have defined an action. Instead of displaying a button in my template, I would like to trigger the action using JavaScript. Is this possible?
7 replies
FFilament
Created by DivDax on 8/3/2023 in #❓┊help
Load component into Action modal?
Hey! Can a component be passed to an action instead of a view?
10 replies
FFilament
Created by DivDax on 7/7/2023 in #❓┊help
Table select/check all?
Hey! 👋 Is it possible to add a select all checkbox to the table header to select/check all current filtered rows of all pages?
4 replies
FFilament
Created by DivDax on 6/26/2023 in #❓┊help
Use chart widget (standalone)
Hey! Is it possible to use the chart widget on my website without filament like the table builder?
14 replies
FFilament
Created by DivDax on 5/31/2023 in #❓┊help
SpatieMediaLibraryFileUpload show uploaded images
Hey! 👋 I want to use the Form Builder inside a Widget to upload images. The upload is working and my media files are stored on disk and in the media table. When i reload the page the uploaded images are gone. Storage path is linked and i have no console errors. The Field inside a Resource on the edit page it works. Any idea what i'm doing wrong?
<?php

namespace App\Filament\Widgets;

use App\Models\Page;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Widgets\Widget;
use Filament\Forms;

class LinkpageImages extends Widget implements HasForms
{
use InteractsWithForms;

protected static string $view = 'filament.widgets.linkpage-images';

protected static ?string $pollingInterval = null;

public $pages;

public $images;

public function mount(): void
{
$this->pages = Page::get();
}

protected function getFormSchema()
{
$fields = [];

foreach ($this->pages as $page) {
$fields[] = Forms\Components\SpatieMediaLibraryFileUpload::make('images')
->collection('background')
->model($page)
->image()
->maxSize(1024*3)
->required();
}

return [
Forms\Components\Grid::make(2)
->schema($fields)
];
}

public function submit(): void
{
dd($this->form->getState());
}
}
<?php

namespace App\Filament\Widgets;

use App\Models\Page;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Widgets\Widget;
use Filament\Forms;

class LinkpageImages extends Widget implements HasForms
{
use InteractsWithForms;

protected static string $view = 'filament.widgets.linkpage-images';

protected static ?string $pollingInterval = null;

public $pages;

public $images;

public function mount(): void
{
$this->pages = Page::get();
}

protected function getFormSchema()
{
$fields = [];

foreach ($this->pages as $page) {
$fields[] = Forms\Components\SpatieMediaLibraryFileUpload::make('images')
->collection('background')
->model($page)
->image()
->maxSize(1024*3)
->required();
}

return [
Forms\Components\Grid::make(2)
->schema($fields)
];
}

public function submit(): void
{
dd($this->form->getState());
}
}
6 replies
FFilament
Created by DivDax on 5/4/2023 in #❓┊help
Count when click on table row to view model
Hey! I have a resource table with messages and a simple view modal. How i can set the reat_at date on the model when the message modal was opened?
8 replies