mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Relocate help menu and make dynamic questionnaire set generation
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div class="parentContainer">
|
||||
<div class="floating-button">
|
||||
<button class="requestModal round-button" data-type="helpMenu">
|
||||
<i class="fa fa-info"></i>
|
||||
<span class="beta-label">Beta</span>
|
||||
</button>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="helpMenu">
|
||||
<help-menu-form-component></help-menu-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.floating-button {
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
bottom: 95px;
|
||||
right: 24px;
|
||||
}
|
||||
|
||||
|
||||
.round-button {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.round-button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
.beta-label {
|
||||
position: absolute;
|
||||
top: 44px;
|
||||
left: 88%;
|
||||
transform: translateX(-50%);
|
||||
background-color: #ffee00;
|
||||
color: black;
|
||||
padding: 0px 4px;
|
||||
border-radius: 5px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
@media (max-height: 600px) {
|
||||
.floating-button {
|
||||
bottom: 85px;
|
||||
right: 14px;
|
||||
}
|
||||
|
||||
.round-button {
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -77,16 +77,6 @@
|
||||
<script>
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
export default {
|
||||
props: {
|
||||
data:{
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
module_type: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
section: 'helpMenuForm',
|
||||
@@ -132,7 +122,7 @@
|
||||
},
|
||||
methods: {
|
||||
fetchFirstQuestion(){
|
||||
this.submit(route('api.helpmenu.first.question'), 'get', this.section, false, false);
|
||||
this.submit(route('api.helpmenu.first.question', 4), 'get', this.section, false, false);
|
||||
},
|
||||
successHandler(response){
|
||||
this.$store.dispatch('completeList', {'name': this.section, 'data': []});
|
||||
@@ -173,7 +163,7 @@
|
||||
else{
|
||||
if(this.question.is_end){
|
||||
if(this.question.question_type === 5){
|
||||
this.submit(this.route('api.helpmenu.next.question'), 'post', this.section, true, true);
|
||||
this.submit(this.route('api.helpmenu.next.question'), 'post', this.section, false, false);
|
||||
this.closeModal();
|
||||
this.reset();
|
||||
}
|
||||
@@ -192,7 +182,7 @@
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.submit(this.route('api.helpmenu.next.question'), 'post', this.section, true, true);
|
||||
this.submit(this.route('api.helpmenu.next.question'), 'post', this.section, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,7 +190,7 @@
|
||||
this.formTouched = false;
|
||||
this.parameters.question = this.question;
|
||||
this.parameters.isPrevious = true;
|
||||
this.submit(this.route('api.helpmenu.next.question'), 'post', this.section, true, true);
|
||||
this.submit(this.route('api.helpmenu.next.question'), 'post', this.section, false, false);
|
||||
}
|
||||
},
|
||||
reset() {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<change-order-number-form-component :section="section" :data="order"></change-order-number-form-component>
|
||||
</modal-component>
|
||||
<!-- <modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="helpMenu">
|
||||
<help-menu-form-component module_type="Order" :data="order"></help-menu-form-component>
|
||||
<help-menu-form-component></help-menu-form-component>
|
||||
</modal-component> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<change-order-number-form-component :section="section" :data="order"></change-order-number-form-component>
|
||||
</modal-component>
|
||||
<!-- <modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="helpMenu">
|
||||
<help-menu-form-component module_type="Order" :data="order"></help-menu-form-component>
|
||||
<help-menu-form-component></help-menu-form-component>
|
||||
</modal-component> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
</div>
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
@include('partials.helpmenu')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<help-menu-component></help-menu-component>
|
||||
@@ -3,7 +3,7 @@
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'helpmenu', 'as' => 'helpmenu.', 'namespace' => 'HelpMenu'], function () {
|
||||
Route::get('/question', 'FetchQuestionQAController@fetch')->name('first.question');
|
||||
Route::get('/question/{set_id}', 'FetchQuestionQAController@fetch')->name('first.question');
|
||||
Route::post('/question', 'UpdateNextQuestionQAController@fetch')->name('next.question');
|
||||
Route::post('/generate', 'GenerateFeedbackUrlController@generate')->name('feedback.url.generate');
|
||||
Route::get('/list', 'ListQuestionsAnswersQAController@list')->name('list.questions.answers');
|
||||
|
||||
Reference in New Issue
Block a user