#pragma checksum "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c908479abff408ab9c55c90099b4f56d2c55f859ccf4e18e44ac204d43775cdd"
// <auto-generated/>
#pragma warning disable 1591
namespace AuthModule.Components.Pages.Roles
{
    #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
    [global::Microsoft.AspNetCore.Components.RouteAttribute(
    // language=Route,Component
#nullable restore
#line (1,7)-(1,25) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
"/manage-UserRole"

#line default
#line hidden
#nullable disable
    )]
    #nullable restore
    public partial class ManageUserRole : global::Microsoft.AspNetCore.Components.ComponentBase
    #nullable disable
    {
        #pragma warning disable 1998
        protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
            global::__Blazor.AuthModule.Components.Pages.Roles.ManageUserRole.TypeInference.CreateMudTable_0(__builder, 0, 1, 
#nullable restore
#line (7,19)-(7,24) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
users

#line default
#line hidden
#nullable disable
            , 2, 
#nullable restore
#line (7,42)-(7,47) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
false

#line default
#line hidden
#nullable disable
            , 3, 
#nullable restore
#line (7,56)-(7,60) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
true

#line default
#line hidden
#nullable disable
            , 4, 
#nullable restore
#line (7,74)-(7,87) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
Breakpoint.Sm

#line default
#line hidden
#nullable disable
            , 5, 
#nullable restore
#line (7,98)-(7,102) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
true

#line default
#line hidden
#nullable disable
            , 6, 
#nullable restore
#line (7,114)-(7,118) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
true

#line default
#line hidden
#nullable disable
            , 7, 
#nullable restore
#line (8,19)-(8,23) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
true

#line default
#line hidden
#nullable disable
            , 8, "table-head-bordered", 9, (__builder2) => {
                __builder2.OpenComponent<global::MudBlazor.MudTHeadRow>(10);
                __builder2.AddComponentParameter(11, nameof(global::MudBlazor.MudTHeadRow.
#nullable restore
#line (10,22)-(10,36) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
IgnoreCheckbox

#line default
#line hidden
#nullable disable
                ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Boolean>(
#nullable restore
#line (10,38)-(10,42) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
true

#line default
#line hidden
#nullable disable
                ));
                __builder2.AddComponentParameter(12, nameof(global::MudBlazor.MudTHeadRow.
#nullable restore
#line (10,44)-(10,49) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
Class

#line default
#line hidden
#nullable disable
                ), "header-centered");
                __builder2.AddAttribute(13, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
                    __builder3.OpenComponent<global::MudBlazor.MudTh>(14);
                    __builder3.AddComponentParameter(15, "colspan", "6");
                    __builder3.AddAttribute(16, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder4) => {
                        __builder4.AddMarkupContent(17, "صلاحيات الوصول للتطبيق");
                    }
                    ));
                    __builder3.CloseComponent();
                }
                ));
                __builder2.CloseComponent();
                __builder2.AddMarkupContent(18, "\n\n        ");
                __builder2.OpenComponent<global::MudBlazor.MudTHeadRow>(19);
                __builder2.AddAttribute(20, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
                    __builder3.OpenComponent<global::MudBlazor.MudTh>(21);
                    __builder3.AddAttribute(22, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder4) => {
                        __builder4.AddMarkupContent(23, "الأسم");
                    }
                    ));
                    __builder3.CloseComponent();
                    __builder3.AddMarkupContent(24, "\n            ");
                    __builder3.OpenComponent<global::MudBlazor.MudTh>(25);
                    __builder3.AddAttribute(26, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder4) => {
                        __builder4.AddMarkupContent(27, "الصلحيات");
                    }
                    ));
                    __builder3.CloseComponent();
                    __builder3.AddMarkupContent(28, "\n            ");
                    __builder3.OpenComponent<global::MudBlazor.MudTh>(29);
                    __builder3.AddAttribute(30, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder4) => {
                        __builder4.AddMarkupContent(31, "أضف صلاحية");
                    }
                    ));
                    __builder3.CloseComponent();
                }
                ));
                __builder2.CloseComponent();
            }
            , 32, (context) => (__builder2) => {
                __builder2.OpenComponent<global::MudBlazor.MudTd>(33);
                __builder2.AddComponentParameter(34, nameof(global::MudBlazor.MudTd.
#nullable restore
#line (22,16)-(22,25) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
DataLabel

#line default
#line hidden
#nullable disable
                ), "الأسم");
                __builder2.AddAttribute(35, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
#nullable restore
#line (22,35)-(22,47) 26 "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
__builder3.AddContent(36, context.Name

#line default
#line hidden
#nullable disable
                    );
                }
                ));
                __builder2.CloseComponent();
                __builder2.AddMarkupContent(37, "\n        ");
                __builder2.OpenComponent<global::MudBlazor.MudTd>(38);
                __builder2.AddComponentParameter(39, nameof(global::MudBlazor.MudTd.
#nullable restore
#line (24,16)-(24,25) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
DataLabel

#line default
#line hidden
#nullable disable
                ), "الصلحيات");
                __builder2.AddAttribute(40, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
                    __builder3.OpenElement(41, "div");
#nullable restore
#line (27,1)-(27,17) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
                

#line default
#line hidden
#nullable disable

#nullable restore
#line (27,18)-(29,1) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
foreach (var role in context.Roles)
                {

#line default
#line hidden
#nullable disable

                    __builder3.OpenElement(42, "div");
                    __builder3.AddAttribute(43, "class", "badge badge-success");
                    __builder3.OpenElement(44, "label");
#nullable restore
#line (30,33)-(30,37) 26 "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
__builder3.AddContent(45, role

#line default
#line hidden
#nullable disable
                    );
                    __builder3.CloseElement();
                    __builder3.AddMarkupContent(46, "\n                        ");
                    __builder3.OpenElement(47, "button");
                    __builder3.AddAttribute(48, "class", "p-1");
                    __builder3.AddAttribute(49, "onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create<global::Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, 
#nullable restore
#line (31,55)-(31,86) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
() => RemoveRole(context, role)

#line default
#line hidden
#nullable disable
                    ));
                    __builder3.AddAttribute(50, "type", "button");
                    __builder3.AddContent(51, "X");
                    __builder3.CloseElement();
                    __builder3.CloseElement();
#nullable restore
#line (33,1)-(34,1) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
                }

