feat : add english name for brands , add displayed change for products
parent
e6dd4c875e
commit
39a4299f06
|
@ -75,29 +75,8 @@
|
|||
</MudStack>
|
||||
<MudGrid>
|
||||
<MudItem sm="12">
|
||||
<RadzenHtmlEditor @bind-Value="@ViewModel.Content" class="min-h-[28rem]">
|
||||
<RadzenHtmlEditorUndo />
|
||||
<RadzenHtmlEditorRedo />
|
||||
<RadzenHtmlEditorSeparator />
|
||||
|
||||
<RadzenHtmlEditorFormatBlock />
|
||||
<RadzenHtmlEditorSeparator />
|
||||
|
||||
<RadzenHtmlEditorAlignLeft />
|
||||
<RadzenHtmlEditorAlignCenter />
|
||||
<RadzenHtmlEditorAlignRight />
|
||||
<RadzenHtmlEditorJustify />
|
||||
<RadzenHtmlEditorSeparator />
|
||||
|
||||
<RadzenHtmlEditorSource />
|
||||
<RadzenHtmlEditorBold />
|
||||
<RadzenHtmlEditorItalic />
|
||||
<RadzenHtmlEditorUnderline />
|
||||
<RadzenHtmlEditorStrikeThrough />
|
||||
<RadzenHtmlEditorRemoveFormat />
|
||||
<RadzenHtmlEditorSeparator />
|
||||
|
||||
</RadzenHtmlEditor>
|
||||
|
||||
<RichTextEditorUi @bind-Text="@ViewModel.Content" />
|
||||
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
|
|
|
@ -16,16 +16,19 @@
|
|||
<MudText Typo="Typo.caption">اطلاعات کلی دسته بندی محصول را به دقت وارد کنید</MudText>
|
||||
</MudStack>
|
||||
<MudGrid>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudTextField T="string" Label="نام برند" @bind-Value="@_name" Variant="Variant.Outlined"></MudTextField>
|
||||
<MudItem lg="6" md="6">
|
||||
<MudTextField T="string" Label="نام فارسی برند" @bind-Value="@_persianName" Variant="Variant.Outlined"></MudTextField>
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem lg="6" md="6">
|
||||
<MudTextField T="string" Label="نام انگلیسی برند" @bind-Value="@_englishName" Variant="Variant.Outlined"></MudTextField>
|
||||
</MudItem>
|
||||
<MudItem lg="6" md="6">
|
||||
<MudSelect T="bool" Label="آیا صفحه شخصی دارد ؟" @bind-Value="@_hasSpecialPage" ToStringFunc="b=>b.ToPersianString()" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
|
||||
<MudSelectItem T="bool" Value="true"></MudSelectItem>
|
||||
<MudSelectItem T="bool" Value="false" />
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem lg="6" md="6">
|
||||
<MudTextField T="string" Label="لینک صفحه شخصی برند" @bind-Value="@_pageUrl" Variant="Variant.Outlined"></MudTextField>
|
||||
</MudItem>
|
||||
<MudItem lg="12" md="12">
|
||||
|
@ -64,7 +67,8 @@
|
|||
|
||||
void Cancel() => MudDialog.Cancel();
|
||||
private bool _isProcessing = false;
|
||||
private string _name = string.Empty;
|
||||
private string _persianName = string.Empty;
|
||||
private string _englishName = string.Empty;
|
||||
private string _description = string.Empty;
|
||||
private bool _hasSpecialPage;
|
||||
private bool _isEditing;
|
||||
|
@ -77,7 +81,9 @@
|
|||
_isEditing = true;
|
||||
_hasSpecialPage = Brand.HasSpecialPage;
|
||||
_description = Brand.Description;
|
||||
_name = Brand.Name;
|
||||
_englishName = Brand.EnglishName;
|
||||
_persianName = Brand.PersianName;
|
||||
|
||||
}
|
||||
return base.OnParametersSetAsync();
|
||||
}
|
||||
|
@ -86,11 +92,11 @@
|
|||
{
|
||||
try
|
||||
{
|
||||
if (_name.IsNullOrEmpty())
|
||||
if (_englishName.IsNullOrEmpty())
|
||||
throw new AppException("لطفا نام برند را وارد کنید");
|
||||
_isProcessing = true;
|
||||
var token = await UserUtility.GetBearerTokenAsync();
|
||||
var request = new CreateBrandCommand(_name, _description, _hasSpecialPage, string.Empty, new List<StorageFileSDto>());
|
||||
var request = new CreateBrandCommand(_persianName,_englishName, _description, _hasSpecialPage, string.Empty, new List<StorageFileSDto>());
|
||||
await RestWrapper.CrudApiRest<Brand, Guid>(Address.BrandController).Create<CreateBrandCommand>(request, token);
|
||||
MudDialog.Close(DialogResult.Ok(true));
|
||||
}
|
||||
|
@ -118,12 +124,12 @@
|
|||
{
|
||||
if (Brand == null)
|
||||
throw new AppException("برند به درستی ارسال نشده است");
|
||||
if (_name.IsNullOrEmpty())
|
||||
if (_englishName.IsNullOrEmpty())
|
||||
throw new AppException("لطفا نام برند را وارد کنید");
|
||||
_isProcessing = true;
|
||||
await Task.Delay(1000);
|
||||
var token = await UserUtility.GetBearerTokenAsync();
|
||||
var request = new UpdateBrandCommand(Brand.Id, _name, _description, _hasSpecialPage, string.Empty , new List<StorageFileSDto>());
|
||||
var request = new UpdateBrandCommand(Brand.Id, _persianName,_englishName, _description, _hasSpecialPage, string.Empty , new List<StorageFileSDto>());
|
||||
await RestWrapper.CrudApiRest<Brand, Guid>(Address.BrandController).Update<UpdateBrandCommand>(request, token);
|
||||
MudDialog.Close();
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ public class DiscountActionDialogBoxViewModel : BaseViewModel<DiscountLDto>
|
|||
{
|
||||
GetProductsResponseDto response = new GetProductsResponseDto();
|
||||
if (product.IsNullOrEmpty())
|
||||
response = await _restWrapper.ProductRestApi.ReadAll(0);
|
||||
response = await _restWrapper.ProductRestApi.ReadAll(0,null,null);
|
||||
else
|
||||
response = await _restWrapper.ProductRestApi.ReadAll(product);
|
||||
_products = response.Products;
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
</MudStack>
|
||||
<MudGrid>
|
||||
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudTextField @bind-Value="@ViewModel.PageDto.PersianName" T="string" Label="نام فارسی محصول" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudTextField @bind-Value="@ViewModel.PageDto.EnglishName" T="string" Label="نام انگلیسی محصول" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
|
||||
<MudAutocomplete Required="true" ToStringFunc="dto => dto.Name" @bind-Value="@ViewModel.SelectedCategory"
|
||||
SearchFunc="ViewModel.SearchProductCategory"
|
||||
|
@ -47,9 +47,9 @@
|
|||
</ItemTemplate>
|
||||
</MudAutocomplete>
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
|
||||
<MudAutocomplete Required="true" ToStringFunc="dto => dto.Name" @bind-Value="@ViewModel.SelectedBrand"
|
||||
<MudAutocomplete Required="true" ToStringFunc="dto => dto.PersianName" @bind-Value="@ViewModel.SelectedBrand"
|
||||
SearchFunc="ViewModel.SearchBrand"
|
||||
T="BrandSDto"
|
||||
Label="برند"
|
||||
|
@ -65,43 +65,43 @@
|
|||
</MudList>
|
||||
</ProgressIndicatorInPopoverTemplate>
|
||||
<ItemTemplate Context="e">
|
||||
<p>@e.Name</p>
|
||||
<p>@e.PersianName</p>
|
||||
</ItemTemplate>
|
||||
</MudAutocomplete>
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudTextField @bind-Value="@ViewModel.PageDto.Cost" T="double" Label="قیمت محصول" Adornment="Adornment.End" Format="N0" AdornmentText="ریالــ" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudTextField @bind-Value="@ViewModel.PageDto.PackingCost" T="double" Label="مبلغ بسته بندی" Format="N0" Adornment="Adornment.End" AdornmentText="ریالــ" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudTextField @bind-Value="@ViewModel.PageDto.Stock" T="int" Format="N0" Label="موجودی انبار" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudTextField @bind-Value="@ViewModel.PageDto.MaxOrderCount" T="int" Format="N0" Label="بیشترین خرید" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudTextField @bind-Value="@ViewModel.PageDto.Warranty" T="string" Label="گارانتی" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudSelect T="bool" @bind-Value="@ViewModel.PageDto.HasExpressDelivery" Label="آیا ارسال سریع دارد ؟" ToStringFunc="b=>b.ToPersianString()" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
|
||||
<MudSelectItem T="bool" Value="true" />
|
||||
<MudSelectItem T="bool" Value="false" />
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudSelect T="bool" @bind-Value="@ViewModel.PageDto.BeDisplayed" Label="آیا نمایش داده شود است ؟" ToStringFunc="b=>b.ToPersianString()" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
|
||||
<MudSelectItem T="bool" Value="true" />
|
||||
<MudSelectItem T="bool" Value="false" />
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem lg="12" md="12">
|
||||
<MudItem sm="12" lg="12" md="12">
|
||||
<MudStack>
|
||||
<MudTextField @bind-Value="@ViewModel.PageDto.Tags" T="string" Label="تگ ها" HelperText="تگ ها را با , میتوانید جدا کنید" HelperTextOnFocus="true" Variant="Variant.Outlined" />
|
||||
</MudStack>
|
||||
</MudItem>
|
||||
<MudItem lg="12" md="12">
|
||||
<MudItem sm="12" lg="12" md="12">
|
||||
<MudTextField class="-mt-3" @bind-Value="@ViewModel.PageDto.Summery" T="string" Label="توضیحاتــ" Variant="Variant.Outlined"></MudTextField>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
|
|
|
@ -96,7 +96,7 @@ public class ProductActionDialogBoxViewModel : BaseViewModel<ProductLDto>
|
|||
productLDto.Specifications.ForEach(s => Specifications.Add(s));
|
||||
productLDto.Files.ForEach(f => Files.Add(f));
|
||||
SelectedCategory = new ProductCategorySDto { Id = productLDto.CategoryId, Name = productLDto.CategoryName };
|
||||
SelectedBrand = new BrandSDto { Id = productLDto.BrandId, Name = productLDto.BrandName };
|
||||
SelectedBrand = new BrandSDto { Id = productLDto.BrandId, PersianName = productLDto.BrandName };
|
||||
PageDto.IsSpecialOffer = productLDto.IsSpecialOffer;
|
||||
IsSpecialOffer = PageDto.IsSpecialOffer;
|
||||
if (productLDto.SpecialOffer != null)
|
||||
|
@ -177,12 +177,10 @@ public class ProductActionDialogBoxViewModel : BaseViewModel<ProductLDto>
|
|||
if (exe != null)
|
||||
_snackbar.Add(exe.Message, Severity.Error);
|
||||
_snackbar.Add(ex.Content, Severity.Error);
|
||||
_mudDialog.Cancel();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
_mudDialog.Cancel();
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -204,6 +202,8 @@ public class ProductActionDialogBoxViewModel : BaseViewModel<ProductLDto>
|
|||
throw new Exception("Token is null");
|
||||
PageDto.Specifications = Specifications.ToList();
|
||||
PageDto.Files = Files.ToList();
|
||||
PageDto.CategoryId = SelectedCategory?.Id ?? default;
|
||||
PageDto.BrandId = SelectedBrand?.Id ?? default;
|
||||
if (PageDto.IsSpecialOffer)
|
||||
{
|
||||
if (ExpireDate != null)
|
||||
|
@ -216,7 +216,7 @@ public class ProductActionDialogBoxViewModel : BaseViewModel<ProductLDto>
|
|||
await _restWrapper.CrudApiRest<Product, Guid>(Address.ProductController).Create<CreateProductCommand>(request, token);
|
||||
|
||||
_snackbar.Add($"ساخت محصول {PageDto.PersianName} با موفقیت انجام شد", Severity.Success);
|
||||
_mudDialog.Close();
|
||||
_mudDialog.Close(DialogResult.Ok(true));
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
|
@ -224,12 +224,10 @@ public class ProductActionDialogBoxViewModel : BaseViewModel<ProductLDto>
|
|||
if (exe != null)
|
||||
_snackbar.Add(exe.Message, Severity.Error);
|
||||
_snackbar.Add(ex.Content, Severity.Error);
|
||||
_mudDialog.Cancel();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
_mudDialog.Cancel();
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<head>
|
||||
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
|
||||
</head>
|
||||
<MudDialog class="mx-auto">
|
||||
<MudDialog class="mx-auto" DisableSidePadding="true">
|
||||
<DialogContent>
|
||||
<MudStack>
|
||||
<MudDivider class="-mt-3" />
|
||||
|
@ -18,16 +18,16 @@
|
|||
<MudText Typo="Typo.caption">اطلاعات کلی دسته بندی محصول را به دقت وارد کنید</MudText>
|
||||
</MudStack>
|
||||
<MudGrid>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudTextField T="string" @bind-Value="@ViewModel.Name" Label="نام دسته بندی" Variant="Variant.Outlined"></MudTextField>
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudSelect T="bool" @bind-Value="@ViewModel.IsMain" Label="آیا دسته بندی اصلی است ؟" ToStringFunc="b=>b.ToPersianString()" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
|
||||
<MudSelectItem T="bool" Value="true" />
|
||||
<MudSelectItem T="bool" Value="false" />
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem lg="4" md="6">
|
||||
<MudItem sm="12" lg="4" md="6">
|
||||
<MudAutocomplete Required="true" ToStringFunc="dto => dto.Name" @bind-Value="@ViewModel.SelectedCategory"
|
||||
SearchFunc="ViewModel.SearchCity"
|
||||
T="ProductCategorySDto"
|
||||
|
@ -48,13 +48,15 @@
|
|||
</ItemTemplate>
|
||||
</MudAutocomplete>
|
||||
</MudItem>
|
||||
<MudItem lg="12" md="12">
|
||||
<MudStack class="mt-4 mb-2" Spacing="0">
|
||||
<MudItem sm="12" lg="12" md="12">
|
||||
<MudContainer class="max-h-[20rem] lg:max-h-[25rem] overflow-y-scroll">
|
||||
<MudStack class="mt-4 mb-2" Spacing="0">
|
||||
|
||||
<MudText Typo="Typo.h6">توضیحات تکمیلی</MudText>
|
||||
<MudText Typo="Typo.caption">می توانید توضیحاتــ تکمیلی محصول را کامل وارد کنید</MudText>
|
||||
</MudStack>
|
||||
<RichTextEditorUi @bind-Text="@ViewModel.Description" />
|
||||
<MudText Typo="Typo.h6">توضیحات تکمیلی</MudText>
|
||||
<MudText Typo="Typo.caption">می توانید توضیحاتــ تکمیلی محصول را کامل وارد کنید</MudText>
|
||||
</MudStack>
|
||||
<RichTextEditorUi @bind-Text="@ViewModel.Description" />
|
||||
</MudContainer>
|
||||
</MudItem>
|
||||
|
||||
</MudGrid>
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
OnAdornmentClick="@ViewModel.SearchAsync"></MudTextField>
|
||||
</ToolBarContent>
|
||||
<Columns>
|
||||
<PropertyColumn Title="نام برند" Property="arg => arg.Name" />
|
||||
<PropertyColumn Title="نام برند" Property="arg => arg.PersianName" />
|
||||
<PropertyColumn Title="نام انگلیسی برند" Property="arg => arg.EnglishName" />
|
||||
<PropertyColumn Title="توضیحاتــ" Property="arg => arg.Description" />
|
||||
<TemplateColumn Title="صفحه اختصاصی دارد" T="BrandSDto">
|
||||
<CellTemplate>
|
||||
|
|
|
@ -58,7 +58,7 @@ public class BrandsPageViewModel : BaseViewModel<List<BrandSDto>>
|
|||
{
|
||||
DialogOptions maxWidth = new DialogOptions() { MaxWidth = MaxWidth.Medium, FullWidth = true, DisableBackdropClick = true };
|
||||
var parameters = new DialogParameters<BrandActionDialogBox> { { x => x.Brand, brand } };
|
||||
await _dialogService.ShowAsync<BrandActionDialogBox>($"ویرایش برند {brand.Name}", parameters, maxWidth);
|
||||
await _dialogService.ShowAsync<BrandActionDialogBox>($"ویرایش برند {brand.PersianName}", parameters, maxWidth);
|
||||
}
|
||||
public async Task DeleteBrandAsync(Guid selectedCategoryId)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<MudText Typo="Typo.h4">دسته بندی ها</MudText>
|
||||
<MudChip Color="Color.Info" Variant="Variant.Outlined">124 عدد</MudChip>
|
||||
|
||||
|
||||
<MudSpacer/>
|
||||
<MudButton Variant="Variant.Filled"
|
||||
DisableElevation="true"
|
||||
|
@ -22,7 +23,7 @@
|
|||
OnClick="ViewModel.AddProductCategoryClicked"
|
||||
class="my-auto">افزودن دسته بندی</MudButton>
|
||||
</MudStack>
|
||||
<MudPaper>
|
||||
<MudPaper class="!max-h-[80vh] overflow-auto">
|
||||
<MudDataGrid FixedFooter="true" FixedHeader="true" Striped="true"
|
||||
T="ProductCategorySDto" Items="@ViewModel.PageDto" CurrentPage="@ViewModel.CurrentPage"
|
||||
RowsPerPage="15" Filterable="false" Loading="@ViewModel.IsProcessing"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<MudStack Row="true" class="mb-8">
|
||||
<MudText Typo="Typo.h4">سوالات متداول فروشگاه من</MudText>
|
||||
<MudSpacer />
|
||||
<MudButton Variant="Variant.Outlined" Size="Size.Large" Color="Color.Success" OnClick="@ViewModel.SaveAsync">ذخیره سوالات</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Size="Size.Large" Color="Color.Success" OnClick="@ViewModel.SaveAsync">ذخیره سوالات</MudButton>
|
||||
</MudStack>
|
||||
<MudGrid>
|
||||
<MudItem sm="4">
|
||||
|
@ -22,8 +22,8 @@
|
|||
<MudItem sm="6">
|
||||
<MudTextField T="string" Label="پاسخ" @bind-Value="@ViewModel.Answer" Variant="Variant.Outlined"></MudTextField>
|
||||
</MudItem>
|
||||
<MudItem sm="1">
|
||||
<MudButton class="my-auto" EndIcon="@Icons.Material.Outlined.Add"
|
||||
<MudItem>
|
||||
<MudButton class="py-3 mt-2" EndIcon="@Icons.Material.Outlined.Add"
|
||||
Variant="Variant.Outlined" Size="Size.Large" Color="Color.Info" OnClick="@ViewModel.AddNewQuestion">افزودن</MudButton>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
OnClick="@ViewModel.AddDigikalaProductClicked"
|
||||
class="my-auto">افزودن محصول از دیجیکالا</MudButton> *@
|
||||
</MudStack>
|
||||
<MudPaper>
|
||||
<MudPaper class="!max-h-[80vh] overflow-auto">
|
||||
<MudDataGrid FixedFooter="true" FixedHeader="true" Striped="true"
|
||||
|
||||
T="ProductSDto" Items="@ViewModel.PageDto" CurrentPage="@ViewModel.CurrentPage"
|
||||
RowsPerPage="20" Filterable="false" Loading="@ViewModel.IsProcessing"
|
||||
|
||||
|
@ -47,8 +48,11 @@
|
|||
|
||||
<MudItem sm="6">
|
||||
<MudAutocomplete class="-mt-0.5" Required="true" ToStringFunc="dto => dto.Name"
|
||||
T="BrandSDto"
|
||||
T="ProductCategorySDto"
|
||||
Label="بر اساس دسته بندی"
|
||||
OnClearButtonClick="ViewModel.ClearProductCategorySearch"
|
||||
SearchFunc="ViewModel.SearchProductCategory"
|
||||
ValueChanged="ViewModel.ProductCategorySelected"
|
||||
Clearable="true">
|
||||
<ProgressIndicatorInPopoverTemplate>
|
||||
<MudList Clickable="false">
|
||||
|
@ -68,6 +72,12 @@
|
|||
</MudGrid>
|
||||
</ToolBarContent>
|
||||
<Columns>
|
||||
|
||||
<TemplateColumn T="ProductSDto" Title="نمایش">
|
||||
<CellTemplate>
|
||||
<MudCheckBox ValueChanged="delegate(bool flag) { context.Item.BeDisplayed = flag; ViewModel.DisplayedChanged(context.Item); }" Color="Color.Secondary" Value="@context.Item.BeDisplayed"></MudCheckBox>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<PropertyColumn Title="نام محصول" Property="arg => arg.PersianName"/>
|
||||
<PropertyColumn Title="دسته بندی" Property="arg => arg.CategoryName"/>
|
||||
<PropertyColumn Title="برند" Property="arg => arg.BrandName" />
|
||||
|
|
|
@ -30,7 +30,7 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
{
|
||||
IsProcessing = true;
|
||||
PageDto.Clear();
|
||||
var dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage);
|
||||
var dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage,null,null);
|
||||
dto.Products.ForEach(d => PageDto.Add(d));
|
||||
if (PageDto.Count == 20)
|
||||
PageCount = 2;
|
||||
|
@ -65,11 +65,11 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
GetProductsResponseDto dto = new GetProductsResponseDto();
|
||||
if (Search.IsNullOrEmpty())
|
||||
{
|
||||
dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage);
|
||||
dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage,null,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage, Search);
|
||||
dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage, Search,null);
|
||||
}
|
||||
|
||||
dto.Products.ForEach(d => PageDto.Add(d));
|
||||
|
@ -184,7 +184,12 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
CurrentPage = 0;
|
||||
PageCount = 1;
|
||||
PageDto.Clear();
|
||||
var dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage, Search);
|
||||
GetProductsResponseDto dto;
|
||||
if (SelectedCategory != null)
|
||||
dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage, Search, SelectedCategory.Id);
|
||||
else
|
||||
dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage, Search,null);
|
||||
|
||||
dto.Products.ForEach(d => PageDto.Add(d));
|
||||
if (PageDto.Count == 20)
|
||||
PageCount = 2;
|
||||
|
@ -204,4 +209,118 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
IsProcessing = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<ProductCategorySDto> _productCategories = new List<ProductCategorySDto>();
|
||||
public ProductCategorySDto? SelectedCategory;
|
||||
public async Task<IEnumerable<ProductCategorySDto>> SearchProductCategory(string category)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (category.IsNullOrEmpty())
|
||||
_productCategories = await _restWrapper.ProductCategoryRestApi.ReadAll(0);
|
||||
else
|
||||
_productCategories = await _restWrapper.ProductCategoryRestApi.ReadAll(category);
|
||||
return _productCategories;
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
var exe = await ex.GetContentAsAsync<ApiResult>();
|
||||
if (exe != null)
|
||||
_snackbar.Add(exe.Message, Severity.Error);
|
||||
_snackbar.Add(ex.Content, Severity.Error);
|
||||
return _productCategories;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
return _productCategories;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ProductCategorySelected(ProductCategorySDto productCategory)
|
||||
{
|
||||
SelectedCategory = productCategory;
|
||||
try
|
||||
{
|
||||
if (SelectedCategory == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
IsProcessing = true;
|
||||
CurrentPage = 0;
|
||||
PageCount = 1;
|
||||
PageDto.Clear();
|
||||
GetProductsResponseDto dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage, Search, SelectedCategory.Id);
|
||||
|
||||
dto.Products.ForEach(d => PageDto.Add(d));
|
||||
if (PageDto.Count == 20)
|
||||
PageCount = 2;
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
var exe = await ex.GetContentAsAsync<ApiResult>();
|
||||
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
IsProcessing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ClearProductCategorySearch()
|
||||
{
|
||||
SelectedCategory = null;
|
||||
try
|
||||
{
|
||||
IsProcessing = true;
|
||||
CurrentPage = 0;
|
||||
PageCount = 1;
|
||||
PageDto.Clear();
|
||||
GetProductsResponseDto dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage, Search, null);
|
||||
|
||||
dto.Products.ForEach(d => PageDto.Add(d));
|
||||
if (PageDto.Count == 20)
|
||||
PageCount = 2;
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
var exe = await ex.GetContentAsAsync<ApiResult>();
|
||||
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
IsProcessing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DisplayedChanged(ProductSDto product)
|
||||
{
|
||||
try
|
||||
{
|
||||
var token = await _userUtility.GetBearerTokenAsync();
|
||||
if (token == null)
|
||||
throw new Exception("Token is null");
|
||||
await _restWrapper.ProductRestApi.ChangeDisplayedAsync(product.Id, product.BeDisplayed, token);
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
var exe = await ex.GetContentAsAsync<ApiResult>();
|
||||
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ public class CustomAuthenticationStateProvider : AuthenticationStateProvider
|
|||
if (user.RoleName == "Customer")
|
||||
return new AuthenticationState(new());
|
||||
var permissions = await _userUtility.GetPermissionsAsync();
|
||||
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new Claim(ClaimTypes.Name, user.FirstName + " " + user.LastName),
|
||||
|
|
|
@ -4,15 +4,18 @@ namespace NetinaShop.AdminPanel.PWA.Services.RestServices;
|
|||
|
||||
public interface IProductRestApi
|
||||
{
|
||||
[Put("/{productId}")]
|
||||
Task<bool> ChangeDisplayedAsync(Guid productId, [Query]bool beDisplayed, [Header("Authorization")]string authorization);
|
||||
|
||||
[Get("")]
|
||||
Task<GetProductsResponseDto> ReadAll();
|
||||
[Get("/{productId}")]
|
||||
Task<GetProductResponseDto> ReadOne(Guid productId);
|
||||
[Get("")]
|
||||
Task<GetProductsResponseDto> ReadAll([Query] int page);
|
||||
[Get("")]
|
||||
Task<GetProductsResponseDto> ReadAll([Query] int page, [Query] string productName);
|
||||
|
||||
[Get("")]
|
||||
Task<GetProductsResponseDto> ReadAll([Query] string productName);
|
||||
|
||||
[Get("")]
|
||||
Task<GetProductsResponseDto> ReadAll([Query] int page, [Query] string? productName, [Query] Guid? categoryId);
|
||||
|
||||
[Get("")]
|
||||
Task<GetProductsResponseDto> ReadAll([Query] string productName, [Query] Guid categoryId);
|
||||
}
|
|
@ -1247,15 +1247,18 @@ input:checked + .toggle-bg {
|
|||
.h-screen {
|
||||
height: 100vh;
|
||||
}
|
||||
.\!max-h-\[80vh\] {
|
||||
max-height: 80vh !important;
|
||||
}
|
||||
.max-h-\[20rem\] {
|
||||
max-height: 20rem;
|
||||
}
|
||||
.max-h-\[30rem\] {
|
||||
max-height: 30rem;
|
||||
}
|
||||
.max-h-\[40rem\] {
|
||||
max-height: 40rem;
|
||||
}
|
||||
.min-h-\[28rem\] {
|
||||
min-height: 28rem;
|
||||
}
|
||||
.min-h-\[33rem\] {
|
||||
min-height: 33rem;
|
||||
}
|
||||
|
@ -1408,6 +1411,9 @@ input:checked + .toggle-bg {
|
|||
margin-right: calc(0.5rem * var(--tw-space-x-reverse));
|
||||
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
||||
}
|
||||
.overflow-auto {
|
||||
overflow: auto;
|
||||
}
|
||||
.overflow-hidden {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
@ -2077,6 +2083,10 @@ code {
|
|||
height: 38rem;
|
||||
}
|
||||
|
||||
.lg\:max-h-\[25rem\] {
|
||||
max-height: 25rem;
|
||||
}
|
||||
|
||||
.lg\:max-h-\[35rem\] {
|
||||
max-height: 35rem;
|
||||
}
|
||||
|
|
|
@ -1380,6 +1380,14 @@ input:checked + .toggle-bg {
|
|||
height: 100vh;
|
||||
}
|
||||
|
||||
.\!max-h-\[80vh\] {
|
||||
max-height: 80vh !important;
|
||||
}
|
||||
|
||||
.max-h-\[20rem\] {
|
||||
max-height: 20rem;
|
||||
}
|
||||
|
||||
.max-h-\[30rem\] {
|
||||
max-height: 30rem;
|
||||
}
|
||||
|
@ -1590,6 +1598,10 @@ input:checked + .toggle-bg {
|
|||
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
||||
}
|
||||
|
||||
.overflow-auto {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.overflow-hidden {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
@ -2386,6 +2398,10 @@ code {
|
|||
height: 38rem;
|
||||
}
|
||||
|
||||
.lg\:max-h-\[25rem\] {
|
||||
max-height: 25rem;
|
||||
}
|
||||
|
||||
.lg\:max-h-\[35rem\] {
|
||||
max-height: 35rem;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue