From 908e241fd8caeb70f840e70a61f3603526240a85 Mon Sep 17 00:00:00 2001 From: Qaisyousuf Date: Wed, 13 Aug 2025 17:03:21 +0200 Subject: [PATCH] Improve questionnaire UI for better usability on smaller devices --- .../QuestionnaireResponseController.cs | 3 +- .../DisplayQuestionnaire.cshtml | 1934 ++++++++++------- Web/Views/QuestionnaireResponse/Error.cshtml | 535 +++-- .../SubmittedSurvey.cshtml | 484 ++++- .../QuestionnaireResponse/ThankYou.cshtml | 493 ++++- 5 files changed, 2370 insertions(+), 1079 deletions(-) diff --git a/Web/Controllers/QuestionnaireResponseController.cs b/Web/Controllers/QuestionnaireResponseController.cs index 16b7d03..5cd65a3 100644 --- a/Web/Controllers/QuestionnaireResponseController.cs +++ b/Web/Controllers/QuestionnaireResponseController.cs @@ -36,8 +36,7 @@ namespace Web.Controllers public IActionResult Error() { - ViewBag.ErrorMessage = "The survey link has expired. request a new link."; - + ViewBag.ErrorMessage = "Undersøgelseslinket er udløbet. Anmod om et nyt link."; return View(); } diff --git a/Web/Views/QuestionnaireResponse/DisplayQuestionnaire.cshtml b/Web/Views/QuestionnaireResponse/DisplayQuestionnaire.cshtml index e9809e3..a4718c0 100644 --- a/Web/Views/QuestionnaireResponse/DisplayQuestionnaire.cshtml +++ b/Web/Views/QuestionnaireResponse/DisplayQuestionnaire.cshtml @@ -3,901 +3,1411 @@ ViewData["Title"] = "DisplayQuestionnaire"; Layout = "~/Views/Shared/_QuestionnaireResponse.cshtml"; } +
- - - - - - + + + + + + + + -

@Model.Title

-

@Html.Raw(Model.Description)

- - -
-
+

@Model.Title

+

@Html.Raw(Model.Description)

