kirakatou
kirakatou
FFilament
Created by kirakatou on 4/29/2025 in #❓┊help
add action to group header table
ohhh its working now, thanks dennis!
15 replies
FFilament
Created by kirakatou on 4/29/2025 in #❓┊help
add action to group header table
class ListSubcategories extends ListRecords
{
protected static string $resource = SubcategoryResource::class;

public bool $hasGroupEditButton = true;

protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}

protected function configureCreateAction(Tables\Actions\CreateAction|CreateAction $action): void
{
$action->modelLabel('category');
$action->url(fn (): string => CategoryResource::getUrl('create'));
}

public function renderGroupEditAction($id)
{
return Actions\Action::make('edit')
->icon("heroicon-m-pencil")
->iconButton()
->url(fn (): string => route('filament.admin.master.resources.categories.edit', ['record' => $id]))
->render();
}

public function renderGroupDeleteAction($id)
{
return DeleteAction::make()
->requiresConfirmation()
->record(Category::find($id))
->successNotificationTitle('Category deleted')
->icon("heroicon-m-trash")
->iconButton()
->color('danger')
->render();
}
}
class ListSubcategories extends ListRecords
{
protected static string $resource = SubcategoryResource::class;

public bool $hasGroupEditButton = true;

protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}

protected function configureCreateAction(Tables\Actions\CreateAction|CreateAction $action): void
{
$action->modelLabel('category');
$action->url(fn (): string => CategoryResource::getUrl('create'));
}

public function renderGroupEditAction($id)
{
return Actions\Action::make('edit')
->icon("heroicon-m-pencil")
->iconButton()
->url(fn (): string => route('filament.admin.master.resources.categories.edit', ['record' => $id]))
->render();
}

public function renderGroupDeleteAction($id)
{
return DeleteAction::make()
->requiresConfirmation()
->record(Category::find($id))
->successNotificationTitle('Category deleted')
->icon("heroicon-m-trash")
->iconButton()
->color('danger')
->render();
}
}
15 replies
FFilament
Created by kirakatou on 4/29/2025 in #❓┊help
add action to group header table
@props([
'collapsible' => false,
'description' => null,
'label' => null,
'start' => null,
'title',
])

@php
$id = null;
$key = $title;
if (isset($this->hasGroupEditButton) && $this->hasGroupEditButton) {
[$title, $id] = explode(' - ', $title);
}
@endphp

<div
{{
$attributes->class([
'fi-ta-group-header flex w-full items-center gap-x-3 bg-gray-50 px-3 py-2 dark:bg-white/5',
'cursor-pointer' => $collapsible,
])
}}
>
{{ $start }}

<div class="grid">
<h4 class="text-sm font-medium text-gray-950 dark:text-white">
@if (filled($label) && $label !== 'Category')
{{ $label }}:
@endif

{{ $title }}
</h4>

@if (filled($description))
<p class="text-sm text-gray-500 dark:text-gray-400">
{{ $description }}
</p>
@endif
</div>

@if (isset($this->hasGroupEditButton) && $this->hasGroupEditButton)
@if(method_exists($this, 'renderGroupDeleteAction'))
<div class="">
{!! $this->renderGroupDeleteAction($id) !!}
</div>
@endif
@endif

@if ($collapsible)
<div x-on:click="toggleCollapseGroup(@js($key))">
<x-filament::icon-button
color="gray"
icon="heroicon-m-chevron-up"
icon-alias="tables::grouping.collapse-button"
:label="filled($label) ? ($label . ': ' . $title) : $title"
size="sm"
:x-bind:aria-expanded="'! isGroupCollapsed(' . \Illuminate\Support\Js::from($title) . ')'"
:x-bind:class="'isGroupCollapsed(' . \Illuminate\Support\Js::from($title) . ') && \'-rotate-180\''"
/>
</div>
@endif
</div>
@props([
'collapsible' => false,
'description' => null,
'label' => null,
'start' => null,
'title',
])

@php
$id = null;
$key = $title;
if (isset($this->hasGroupEditButton) && $this->hasGroupEditButton) {
[$title, $id] = explode(' - ', $title);
}
@endphp

