@namespace BackOffice.Pages.Role.Components

@using MudBlazor

<MudDialog>
    <DialogContent>
        <MudStack Spacing="2">
            <MudText Typo="Typo.h6">دسترسی‌های نقش @RoleName</MudText>

            @foreach (var category in _categories)
            {
                <MudExpansionPanels Elevation="0">
                    <MudExpansionPanel Text="@category.DisplayName" Expanded="false">
                        <MudStack Spacing="1">
                            @foreach (var permission in category.Permissions)
                            {
                                <MudCheckBox T="bool"
                                             Label="@permission.DisplayName"
                                             LabelPosition="LabelPosition.End"
                                             Color="Color.Primary"
                                             Value="@_selectedPermissions.Contains(permission.Key)"
                                             ValueChanged="(checkedValue => OnPermissionChanged(checkedValue, permission.Key))" />
                            }
                        </MudStack>
                    </MudExpansionPanel>
                </MudExpansionPanels>
            }
        </MudStack>
    </DialogContent>
    <DialogActions>
        <MudButton Color="Color.Default" Variant="Variant.Text" OnClick="Cancel">
            انصراف
        </MudButton>
        <MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="SaveAsync">
            ذخیره
        </MudButton>
    </DialogActions>
</MudDialog>

