2024-05-07 11:01:57 +03:30
|
|
|
|
@page "/product/categories"
|
2024-01-22 17:26:29 +03:30
|
|
|
|
@inject IDialogService DialogService
|
|
|
|
|
|
@inject NavigationManager NavigationManager
|
|
|
|
|
|
@inject IRestWrapper RestWrapper
|
|
|
|
|
|
@inject ISnackbar Snackbar
|
|
|
|
|
|
@inject IUserUtility UserUtility
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-01 20:09:11 +03:30
|
|
|
|
<MudStack class="w-full p-8 h-screen bg-[--mud-palette-background-grey]">
|
2024-01-22 17:26:29 +03:30
|
|
|
|
<MudGrid>
|
|
|
|
|
|
<MudItem xs="12">
|
|
|
|
|
|
<MudStack Row="true" class="mb-5">
|
|
|
|
|
|
<MudText Typo="Typo.h4">دسته بندی ها</MudText>
|
|
|
|
|
|
<MudChip Color="Color.Info" Variant="Variant.Outlined">124 عدد</MudChip>
|
2024-01-28 20:51:50 +03:30
|
|
|
|
|
2024-02-22 20:34:52 +03:30
|
|
|
|
|
2024-01-28 20:51:50 +03:30
|
|
|
|
<MudSpacer/>
|
2024-01-22 17:26:29 +03:30
|
|
|
|
<MudButton Variant="Variant.Filled"
|
|
|
|
|
|
DisableElevation="true"
|
|
|
|
|
|
StartIcon="@Icons.Material.Outlined.Add"
|
|
|
|
|
|
Color="Color.Secondary"
|
2024-01-28 20:51:50 +03:30
|
|
|
|
OnClick="ViewModel.AddProductCategoryClicked"
|
2024-01-22 17:26:29 +03:30
|
|
|
|
class="my-auto">افزودن دسته بندی</MudButton>
|
|
|
|
|
|
</MudStack>
|
2024-02-22 20:34:52 +03:30
|
|
|
|
<MudPaper class="!max-h-[80vh] overflow-auto">
|
2024-01-28 20:51:50 +03:30
|
|
|
|
<MudDataGrid FixedFooter="true" FixedHeader="true" Striped="true"
|
|
|
|
|
|
T="ProductCategorySDto" Items="@ViewModel.PageDto" CurrentPage="@ViewModel.CurrentPage"
|
|
|
|
|
|
RowsPerPage="15" Filterable="false" Loading="@ViewModel.IsProcessing"
|
2024-01-22 17:26:29 +03:30
|
|
|
|
SortMode="@SortMode.None" Groupable="false">
|
|
|
|
|
|
<ToolBarContent>
|
|
|
|
|
|
<MudTextField T="string" Placeholder="جست جو بر اساس نام" Adornment="Adornment.Start" Immediate="true"
|
2024-01-28 20:51:50 +03:30
|
|
|
|
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" class="my-auto"
|
|
|
|
|
|
@bind-Value="@ViewModel.Search"
|
|
|
|
|
|
OnAdornmentClick="@ViewModel.SearchAsync"></MudTextField>
|
2024-01-22 17:26:29 +03:30
|
|
|
|
</ToolBarContent>
|
2024-01-28 20:51:50 +03:30
|
|
|
|
|
2024-01-22 17:26:29 +03:30
|
|
|
|
<Columns>
|
2024-01-28 20:51:50 +03:30
|
|
|
|
<HierarchyColumn T="ProductCategorySDto" ButtonDisabledFunc="@(x => x.Description.IsNullOrEmpty())" />
|
|
|
|
|
|
<PropertyColumn Title="نام دسته" Resizable="false" Property="arg => arg.Name"/>
|
|
|
|
|
|
@* <TemplateColumn Title="توضیحاتــ" Resizable="false" T="ProductCategorySDto">
|
|
|
|
|
|
<CellTemplate>
|
|
|
|
|
|
<p class="line-clamp-1">@context.Item.Description</p>
|
|
|
|
|
|
</CellTemplate>
|
|
|
|
|
|
</TemplateColumn> *@
|
|
|
|
|
|
<TemplateColumn Resizable="false" Title="دسته اصلی" T="ProductCategorySDto">
|
2024-01-22 17:26:29 +03:30
|
|
|
|
<CellTemplate>
|
|
|
|
|
|
@if (@context.Item.IsMain)
|
|
|
|
|
|
{
|
|
|
|
|
|
<p>بلی</p>
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
<p>خیر</p>
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
</CellTemplate>
|
|
|
|
|
|
</TemplateColumn>
|
2024-01-28 20:51:50 +03:30
|
|
|
|
<PropertyColumn Title="دسته پدر" Resizable="false" Property="arg => arg.ParentName" />
|
2024-01-22 17:26:29 +03:30
|
|
|
|
<TemplateColumn CellClass="d-flex justify-end">
|
|
|
|
|
|
<CellTemplate>
|
|
|
|
|
|
<MudStack Row="true">
|
2024-01-28 20:51:50 +03:30
|
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Edit"
|
|
|
|
|
|
Size="@Size.Small"
|
|
|
|
|
|
Variant="@Variant.Outlined"
|
|
|
|
|
|
OnClick="async () => await ViewModel.EditProductCategoryClicked(context.Item)"
|
|
|
|
|
|
Color="@Color.Info"/>
|
|
|
|
|
|
|
|
|
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Delete"
|
|
|
|
|
|
Size="@Size.Small"
|
|
|
|
|
|
Variant="@Variant.Outlined"
|
|
|
|
|
|
OnClick="async () => await ViewModel.DeleteProductCategoryAsync(context.Item.Id)"
|
|
|
|
|
|
Color="@Color.Error"/>
|
2024-01-22 17:26:29 +03:30
|
|
|
|
</MudStack>
|
|
|
|
|
|
</CellTemplate>
|
|
|
|
|
|
</TemplateColumn>
|
|
|
|
|
|
</Columns>
|
2024-01-28 20:51:50 +03:30
|
|
|
|
|
|
|
|
|
|
<ChildRowContent>
|
|
|
|
|
|
<MudCard>
|
|
|
|
|
|
<MudCardHeader>
|
|
|
|
|
|
<CardHeaderContent>
|
|
|
|
|
|
<MudText Typo="Typo.h6">توضیحاتــ</MudText>
|
|
|
|
|
|
</CardHeaderContent>
|
|
|
|
|
|
</MudCardHeader>
|
|
|
|
|
|
<MudCardContent>
|
|
|
|
|
|
<MudText>@context.Item.Description</MudText>
|
|
|
|
|
|
</MudCardContent>
|
|
|
|
|
|
</MudCard>
|
|
|
|
|
|
</ChildRowContent>
|
|
|
|
|
|
<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>
|
2024-01-22 17:26:29 +03:30
|
|
|
|
</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();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|