<div
{{
$attributes->class([
'fi-ta-group-header flex w-full items-center gap-x-3 bg-gray-50 px-3 py-2 dark:bg-white/5',
'cursor-pointer' => $collapsible,
])
}}
>
{{ $start }}

<div class="grid">
<h4 class="text-sm font-medium text-gray-950 dark:text-white">
@if (filled($label) && $label !== 'Category')
{{ $label }}:
@endif

{{ $title }}
</h4>

@if (filled($description))
<p class="text-sm text-gray-500 dark:text-gray-400">
{{ $description }}
</p>
@endif
</div>

@if (isset($this->hasGroupEditButton) && $this->hasGroupEditButton)
@if(method_exists($this, 'renderGroupDeleteAction'))
<div class="">
{!! $this->renderGroupDeleteAction($id) !!}
</div>
@endif
@endif

@if ($collapsible)
<div x-on:click="toggleCollapseGroup(@js($key))">
<x-filament::icon-button
color="gray"
icon="heroicon-m-chevron-up"
icon-alias="tables::grouping.collapse-button"
:label="filled($label) ? ($label . ': ' . $title) : $title"
size="sm"
:x-bind:aria-expanded="'! isGroupCollapsed(' . \Illuminate\Support\Js::from($title) . ')'"
:x-bind:class="'isGroupCollapsed(' . \Illuminate\Support\Js::from($title) . ') && \'-rotate-180\''"
/>
</div>
@endif
</div>
15 replies
FFilament
Created by kirakatou on 4/29/2025 in #❓┊help
add action to group header table
cause im trying to use it on resources/views/vendor/filament-tables/components/group/header.blade.php
15 replies
FFilament
Created by kirakatou on 4/29/2025 in #❓┊help
add action to group header table
heres my DeleteAction
return DeleteAction::make()
->requiresConfirmation()
->record(Category::find($id))
->successNotificationTitle('Category deleted')
->icon("heroicon-m-trash")
->iconButton()
->color('danger')
->render();
return DeleteAction::make()
->requiresConfirmation()
->record(Category::find($id))
->successNotificationTitle('Category deleted')
->icon("heroicon-m-trash")
->iconButton()
->color('danger')
->render();
15 replies
FFilament
Created by kirakatou on 4/29/2025 in #❓┊help
add action to group header table
i did try to use DeleteAction too but its the same only quick loading spin
15 replies
FFilament
Created by kirakatou on 2/18/2025 in #❓┊help
add textinput beside action
oh ok willl try it thanks
16 replies
FFilament
Created by kirakatou on 2/18/2025 in #❓┊help
add textinput beside action
oh we can add custom class to row ?
16 replies
FFilament
Created by kirakatou on 2/18/2025 in #❓┊help
add textinput beside action
how do i do this ? do u have link for the doc ?
16 replies
FFilament
Created by kirakatou on 2/18/2025 in #❓┊help
add textinput beside action
for the form yes, just having problem for that sticky layout since the action button is seperate from form.
16 replies
FFilament
Created by kirakatou on 2/18/2025 in #❓┊help
add textinput beside action
ya create invoice is just save button. i dont think i have decision to change the design, is there a way i make customize layout for it to be sticky bottom ?
16 replies
FFilament
Created by kirakatou on 2/18/2025 in #❓┊help
add textinput beside action
No description
16 replies
FFilament
Created by kirakatou on 2/18/2025 in #❓┊help
add textinput beside action
so i disable current action like create, create another and cancel first, and then add action in form layout ?
16 replies
FFilament
Created by PabloZagni on 7/29/2024 in #❓┊help
createOptionForm not checking policys
@J H u can use when for visibility
Select::make('country_id')->relationship('country', 'name')
->rules(['integer', 'exists:countries,id'])
->searchable()
->preload()
->when(auth()->user()->can('create', Country::class), function ($field) {
return $field->createOptionForm(fn() => CountryResource::formFields());
})
Select::make('country_id')->relationship('country', 'name')
->rules(['integer', 'exists:countries,id'])
->searchable()
->preload()
->when(auth()->user()->can('create', Country::class), function ($field) {
return $field->createOptionForm(fn() => CountryResource::formFields());
})
8 replies