Jon Mason
Jon Mason
FFilament
Created by Jon Mason on 6/10/2024 in #❓┊help
searchable select in infolist?
I need to display some information, but need to allow the user to interact with it. I need to use a searchable select. Ideally I'd use a table, which is what I'm currently doing, but the select isn't searchable, which is becoming problematic. I've briefly attempted to make an infolist with a form inside it, but it doesn't seem to be working from my initial quick attempt. Before I spend more time I thought I'd just ask if anyone has done anything like this and how you did it? Is there a better way I'm not thinking of?
3 replies
FFilament
Created by Jon Mason on 6/8/2024 in #❓┊help
double tooltips, workaround not working.
No description
4 replies
FFilament
Created by Jon Mason on 5/10/2024 in #❓┊help
Production issue affecting multiple users. Need some help with where to start.
No description
16 replies
FFilament
Created by Jon Mason on 5/7/2024 in #❓┊help
Cannot mutate reactive prop InteractsWithPageFilters Trait
I'm getting an error on my dashboard widget: cannot mutate reactive prop [filters] in component. I'm using the ApexChartWidget plugin, but I don't believe it's related to that. It seems to be related to the #[Reactive] prop on the InteractsWithPageFilters trait. I have another component that has a filters form and I'm dispatching an event when a user changes the filter. That seems to work fine, but when I switch tenants, if the user had a filter other than "all" then it's stored in the session when they navigate to the new dashboard. In the mount method I'm checking the tenant for the user and setting to "all" if not present. The error occurs just after that happens. I don't understand why I'm not able to update the prop in the mount method?
class MonthEndProgress extends ApexChartWidget
{
use InteractsWithPageFilters;

protected static ?string $chartId = 'monthEndProgress';

protected static ?string $heading = 'Month End Progress';

protected int | string | array $columnStart = 1;

protected int | string | array $columnSpan = 'full';

protected static ?int $sort = 2;

protected static ?string $pollingInterval = null;

public ?array $data = [];

/**
* Initializes the options for the object.
*/
public function mount(): void
{
$this->filters['location_filter'] = Session::get('dashboardSelectedUser') ?? 'all';

$tenant = Filament::getTenant();

if (!$tenant->members()->where('team_user.id', $this->filters['location_filter'])->first()) {
Log::debug('tenant has no member!');
Session::put('dashboardSelectedUser', 'all');
$this->filters['location_filter'] = 'all';
}

$this->options = $this->getOptions();

$this->form->fill();
Log::debug($tenant->members);
Log::debug($this->filters);

if (!$this->getDeferLoading()) {
$this->readyToLoad = true;
}
}
class MonthEndProgress extends ApexChartWidget
{
use InteractsWithPageFilters;

protected static ?string $chartId = 'monthEndProgress';

protected static ?string $heading = 'Month End Progress';

protected int | string | array $columnStart = 1;

protected int | string | array $columnSpan = 'full';

protected static ?int $sort = 2;

protected static ?string $pollingInterval = null;

public ?array $data = [];

/**
* Initializes the options for the object.
*/
public function mount(): void
{
$this->filters['location_filter'] = Session::get('dashboardSelectedUser') ?? 'all';

$tenant = Filament::getTenant();

if (!$tenant->members()->where('team_user.id', $this->filters['location_filter'])->first()) {
Log::debug('tenant has no member!');
Session::put('dashboardSelectedUser', 'all');
$this->filters['location_filter'] = 'all';
}

$this->options = $this->getOptions();

$this->form->fill();
Log::debug($tenant->members);
Log::debug($this->filters);

if (!$this->getDeferLoading()) {
$this->readyToLoad = true;
}
}
2 replies
FFilament
Created by Jon Mason on 5/6/2024 in #❓┊help
searchable on SelectColumn?
Is searchable not a working method on a SelectColumn? No matter where I put searchable() it doesn't seem to work.
SelectColumn::make('account_ref_id')->label('Quick Edit')
->searchable()
->options($this->accounts)

->beforeStateUpdated(function ($record, $state) {
$record->is_complete = 1;
})
->afterStateUpdated(function () {
$this->resetTable();
})
->disabled(fn ($record) => $record->is_complete)
SelectColumn::make('account_ref_id')->label('Quick Edit')
->searchable()
->options($this->accounts)

->beforeStateUpdated(function ($record, $state) {
$record->is_complete = 1;
})
->afterStateUpdated(function () {
$this->resetTable();
})
->disabled(fn ($record) => $record->is_complete)
I can also just take everything off except searchable and options and it still doesn't work. It's displayed as a normal select box without search capability.
3 replies
FFilament
Created by Jon Mason on 5/4/2024 in #❓┊help
TextEntry with static url, how to set text of anchor tag?
I have an infolist that I'm trying to add a link to like so:
TextEntry::make('myLink')
->label('Do Something')
->url(function (Model $reference) {
$id = $reference->id;
return "https://somedomain.com/somepath?someid={$id}"; })
->openUrlInNewTab(),
TextEntry::make('myLink')
->label('Do Something')
->url(function (Model $reference) {
$id = $reference->id;
return "https://somedomain.com/somepath?someid={$id}"; })
->openUrlInNewTab(),
The a tag is in the dom, but there's no text, so it's not showing up as anything. I'm sure I'm missing something stupid, but it doesn't appear to be in the docs, and looking at the source code, I don't see a method to set the text. ->label() isn't doing it.
6 replies
FFilament
Created by Jon Mason on 5/2/2024 in #❓┊help
FileUpload failed to upload.
Anyone run into this? Was working previously, now all of a sudden is not.
The data.document_id.4af07f15-4f73-40f8-89a7-1f9f086e05da failed to upload.
The data.document_id.4af07f15-4f73-40f8-89a7-1f9f086e05da failed to upload.
There's no more information, so I don't really know what the problem is.
7 replies
FFilament
Created by Jon Mason on 5/2/2024 in #❓┊help
shifting button when submitting
No description
2 replies
FFilament
Created by Jon Mason on 5/2/2024 in #❓┊help
is it possible to add dividers in a grouped action blade / livewire component?
I see that you can add dividers to an action group here: https://filamentphp.com/docs/3.x/actions/grouping-actions#adding-dividers-between-actions. Is it possible to do it in a livewire component where you're defining the action group in blade?
<x-filament-actions::group :actions="[
($this->markTaskCompletedAction)(['id' => $taskId]),
//divider?
//other actions
]" />
<x-filament-actions::group :actions="[
($this->markTaskCompletedAction)(['id' => $taskId]),
//divider?
//other actions
]" />
4 replies
FFilament
Created by Jon Mason on 5/1/2024 in #❓┊help
extraAttributes to reformat hint on checkbox?
No description
11 replies
FFilament
Created by Jon Mason on 4/30/2024 in #❓┊help
How do I access the uploaded file?
No description
3 replies
FFilament
Created by Jon Mason on 4/24/2024 in #❓┊help
Error on Deployment: No such file for FilamentAsset
I have this in my AppServiceProvider's boot method:
FilamentAsset::register([
Js::make('jsConfetti', 'node_modules/js-confetti/dist/js-confetti.min.js')->loadedOnRequest(),
]);
FilamentAsset::register([
Js::make('jsConfetti', 'node_modules/js-confetti/dist/js-confetti.min.js')->loadedOnRequest(),
]);
and I have this in my package.json:
"dependencies": {
"dragula": "^3.7.3",
"js-confetti": "^0.12.0",
"puppeteer": "^21.3.8"
}
"dependencies": {
"dragula": "^3.7.3",
"js-confetti": "^0.12.0",
"puppeteer": "^21.3.8"
}
My deployment is failing in the @php artisan Filament::updgrade composer script: copy(node_modules/js-confetti/dist/js-confetti.min.js): Failed to open stream: No such file or directory This is with Laravel Forge. What am I doing wrong, or what do I need to change in order for this to work? Perhaps I need to run npm install on my server?
18 replies
FFilament
Created by Jon Mason on 4/24/2024 in #❓┊help
Error when deploying to production using Laravel Forge, svg path not found
Has anyone run into this when deploying to production? I'm using laravel forge. "The path for the default set does not exist."
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

