#pragma checksum "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ea3f598b26f7c071bc0e42b3b4c008a87c851c58bc2f3e4759c6597590617d7a"
// <auto-generated/>
#pragma warning disable 1591
namespace AuthModule.Components.Pages.Roles.Components
{
    #line default
    using global::System;
    using global::System.Collections.Generic;
    using global::System.Linq;
    using global::System.Threading.Tasks;
    using global::Microsoft.AspNetCore.Components;
#nullable restore
#line (2,2)-(2,33) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Auth.Contracts.DTOs.Users

#nullable disable
    ;
#nullable restore
#line (3,2)-(3,32) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Auth.Contracts.DTOs.Auth

#nullable disable
    ;
#nullable restore
#line (4,2)-(4,27) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using AuthModule.Services

#nullable disable
    ;
#nullable restore
#line (5,2)-(5,42) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Microsoft.AspNetCore.Authorization

#nullable disable
    ;
#nullable restore
#line (6,2)-(6,53) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Microsoft.AspNetCore.Components.Authorization

#nullable disable
    ;
#nullable restore
#line (7,2)-(7,28) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using LayoutLib.Components

#nullable disable
    ;
#nullable restore
#line (9,2)-(9,17) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using MudBlazor

#nullable disable
    ;
#nullable restore
#line (10,2)-(10,23) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Auth.Contracts;

#nullable disable
#nullable restore
#line (13,2)-(13,23) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using System.Net.Http

#nullable disable
    ;
#nullable restore
#line (14,2)-(14,28) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using System.Net.Http.Json

#nullable disable
    ;
#nullable restore
#line (15,2)-(15,45) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Microsoft.AspNetCore.Components.Forms

#nullable disable
    ;
#nullable restore
#line (16,2)-(16,47) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Microsoft.AspNetCore.Components.Routing

#nullable disable
    ;
#nullable restore
#line (17,2)-(17,43) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Microsoft.AspNetCore.Components.Web

#nullable disable
    ;
#nullable restore
#line (18,2)-(18,58) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/_Imports.razor"
using Microsoft.AspNetCore.Components.Web.Virtualization

#nullable disable
    ;
    #line default
    #line hidden
    #nullable restore
    public partial class AddRolePopUp : global::Microsoft.AspNetCore.Components.ComponentBase
    #nullable disable
    {
        #pragma warning disable 1998
        protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
            __builder.OpenElement(0, "div");
            __builder.AddAttribute(1, "class", "flex flex-col w-full h-full gap-5");
            global::__Blazor.AuthModule.Components.Pages.Roles.Components.AddRolePopUp.TypeInference.CreateMudSelect_0(__builder, 2, 3, 
#nullable restore
#line (6,29)-(6,41) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
selectedRole

#line default
#line hidden
#nullable disable
            , 4, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => selectedRole = __value, selectedRole)), 5, (__builder2) => {
#nullable restore
#line (7,1)-(7,9) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
        

#line default
#line hidden
#nullable disable

#nullable restore
#line (7,10)-(9,1) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
foreach (var role in roles)
        {

#line default
#line hidden
#nullable disable

                global::__Blazor.AuthModule.Components.Pages.Roles.Components.AddRolePopUp.TypeInference.CreateMudSelectItem_1(__builder2, 6, 7, 
#nullable restore
#line (9,35)-(9,39) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
role

#line default
#line hidden
#nullable disable
                , 8, (__builder3) => {
#nullable restore
#line (9,42)-(9,46) 25 "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
__builder3.AddContent(9, role

#line default
#line hidden
#nullable disable
                    );
                }
                );
#nullable restore
#line (10,1)-(11,1) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
        }

#line default
#line hidden
#nullable disable

            }
            );
            __builder.AddMarkupContent(10, "\n    ");
            __builder.OpenElement(11, "button");
            __builder.AddAttribute(12, "class", "w-full btn btn-primary h-full");
            __builder.AddAttribute(13, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (12,61)-(12,76) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
() => AddRole()

#line default
#line hidden
#nullable disable
            ));
            __builder.AddMarkupContent(14, "أضف صلاحية");
            __builder.CloseElement();
            __builder.CloseElement();
        }
        #pragma warning restore 1998
#nullable restore
#line (17,8)-(50,1) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"

    string selectedRole;

    [Parameter] public UserVM UserVM { get; set; }
    [Parameter] public EventCallback AddMethod { get; set; }


    List<string> roles = new();

    protected override async Task OnInitializedAsync()
    {
        roles = Enum.GetNames<AppEnum.Roles>().Except(UserVM.Roles).ToList();
    }

    async Task AddRole()
    {


        var result = await roleAPIConsumer.AddUserToRole(UserVM.Id, selectedRole);
        if (result)
        {
            UserVM.Roles.Add(selectedRole);
            Snackbar.Add("تم الإضافة", Severity.Success);
            await AddMethod.InvokeAsync();
        }
        else
        {
            Snackbar.Add("تعذر الإضافة", Severity.Error);

        }

    }


#line default
#line hidden
#nullable disable

        [global::Microsoft.AspNetCore.Components.InjectAttribute] private 
#nullable restore
#line (2,9)-(2,18) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
ISnackbar

#line default
#line hidden
#nullable disable
         
#nullable restore
#line (2,19)-(2,27) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
Snackbar

#line default
#line hidden
#nullable disable
         { get; set; }
         = default!;
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private 
#nullable restore
#line (1,9)-(1,24) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
RoleAPIConsumer

#line default
#line hidden
#nullable disable
         
#nullable restore
#line (1,25)-(1,40) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
roleAPIConsumer

#line default
#line hidden
#nullable disable
         { get; set; }
         = default!;
    }
}
namespace __Blazor.AuthModule.Components.Pages.Roles.Components.AddRolePopUp
{
    #line hidden
    internal static class TypeInference
    {
        public static void CreateMudSelect_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, T __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback<T> __arg1, int __seq2, global::Microsoft.AspNetCore.Components.RenderFragment __arg2)
        {
        __builder.OpenComponent<global::MudBlazor.MudSelect<T>>(seq);
        __builder.AddComponentParameter(__seq0, nameof(global::MudBlazor.MudSelect<T>.
#nullable restore
#line (6,22)-(6,27) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
Value

#line default
#line hidden
#nullable disable
        ), __arg0);
        __builder.AddComponentParameter(__seq1, nameof(global::MudBlazor.MudSelect<T>.ValueChanged), __arg1);
        __builder.AddComponentParameter(__seq2, "ChildContent", __arg2);
        __builder.CloseComponent();
        }
        public static void CreateMudSelectItem_1<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, T __arg0, int __seq1, global::Microsoft.AspNetCore.Components.RenderFragment __arg1)
        {
        __builder.OpenComponent<global::MudBlazor.MudSelectItem<T>>(seq);
        __builder.AddComponentParameter(__seq0, nameof(global::MudBlazor.MudSelectItem<T>.
#nullable restore
#line (9,28)-(9,33) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/Components/AddRolePopUp.razor"
Value

#line default
#line hidden
#nullable disable
        ), __arg0);
        __builder.AddComponentParameter(__seq1, "ChildContent", __arg1);
        __builder.CloseComponent();
        }
    }
}
#pragma warning restore 1591
