#pragma checksum "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "dfc7195239b931f96354ea1af319e8bad60be72d"
// <auto-generated/>
#pragma warning disable 1591
namespace SPWA.Pages
{
    #line hidden
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Components;
#nullable restore
#line 2 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using System.Net.Http;

#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Components.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 5 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Components.Forms;

#line default
#line hidden
#nullable disable
#nullable restore
#line 6 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Components.Routing;

#line default
#line hidden
#nullable disable
#nullable restore
#line 7 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Components.Web;

#line default
#line hidden
#nullable disable
#nullable restore
#line 8 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.JSInterop;

#line default
#line hidden
#nullable disable
#nullable restore
#line 9 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using SPWA;

#line default
#line hidden
#nullable disable
#nullable restore
#line 10 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using SPWA.Shared;

#line default
#line hidden
#nullable disable
#nullable restore
#line 11 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using MatBlazor;

#line default
#line hidden
#nullable disable
#nullable restore
#line 12 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using BlazorInputFile;

#line default
#line hidden
#nullable disable
#nullable restore
#line 13 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.Identity;

#line default
#line hidden
#nullable disable
#nullable restore
#line 14 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using Microsoft.AspNetCore.DataProtection;

#line default
#line hidden
#nullable disable
#nullable restore
#line 15 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\_Imports.razor"
using SPWA.LoginFeatures.Account.Pages.GoogleLogin;

#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
using SPWA.DataAccess.Data.QuestionServices;

#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
using SPWA.DataAccess.Data.Models;

#line default
#line hidden
#nullable disable
    [Microsoft.AspNetCore.Components.RouteAttribute("/questions")]
    public partial class Questions : OwningComponentBase<QuestionServices>
    {
        #pragma warning disable 1998
        protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
            __builder.OpenComponent<MatBlazor.MatCard>(0);
            __builder.AddAttribute(1, "Class", "mat-elevation-z1");
            __builder.AddAttribute(2, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
                __builder2.AddMarkupContent(3, "\r\n    ");
                __builder2.OpenComponent<MatBlazor.MatDialogTitle>(4);
                __builder2.AddAttribute(5, "Style", "font-family:\'Nunito\';font-size:x-large");
                __builder2.AddAttribute(6, "Class", "font-weight-bold");
                __builder2.AddAttribute(7, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
                    __builder3.AddContent(8, "Questions Table");
                }
                ));
                __builder2.CloseComponent();
                __builder2.AddMarkupContent(9, "\r\n");
            }
            ));
            __builder.CloseComponent();
            __builder.AddMarkupContent(10, "\r\n");
            __builder.OpenComponent<MatBlazor.MatDivider>(11);
            __builder.CloseComponent();
            __builder.AddMarkupContent(12, "\r\n\r\n");
            __builder.OpenElement(13, "div");
            __builder.AddAttribute(14, "class", "mat-elevation-z1");
            __builder.AddAttribute(15, "style", "font-family:\'Nunito\'");
            __builder.AddMarkupContent(16, "\r\n    ");
            __Blazor.SPWA.Pages.Questions.TypeInference.CreateMatBlazor_MatTable_0(__builder, 17, 18, 
#nullable restore
#line 14 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                questions

#line default
#line hidden
#nullable disable
            , 19, "table-hover", 20, "flex-wrap:wrap", 21, (__builder2) => {
                __builder2.AddMarkupContent(22, "\r\n            ");
                __builder2.AddMarkupContent(23, "<th style=\"font-weight:bold\">QuestionID</th>\r\n            ");
                __builder2.AddMarkupContent(24, "<th style=\"font-weight:bold\">Question Text</th>\r\n            ");
                __builder2.AddMarkupContent(25, "<th style=\"font-weight:bold\">Question Value</th>\r\n            ");
                __builder2.AddMarkupContent(26, "<th style=\"font-weight:bold\">Display Question</th>\r\n\r\n\r\n        ");
            }
            , 27, (context) => (__builder2) => {
                __builder2.AddMarkupContent(28, "\r\n            ");
                __builder2.OpenElement(29, "td");
                __builder2.AddAttribute(30, "width", "25%");
                __builder2.AddContent(31, 
#nullable restore
#line 24 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                             context.QuestionID

#line default
#line hidden
#nullable disable
                );
                __builder2.CloseElement();
                __builder2.AddMarkupContent(32, "\r\n            ");
                __builder2.OpenElement(33, "td");
                __builder2.AddAttribute(34, "width", "25%");
                __builder2.AddContent(35, 
#nullable restore
#line 25 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                             context.text

#line default
#line hidden
#nullable disable
                );
                __builder2.CloseElement();
                __builder2.AddMarkupContent(36, "\r\n            ");
                __builder2.OpenElement(37, "td");
                __builder2.AddAttribute(38, "width", "25%");
                __builder2.AddContent(39, 
#nullable restore
#line 26 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                             context.value

#line default
#line hidden
#nullable disable
                );
                __builder2.CloseElement();
                __builder2.AddMarkupContent(40, "\r\n            ");
                __builder2.OpenElement(41, "td");
                __builder2.AddAttribute(42, "width", "25%");
                __builder2.AddContent(43, 
#nullable restore
#line 27 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                             context.display

#line default
#line hidden
#nullable disable
                );
                __builder2.CloseElement();
                __builder2.AddMarkupContent(44, "\r\n\r\n            ");
                __builder2.OpenElement(45, "td");
                __builder2.OpenComponent<MatBlazor.MatIconButton>(46);
                __builder2.AddAttribute(47, "Icon", "edit");
                __builder2.AddAttribute(48, "OnClick", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<Microsoft.AspNetCore.Components.EventCallback<Microsoft.AspNetCore.Components.Web.MouseEventArgs>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line 29 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                                       (_) =>EditQuestion(@context)

#line default
#line hidden
#nullable disable
                )));
                __builder2.AddAttribute(49, "Style", "color:dodgerblue");
                __builder2.CloseComponent();
                __builder2.CloseElement();
                __builder2.AddMarkupContent(50, "\r\n        ");
            }
            );
            __builder.AddMarkupContent(51, "\r\n");
            __builder.CloseElement();
            __builder.AddMarkupContent(52, "\r\n\r\n");
