dyo
dyo
FFilament
Created by dyo on 10/16/2024 in #❓┊help
isTableRecordSelectable is not working
I want to hide bulk select in certain records with the following conditions, but when it met, the bulk checkbox is still exist, what did I miss?
public function isTableRecordSelectable(): ?Closure
{
return fn(Model $record): bool => !in_array($record->status_konf, ['Sukses', 'success', 'Paid']);
}
public function isTableRecordSelectable(): ?Closure
{
return fn(Model $record): bool => !in_array($record->status_konf, ['Sukses', 'success', 'Paid']);
}
3 replies
FFilament
Created by dyo on 10/10/2024 in #❓┊help
Problem in table tabs at the custom page
Why my tabs modified query in not applied to the table when the tab is selected? Can someon tell me what is missing?
9 replies
FFilament
Created by dyo on 9/25/2024 in #❓┊help
Optimize duplicate queries in 2 method at the same TextColumn Class
Can someone help me to optimize with this case, TextColumn::make('jenisDonasi.nama_jenis') ->tooltip(function ($record) { if ($record->campaign) { return 'Campaign: ' . $record->campaign->judul; } }) ->description(function ($record) { if ($record->campaign) { return 'Lihat campaign'; } }) The $record->campaign is a belongsTo relationship query, which is duplicate. How can I execute only one $record->campaign to both method above in TextColumn?
10 replies
FFilament
Created by dyo on 9/21/2024 in #❓┊help
Problems in duplicate query detected at debugbar
Here's a table action I'm using, with some conditions to be visible Action::make('verifikasi') ->icon('heroicon-o-magnifying-glass') ->visible(function ($record) { if ( $record->trans_ref != null && in_array($record->status_konf, ['Baru', 'Pending', 'Cek Lagi']) ) { return Setoran::unconfirm() ->where('rekening_id', $record->rekening_id) ->whereDate('tanggal', '>=', date('Y-m-d', strtotime($record->tanggal))) ->where('dana', $record->dana) ->exists(); } }) The problem is, why the query of model Setoran above is detected duplicate or executed twice in debugbar queries tab? The conditions above is only met in one record at the table. I hope someone can explain me what's wrong.
2 replies
FFilament
Created by dyo on 9/14/2024 in #❓┊help
Problem getting multiple select value in action modal form
How can I get multiple select values of form method in action method in Action class? I didn't find it when I check in $data at action method function.
Action::make('masuka_label')
->action(function ($record, array $data, $livewire): void {
dd(
$record,
$data,
$livewire
);

$user = auth()->user();

$label = [
'label_id' => $data['label_id'],
'prospek_id' => $record->id,
'prioritas_id' => $user->prioritas_id,
'cms_users_id' => $user->id,
'lembagaId' => $user->lembaga_id,
];

if ($data['label_baru'] == null) {
LabelProspek::updateOrCreate($label, $label);
} else {
$label['label_id'] = Label::create(['label' => $data['label_baru']])->id;
LabelProspek::create($label);
}
})
->fillForm(fn($record) => [
'label_prospek' => $record->label_prospek->pluck('id')
])
->form([
Select::make('label_prospek')
->multiple()
->relationship(
'label_prospek',
'label',
fn(Builder $query) => $query
->whereHas('label_prospek', function (Builder $q) {
return $q->where('cms_users_id', auth()->user()->id);
})
)
->preload(),

TextInput::make('label_baru')
])
->requiresConfirmation(),
Action::make('masuka_label')
->action(function ($record, array $data, $livewire): void {
dd(
$record,
$data,
$livewire
);

$user = auth()->user();

$label = [
'label_id' => $data['label_id'],
'prospek_id' => $record->id,
'prioritas_id' => $user->prioritas_id,
'cms_users_id' => $user->id,
'lembagaId' => $user->lembaga_id,
];

if ($data['label_baru'] == null) {
LabelProspek::updateOrCreate($label, $label);
} else {
$label['label_id'] = Label::create(['label' => $data['label_baru']])->id;
LabelProspek::create($label);
}
})
->fillForm(fn($record) => [
'label_prospek' => $record->label_prospek->pluck('id')
])
->form([
Select::make('label_prospek')
->multiple()
->relationship(
'label_prospek',
'label',
fn(Builder $query) => $query
->whereHas('label_prospek', function (Builder $q) {
return $q->where('cms_users_id', auth()->user()->id);
})
)
->preload(),

TextInput::make('label_baru')
])
->requiresConfirmation(),
12 replies
FFilament
Created by dyo on 9/10/2024 in #❓┊help
Alpine Expression Error: error is not defined when using fileupload
Why I got error in console, said: "Alpine Expression Error: error is not defined" When I'm using Fileupload, with only method required() at it?
2 replies
FFilament
Created by dyo on 8/16/2024 in #❓┊help
Problem in modal form
Action::make('import') ->form([ FileUpload::make('upload'), ]) ->action(function (array $data) { Excel::import(new DistribusiFirstSheet, $data['upload']); }), I want to create a modal form with FileUpload in it, but when i submit the uploaded form i got error: Illuminate \ Contracts \ Filesystem \ FileNotFoundException What did I miss?
9 replies
FFilament
Created by dyo on 8/16/2024 in #❓┊help
Set dependant value of Datepicker in form() Filter
In table filter class, how can I set other Filter form based on other value? In my example, if konfirmasi_hari_ini is checked, then the value of filter ['tanggal']['from'] and ['tanggal']['until'] is set to now()
Filter::make('konfirmasi_hari_ini')
->toggle()
->query(
fn(Builder $query) => $query->whereDate('tanggal', '>=', date('Y-m-d'))
)
->columnSpanFull(),

