Franco Miranda
Franco Miranda
FFilament
Created by Franco Miranda on 10/5/2024 in #❓┊help
recordClasses not applying
Hi, I have no idea why this is not working, only working the first one, green or red.
return $table
->recordClasses(fn (SolicitudConductor $record) =>
$record->isRejected()
? 'border-l-4 border-red-600 dark:border-red-300'
: 'border-l-4 border-green-600 dark:border-green-300'
)
return $table
->recordClasses(fn (SolicitudConductor $record) =>
$record->isRejected()
? 'border-l-4 border-red-600 dark:border-red-300'
: 'border-l-4 border-green-600 dark:border-green-300'
)
I have created a custom theme, my AppPanelProvider:
->colors([
'danger' => Color::Rose,
'gray' => Color::Gray,
'info' => Color::Blue,
'primary' => Color::Orange,
'success' => Color::Emerald,
'warning' => Color::Yellow,
'red' => Color::Red,
])

->viteTheme('resources/css/filament/app/theme.css');
->colors([
'danger' => Color::Rose,
'gray' => Color::Gray,
'info' => Color::Blue,
'primary' => Color::Orange,
'success' => Color::Emerald,
'warning' => Color::Yellow,
'red' => Color::Red,
])

->viteTheme('resources/css/filament/app/theme.css');
theme.css
@import '/vendor/filament/filament/resources/css/theme.css';

@config 'tailwind.config.js';

/* Agrega tus nuevas clases aquí */
.border-l-2 {
border-left-width: 2px;
}

.border-l-4 {
border-left-width: 4px;
}

.border-r-4 {
border-right-width: 4px;
}

.dark\:border-orange-300 {
border-color: rgb(252 211 77);
}

.border-green-600 {
border-color: rgb(22 163 74);
}

.dark\:border-green-300 {
border-color: rgb(134 239 172);
}

.border-red-600 {
border-color: rgb(220, 38, 38);
}

.dark\:border-red-300 {
border-color: rgb(252, 165, 165);
}
@import '/vendor/filament/filament/resources/css/theme.css';

@config 'tailwind.config.js';

/* Agrega tus nuevas clases aquí */
.border-l-2 {
border-left-width: 2px;
}

.border-l-4 {
border-left-width: 4px;
}

.border-r-4 {
border-right-width: 4px;
}

.dark\:border-orange-300 {
border-color: rgb(252 211 77);
}

.border-green-600 {
border-color: rgb(22 163 74);
}

.dark\:border-green-300 {
border-color: rgb(134 239 172);
}

.border-red-600 {
border-color: rgb(220, 38, 38);
}

.dark\:border-red-300 {
border-color: rgb(252, 165, 165);
}
tailwind.config.js:
import preset from '../../../../vendor/filament/filament/tailwind.config.preset'

export default {
presets: [preset],
content: [
'./app/Filament/Clusters/Mantenedores/**/*.php',
'./resources/views/filament/clusters/mantenedores/**/*.blade.php',
'./vendor/filament/**/*.blade.php',
],
}
import preset from '../../../../vendor/filament/filament/tailwind.config.preset'

