Dennyvik
Dennyvik
FFilament
Created by Xavi on 10/10/2024 in #❓┊help
Full page loading
thank you for looking up on my issue. it is slow because in production my table's records already growing. I am sorry if i made some confusion. Now I realize I didn't said it clearly. The loading indicator is shown in the table where I set the render hook to.
php TablesRenderHook::TOOLBAR_START,
fn(): View => view('filament.views.loading')
php TablesRenderHook::TOOLBAR_START,
fn(): View => view('filament.views.loading')
What i am looking for is to display the loading indicator in the TextColumn when it clicked. similar with Table Action when it clicked. But that's okay. Thanks again by the way. I will just let it be for now, or i will convert it into table Action later.
19 replies
FFilament
Created by Xavi on 10/10/2024 in #❓┊help
Full page loading
This is called inside TextColumn ->action()
private function UpdateStatusPaid(){
return Action::make('update_payment')
->modal()
->authorize($this->user->can('create_payment'))
->requiresConfirmation()
->modalHeading(fn(TempInvoice2List $record) =>
($this->isInvoicePaid($record)) ? 'Invoice already Paid' :'Update Payment Status')
->modalDescription(fn(TempInvoice2List $record) =>
($this->isInvoicePaid($record))
? ($record->payments->isEmpty() ? '' : 'Last payment made on ' . $record->payments->last()->payment_date->format('d M Y'))
: 'This will mark the invoice as PAID. Are you sure you want to proceed?')
->color('warning')
->form(function(TempInvoice2List $record) {
if($record->status_paid !== StatusPaid::PAID){
return [
Section::make([
//placeholders here, info about the current row record
DatePicker::make('payment_date')
->label('Set the Payment Date')
->native(false)
->displayFormat('d M Y')
->required()
->default(now()->format('Y-m-d'))
->maxDate(now())
->columnSpanFull(),
])->columns(3)
];
}
})
->action(function(TempInvoice2List $record, array $data) {
$this->processPayment($record, $data);
})
->modalSubmitAction(fn(TempInvoice2List $record, StaticAction $action)
=> ($record->status_paid == StatusPaid::PAID) ? false : $action->label('Confirm'));
}
private function UpdateStatusPaid(){
return Action::make('update_payment')
->modal()
->authorize($this->user->can('create_payment'))
->requiresConfirmation()
->modalHeading(fn(TempInvoice2List $record) =>
($this->isInvoicePaid($record)) ? 'Invoice already Paid' :'Update Payment Status')
->modalDescription(fn(TempInvoice2List $record) =>
($this->isInvoicePaid($record))
? ($record->payments->isEmpty() ? '' : 'Last payment made on ' . $record->payments->last()->payment_date->format('d M Y'))
: 'This will mark the invoice as PAID. Are you sure you want to proceed?')
->color('warning')
->form(function(TempInvoice2List $record) {
if($record->status_paid !== StatusPaid::PAID){
return [
Section::make([
//placeholders here, info about the current row record
DatePicker::make('payment_date')
->label('Set the Payment Date')
->native(false)
->displayFormat('d M Y')
->required()
->default(now()->format('Y-m-d'))
->maxDate(now())
->columnSpanFull(),
])->columns(3)
];
}
})
->action(function(TempInvoice2List $record, array $data) {
$this->processPayment($record, $data);
})
->modalSubmitAction(fn(TempInvoice2List $record, StaticAction $action)
=> ($record->status_paid == StatusPaid::PAID) ? false : $action->label('Confirm'));
}
19 replies
FFilament
Created by Xavi on 10/10/2024 in #❓┊help
Full page loading
i checked my code again, it isn't ->url(), i was wrong. it is ->action(), and inside return an Action with form(), it called modal pop up successfully, but from the moment user click the TextColumn until modal shown, nothing happened in the screen, so user usually click again many times even though the first click was run, just because the modal took time and nothing indicate the loading progress.
19 replies
FFilament
Created by Xavi on 10/10/2024 in #❓┊help
Full page loading
i can use it on table loading. but don't know how to implement it on modal loading when TextColumn has url() and open a modal when clicked. couldn't find where to put the renderhook targeting it
19 replies
FFilament
Created by Xavi on 10/10/2024 in #❓┊help
Full page loading
Can you guide me how? i need to show loading indicator when action open a modal. somehow the modal took longer time to load. and user didn't sure if their click work or not without anything indicate that.
19 replies
FFilament
Created by Dennyvik on 9/15/2024 in #❓┊help
Custom Filter Indicator removal to affect multiple fields removal
I tried using multiple removeField() like the code below, but it's not working.
$indicators[] = Indicator::make('Curriculum : ' . Curriculum::find($data['Curriculum'])->name)
->removeField('Curriculum')
->removeField('Level');
$indicators[] = Indicator::make('Curriculum : ' . Curriculum::find($data['Curriculum'])->name)
->removeField('Curriculum')
->removeField('Level');
3 replies
FFilament
Created by David | Fortune Validator on 9/10/2024 in #❓┊help
Update Edit Modal on Table
try looking into livewire dispatch event, maybe it can help.
26 replies
FFilament
Created by Dennyvik on 9/14/2024 in #❓┊help
Reordering new item on Repeater relationship throw error
Okay I solved this. The problem is because I am using action to modified the item, and missed how repeater populate their array. I just need to adjust 'key' for my newly added item. Here my updated code.
->addAction(function (FormAction $action) {
return $action
->label('Add Shift')
->icon('heroicon-s-plus-circle')
->action(function (Get $get, Set $set) {
$shifts = $get('shifts') ?? [];
$count = count($shifts);
if($count > 0) {
$last = end($shifts);
$duration = $get('duration') ?? 0;

($last) ? $start = $last['end_time'] : $start = null;
$end = Carbon::createFromFormat('Y-m-d H:i:s', $last['end_time'])->addMinute($duration);

$shifts["record-".$count+1] = [
'start_time' => $start,
'end_time' => (string) $end,
];
$set('shifts', $shifts);
} else {
$shifts["record-".$count+1] = [
'start_time' => null,
'end_time' => null,
];
$set('shifts', $shifts);
}
});
->addAction(function (FormAction $action) {
return $action
->label('Add Shift')
->icon('heroicon-s-plus-circle')
->action(function (Get $get, Set $set) {
$shifts = $get('shifts') ?? [];
$count = count($shifts);
if($count > 0) {
$last = end($shifts);
$duration = $get('duration') ?? 0;

($last) ? $start = $last['end_time'] : $start = null;
$end = Carbon::createFromFormat('Y-m-d H:i:s', $last['end_time'])->addMinute($duration);

$shifts["record-".$count+1] = [
'start_time' => $start,
'end_time' => (string) $end,
];
$set('shifts', $shifts);
} else {
$shifts["record-".$count+1] = [
'start_time' => null,
'end_time' => null,
];
$set('shifts', $shifts);
}
});
This part solve it : $shifts["record-".$count+1] =
4 replies
FFilament
Created by Bruno on 9/13/2024 in #❓┊help
Hiding the super_admin role
I am able to achieved this using relationship. In my case, I also added role group on top of role from filament-shield.
Forms\Components\Select::make('roles')
->preload()
->relationship('roles', 'name',
function (Builder $query) use ($userAuth)
{
if( $userAuth->first()->group !== 'ADMIN'){
$query->where('name', '!=', 'super_admin');
}
}
)
->required()
->live()
->disabled(function() use ($userAuth){
if($userAuth->first()->group !== 'ADMIN'
&& auth()->user()->roles->first()->name !== 'founder')
{
return true;
}
})
Forms\Components\Select::make('roles')
->preload()
->relationship('roles', 'name',
function (Builder $query) use ($userAuth)
{
if( $userAuth->first()->group !== 'ADMIN'){
$query->where('name', '!=', 'super_admin');
}
}
)
->required()
->live()
->disabled(function() use ($userAuth){
if($userAuth->first()->group !== 'ADMIN'
&& auth()->user()->roles->first()->name !== 'founder')
{
return true;
}
})
8 replies
FFilament
Created by Dennyvik on 9/6/2024 in #❓┊help
Database Notification error "operator does not exist: json ->> unknown"
Thank you for your response. I am used to work fine with json field in postgre. But currently my client using old version of postgres in the production where the json feature is still early, and somehow Filament Database Notification use symbol operator on postgres that not available in that version. I am looking for solution (if any) that not required a postgre version upgrade.
4 replies
FFilament
Created by Dennyvik on 1/31/2024 in #❓┊help
summarize Count icons take all icons as false
from the debug session i had, it seems like the summarize (or Count::) run the getStateuUsing again twice but didn't use the relationship or couldn't, resulted in false on every iteration
3 replies