diff --git a/Netina.AdminPanel.PWA/Components/Originals/SideBarUi.razor b/Netina.AdminPanel.PWA/Components/Originals/SideBarUi.razor index 91080a7..4017d29 100644 --- a/Netina.AdminPanel.PWA/Components/Originals/SideBarUi.razor +++ b/Netina.AdminPanel.PWA/Components/Originals/SideBarUi.razor @@ -5,7 +5,7 @@ - + داشبورد @if (isShop) { diff --git a/Netina.AdminPanel.PWA/Dialogs/FastProductCreateDialogBox.razor b/Netina.AdminPanel.PWA/Dialogs/FastProductCreateDialogBox.razor index d90ad22..e05fe22 100644 --- a/Netina.AdminPanel.PWA/Dialogs/FastProductCreateDialogBox.razor +++ b/Netina.AdminPanel.PWA/Dialogs/FastProductCreateDialogBox.razor @@ -6,7 +6,7 @@ - + افزودن سریع محصول @@ -35,7 +35,7 @@ + + + + + + + + + + + + + + + افزودن + + + + + + + + + + + + حذف + + + + + + + + + - + ثبت محصول diff --git a/Netina.AdminPanel.PWA/Dialogs/FastProductCreateDialogBox.razor.cs b/Netina.AdminPanel.PWA/Dialogs/FastProductCreateDialogBox.razor.cs index 42ab427..154181a 100644 --- a/Netina.AdminPanel.PWA/Dialogs/FastProductCreateDialogBox.razor.cs +++ b/Netina.AdminPanel.PWA/Dialogs/FastProductCreateDialogBox.razor.cs @@ -24,7 +24,7 @@ public class FastProductCreateDialogBoxViewModel(ISnackbar snackbar, IRestWrappe { var categories = await restWrapper.ProductCategoryRestApi.ReadAll(true); categories.ForEach(c => Categories.Add(c)); - PageDto.Stock = 1; + PageDto.Stock = 10; await base.InitializeAsync(); } @@ -90,7 +90,7 @@ public class FastProductCreateDialogBoxViewModel(ISnackbar snackbar, IRestWrappe var token = await userUtility.GetBearerTokenAsync(); if (token == null) return; - var command = brand.Adapt() with {Files = new()}; + var command = brand.Adapt() with { Files = new() }; var response = await restWrapper.CrudApiRest(Address.BrandController) .Create(command, token); brand.Id = response; @@ -110,6 +110,7 @@ public class FastProductCreateDialogBoxViewModel(ISnackbar snackbar, IRestWrappe var product = PageDto.Clone(); var brand = SelectedBrand.Clone(); var browserFiles = Files.ToList(); + var specifications = Specifications.ToList(); Task.Run(async () => { var token = await userUtility.GetBearerTokenAsync(); @@ -136,19 +137,23 @@ public class FastProductCreateDialogBoxViewModel(ISnackbar snackbar, IRestWrappe FileType = StorageFileType.Image }); } + + product.Cost *= 10; var command = product.Adapt() with { BeDisplayed = true, BrandId = brand.Id, CategoryId = SelectedCategory.Id, - Files = files + Files = files, + Specifications = specifications }; await restWrapper.CrudApiRest(Address.ProductController) .Create(command, token); - + }); - PageDto = new ProductLDto{Stock = 1}; + PageDto = new ProductLDto { Stock = 1 }; FileNames.Clear(); + //Specifications.Clear(); Files.Clear(); } catch (Exception e) @@ -156,4 +161,35 @@ public class FastProductCreateDialogBoxViewModel(ISnackbar snackbar, IRestWrappe snackbar.Add(e.Message, Severity.Error); } } + + + public string SpecificationTitle = string.Empty; + public string SpecificationValue = string.Empty; + public readonly ObservableCollection Specifications = new ObservableCollection(); + + public void AddSpecification() + { + try + { + if (SpecificationTitle.IsNullOrEmpty()) + throw new AppException("عنوان ویژگی مورد نظر را وارد کنید"); + if (SpecificationValue.IsNullOrEmpty()) + throw new AppException("مقدار ویژگی مورد نظر را وارد کنید"); + Specifications.Add(new SpecificationSDto { Title = SpecificationTitle.ToString(), Value = SpecificationValue.ToString() }); + + SpecificationTitle = string.Empty; + SpecificationValue = string.Empty; + } + catch (Exception e) + { + snackbar.Add(e.Message, Severity.Error); + } + } + + public void RemoveSpecification(SpecificationSDto specification) + { + var spec = Specifications.FirstOrDefault(s => s.Value == specification.Value && s.Title == specification.Title); + if (spec != null) + Specifications.Remove(spec); + } } \ No newline at end of file diff --git a/Netina.AdminPanel.PWA/Netina.AdminPanel.PWA.csproj b/Netina.AdminPanel.PWA/Netina.AdminPanel.PWA.csproj index 34e5e88..5365d4f 100644 --- a/Netina.AdminPanel.PWA/Netina.AdminPanel.PWA.csproj +++ b/Netina.AdminPanel.PWA/Netina.AdminPanel.PWA.csproj @@ -5,8 +5,8 @@ enable enable service-worker-assets.js - 1.0.3.4 - 1.0.3.4 + 1.1.8.11 + 1.1.8.11 $(MSBuildProjectName) diff --git a/Netina.AdminPanel.PWA/Pages/CategoriesPage.razor b/Netina.AdminPanel.PWA/Pages/CategoriesPage.razor index 14ae37f..44a80c6 100644 --- a/Netina.AdminPanel.PWA/Pages/CategoriesPage.razor +++ b/Netina.AdminPanel.PWA/Pages/CategoriesPage.razor @@ -10,7 +10,7 @@ background-color: var(--mud-palette-background-grey); } *@ - + @@ -105,7 +105,7 @@ - + @code { diff --git a/Netina.AdminPanel.PWA/wwwroot/css/app.min.css b/Netina.AdminPanel.PWA/wwwroot/css/app.min.css index 4d61f44..94340a1 100644 --- a/Netina.AdminPanel.PWA/wwwroot/css/app.min.css +++ b/Netina.AdminPanel.PWA/wwwroot/css/app.min.css @@ -1784,10 +1784,6 @@ input:checked + .toggle-bg { --tw-text-opacity: 1; color: rgb(217 119 6 / var(--tw-text-opacity)); } -.text-black { - --tw-text-opacity: 1; - color: rgb(0 0 0 / var(--tw-text-opacity)); -} .text-blue-600 { --tw-text-opacity: 1; color: rgb(28 100 242 / var(--tw-text-opacity)); diff --git a/Netina.AdminPanel.PWA/wwwroot/css/app.output.css b/Netina.AdminPanel.PWA/wwwroot/css/app.output.css index 3abbb97..6556c50 100644 --- a/Netina.AdminPanel.PWA/wwwroot/css/app.output.css +++ b/Netina.AdminPanel.PWA/wwwroot/css/app.output.css @@ -1259,10 +1259,6 @@ input:checked + .toggle-bg { margin-top: -0.75rem; } -.-mt-\[3px\] { - margin-top: -3px; -} - .mb-1 { margin-bottom: 0.25rem; } @@ -1339,22 +1335,6 @@ input:checked + .toggle-bg { margin-top: 2rem; } -.-mt-\[4px\] { - margin-top: -4px; -} - -.-mt-\[2px\] { - margin-top: -2px; -} - -.-mt-\[5px\] { - margin-top: -5px; -} - -.-mt-\[0\.15rem\] { - margin-top: -0.15rem; -} - .block { display: block; } @@ -2095,11 +2075,6 @@ input:checked + .toggle-bg { color: rgb(217 119 6 / var(--tw-text-opacity)); } -.text-black { - --tw-text-opacity: 1; - color: rgb(0 0 0 / var(--tw-text-opacity)); -} - .text-blue-600 { --tw-text-opacity: 1; color: rgb(28 100 242 / var(--tw-text-opacity));