+ +
-
-
- - -
-
- - -
-
-
-
-
- -
-
- @for (int i = 0; i < Model.Questions.Count; i++) - { - var question = Model.Questions[i]; - string stepClass = i == 0 ? "active" : ""; // Adjusted the index to start from the first question -
- @((i + 1)). - @question.Type -
- } +
+
+ +
- -
- +
+
+ + +
+
+
+
+ +
+ +
+
@for (int i = 0; i < Model.Questions.Count; i++) { var question = Model.Questions[i]; - - - - - @for (int j = 0; j < question.Answers.Count; j++) - { - var answer = question.Answers[j]; - - - - } -
- -

@(i + 1). @question.Text

- - @switch (question.Type) - { - case QuestionType.Text: - @foreach (var answer in question.Answers) - { - - - } - break; - case QuestionType.CheckBox: - case QuestionType.Multiple_choice: - case QuestionType.Demographic: - -
- - @foreach (var answer in question.Answers) - { -
- - -
- - } - -
- break; - case QuestionType.TrueFalse: -
- - @foreach (var answer in question.Answers) - { -
- - - -
- - } - -
- - break; - case QuestionType.Open_ended: - - @foreach (var answer in question.Answers) - { - - - - } - - break; - - case QuestionType.Slider: - - @foreach (var answer in question.Answers) - { - - - - 50 - - } - - break; - case QuestionType.Rating: -
- - @foreach (var answer in question.Answers) - { -
-
@answer.Text
- - -
- } -
- - break; - case QuestionType.Ranking: - -
-

drag and drop to move the answers

-
    - @{ - int index = 1; // Initialize the index to start numbering from 1 - } - @foreach (var answer in question.Answers) - { -
  • - @index. @answer.Text - - - - - -
  • - index++; // Increment the index for the next item - } -
-
- - - - - - - break; - - case QuestionType.Likert: - -
- -
- -
- @foreach (var answer in question.Answers) - { - - } -
-
- - -
- - break; - case QuestionType.Matrix: - -
- - - - - @foreach (var option in question.Answers) // Assuming these are the consistent answer options across all sub-questions - { - - } - - - - - - @foreach (var option in question.Answers) // Use consistent options for each sub-question - { - - } - - -
Question@option.Text
@question.Text - -
-
- - break; - case QuestionType.Image: - - - -
-
- @foreach (var answer in question.Answers) - { -
- Image option - -
- } -
-
- - - break; - default: - - break; - } - -
- @if (i > 0) - { - - } - @if (i < Model.Questions.Count - 1) - { - - } -
+ string stepClass = i == 0 ? "active" : ""; +
+ @((i + 1)) + @question.Type
} - + + +
+ @for (int i = 0; i < Model.Questions.Count; i++) + { + var question = Model.Questions[i]; + + + + + @for (int j = 0; j < question.Answers.Count; j++) + { + var answer = question.Answers[j]; + + + } + +
+

@(i + 1). @question.Text

+ + @switch (question.Type) + { + case QuestionType.Text: + @foreach (var answer in question.Answers) + { + + + } + break; + + case QuestionType.CheckBox: + case QuestionType.Multiple_choice: + case QuestionType.Demographic: +
+ @foreach (var answer in question.Answers) + { +
+ + +
+ } +
+ break; + + case QuestionType.TrueFalse: +
+ @foreach (var answer in question.Answers) + { +
+ + +
+ } +
+ break; + + case QuestionType.Open_ended: + @foreach (var answer in question.Answers) + { + + + } + break; + + case QuestionType.Slider: + @foreach (var answer in question.Answers) + { + + + 50 + + } + break; + + case QuestionType.Rating: +
+ @foreach (var answer in question.Answers) + { +
+
@answer.Text
+ + +
+ } +
+ break; + + case QuestionType.Ranking: +
+

drag and drop to move the answers

+
    + @{ + int index = 1; + } + @foreach (var answer in question.Answers) + { +
  • + @index. @answer.Text + + + + +
  • + index++; + } +
+
+ + break; + + case QuestionType.Likert: +
+
+ +
+ @foreach (var answer in question.Answers) + { + + } +
+
+
+ break; + + case QuestionType.Matrix: +
+ + + + + @foreach (var option in question.Answers) + { + + } + + + + + + @foreach (var option in question.Answers) + { + + } + + +
Question@option.Text
@question.Text + + +
+
+ break; + + case QuestionType.Image: + +
+
+ @foreach (var answer in question.Answers) + { +
+ Image option + +
+ } +
+
+ break; + + default: + + break; + } + +
+ @if (i > 0) + { + + } + @if (i < Model.Questions.Count - 1) + { + + }
- + } + +
+ @section Scripts { @{ } + } \ No newline at end of file diff --git a/Web/Views/QuestionnaireResponse/Error.cshtml b/Web/Views/QuestionnaireResponse/Error.cshtml index 7e1288b..67d133c 100644 --- a/Web/Views/QuestionnaireResponse/Error.cshtml +++ b/Web/Views/QuestionnaireResponse/Error.cshtml @@ -1,174 +1,457 @@ - -@{ +@{ ViewData["Title"] = "Error"; Layout = "~/Views/Shared/_QuestionnaireResponse.cshtml"; } -
+
+
+
+
- -
-
- - -
-
-
@ViewBag.ErrorMessage
+
+
+
⚠ Fejl Opstået
+

+ Undersøgelseslinket er udløbet. +

- @*

@Html.Raw(Model.Content) SeoSoft

*@ +

+ Anmod om et nyt link for at få adgang til undersøgelsen. +

- Contact + + + Kontakt Os + +
-
-
- - -
+
+
+
+ + +
- - +
-
- -
- - - - - - - - +
+
\ No newline at end of file diff --git a/Web/Views/QuestionnaireResponse/SubmittedSurvey.cshtml b/Web/Views/QuestionnaireResponse/SubmittedSurvey.cshtml index 3fb7b8f..db8e1c4 100644 --- a/Web/Views/QuestionnaireResponse/SubmittedSurvey.cshtml +++ b/Web/Views/QuestionnaireResponse/SubmittedSurvey.cshtml @@ -1,153 +1,423 @@ - -@{ +@{ ViewData["Title"] = "SubmittedSurvey"; Layout = "~/Views/Shared/_QuestionnaireResponse.cshtml"; } - -
+ +
\ No newline at end of file diff --git a/Web/Views/QuestionnaireResponse/ThankYou.cshtml b/Web/Views/QuestionnaireResponse/ThankYou.cshtml index f366549..69e6334 100644 --- a/Web/Views/QuestionnaireResponse/ThankYou.cshtml +++ b/Web/Views/QuestionnaireResponse/ThankYou.cshtml @@ -1,162 +1,423 @@ - -@{ +@{ ViewData["Title"] = "Thank You"; Layout = "~/Views/Shared/_QuestionnaireResponse.cshtml"; } -
+
+
+
+
- -
-
+
+
+
✓ Undersøgelse Gennemført
+

+ Hej @ViewBag.UserName +

-
-
-

Hello @ViewBag.UserName

- -
Thank you for taking the time to submit the survey!
-

Your insights are invaluable to us and help us improve our services.

-
-
- - -
+

+ Tak fordi du tog dig tid til at udfylde undersøgelsen! +

- +
+
+
+ + + +
+
-
- -
- - - - - - - - - +
+
\ No newline at end of file