78 lines
3.7 KiB
Plaintext
78 lines
3.7 KiB
Plaintext
@page "/CategoriesPage"
|
||
@using NetinaShop.AdminPanel.PWA.Utilities
|
||
@inject IDialogService DialogService
|
||
@inject NavigationManager NavigationManager
|
||
@inject IRestWrapper RestWrapper
|
||
@inject ISnackbar Snackbar
|
||
@inject IUserUtility UserUtility
|
||
|
||
|
||
<MudStack class="w-full p-8 h-screen bg-[--color-background]">
|
||
<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.AddProductClicked"
|
||
class="my-auto">افزودن دسته بندی</MudButton>
|
||
</MudStack>
|
||
<MudPaper>
|
||
<MudDataGrid Striped="true" T="ProductCategorySDto" Items="@ViewModel.PageDto" Filterable="false" Loading="@ViewModel.IsProcessing"
|
||
SortMode="@SortMode.None" Groupable="false">
|
||
<ToolBarContent>
|
||
<MudTextField T="string" Placeholder="جست جو بر اساس نام" Adornment="Adornment.Start" Immediate="true"
|
||
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" class="my-auto"></MudTextField>
|
||
</ToolBarContent>
|
||
<Columns>
|
||
<PropertyColumn Title="نام دسته" Property="arg => arg.Name"/>
|
||
<PropertyColumn Title="توضیحاتــ" Property="arg => arg.Description"/>
|
||
<TemplateColumn Title="دسته اصلی" T="ProductCategorySDto">
|
||
<CellTemplate>
|
||
@if (@context.Item.IsMain)
|
||
{
|
||
<p>بلی</p>
|
||
}
|
||
else
|
||
{
|
||
<p>خیر</p>
|
||
|
||
}
|
||
</CellTemplate>
|
||
</TemplateColumn>
|
||
<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"></MudIconButton>
|
||
<MudIconButton Icon="@Icons.Material.Filled.Delete"
|
||
Size="@Size.Small"
|
||
Variant="@Variant.Outlined"
|
||
OnClick="async() => await ViewModel.DeleteProductCategoryAsync(context.Item.Id)"
|
||
Color="@Color.Error"></MudIconButton>
|
||
</MudStack>
|
||
</CellTemplate>
|
||
</TemplateColumn>
|
||
</Columns>
|
||
</MudDataGrid>
|
||
</MudPaper>
|
||
</MudItem>
|
||
</MudGrid>
|
||
</MudStack>
|
||
|
||
@code
|
||
{
|
||
public CategoriesPageViewModel ViewModel { get; set; }
|
||
protected override async Task OnInitializedAsync()
|
||
{
|
||
ViewModel = new CategoriesPageViewModel(NavigationManager, Snackbar, UserUtility, RestWrapper, DialogService);
|
||
await ViewModel.InitializeAsync();
|
||
await base.OnInitializedAsync();
|
||
}
|
||
|
||
}
|