RedSquirrel
RedSquirrel
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
So basically a relationship form
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
It's a "Lead" model which is the resource, which has a page where you can manage answers to questions about the lead
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
It's a page within a simple resource
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
On a page
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
It's a header action
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
Thank you, Where does that need to be chained to sorry?
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
and then the section description would be updated
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
So in an ideal world, on save, the form would be rebuilt
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
public function form(Form $form): Form { $dynamicForm = []; if($this->question_groups) { foreach($this->question_groups as $qg) { $dynamicQuestions = []; $questions = Question::where('question_group_id', $qg->id)->get(); if($questions) { $total_answered = 0; foreach($questions as $q) { $dynamicQuestions[] = $this->getDynamicField($q); if($this->checkIfAnswered($q->id, $this->existing_answers)) { $total_answered = $total_answered + 1; } } } $total_questions = $questions->count(); $dynamicForm[] = Section::make($qg->name)->collapsed()->description('Completed ' . $total_answered . " of " . $total_questions)->schema($dynamicQuestions); } } return $form ->schema($dynamicForm) ->statePath('data'); }
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
public function answerform(): void { foreach($this->form->getState() as $key => $answer) { $answers = Answer::where('lead_id', $this->record->id)->where('question_set_id', $this->question_set->id)->where('question_id', $key)->first(); if(!$answers) { $answers = new Answer; } $answers->lead_id = $this->record->id; $answers->question_set_id = $this->question_set->id; $answers->question_id = $key; $answers->value = $answer; $answers->save(); } Notification::make() ->title('Updated') ->body('Your answers have been saved') ->success() ->send(); }
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
protected function getHeaderActions(): array { return [ Action::make('save') ->label('Save Answers') ->action(function() { $this->answerform(); $this->refreshFormData(); }) ]; }
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
The error I get for that is that refreshFormData does not exist
21 replies
FFilament
Created by RedSquirrel on 6/27/2024 in #❓┊help
Refresh form section description after save
Hi Leandro, thanks for the suggestion, I have, this refreshes the data inside the fields but the section description stays the same
21 replies
FFilament
Created by RedSquirrel on 5/22/2024 in #❓┊help
Issues with scrolling relationship manager modal on IOS Devices
Ah perfect, thank you @toeknee, thought 3.2.9 was latest, my bad!
5 replies
FFilament
Created by RedSquirrel on 5/22/2024 in #❓┊help
Issues with scrolling relationship manager modal on IOS Devices
Just to follow up, this is version v3.2.9
5 replies