orchidsoftware / orchidsoftware/platform

Async Modal but got 404 error

Open
#2,047 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
4.8k
Forks
662
Avg merge
1d 9h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the 404 with the shown Layout::modal, ModalToggle, and asyncGetAnswersDetails code, then trace the async modal request and the reported missing template identifier. Check how the async method's returned subs_quiz data is consumed. Done means the modal loads its answer details without the “Async template ... not found” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.