Filter::make('tanggal')
->form([
Forms\Components\DatePicker::make('from')
// ->maxDate(now()) // sementara tidak perlu karena perlu tranking data yang salah input dari user jk tgl nya lebih besar dari hari ini
->label('Dari Tanggal')
->default(now())
->native(false)
->reactive()
->closeOnDateSelection(),

Forms\Components\DatePicker::make('until')
// ->maxDate(now()) // sementara tidak perlu karena perlu tranking data yang salah input dari user jk tgl nya lebih besar dari hari ini
->label('Sampai Tanggal')
->minDate(fn($get) => $get('from'))
->native(false)
->closeOnDateSelection(),
])
Filter::make('konfirmasi_hari_ini')
->toggle()
->query(
fn(Builder $query) => $query->whereDate('tanggal', '>=', date('Y-m-d'))
)
->columnSpanFull(),

Filter::make('tanggal')
->form([
Forms\Components\DatePicker::make('from')
// ->maxDate(now()) // sementara tidak perlu karena perlu tranking data yang salah input dari user jk tgl nya lebih besar dari hari ini
->label('Dari Tanggal')
->default(now())
->native(false)
->reactive()
->closeOnDateSelection(),

Forms\Components\DatePicker::make('until')
// ->maxDate(now()) // sementara tidak perlu karena perlu tranking data yang salah input dari user jk tgl nya lebih besar dari hari ini
->label('Sampai Tanggal')
->minDate(fn($get) => $get('from'))
->native(false)
->closeOnDateSelection(),
])
3 replies
FFilament
Created by dyo on 8/5/2024 in #❓┊help
Problem with bulk selection in custom page table
I'm using filament table on a custom page. If I select bulk data, and I choose to select all, why is it only selected the first row? What am I missing?
6 replies
FFilament
Created by dyo on 8/2/2024 in #❓┊help
Using global variable in form input method at resource class
How can I use like a global variable in form input method at resource class? Here's my case:
TextInput::make('jumlah')
->prefixIcon(
function ($record) {
if ($record->retur_vendor_detail->sum('jumlah') != $record->jumlah) {
return 'heroicon-o-exclamation-triangle';
}

return null;
}
)
->prefixIconColor('danger')
->helperText(function ($record) {
if ($record->retur_vendor_detail->sum('jumlah') != $record->jumlah) {
return '* Jumlah tidak sesuai dengan data retur vendor detail.';
}

return null;
}),
TextInput::make('jumlah')
->prefixIcon(
function ($record) {
if ($record->retur_vendor_detail->sum('jumlah') != $record->jumlah) {
return 'heroicon-o-exclamation-triangle';
}

return null;
}
)
->prefixIconColor('danger')
->helperText(function ($record) {
if ($record->retur_vendor_detail->sum('jumlah') != $record->jumlah) {
return '* Jumlah tidak sesuai dengan data retur vendor detail.';
}

return null;
}),
I want $record->retur_vendor_detail->sum('jumlah') to be called only once.
8 replies
FFilament
Created by dyo on 7/22/2024 in #❓┊help
send parameter to create record page
How can I send parameter to create record page? I want to create the record in other related record header page.
5 replies
FFilament
Created by dyo on 7/16/2024 in #❓┊help
Having conditions in Widget Stat Overview for the queries
How can I have a condition for query in table stat overview? Only using the table query if the table is filtered and using other query when not filtered.
5 replies
FFilament
Created by dyo on 7/10/2024 in #❓┊help
Problem with formatStateUsing in TextColumn of custom table attribute
I just upgrading filament v2 to v3, but I got issue in textcolumn class with formatStateUsing method..
Tables\Columns\TextColumn::make('qty')->formatStateUsing(function ($record) {
$qty = Konfirmasi::where('trans_ref', $record->id)->sukses()->count();
return number_format($qty, 0);
}),
Tables\Columns\TextColumn::make('qty')->formatStateUsing(function ($record) {
$qty = Konfirmasi::where('trans_ref', $record->id)->sukses()->count();
return number_format($qty, 0);
}),
The qty attribute is not in table schema.. I need extra column to show the custom query.. In v2, the code above is working, but in v3, the column is returned blank.. What should I do to make it work in v3?
9 replies
FFilament
Created by dyo on 7/9/2024 in #❓┊help
Using cached computed property as select options in resource class
How can I do that?
2 replies
FFilament
Created by dyo on 7/5/2024 in #❓┊help
Reset stat overview widget data in custom page
I'm using filament table in custom page, with stat overview above the table and using InteractsWithPageTable in the widget class. I also using a custom filter, not filament table filter. After submitting the filter, I called $this->resetTable() to apply the filter. My question is, how can I also reset the widget data?
3 replies
FFilament
Created by dyo on 7/4/2024 in #❓┊help
Problem with wire:init and $this->table in custom page
Why does wire:init prevent $this->table from appearing, while the method is being executed on the custom page? Even though the method called in wire:init has nothing to do with the table method in the component.
8 replies
FFilament
Created by dyo on 6/27/2024 in #❓┊help
formatStateUsing method in TextColumn is not working at the custom page
Why my formatStateUsing method in TextColumn is not working at the custom page. I try debugging the problem with simple formatState like
TextColumn::make('name')
->formatStateUsing(fn ($record) => $record->id)
TextColumn::make('name')
->formatStateUsing(fn ($record) => $record->id)
But it returns nothing.
2 replies
FFilament
Created by dyo on 6/27/2024 in #❓┊help
resetTable with table loading animation
How can I have a loading table animation when resetTable is triggered?
5 replies
FFilament
Created by dyo on 6/26/2024 in #❓┊help
Changing navigation color text.
How can I change the color of navigation item text to black?
10 replies
FFilament
Created by dyo on 6/24/2024 in #❓┊help
previous or next button for month in datepicker
How can I have a previous or next button for month navigation in filament datepicker?
5 replies