82 lines
4.3 KiB
Plaintext
82 lines
4.3 KiB
Plaintext
|
|
@page "/blog/categories"
|
|||
|
|
@using Netina.AdminPanel.PWA.Utilities
|
|||
|
|
@using Netina.AdminPanel.PWA.Services.RestServices
|
|||
|
|
@attribute [Microsoft.AspNetCore.Authorization.Authorize]
|
|||
|
|
|
|||
|
|
@inject IDialogService DialogService
|
|||
|
|
@inject NavigationManager NavigationManager
|
|||
|
|
@inject ISnackbar Snackbar
|
|||
|
|
@inject IUserUtility UserUtility
|
|||
|
|
@inject IRestWrapper RestWrapper
|
|||
|
|
|
|||
|
|
<MudStack class="w-full p-8 h-screen bg-[--mud-palette-background-grey]">
|
|||
|
|
<MudGrid>
|
|||
|
|
<MudItem xs="12">
|
|||
|
|
<MudStack Row="true" class="mb-5">
|
|||
|
|
<MudText Typo="Typo.h4">دسته بندی بلاگـــــ ها</MudText>
|
|||
|
|
<MudChip Color="Color.Info" Variant="Variant.Outlined">124 عدد</MudChip>
|
|||
|
|
<MudSpacer />
|
|||
|
|
<MudButton Variant="Variant.Filled"
|
|||
|
|
DisableElevation="true"
|
|||
|
|
StartIcon="@Icons.Material.Outlined.Add"
|
|||
|
|
Color="Color.Secondary"
|
|||
|
|
OnClick="@ViewModel.AddBlogCategoryClicked"
|
|||
|
|
class="my-auto">افزودن دسته بندی</MudButton>
|
|||
|
|
</MudStack>
|
|||
|
|
<MudPaper>
|
|||
|
|
<MudDataGrid FixedFooter="true" FixedHeader="true" Striped="true"
|
|||
|
|
T="BlogCategorySDto" Items="@ViewModel.PageDto" CurrentPage="@ViewModel.CurrentPage"
|
|||
|
|
RowsPerPage="20" Filterable="false" Loading="@ViewModel.IsProcessing"
|
|||
|
|
SortMode="@SortMode.None" Groupable="false">
|
|||
|
|
|
|||
|
|
<ToolBarContent>
|
|||
|
|
<MudTextField T="string" Placeholder="جست جو بر اساس نام" Adornment="Adornment.Start" Immediate="true"
|
|||
|
|
Clearable="true"
|
|||
|
|
ValueChanged="@ViewModel.SearchChanged"
|
|||
|
|
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" class="my-auto"
|
|||
|
|
OnAdornmentClick="@ViewModel.SearchAsync"></MudTextField>
|
|||
|
|
</ToolBarContent>
|
|||
|
|
<Columns>
|
|||
|
|
<PropertyColumn Title="عنوان " Property="arg => arg.Name" />
|
|||
|
|
<PropertyColumn Title="توضیحاتــ" Property="arg => arg.Description" />
|
|||
|
|
<TemplateColumn CellClass="d-flex justify-end">
|
|||
|
|
<CellTemplate>
|
|||
|
|
<MudStack Row="true">
|
|||
|
|
<MudIconButton Icon="@Icons.Material.Filled.Edit"
|
|||
|
|
Size="@Size.Small"
|
|||
|
|
Variant="@Variant.Outlined"
|
|||
|
|
Color="@Color.Info"
|
|||
|
|
OnClick="async()=>await ViewModel.EditBlogCategoryClicked(context.Item)" />
|
|||
|
|
<MudIconButton Icon="@Icons.Material.Filled.Delete"
|
|||
|
|
Size="@Size.Small"
|
|||
|
|
Variant="@Variant.Outlined"
|
|||
|
|
OnClick="async () => await ViewModel.DeleteBlogCategoryAsync(context.Item.Id)"
|
|||
|
|
Color="@Color.Error" />
|
|||
|
|
</MudStack>
|
|||
|
|
</CellTemplate>
|
|||
|
|
</TemplateColumn>
|
|||
|
|
</Columns>
|
|||
|
|
<PagerContent>
|
|||
|
|
<MudStack Row="true" class="w-full">
|
|||
|
|
|
|||
|
|
<MudPagination Rectangular="true" Variant="Variant.Filled" Count="@ViewModel.PageCount"
|
|||
|
|
SelectedChanged="@ViewModel.ChangePageAsync" class="my-4 mx-auto" />
|
|||
|
|
</MudStack>
|
|||
|
|
|
|||
|
|
</PagerContent>
|
|||
|
|
</MudDataGrid>
|
|||
|
|
</MudPaper>
|
|||
|
|
</MudItem>
|
|||
|
|
</MudGrid>
|
|||
|
|
</MudStack>
|
|||
|
|
|
|||
|
|
@code
|
|||
|
|
{
|
|||
|
|
public BlogCategoriesPageViewModel ViewModel { get; set; }
|
|||
|
|
protected override async Task OnInitializedAsync()
|
|||
|
|
{
|
|||
|
|
ViewModel = new BlogCategoriesPageViewModel(NavigationManager, Snackbar, UserUtility, RestWrapper, DialogService);
|
|||
|
|
await ViewModel.InitializeAsync();
|
|||
|
|
await base.OnInitializedAsync();
|
|||
|
|
}
|
|||
|
|
}
|