export default {
presets: [preset],
content: [
'./app/Filament/Clusters/Mantenedores/**/*.php',
'./resources/views/filament/clusters/mantenedores/**/*.blade.php',
'./vendor/filament/**/*.blade.php',
],
}
2 replies
FFilament
Created by Franco Miranda on 5/6/2024 in #❓┊help
How can i get form data in a Relation Manager?
In a Create Action slide over of a relation tab, i need to access all the data in fields.
3 replies
FFilament
Created by Franco Miranda on 3/21/2024 in #❓┊help
Rendering a Table in a Livewire Component within a Modal
I'm following the example provided at https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component, but I'm unable to display the table within a modal. When I use a route, the table functions correctly. This works: //web.php
Route::get('/solicitudes-pendientes', ListSolicitudesConductores::class);
Route::get('/solicitudes-pendientes', ListSolicitudesConductores::class);
//ListSolicitudesConductores:
class ListSolicitudesConductores extends Component implements HasForms, HasTable
{

use InteractsWithTable;
use InteractsWithForms;

public function table(Table $table): Table
{
return $table
->query(SolicitudConductor::query())
->columns(
SolicitudConductorTableComponents::schema()
)
->filters([
// ...
])
->actions([

])
->bulkActions([
// ...
]);
}
public function render()
{
return view('livewire.list-solicitudes-conductores');
}
}
class ListSolicitudesConductores extends Component implements HasForms, HasTable
{

use InteractsWithTable;
use InteractsWithForms;

public function table(Table $table): Table
{
return $table
->query(SolicitudConductor::query())
->columns(
SolicitudConductorTableComponents::schema()
)
->filters([
// ...
])
->actions([

])
->bulkActions([
// ...
]);
}
public function render()
{
return view('livewire.list-solicitudes-conductores');
}
}
//list-solicitudes-conductores.blade:
<div>
{{ $this->table }}
</div>
<div>
{{ $this->table }}
</div>
if I try this, work as expected in modal:
<div>
{{ test }}
</div>
<div>
{{ test }}
</div>
However, the following does not work with the same Livewire component and Blade template:
Actions\Action::make('list-solicitudes-conductores')
->label('Solicitudes')
->color('success')
->modalSubmitAction(false)
->modalCancelAction(false)
//->slideOver()
->modalContent(view('livewire.list-solicitudes-conductores')),
Actions\Action::make('list-solicitudes-conductores')
->label('Solicitudes')
->color('success')
->modalSubmitAction(false)
->modalCancelAction(false)
//->slideOver()
->modalContent(view('livewire.list-solicitudes-conductores')),
Thanks in advance
9 replies
FFilament
Created by Franco Miranda on 6/15/2023 in #❓┊help
Persist and save information from modal additional inputs
Hi, i'm using the admin panel and the table repeater and drop-in actions plugins by awcodes. I am a newbie to livewire, I'm working in my 'FormResource\Pages\EditForm', I need the information added in the form of DropInAction persist and when the user has finished adding fields and their additional options, press save to save all changes to all fields in the database. Also, how can i fill this modal inputs with the corresponding information?
TableRepeater::make('options')
->relationship('formFields')
->label('')
->disableLabel()
->cloneable()
->schema([

TextInput::make('name')
->required(),
//... more fields

//Button in tablerepeater showing additional inputs in modal to be added to each formField. Saving this additional data in database will be when user click save button in parent.
DropInAction::make('additional-options-field')
->execute(function (Closure $get, Closure $set) {
return Action::make('fillOptions')
->mountUsing(
//How can i fill the data in modal?
)
->action(function (array $data, $component, $livewire) use($get, $set): void {
//...
}
->form( function() use($get) {
return [
TextInput::make('options.minLength'),
TextInput::make('options.maxLength'),
TextInput::make('options.minValue'),
TextInput::make('options.maxValue'),
];
})
}),

]),
TableRepeater::make('options')
->relationship('formFields')
->label('')
->disableLabel()
->cloneable()
->schema([

TextInput::make('name')
->required(),
//... more fields

//Button in tablerepeater showing additional inputs in modal to be added to each formField. Saving this additional data in database will be when user click save button in parent.
DropInAction::make('additional-options-field')
->execute(function (Closure $get, Closure $set) {
return Action::make('fillOptions')
->mountUsing(
//How can i fill the data in modal?
)
->action(function (array $data, $component, $livewire) use($get, $set): void {
//...
}
->form( function() use($get) {
return [
TextInput::make('options.minLength'),
TextInput::make('options.maxLength'),
TextInput::make('options.minValue'),
TextInput::make('options.maxValue'),
];
})
}),

]),
php Is this possible something possible to do? maybe there is a better approach to do this? I hope i explain myself clearly, Thanks in advance.
4 replies
FFilament
Created by Franco Miranda on 4/27/2023 in #❓┊help
'name' gone in Select multiple() after getSearchResultsUsing()
Hi everyone, I'm using Filament Admin and I have the error presented in the video. Apparently, every time a search is done, the selected options are cleared. I've searched and found a similar problem like mine here: https://github.com/filamentphp/filament/discussions/3079, where Ryang says that 'wire:ignore' or 'wire:ignore.self' need to be added to prevent the Alpine component being reinitialized, but I couldn't make it work through a
->extraAttributes()
->extraAttributes()
in the Select Component. This is my code:
Select::make('ListasCategorias')
->multiple()
->searchable()
->label('Categorias')
->getSearchResultsUsing(fn (string $search) => Categoria::where('descripcion', 'like', "%{$search}%")->limit(20)->pluck('descripcion', 'cod_categoria'))
->getOptionLabelUsing(fn ($value): ?string => Categoria::find($value)?->descripcion),
Select::make('ListasCategorias')
->multiple()
->searchable()
->label('Categorias')
->getSearchResultsUsing(fn (string $search) => Categoria::where('descripcion', 'like', "%{$search}%")->limit(20)->pluck('descripcion', 'cod_categoria'))
->getOptionLabelUsing(fn ($value): ?string => Categoria::find($value)?->descripcion),

The
->getOptionLabelUsing()
->getOptionLabelUsing()
for some reason is not working, any help would be appreciated it!
4 replies