diff --git a/app/Classes/Modules/HelpMenu/Processors/FetchFirstQuestionQAProcessor.php b/app/Classes/Modules/HelpMenu/Processors/FetchFirstQuestionQAProcessor.php index 9f463418..c4f81f27 100644 --- a/app/Classes/Modules/HelpMenu/Processors/FetchFirstQuestionQAProcessor.php +++ b/app/Classes/Modules/HelpMenu/Processors/FetchFirstQuestionQAProcessor.php @@ -23,7 +23,7 @@ class FetchFirstQuestionQAProcessor public function execute(Request $request){ try { - $query = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1]); + $query = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => $request->route('set_id')]); return $query; } catch (\Exception $exception){ throw new ErrorException($exception->getMessage(), $exception->getCode()); diff --git a/app/Classes/Modules/HelpMenu/Processors/FetchNextQuestionQAProcessor.php b/app/Classes/Modules/HelpMenu/Processors/FetchNextQuestionQAProcessor.php index d9fc9a0a..39188cf5 100644 --- a/app/Classes/Modules/HelpMenu/Processors/FetchNextQuestionQAProcessor.php +++ b/app/Classes/Modules/HelpMenu/Processors/FetchNextQuestionQAProcessor.php @@ -38,6 +38,7 @@ class FetchNextQuestionQAProcessor $nextQuestionNumber = 0; $nextNestedQuestion = 0; $nextMainQuestion= 0; + $questionnaireSetId = 0; $currentQuestion = $request->question; $questionType = QAType::DEFAULT; $returnQuestion = null; @@ -48,7 +49,9 @@ class FetchNextQuestionQAProcessor $questionType = $currentQuestion['question_type']; $nextNestedQuestion = $currentQuestion['next_nested_question']; $nextMainQuestion = $currentQuestion['next_main_question']; + $questionnaireSetId = $currentQuestion['questionnaire_set_id']; } + if ($request->has('answerObj')) { $nextQuestionNumber = $request->answerObj['next_question_number']; } @@ -58,7 +61,7 @@ class FetchNextQuestionQAProcessor $previousAnswer = $this->listsHelpMenuUserAnswerSelected->execute(['user_id' => $userId, 'order_by' => (object)['column' => 'id','DESC' => true]])[0]; //Get previous question - $previousQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'id' => $previousAnswer['question_id']]); + $previousQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => $questionnaireSetId, 'id' => $previousAnswer['question_id']]); $returnQuestion = $previousQuestion; } else{ @@ -79,11 +82,11 @@ class FetchNextQuestionQAProcessor $returnQuestion = null; } else if($question_number != 0){ - $nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'question_number' => $question_number]); + $nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => $questionnaireSetId, 'question_number' => $question_number]); $returnQuestion = $nextQuestion; } else if (array_key_exists('id', $request->input('question'))) { - $nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => 1, 'id_next' => $questionId, 'next_main_question' => null]); + $nextQuestion = $this->fetchesHelpMenuQuestion->execute(['questionnaire_set_id' => $questionnaireSetId, 'id_next' => $questionId, 'next_main_question' => null]); $returnQuestion = $nextQuestion; } } diff --git a/resources/assets/vue/components/general/elements/HelpMenuComponent.vue b/resources/assets/vue/components/general/elements/HelpMenuComponent.vue new file mode 100644 index 00000000..2f1a6e34 --- /dev/null +++ b/resources/assets/vue/components/general/elements/HelpMenuComponent.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/resources/assets/vue/components/general/forms/HelpMenuFormComponent.vue b/resources/assets/vue/components/general/forms/HelpMenuFormComponent.vue index bef90475..e27851a5 100644 --- a/resources/assets/vue/components/general/forms/HelpMenuFormComponent.vue +++ b/resources/assets/vue/components/general/forms/HelpMenuFormComponent.vue @@ -77,16 +77,6 @@