#nullable restore
#line 34 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
 if (ShowPopup)
{

#line default
#line hidden
#nullable disable
            __builder.AddMarkupContent(53, "    \r\n    ");
            __builder.OpenElement(54, "div");
            __builder.AddAttribute(55, "class", "modal");
            __builder.AddAttribute(56, "tabindex", "-1");
            __builder.AddAttribute(57, "style", "display:block");
            __builder.AddAttribute(58, "role", "dialog");
            __builder.AddMarkupContent(59, "\r\n        ");
            __builder.OpenElement(60, "div");
            __builder.AddAttribute(61, "class", "modal-dialog");
            __builder.AddMarkupContent(62, "\r\n            ");
            __builder.OpenElement(63, "div");
            __builder.AddAttribute(64, "class", "modal-content");
            __builder.AddMarkupContent(65, "\r\n                ");
            __builder.OpenElement(66, "div");
            __builder.AddAttribute(67, "class", "modal-header");
            __builder.AddMarkupContent(68, "\r\n                    ");
            __builder.AddMarkupContent(69, "<h3 class=\"modal-title\">Edit Question</h3>\r\n                    \r\n                    ");
            __builder.OpenElement(70, "button");
            __builder.AddAttribute(71, "type", "button");
            __builder.AddAttribute(72, "class", "close");
            __builder.AddAttribute(73, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line 44 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                      ClosePopup

#line default
#line hidden
#nullable disable
            ));
            __builder.AddMarkupContent(74, "\r\n                        ");
            __builder.AddMarkupContent(75, "<span aria-hidden=\"true\">X</span>\r\n                    ");
            __builder.CloseElement();
            __builder.AddMarkupContent(76, "\r\n                ");
            __builder.CloseElement();
            __builder.AddMarkupContent(77, "\r\n                \r\n                ");
            __builder.OpenElement(78, "div");
            __builder.AddAttribute(79, "class", "modal-body");
            __builder.AddMarkupContent(80, "\r\n                    \r\n");
