@using CMSMicroservice.Protobuf.Protos.Role
<MudDialog>
    <DialogContent>
        @if (_isFirstLoad)
        {
            <MudStack Justify="Justify.Center" AlignItems="AlignItems.Center">
                <MudProgressCircular Color="Color.Primary" Indeterminate="true" />
            </MudStack>

        }
        else
        {
            <MudStack>
                @foreach (var item in _roleresponse.Models.OrderBy(x=>x.Name).ToList())
                {

                    <MudCheckBox T="bool" Label="@item.Name" LabelPosition="LabelPosition.End" Color="Color.Primary" Value="@(_selectedRole.Any(x=>x == item.Id))" ValueChanged="(e)=>OnChackedChange(e,item.Id)"></MudCheckBox>
                }
            </MudStack>
        }

    </DialogContent>
    <DialogActions>
        <MudButton Color="Color.Primary" OnClick="Cancel">بستن</MudButton>
        <MudButton Color="Color.Primary" Variant="Variant.Filled" Disabled="_isLoading" OnClick="@(async () => await AddItem())">ثبت</MudButton>

    </DialogActions>
</MudDialog>