BladeUI\Icons\Exceptions\CannotRegisterIconSet

The [/home/forge/test.myapp.com/resources/svg] path for the "default" set does not exist.

at vendor/blade-ui-kit/blade-icons/src/Exceptions/CannotRegisterIconSet.php:18
14▕ }
15▕
16▕ public static function nonExistingPath(string $set, string $path): self
17▕ {
➜ 18▕ return new self("The [$path] path for the \"$set\" set does not exist.");
19▕ }
20▕
21▕ public static function prefixNotDefined(string $set): self
22▕ {
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

BladeUI\Icons\Exceptions\CannotRegisterIconSet

The [/home/forge/test.myapp.com/resources/svg] path for the "default" set does not exist.

at vendor/blade-ui-kit/blade-icons/src/Exceptions/CannotRegisterIconSet.php:18
14▕ }
15▕
16▕ public static function nonExistingPath(string $set, string $path): self
17▕ {
➜ 18▕ return new self("The [$path] path for the \"$set\" set does not exist.");
19▕ }
20▕
21▕ public static function prefixNotDefined(string $set): self
22▕ {
5 replies
FFilament
Created by Jon Mason on 4/23/2024 in #❓┊help
how to fix tag name showing up in search box spatie/tags
No description
5 replies
FFilament
Created by Jon Mason on 4/21/2024 in #❓┊help
table action modal form refresh?
Since I've been unable to get the FileUpload component to display a preview when a file is present on the model, I decided to make a custom "FileAttachment" field, that shows the attachment and has a button to click to remove the attachment. I'm using this inside of a table row action and it's working as expected except the form isn't updated when the wire:click event is completed.
EditAction::make('editTransaction')
...
->form([
FileUpload::make('document')
->label('Attach Document')
->preserveFilenames()
->acceptedFileTypes(['application/pdf', 'application/jpeg'])
->maxSize(12288)
->live()
->visible(fn (Model $record) => empty($record->document_id))
->storeFiles(false),
FileAttachment::make('attachment')
->description(fn (Get $get) => $get('file_name') ?? null)
->live()
->id(fn (Model $record) => $record->document_id)
->visible(fn (Model $record) => !empty($record->document_id))

])
EditAction::make('editTransaction')
...
->form([
FileUpload::make('document')
->label('Attach Document')
->preserveFilenames()
->acceptedFileTypes(['application/pdf', 'application/jpeg'])
->maxSize(12288)
->live()
->visible(fn (Model $record) => empty($record->document_id))
->storeFiles(false),
FileAttachment::make('attachment')
->description(fn (Get $get) => $get('file_name') ?? null)
->live()
->id(fn (Model $record) => $record->document_id)
->visible(fn (Model $record) => !empty($record->document_id))

])
//called from wire:click on my custom field blade file.
public function removeAttachment($id)
{

//do delete stuff
$this->form->fill() //not working, which I kind of expect given the context of a table row action, but not sure what else to try.
//called from wire:click on my custom field blade file.
public function removeAttachment($id)
{

//do delete stuff
$this->form->fill() //not working, which I kind of expect given the context of a table row action, but not sure what else to try.
3 replies
FFilament
Created by Jon Mason on 4/19/2024 in #❓┊help
is it possible to set the existing avatar on page load?
Ony my edit profile page, the user can select an avatar using the file upload component. After it's selected, or when the page loads if they've previously selected one, I want to populate the upload component with the existing file from the url I have stored in my users table. It's not obvious from the docs how to do that, or if it's possible. I tried just adding that as a field in $this->form->fill() in my mount method, but that's not doing it.
$this->form->fill([
'email' => $this->user->email,
'first_name' => $this->user->first_name,
'last_name' => $this->user->last_name,
'timezone' => $this->user->timezone,
'avatar_path' => $this->user->avatar_path ?? '' //no joy.
]);
$this->form->fill([
'email' => $this->user->email,
'first_name' => $this->user->first_name,
'last_name' => $this->user->last_name,
'timezone' => $this->user->timezone,
'avatar_path' => $this->user->avatar_path ?? '' //no joy.
]);
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('email')
->required()
->disabled()
->maxLength(255),
TextInput::make('first_name'),
TextInput::make('last_name'),
TimezoneSelect::make('timezone')->preload()->required()->searchable(),
FileUpload::make('avatar_path')
->avatar()
->imageEditor()
->circleCropper()
->disk('s3')
->directory('avatars')
])
->statePath('data')
->model(User::class);
}
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('email')
->required()
->disabled()
->maxLength(255),
TextInput::make('first_name'),
TextInput::make('last_name'),
TimezoneSelect::make('timezone')->preload()->required()->searchable(),
FileUpload::make('avatar_path')
->avatar()
->imageEditor()
->circleCropper()
->disk('s3')
->directory('avatars')
])
->statePath('data')
->model(User::class);
}
8 replies
FFilament
Created by Jon Mason on 4/19/2024 in #❓┊help
Make user profile form wider?
Can't seem to make the form on the user profile page wider. I tried extraAttributes and attaching a class that way, but it's the parent of the form that's controlling the width, the <main> div with a class of fi-simple-main. I don't want to override the width of that div in my css file because that would affect other pages, and as far as i'm aware, css can't go up the dom from the current element. Can someone clue me in on how to do this? It's probably something super obvious and I'm being dense...
->extraAttributes(['class' => 'sm:max-w-lg'])
->extraAttributes(['class' => 'sm:max-w-lg'])
10 replies
FFilament
Created by Jon Mason on 4/18/2024 in #❓┊help
Problems with canAccessPanel what is the filament.app.tenant route?
No description
9 replies
FFilament
Created by Jon Mason on 4/18/2024 in #❓┊help
any way to customize validationMessages for a checkbox?
Checkbox::make('has_agreed_to_tos')
->accepted()
->required()
->label(fn () => new HtmlString('I agree to the <a href="#" target="_blank" class="fi-link group/link relative inline-flex items-center justify-center outline-none fi-size-md fi-link-size-md text-sky-500 text-underline">Terms & Conditions</a> and <a href="#" target="_blank" class="fi-link group/link relative inline-flex items-center justify-center outline-none fi-size-md fi-link-size-md text-sky-500 text-underline">Privacy Policy</a>'))
->validationMessages([
'accepted' => 'You must agree to the terms and conditions to continue.',
'required' => 'test'
])
])
Checkbox::make('has_agreed_to_tos')
->accepted()
->required()
->label(fn () => new HtmlString('I agree to the <a href="#" target="_blank" class="fi-link group/link relative inline-flex items-center justify-center outline-none fi-size-md fi-link-size-md text-sky-500 text-underline">Terms & Conditions</a> and <a href="#" target="_blank" class="fi-link group/link relative inline-flex items-center justify-center outline-none fi-size-md fi-link-size-md text-sky-500 text-underline">Privacy Policy</a>'))
->validationMessages([
'accepted' => 'You must agree to the terms and conditions to continue.',
'required' => 'test'
])
])
tried both required and accepted separately and together and it always posts the entire content of the label attribute as the error message on the UI, which is obviously not great. Maybe using label isn't the right approach?
19 replies
FFilament
Created by Jon Mason on 4/17/2024 in #❓┊help
Sum of items selected on table?
No description
4 replies