#nullable restore
#line 51 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                     if (objQuestion.QuestionID != 0)
                    {

#line default
#line hidden
#nullable disable
            __builder.AddContent(81, "                        ");
            __builder.OpenElement(82, "p");
            __builder.AddContent(83, "Question ID: ");
            __builder.AddContent(84, 
#nullable restore
#line 53 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                         objQuestion.QuestionID

#line default
#line hidden
#nullable disable
            );
            __builder.CloseElement();
            __builder.AddMarkupContent(85, "\r\n");
#nullable restore
#line 54 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                    }

#line default
#line hidden
#nullable disable
            __builder.AddMarkupContent(86, "                    \r\n");
#nullable restore
#line 56 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                     if (objQuestion.QuestionID != 0)
                    {

                    }
                    else
                    {

                    }

#line default
#line hidden
#nullable disable
            __builder.AddMarkupContent(87, "\r\n                    ");
            __builder.AddMarkupContent(88, "<label for=\"Name\" class=\"control-label\">Question Text</label>\r\n                    ");
            __builder.OpenElement(89, "input");
            __builder.AddAttribute(90, "class", "form-control");
            __builder.AddAttribute(91, "type", "text");
            __builder.AddAttribute(92, "placeholder", "Question Name");
            __builder.AddAttribute(93, "value", Microsoft.AspNetCore.Components.BindConverter.FormatValue(
#nullable restore
#line 68 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                  objQuestion.text

#line default
#line hidden
#nullable disable
            ));
            __builder.AddAttribute(94, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => objQuestion.text = __value, objQuestion.text));
            __builder.SetUpdatesAttributeName("value");
            __builder.CloseElement();
            __builder.AddMarkupContent(95, "\r\n                    ");
            __builder.AddMarkupContent(96, "<label for=\"Name\" class=\"control-label\">Question Value</label>\r\n                    ");
            __builder.OpenElement(97, "input");
            __builder.AddAttribute(98, "class", "form-control");
            __builder.AddAttribute(99, "type", "text");
            __builder.AddAttribute(100, "placeholder", "Question Value");
            __builder.AddAttribute(101, "value", Microsoft.AspNetCore.Components.BindConverter.FormatValue(
#nullable restore
#line 72 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                  objQuestion.value

#line default
#line hidden
#nullable disable
            ));
            __builder.AddAttribute(102, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => objQuestion.value = __value, objQuestion.value));
            __builder.SetUpdatesAttributeName("value");
            __builder.CloseElement();
            __builder.AddMarkupContent(103, "\r\n                    ");
            __builder.AddMarkupContent(104, "<label for=\"Name\" class=\"control-label\">Display Question</label>\r\n                    ");
            __builder.OpenElement(105, "input");
            __builder.AddAttribute(106, "class", "form-control");
            __builder.AddAttribute(107, "type", "text");
            __builder.AddAttribute(108, "placeholder", "Display Question");
            __builder.AddAttribute(109, "value", Microsoft.AspNetCore.Components.BindConverter.FormatValue(
#nullable restore
#line 76 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                  objQuestion.display

#line default
#line hidden
#nullable disable
            ));
            __builder.AddAttribute(110, "onchange", Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => objQuestion.display = __value, objQuestion.display));
            __builder.SetUpdatesAttributeName("value");
            __builder.CloseElement();
            __builder.AddMarkupContent(111, "\r\n\r\n\r\n                    \r\n                    ");
            __builder.OpenElement(112, "button");
            __builder.AddAttribute(113, "class", "btn btn-primary");
            __builder.AddAttribute(114, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line 81 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                      SaveQuestion

#line default
#line hidden
#nullable disable
            ));
            __builder.AddMarkupContent(115, "\r\n                        Save\r\n                    ");
            __builder.CloseElement();
            __builder.AddMarkupContent(116, "\r\n                    \r\n");
#nullable restore
#line 85 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                     if (objQuestion.QuestionID != 0)
                    {

#line default
#line hidden
#nullable disable
            __builder.AddMarkupContent(117, "                        \r\n                        ");
            __builder.OpenElement(118, "button");
            __builder.AddAttribute(119, "class", "btn btn-danger");
            __builder.AddAttribute(120, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line 89 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                          DeleteQuestion

#line default
#line hidden
#nullable disable
            ));
            __builder.AddMarkupContent(121, "\r\n                            Delete\r\n                        ");
            __builder.CloseElement();
            __builder.AddMarkupContent(122, "\r\n");
#nullable restore
#line 92 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                    }

#line default
#line hidden
#nullable disable
            __builder.AddMarkupContent(123, "                    <br>\r\n                    ");
            __builder.OpenElement(124, "span");
            __builder.AddAttribute(125, "style", "color:red");
            __builder.AddContent(126, 
#nullable restore
#line 94 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                             strError

#line default
#line hidden
#nullable disable
            );
            __builder.CloseElement();
            __builder.AddMarkupContent(127, "\r\n                ");
            __builder.CloseElement();
            __builder.AddMarkupContent(128, "\r\n            ");
            __builder.CloseElement();
            __builder.AddMarkupContent(129, "\r\n        ");
            __builder.CloseElement();
            __builder.AddMarkupContent(130, "\r\n    ");
            __builder.CloseElement();
            __builder.AddMarkupContent(131, "\r\n");
