platform
platform copied to clipboard
Async Modal but got 404 error
Discussed in https://github.com/orchidsoftware/platform/discussions/2046
Originally posted by viyyan January 4, 2022 Hi I tried to implements async modal but got this 404 error.
{message: "Async template: d590a2c095fd0d5838809cc4249db98f72d9122e not found",…}
Here is my code.
Modal
Layout::modal('detailsModal', [
Layout::table('subs_quiz', [
TD::make('quiz', 'Quiz'),
TD::make('answer', 'Answer')
]),
])
->async('asyncGetAnswersDetails')
->title('Answers Combination')
->withoutApplyButton()
Modal Toggle
ModalToggle::make('Show Details')
->modal('detailsModal')
->icon('full-screen')
->asyncParameters($item)
Async Method
public function asyncGetAnswersDetails(string $item): array
{
$arr = explode(".", $item);
$sub_quizes = [];
foreach ($arr as $key=>$item) {
$quiz = Quiz::where("order", $key + 1)->first();
$option = $quiz->options()->where("code", $item)->first();
$data = [
"quiz" => $key + 1,
"answer" => $option->name
];
$sub_quizes[] = $data;
}
return [
'subs_quiz' => $sub_quizes,
];
}
I have the same error.
same error
- Layout::modal - should not be covered TD tags or etc.
- Your template should not have similar fields. In my case, there was an if-else condition where I tried to use templates with similar fields.
same error
- Layout::modal - should not be covered TD tags or etc.
- Your template should not have similar fields. In my case, there was an if-else condition where I tried to use templates with similar fields.