platform icon indicating copy to clipboard operation
platform copied to clipboard

Async Modal but got 404 error

Open viyyan opened this issue 3 years ago • 4 comments

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,
        ];
    }

viyyan avatar Jan 04 '22 02:01 viyyan

I have the same error.

SVVladymyr avatar Aug 21 '22 12:08 SVVladymyr

same error

glonaldo70 avatar Sep 21 '22 10:09 glonaldo70

  1. Layout::modal - should not be covered TD tags or etc.
  2. 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

  1. Layout::modal - should not be covered TD tags or etc.
  2. 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.

SVVladymyr avatar Sep 22 '22 09:09 SVVladymyr

#2046

The answer to that question is here.

ega22a avatar Mar 03 '23 04:03 ega22a