#line default
#line hidden
#nullable disable

                    __builder3.CloseElement();
                }
                ));
                __builder2.CloseComponent();
                __builder2.AddMarkupContent(52, "\n        ");
                __builder2.OpenComponent<global::MudBlazor.MudTd>(53);
                __builder2.AddComponentParameter(54, nameof(global::MudBlazor.MudTd.
#nullable restore
#line (36,16)-(36,25) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
DataLabel

#line default
#line hidden
#nullable disable
                ), "أضف صلاحية");
                __builder2.AddAttribute(55, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
                    __builder3.OpenElement(56, "AddRolePopUp");
                    __builder3.AddAttribute(57, "UserVM", "context");
                    __builder3.AddAttribute(58, "AddMethod", "AddRole");
                    __builder3.CloseElement();
                }
                ));
                __builder2.CloseComponent();
            }
            );
        }
        #pragma warning restore 1998
#nullable restore
#line (45,8)-(80,1) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"


    List<UserVM> users = new List<UserVM>();

    List<string> roles = new List<string>();



    protected override async Task OnInitializedAsync()
    {
        users = await userAPIConsumer.GetUsers();
        var rolesArr = Enum.GetValues(typeof(AppEnum.Roles));

        roles = rolesArr.OfType<string>().ToList();
    }

    async Task AddRole()
    {
        StateHasChanged();
    }

    async Task RemoveRole(UserVM user, string role)
    {
        var result = await roleAPIConsumer.RemoveUserFromRole(user.Id, role);
        if (result)
        {
            user.Roles.Remove(role);
            Snackbar.Add("تم الإزالة", Severity.Success);
        }
        else
        {
            Snackbar.Add("حدث خطأ لم يتم الإزالة", Severity.Warning);
        }
    }


#line default
#line hidden
#nullable disable

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

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

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

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

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

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

#line default
#line hidden
#nullable disable
         { get; set; }
         = default!;
    }
}
namespace __Blazor.AuthModule.Components.Pages.Roles.ManageUserRole
{
    #line hidden
    internal static class TypeInference
    {
        public static void CreateMudTable_0<T>(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, global::System.Collections.Generic.IEnumerable<T> __arg0, int __seq1, global::System.Boolean __arg1, int __seq2, global::System.Boolean __arg2, int __seq3, global::MudBlazor.Breakpoint __arg3, int __seq4, global::System.Boolean __arg4, int __seq5, global::System.Boolean __arg5, int __seq6, global::System.Boolean __arg6, int __seq7, global::System.String __arg7, int __seq8, global::Microsoft.AspNetCore.Components.RenderFragment __arg8, int __seq9, global::Microsoft.AspNetCore.Components.RenderFragment<T> __arg9)
        {
        __builder.OpenComponent<global::MudBlazor.MudTable<T>>(seq);
        __builder.AddComponentParameter(__seq0, nameof(global::MudBlazor.MudTable<T>.
#nullable restore
#line (7,11)-(7,16) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
Items

#line default
#line hidden
#nullable disable
        ), __arg0);
        __builder.AddComponentParameter(__seq1, nameof(global::MudBlazor.MudTable<T>.
#nullable restore
#line (7,26)-(7,40) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
MultiSelection

#line default
#line hidden
#nullable disable
        ), __arg1);
        __builder.AddComponentParameter(__seq2, nameof(global::MudBlazor.MudTable<T>.
#nullable restore
#line (7,49)-(7,54) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
Hover

#line default
#line hidden
#nullable disable
        ), __arg2);
        __builder.AddComponentParameter(__seq3, nameof(global::MudBlazor.MudTable<T>.
#nullable restore
#line (7,62)-(7,72) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
Breakpoint

#line default
#line hidden
#nullable disable
        ), __arg3);
        __builder.AddComponentParameter(__seq4, nameof(global::MudBlazor.MudTable<T>.
#nullable restore
#line (7,89)-(7,96) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
Striped

#line default
#line hidden
#nullable disable
        ), __arg4);
        __builder.AddComponentParameter(__seq5, nameof(global::MudBlazor.MudTable<T>.
#nullable restore
#line (7,104)-(7,112) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
Bordered

#line default
#line hidden
#nullable disable
        ), __arg5);
        __builder.AddComponentParameter(__seq6, nameof(global::MudBlazor.MudTable<T>.
#nullable restore
#line (8,5)-(8,17) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
CustomHeader

#line default
#line hidden
#nullable disable
        ), __arg6);
        __builder.AddComponentParameter(__seq7, nameof(global::MudBlazor.MudTable<T>.
#nullable restore
#line (8,25)-(8,36) "/run/media/yla/Dataa/Work/Programming/AllProjects/MainProgram/UI/Libs/Modules/AuthModule/Components/Pages/Roles/ManageUserRole.razor"
HeaderClass

#line default
#line hidden
#nullable disable
        ), __arg7);
        __builder.AddComponentParameter(__seq8, "HeaderContent", __arg8);
        __builder.AddComponentParameter(__seq9, "RowTemplate", __arg9);
        __builder.CloseComponent();
        }
    }
}
#pragma warning restore 1591