#nullable restore
#line 99 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
}

#line default
#line hidden
#nullable disable
            __builder.OpenElement(132, "button");
            __builder.AddAttribute(133, "class", "btn btn-success");
            __builder.AddAttribute(134, "onclick", Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line 100 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
                                          AddNewQuestion

#line default
#line hidden
#nullable disable
            ));
            __builder.AddContent(135, "Add Question");
            __builder.CloseElement();
        }
        #pragma warning restore 1998
#nullable restore
#line 102 "C:\Users\jayt7\Source\Repos\Senior-Project\SPWA\Pages\Questions.razor"
       

    // AuthenticationState is available as a CascadingParameter
    [CascadingParameter]
    private Task<AuthenticationState> authenticationStateTask { get; set; }

    List<Question> questions;
    bool NewQuestion = false;

    protected override async Task OnInitializedAsync()
    {
        // Get the current user
        var user = (await authenticationStateTask).User;
        // Get the Question for the current user
        // We access QuestionService using @Service
        questions = await @Service.GetQuestionAsync(user.Identity.Name);
    }
    string strError = "";
    Question objQuestion = new Question();
    bool ShowPopup = false;
    bool ReadMorePopup = false;

    void ClosePopup()
    {
        // Close the Popup
        ShowPopup = false;
    }


    void AddNewQuestion()
    {
        //System.Diagnostics.Debug.WriteLine("read value =" + ReadMorePopup);
        // Make new Question
        objQuestion = new Question();
        // Set Id to 0 so we know it is a new record
        objQuestion.QuestionID = 0;
        // Open the Popup
        ShowPopup = true;
        //NewQuestion = true;
    }



    async Task SaveQuestion()
    {
        // Close the Popup
        ShowPopup = false;
        // Get the current user
        var user = (await authenticationStateTask).User;
        // A new Question will have newQuestion set to true
        if (objQuestion.QuestionID == 0)
        {
            // Create new Question
            Question objNewQuestion = new Question();
            objNewQuestion.text = objQuestion.text;
            objNewQuestion.Default = objQuestion.Default;
            objNewQuestion.value = objQuestion.value;
            objNewQuestion.display = objQuestion.display;


        

            // Save the result
            var result =
            @Service.CreateQuestionAsync(objNewQuestion);
        }
        else
        {
            // This is an update
            var result =
            @Service.UpdateQuestionAsync(objQuestion);
        }
        // Get the Question for the current user
        questions =
        await @Service.GetQuestionAsync(user.Identity.Name);
    }


    void EditQuestion(Question question)
    {
        //System.Diagnostics.Debug.WriteLine("read value =" + ReadMorePopup);
        // Set the selected Question
        // as the current Question
        objQuestion = question;
        // Open the Popup
        ShowPopup = true;
    }

    void ReadQuestion(Question question)
    {
        //System.Diagnostics.Debug.WriteLine("In Readmorepopup ");
        // Set the selected Question
        // as the current Question
        objQuestion = question;
        // Open the Popup
        ReadMorePopup = true;
        //System.Diagnostics.Debug.WriteLine(ReadMorePopup);
    }

    async Task DeleteQuestion()
    {
        // Close the Popup
        ShowPopup = false;
        // Get the Question

    }



#line default
#line hidden
#nullable disable
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private AuthenticationStateProvider AuthenticationStateProvider { get; set; }
    }
}
namespace __Blazor.SPWA.Pages.Questions
{
    #line hidden
    internal static class TypeInference
    {
        public static void CreateMatBlazor_MatTable_0<TableItem>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, global::System.Collections.Generic.IEnumerable<TableItem> __arg0, int __seq1, global::System.String __arg1, int __seq2, global::System.String __arg2, int __seq3, global::Microsoft.AspNetCore.Components.RenderFragment __arg3, int __seq4, global::Microsoft.AspNetCore.Components.RenderFragment<TableItem> __arg4)
        {
        __builder.OpenComponent<global::MatBlazor.MatTable<TableItem>>(seq);
        __builder.AddAttribute(__seq0, "Items", __arg0);
        __builder.AddAttribute(__seq1, "Class", __arg1);
        __builder.AddAttribute(__seq2, "Style", __arg2);
        __builder.AddAttribute(__seq3, "MatTableHeader", __arg3);
        __builder.AddAttribute(__seq4, "MatTableRow", __arg4);
        __builder.CloseComponent();
        }
    }
}
#pragma warning restore 1591
