Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @using EPEdition.Data.Extensions
- @using EPEdition.Data.ViewModels
- @using EPEdition.Model.Models
- @model int
- @{
- List<SurveyLineViewModel> line = SurveyBuilderExtensions.GetGroupQuestions(Model, iSurveyEntryID: Convert.ToInt32(ViewData["SurveyEntryID"]));
- string disabled = "";
- bool isDisabled = false;
- if (ViewData["EntryStatusCode"].ToString().ToUpper() == "SUBMITTED")
- {
- disabled = "disabled";
- isDisabled = true;
- }
- }
- @foreach (SurveyQuestionSubType subtype in SurveyBuilderExtensions._GetSurveyQuestionSubTypes())
- {
- SurveyQuestionTypes? sub = SurveyBuilderExtensions.GetSurveyQuestionSubType(subtype.ID);
- bool hasAnotherQuestion = (line.Where(x => x.HasAnotherQuestion == true && x.QuestionSubTypeID == subtype.ID).Count() > 0 ? true : false);
- <table class="questionlist SurveyTable" data-id="@subtype.ID">
- <tr>
- <td class="QuestionColumn">
- </td>
- @foreach (SurveyQuestionTypeValue value in SurveyBuilderExtensions.QuestionValues(subtype.ID))
- {
- <td class="QuestionColumn2 FontSize15 QuestionColumn2Header">
- <div>@value.Label</div>
- </td>
- }
- @if (hasAnotherQuestion)
- {
- <td class="QuestionColumn2 FontSize15 QuestionColumn2Header"></td>
- }
- </tr>
- @foreach (SurveyLineViewModel question in line)
- {
- if (question.QuestionSubTypeID == subtype.ID)
- {
- if (sub == SurveyQuestionTypes.FreeText)
- {
- <tr class="SingleQuestion FontSize14 GroupQuestionAlt">
- <td class="QuestionColumn2Alt">
- <i class="icon-comments red"></i>
- @question.Nr @question.Name
- @{
- if (question.IsRequired == true)
- {
- <span style="color: red;">*</span>
- }
- }
- </td>
- <td class="QuestionColumn3" style="text-align: left;">
- @if (question.AnswerValues.Count > 0)
- {
- <span>@Html.TextArea("TXT|" + question.ID.ToString(), question.AnswerValues[0], new { @class = "FreeText limited", @maxlenght = "250" })</span>
- }
- else
- {
- <span>@Html.TextArea("TXT|" + question.ID.ToString(), new { @class = "FreeText limited", @maxlenght = "250" })</span>
- }
- </td>
- </tr>
- }
- else
- {
- <tr class="BorderTopBot SingleQuestion FontSize14">
- <td class="QuestionColumn">
- <i class="icon-comments red"></i>
- @question.Nr @question.Name
- @{
- if (question.IsRequired == true)
- {
- <span style="color: red;">*</span>
- }
- }
- </td>
- @foreach (SurveyQuestionTypeValue value in SurveyBuilderExtensions.QuestionValues(subtype.ID))
- {
- <td class="QuestionColumn2 QuestionColumn2Row">
- @if (sub == SurveyQuestionTypes.Checkbox)
- {
- if (question.AnswerValues.Count > 0)
- {
- if (question.AnswerValues.FirstOrDefault(x => x == value.ID.ToString()) != null)
- {
- <span>@Html.CheckBox("CHK|" + question.ID + "|" + value.ID, true)</span>
- //isDisabled = true;
- }
- else
- {
- <span>@Html.CheckBox("CHK|" + question.ID + "|" + value.ID)</span>
- }
- }
- else
- {
- <span>@Html.CheckBox("CHK|" + question.ID + "|" + value.ID)</span>
- }
- }
- @if (sub == SurveyQuestionTypes.Radiobutton)
- {
- if (question.AnswerValues.Count > 0)
- {
- if (question.AnswerValues.FirstOrDefault(x => x == value.ID.ToString()) != null)
- {
- <span>@Html.RadioButton("RDB|" + question.ID.ToString(), value.ID, true, new { @class = "RadiobuttonOption" })</span>
- }
- else
- {
- <span>@Html.RadioButton("RDB|" + question.ID.ToString(), value.ID, false, new { @class = "RadiobuttonOption" })</span>
- }
- }
- else
- {
- <span>@Html.RadioButton("RDB|" + question.ID.ToString(), value.ID, false, new { @class = "RadiobuttonOption" })</span>
- }
- }
- </td>
- }
- @if (question.HasAnotherQuestion == true)
- {
- <td class="QuestionColumn2 QuestionColumn2Row OtherColumn" data-id="@question.ID" style="margin-bottom: auto; margin-top: auto; height: 20px; width: 250px; border-right: none;">
- @if (sub == SurveyQuestionTypes.Checkbox)
- {
- if (question.AnswerValues.Count > 0 != null)
- {
- <span>@Html.CheckBox("CHK|" + question.ID + "_AnotherQuestion", true, new { @id = "" + question.ID + "_AnotherQuestion", @class = "CheckboxOther" })</span>
- }
- else
- {
- <span>@Html.CheckBox("CHK|" + question.ID + "_AnotherQuestion", false, new { @id = "" + question.ID + "_AnotherQuestion", @class = "CheckboxOther" })</span>
- }
- }
- @if (sub == SurveyQuestionTypes.Radiobutton)
- {
- if (question.AnswerValues.Count > 0 != null)
- {
- <span>@Html.RadioButton("RDB|" + question.ID.ToString(), "AnotherQuestion", true, new { @id = question.ID.ToString(), @class = "RadiobuttonOther RadiobuttonOption" })</span>
- }
- else
- {
- <span>@Html.RadioButton("RDB|" + question.ID.ToString(), "AnotherQuestion", false, new { @id = question.ID.ToString(), @class = "RadiobuttonOther RadiobuttonOption" })</span>
- }
- }
- @if (question.AnswerValues.Count > 0 != null)
- {
- <span>@Html.TextBox((sub == SurveyQuestionTypes.Checkbox ? "CHK|" : "RDB|") + question.ID.ToString() + "_AnotherQuestionDescription", question.AnswerValues[0], new { @id = "" + question.ID.ToString() + "_AnotherQuestionDescription", @class = "AnotherAnswerDescriptionCLASS", @style = "margin-top: auto;margin-bottom: auto;height: 20px;margin-left: auto;margin-right: auto;width: 210px;" })</span>
- }
- else
- {
- <span>@Html.TextBox((sub == SurveyQuestionTypes.Checkbox ? "CHK|" : "RDB|") + question.ID.ToString() + "_AnotherQuestionDescription", "", new { @id = "" + question.ID.ToString() + "_AnotherQuestionDescription", @class = "AnotherAnswerDescriptionCLASS", @style = "margin-top: auto;margin-bottom: auto;height: 20px;margin-left: auto;margin-right: auto;width: 210px;" })</span>
- }
- </td>
- }
- else
- {
- if (hasAnotherQuestion)
- {
- <td> </td>
- }
- }
- </tr>
- }
- }
- }
- </table>
- }
- <script>
- $(function () {
- @if (isDisabled == true)
- {
- <text>
- $('#ToRender input[type=radio]').attr("disabled", "disabled");
- $('#ToRender input[type=checkbox]').attr("disabled", "disabled");
- $('#ToRender input[type=text]').attr("disabled", "disabled");
- </text>
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement