Compare commits
3 Commits
59dad6f038
...
d457803c30
Author | SHA1 | Date |
---|---|---|
|
d457803c30 | |
|
956b0421b2 | |
|
80abffa292 |
|
@ -1,8 +1,9 @@
|
|||
@inject IJSRuntime JsRuntime
|
||||
@implements IAsyncDisposable
|
||||
|
||||
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/content-styles.css" />
|
||||
<link rel="stylesheet" href="assets/vendor/ckeditor5-content.css" />
|
||||
</head>
|
||||
<style>
|
||||
.ck-content * {
|
||||
|
@ -15,65 +16,9 @@
|
|||
|
||||
</style>
|
||||
<div class="editor"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function destroyEditor() {
|
||||
// document.querySelector('.editor').ckeditorInstance.destroy();
|
||||
window.editor = null;
|
||||
}
|
||||
function lunchEditor(data) {
|
||||
if (!document.querySelector('.editor')) return
|
||||
if (window.editor) return
|
||||
ClassicEditor.create(document.querySelector('.editor'), {
|
||||
htmlSupport: {
|
||||
allow: [
|
||||
{
|
||||
name: 'iframe',
|
||||
attributes: true,
|
||||
classes: true,
|
||||
styles: true
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
.then(editor => {
|
||||
window.editor = editor;
|
||||
window.editor.setData(data);
|
||||
editor.editing.view.document.on('blur', () => {
|
||||
GLOBAL.DotNetReference.invokeMethodAsync('MyMethod', window.editor.getData());
|
||||
});
|
||||
})
|
||||
.catch(handleSampleError);
|
||||
}
|
||||
var GLOBAL = {};
|
||||
GLOBAL.DotNetReference = null;
|
||||
GLOBAL.SetDotnetReference = function (pDotNetReference) {
|
||||
GLOBAL.DotNetReference = pDotNetReference;
|
||||
};
|
||||
|
||||
|
||||
function handleSampleError(error) {
|
||||
const issueUrl = 'https://github.com/ckeditor/ckeditor5/issues';
|
||||
|
||||
const message = [
|
||||
'Oops, something went wrong!',
|
||||
`Please, report the following error on ${issueUrl} with the build id "pws0dnpd0jqj-zi42lsl7aqxa" and the error stack trace:`
|
||||
].join('\n');
|
||||
|
||||
console.error(message);
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
function setData(data) {
|
||||
if (!!window.editor.date && window.editor.data != data) {
|
||||
window.editor.setData(data);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@code {
|
||||
@code
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
@ -100,7 +45,7 @@
|
|||
{
|
||||
try
|
||||
{
|
||||
await JsRuntime.InvokeVoidAsync("window.setData", Text);
|
||||
await JsRuntime.InvokeVoidAsync("setData", Text);
|
||||
isTextSeted = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -114,20 +59,23 @@
|
|||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
|
||||
var lDotNetReference = DotNetObjectReference.Create(this);
|
||||
await JsRuntime.InvokeVoidAsync("GLOBAL.SetDotnetReference", lDotNetReference);
|
||||
await JsRuntime.InvokeVoidAsync("window.lunchEditor", Text);
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
if (firstRender)
|
||||
{
|
||||
var lDotNetReference = DotNetObjectReference.Create(this);
|
||||
await JsRuntime.InvokeVoidAsync("GLOBAL.SetDotnetReference", lDotNetReference);
|
||||
await JsRuntime.InvokeVoidAsync("initializeCKEditor", Text);
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
JsRuntime.InvokeVoidAsync("window.destroyEditor", Text);
|
||||
JsRuntime.InvokeVoidAsync("destroyEditor", Text);
|
||||
}
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
await JsRuntime.InvokeVoidAsync("window.destroyEditor", Text);
|
||||
await JsRuntime.InvokeVoidAsync("destroyEditor", Text);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -199,6 +199,7 @@
|
|||
<BaseButtonUi class="h-12 w-full rounded-md" IsProcessing="@ViewModel.IsProcessing"
|
||||
Icon="@Icons.Material.Outlined.RemoveCircle"
|
||||
Variant="Variant.Outlined" Color="Color.Error"
|
||||
OnClickCallback="ViewModel.CancelAsync"
|
||||
Content="لغو سفارش" />
|
||||
</MudItem>
|
||||
|
||||
|
|
|
@ -259,4 +259,41 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CancelAsync()
|
||||
{
|
||||
var reference = await _dialogService.ShowQuestionDialog($"ایا از کنسل کردن سفارش اطمینان دارید ?");
|
||||
var result = await reference.Result;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
try
|
||||
{
|
||||
var token = await _userUtility.GetBearerTokenAsync();
|
||||
if (token == null)
|
||||
throw new Exception("Token is null");
|
||||
IsProcessing = true;
|
||||
|
||||
|
||||
await _restWrapper.OrderRestApi.CancelOrderStepAsync(PageDto.Id, token);
|
||||
_snackbar.Add($"سفارش {PageDto.FactorCode} کنسل شد", Severity.Warning);
|
||||
_mudDialog.Close(true);
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
var exe = await ex.GetContentAsAsync<ApiResult>();
|
||||
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
_mudDialog.Cancel();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
_mudDialog.Cancel();
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
IsProcessing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,7 +235,12 @@
|
|||
|
||||
<MudItem xs="12" md="4">
|
||||
|
||||
<MudSelect Disabled="@ViewModel.IsSpecialOffer.Not()" T="DiscountAmountType" ValueChanged="@ViewModel.AmountTypeChanged" Label="نوع تخفیفـــ" ToStringFunc="b=>b.ToDisplay()" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
|
||||
<MudSelect Disabled="@ViewModel.IsSpecialOffer.Not()" T="DiscountAmountType"
|
||||
ValueChanged="@ViewModel.AmountTypeChanged"
|
||||
Label="نوع تخفیفـــ" ToStringFunc="b=>b.ToDisplay()"
|
||||
Variant="Variant.Outlined"
|
||||
Value="@ViewModel.Discount.AmountType"
|
||||
AnchorOrigin="Origin.BottomCenter">
|
||||
<MudSelectItem T="DiscountAmountType" Value="DiscountAmountType.Percent" />
|
||||
<MudSelectItem T="DiscountAmountType" Value="DiscountAmountType.Amount" />
|
||||
</MudSelect>
|
||||
|
@ -251,11 +256,11 @@
|
|||
|
||||
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudDatePicker Disabled="@ViewModel.IsSpecialOffer.Not()" @bind-Date="@ViewModel.StartDate" UseShortNames="false" TitleDateFormat="dddd, dd MMMM" Label="تاریخ شروع تخفیفــ" Variant="Variant.Outlined" Culture="@PersianCultureInfo.GetPersianCulture()" />
|
||||
|
||||
<MudDatePicker Disabled="@ViewModel.IsSpecialOffer.Not()" @bind-Date="@ViewModel.StartDate" DisableToolbar="true" UseShortNames="false" TitleDateFormat="dddd, dd MMMM" Label="تاریخ شروع تخفیفــ" Variant="Variant.Outlined" Culture="@PersianCultureInfo.GetPersianCulture()" />
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudDatePicker Disabled="@ViewModel.IsSpecialOffer.Not()" @bind-Date="@ViewModel.ExpireDate" UseShortNames="false" TitleDateFormat="dddd, dd MMMM" Label="تاریخ پایان تخفیفــ" Variant="Variant.Outlined" Culture="@PersianCultureInfo.GetPersianCulture()" />
|
||||
<MudDatePicker Disabled="@ViewModel.IsSpecialOffer.Not()" @bind-Date="@ViewModel.ExpireDate" DisableToolbar="true" UseShortNames="false" TitleDateFormat="dddd, dd MMMM" Label="تاریخ پایان تخفیفــ" Variant="Variant.Outlined" Culture="@PersianCultureInfo.GetPersianCulture()" />
|
||||
|
||||
</MudItem>
|
||||
|
||||
|
|
|
@ -61,11 +61,13 @@ public class ProductActionDialogBoxViewModel : BaseViewModel<ProductLDto>
|
|||
{
|
||||
_isSpecialOffer = value;
|
||||
PageDto.IsSpecialOffer = value;
|
||||
if(!value)
|
||||
if (!value)
|
||||
{
|
||||
IsAmountType = value;
|
||||
IsPercentType = value;
|
||||
}
|
||||
else if(!IsAmountType)
|
||||
IsPercentType = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,6 +110,7 @@ public class ProductActionDialogBoxViewModel : BaseViewModel<ProductLDto>
|
|||
|
||||
ExpireDate = Discount.ExpireDate;
|
||||
StartDate = Discount.StartDate;
|
||||
IsSpecialOffer = true;
|
||||
}
|
||||
}
|
||||
catch (ApiException ex)
|
||||
|
@ -236,10 +239,12 @@ public class ProductActionDialogBoxViewModel : BaseViewModel<ProductLDto>
|
|||
case DiscountAmountType.Amount:
|
||||
IsAmountType = true;
|
||||
IsPercentType = false;
|
||||
Discount.AmountType = DiscountAmountType.Amount;
|
||||
break;
|
||||
case DiscountAmountType.Percent:
|
||||
IsAmountType = false;
|
||||
IsPercentType = true;
|
||||
Discount.AmountType = DiscountAmountType.Percent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="wwwroot\assets\vendor\ckeditor5.css.map" />
|
||||
<None Include="wwwroot\assets\vendor\ckeditor5.js" />
|
||||
<None Include="wwwroot\assets\vendor\ckeditor5.js.map" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Append.Blazor.Printing" Version="6.3.0" />
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.4.0" />
|
||||
|
@ -55,7 +61,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Netina\Netina.Domain\Netina.Domain.csproj" />
|
||||
<ProjectReference Include="..\..\Api\Netina.Domain\Netina.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -134,7 +134,6 @@
|
|||
</TemplateColumn>
|
||||
<PropertyColumn Title="نام محصول" Property="arg => arg.PersianName" />
|
||||
<PropertyColumn Title="دسته بندی" Property="arg => arg.CategoryName" />
|
||||
<PropertyColumn Title="برند" Property="arg => arg.BrandName" />
|
||||
<TemplateColumn T="ProductSDto" Title="پیشنهاد ویژه است">
|
||||
<CellTemplate>
|
||||
@if (@context.Item.IsSpecial)
|
||||
|
@ -165,7 +164,15 @@
|
|||
|
||||
<TemplateColumn T="ProductSDto" Title="قیمتــ">
|
||||
<CellTemplate>
|
||||
<p>@context.Item.Cost.ToString("N0") ریالــ</p>
|
||||
<MudTextField class="-mt-2"
|
||||
Format="N0"
|
||||
T="double"
|
||||
ValueChanged="async(cost) => await ViewModel.ChangeProductCostAsync(context.Item,cost)"
|
||||
AdornmentText="ریالــ"
|
||||
Immediate="false"
|
||||
AdornmentIcon="@Icons.Material.Filled.Check"
|
||||
Adornment="Adornment.End"
|
||||
Value="context.Item.Cost"></MudTextField>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn CellClass="d-flex justify-end">
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
using MudBlazor.Services;
|
||||
using Netina.Domain.Entities.Products;
|
||||
|
||||
namespace Netina.AdminPanel.PWA.Pages;
|
||||
|
||||
public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductSDto>>
|
||||
public class ProductsPageViewModel(
|
||||
NavigationManager navigationManager,
|
||||
ISnackbar snackbar,
|
||||
IUserUtility userUtility,
|
||||
IRestWrapper restWrapper,
|
||||
IDialogService dialogService,
|
||||
IBrowserViewportService browserViewportService)
|
||||
: BaseViewModel<ObservableCollection<ProductSDto>>(userUtility)
|
||||
{
|
||||
private readonly NavigationManager _navigationManager;
|
||||
private readonly ISnackbar _snackbar;
|
||||
private readonly IUserUtility _userUtility;
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly IBrowserViewportService _browserViewportService;
|
||||
private readonly IRestWrapper _restWrapper;
|
||||
private readonly NavigationManager _navigationManager = navigationManager;
|
||||
private readonly IUserUtility _userUtility = userUtility;
|
||||
|
||||
public string? Search = string.Empty;
|
||||
public int CurrentPage = 0;
|
||||
|
@ -18,22 +22,6 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
public bool IsXs = false;
|
||||
public bool IsEnable { get; set; } = true;
|
||||
|
||||
public ProductsPageViewModel(NavigationManager navigationManager,
|
||||
ISnackbar snackbar,
|
||||
IUserUtility userUtility,
|
||||
IRestWrapper restWrapper,
|
||||
IDialogService dialogService,
|
||||
IBrowserViewportService browserViewportService) : base(userUtility)
|
||||
{
|
||||
_navigationManager = navigationManager;
|
||||
_snackbar = snackbar;
|
||||
_userUtility = userUtility;
|
||||
_restWrapper = restWrapper;
|
||||
_dialogService = dialogService;
|
||||
_browserViewportService = browserViewportService;
|
||||
|
||||
}
|
||||
|
||||
public override async Task InitializeAsync()
|
||||
{
|
||||
await GetEntitiesAsync();
|
||||
|
@ -50,21 +38,21 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
IsProcessing = true;
|
||||
PageDto.Clear();
|
||||
var search = Search.IsNullOrEmpty() ? null : Search;
|
||||
var dto = await _restWrapper.ProductRestApi.ReadAll(CurrentPage, search, SelectedCategory?.Id, IsEnable);
|
||||
var dto = await restWrapper.ProductRestApi.ReadAll(CurrentPage, search, SelectedCategory?.Id, IsEnable);
|
||||
dto.Products.ForEach(d => PageDto.Add(d));
|
||||
if (PageDto.Count % 20 == 0)
|
||||
PageCount = CurrentPage + 2;
|
||||
TotalItems = dto.Pager.TotalItems;
|
||||
IsXs = (await _browserViewportService.GetCurrentBreakpointAsync()) == Breakpoint.Xs;
|
||||
IsXs = (await browserViewportService.GetCurrentBreakpointAsync()) == Breakpoint.Xs;
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
var exe = await ex.GetContentAsAsync<ApiResult>();
|
||||
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
snackbar.Add(e.Message, Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -82,10 +70,10 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
public async Task AddProductClicked()
|
||||
{
|
||||
DialogOptions maxWidth = new DialogOptions() { MaxWidth = MaxWidth.Large, FullWidth = true, DisableBackdropClick = true };
|
||||
var breakPoint = await _browserViewportService.GetCurrentBreakpointAsync();
|
||||
var breakPoint = await browserViewportService.GetCurrentBreakpointAsync();
|
||||
if (breakPoint == Breakpoint.Xs)
|
||||
maxWidth = new DialogOptions { FullScreen = true, CloseButton = true };
|
||||
var dialogResult = await _dialogService.ShowAsync<ProductActionDialogBox>("افزودن محصول جدید", maxWidth);
|
||||
var dialogResult = await dialogService.ShowAsync<ProductActionDialogBox>("افزودن محصول جدید", maxWidth);
|
||||
var result = await dialogResult.Result;
|
||||
if (!result.Canceled && result.Data is bool and true)
|
||||
{
|
||||
|
@ -97,10 +85,10 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
public async Task AddFastProductClicked()
|
||||
{
|
||||
DialogOptions maxWidth = new DialogOptions() { MaxWidth = MaxWidth.Large, FullWidth = true, NoHeader = true, DisableBackdropClick = true, CloseButton = true };
|
||||
var breakPoint = await _browserViewportService.GetCurrentBreakpointAsync();
|
||||
var breakPoint = await browserViewportService.GetCurrentBreakpointAsync();
|
||||
if (breakPoint == Breakpoint.Xs)
|
||||
maxWidth = new DialogOptions { FullScreen = true, NoHeader = true, CloseButton = true };
|
||||
var dialogResult = await _dialogService.ShowAsync<FastProductCreateDialogBox>("افزودن محصول جدید", maxWidth);
|
||||
var dialogResult = await dialogService.ShowAsync<FastProductCreateDialogBox>("افزودن محصول جدید", maxWidth);
|
||||
var result = await dialogResult.Result;
|
||||
if (!result.Canceled && result.Data is bool and true)
|
||||
{
|
||||
|
@ -111,7 +99,7 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
{
|
||||
|
||||
DialogOptions maxWidth = new DialogOptions() { MaxWidth = MaxWidth.Medium, FullWidth = true, DisableBackdropClick = true };
|
||||
var dialogResult = await _dialogService.ShowAsync<DigikalaProductActionDialogBox>("افزودن محصول جدید", maxWidth);
|
||||
var dialogResult = await dialogService.ShowAsync<DigikalaProductActionDialogBox>("افزودن محصول جدید", maxWidth);
|
||||
var result = await dialogResult.Result;
|
||||
if (!result.Canceled && result.Data is bool and true)
|
||||
{
|
||||
|
@ -122,12 +110,12 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
public async Task EditProductClicked(ProductSDto product)
|
||||
{
|
||||
DialogOptions maxWidth = new DialogOptions() { MaxWidth = MaxWidth.Large, FullWidth = true, DisableBackdropClick = true };
|
||||
var breakPoint = await _browserViewportService.GetCurrentBreakpointAsync();
|
||||
var breakPoint = await browserViewportService.GetCurrentBreakpointAsync();
|
||||
if (breakPoint == Breakpoint.Xs)
|
||||
maxWidth = new DialogOptions { FullScreen = true, CloseButton = true };
|
||||
var parameters = new DialogParameters<ProductActionDialogBox>();
|
||||
parameters.Add(x => x.Product, product);
|
||||
var dialogResult = await _dialogService.ShowAsync<ProductActionDialogBox>($"ویرایش محصول {product.PersianName}", parameters, maxWidth);
|
||||
var dialogResult = await dialogService.ShowAsync<ProductActionDialogBox>($"ویرایش محصول {product.PersianName}", parameters, maxWidth);
|
||||
var result = await dialogResult.Result;
|
||||
if (!result.Canceled && result.Data is bool and true)
|
||||
{
|
||||
|
@ -137,7 +125,7 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
|
||||
public async Task DeleteProductAsync(Guid selectedCategoryId)
|
||||
{
|
||||
var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف محصول اطمینان دارید ?");
|
||||
var reference = await dialogService.ShowQuestionDialog($"آیا از حذف محصول اطمینان دارید ?");
|
||||
var result = await reference.Result;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
|
@ -147,20 +135,20 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
|
||||
IsProcessing = true;
|
||||
var token = await _userUtility.GetBearerTokenAsync();
|
||||
await _restWrapper.CrudDtoApiRest<Product, ProductSDto, Guid>(Address.ProductController)
|
||||
await restWrapper.CrudDtoApiRest<Product, ProductSDto, Guid>(Address.ProductController)
|
||||
.Delete(selectedCategoryId, token);
|
||||
_snackbar.Add("حذف محصول با موفقیت انجام شد", Severity.Success);
|
||||
snackbar.Add("حذف محصول با موفقیت انجام شد", Severity.Success);
|
||||
await InitializeAsync();
|
||||
|
||||
}
|
||||
catch (ApiException ex)
|
||||
{
|
||||
var exe = await ex.GetContentAsAsync<ApiResult>();
|
||||
_snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
snackbar.Add(e.Message, Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -185,22 +173,22 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
try
|
||||
{
|
||||
if (category.IsNullOrEmpty())
|
||||
_productCategories = await _restWrapper.ProductCategoryRestApi.ReadAll(0);
|
||||
_productCategories = await restWrapper.ProductCategoryRestApi.ReadAll(0);
|
||||
else
|
||||
_productCategories = await _restWrapper.ProductCategoryRestApi.ReadAll(category);
|
||||
_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);
|
||||
snackbar.Add(exe.Message, Severity.Error);
|
||||
snackbar.Add(ex.Content, Severity.Error);
|
||||
return _productCategories;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
snackbar.Add(e.Message, Severity.Error);
|
||||
return _productCategories;
|
||||
}
|
||||
}
|
||||
|
@ -224,16 +212,16 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
var token = await _userUtility.GetBearerTokenAsync();
|
||||
if (token == null)
|
||||
throw new Exception("Token is null");
|
||||
await _restWrapper.ProductRestApi.ChangeDisplayedAsync(product.Id, product.BeDisplayed, token);
|
||||
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);
|
||||
snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_snackbar.Add(e.Message, Severity.Error);
|
||||
snackbar.Add(e.Message, Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,4 +233,28 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
|
|||
CurrentPage = 0;
|
||||
await GetEntitiesAsync();
|
||||
}
|
||||
|
||||
public async Task ChangeProductCostAsync(ProductSDto product,double cost)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var token = await _userUtility.GetBearerTokenAsync();
|
||||
if (token == null)
|
||||
throw new Exception("Token is null");
|
||||
await restWrapper.ProductRestApi.ChangeCostAsync(product.Id, cost, token);
|
||||
product.Cost = cost;
|
||||
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,6 +16,9 @@ public interface IOrderRestApi
|
|||
|
||||
[Post("/{id}/confirm")]
|
||||
Task<bool> ConfirmOrderStepAsync(Guid id,[Query] OrderStatus nextOrderStatus, [Header("Authorization")] string authorization);
|
||||
|
||||
[Post("/{id}/cancel")]
|
||||
Task<bool> CancelOrderStepAsync(Guid id ,[Header("Authorization")] string authorization);
|
||||
[Post("/{id}/confirm")]
|
||||
Task<bool> ConfirmOrderStepAsync(Guid id, [Query] OrderStatus nextOrderStatus, [Query]string trackingCode, [Header("Authorization")] string authorization);
|
||||
}
|
|
@ -2,9 +2,13 @@
|
|||
|
||||
public interface IProductRestApi
|
||||
{
|
||||
[Put("/{productId}")]
|
||||
[Put("/{productId}/displayed")]
|
||||
Task<bool> ChangeDisplayedAsync(Guid productId, [Query]bool beDisplayed, [Header("Authorization")]string authorization);
|
||||
|
||||
[Put("/{productId}/cost")]
|
||||
Task<bool> ChangeCostAsync(Guid productId, [Query] double cost, [Header("Authorization")] string authorization);
|
||||
|
||||
|
||||
[Get("/{productId}")]
|
||||
Task<GetProductResponseDto> ReadOne(Guid productId);
|
||||
|
||||
|
|
|
@ -1,27 +1,5 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@ckeditor/ckeditor5-alignment": "41.0.0",
|
||||
"@ckeditor/ckeditor5-autoformat": "41.0.0",
|
||||
"@ckeditor/ckeditor5-basic-styles": "41.0.0",
|
||||
"@ckeditor/ckeditor5-block-quote": "41.0.0",
|
||||
"@ckeditor/ckeditor5-editor-classic": "41.0.0",
|
||||
"@ckeditor/ckeditor5-essentials": "41.0.0",
|
||||
"@ckeditor/ckeditor5-font": "41.0.0",
|
||||
"@ckeditor/ckeditor5-heading": "41.0.0",
|
||||
"@ckeditor/ckeditor5-horizontal-line": "41.0.0",
|
||||
"@ckeditor/ckeditor5-html-support": "^41.0.0",
|
||||
"@ckeditor/ckeditor5-image": "41.0.0",
|
||||
"@ckeditor/ckeditor5-indent": "41.0.0",
|
||||
"@ckeditor/ckeditor5-link": "41.0.0",
|
||||
"@ckeditor/ckeditor5-list": "41.0.0",
|
||||
"@ckeditor/ckeditor5-media-embed": "41.0.0",
|
||||
"@ckeditor/ckeditor5-paragraph": "41.0.0",
|
||||
"@ckeditor/ckeditor5-paste-from-office": "41.0.0",
|
||||
"@ckeditor/ckeditor5-table": "41.0.0",
|
||||
"@ckeditor/ckeditor5-typing": "41.0.0",
|
||||
"@ckeditor/ckeditor5-undo": "41.0.0",
|
||||
"@ckeditor/ckeditor5-upload": "41.0.0",
|
||||
"@ckeditor/ckeditor5-word-count": "41.0.0",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"flowbite": "^2.2.1",
|
||||
"postcss": "^8.4.33",
|
||||
|
|
|
@ -29,7 +29,6 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
plugins: [
|
||||
require('@tailwindcss/typography'),
|
||||
require('flowbite/plugin')
|
||||
],
|
||||
}
|
||||
|
|
|
@ -8,10 +8,16 @@
|
|||
"Microsoft.AspNetCore.Http.Connections": "Debug"
|
||||
}
|
||||
},
|
||||
"WebSiteUrl": "https://bonsaigallery.shop",
|
||||
"AdminPanelBaseUrl": "https://admin.bonsaigallery.shop",
|
||||
"StorageBaseUrl": "https://storage.bonsaigallery.shop",
|
||||
"ApiUrl": "https://api.bonsaigallery.shop/api",
|
||||
"WebSiteUrl": "https://vesmeh.com",
|
||||
"AdminPanelBaseUrl": "https://admin.vesmeh.com",
|
||||
"StorageBaseUrl": "https://storage.vesmeh.com",
|
||||
//"ApiUrl": "https://api.vesmeh.com/api",
|
||||
"ApiUrl": "http://localhost:32770/api",
|
||||
|
||||
//"WebSiteUrl": "https://bonsaigallery.shop",
|
||||
//"AdminPanelBaseUrl": "https://admin.bonsaigallery.shop",
|
||||
//"StorageBaseUrl": "https://storage.bonsaigallery.shop",
|
||||
//"ApiUrl": "https://api.bonsaigallery.shop/api",
|
||||
"IsShop": true
|
||||
//"ApiUrl": "http://localhost:32770/api"
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,322 @@
|
|||
import {
|
||||
ClassicEditor,
|
||||
AccessibilityHelp,
|
||||
Alignment,
|
||||
Autoformat,
|
||||
AutoImage,
|
||||
AutoLink,
|
||||
Autosave,
|
||||
BalloonToolbar,
|
||||
BlockQuote,
|
||||
Bold,
|
||||
CodeBlock,
|
||||
Essentials,
|
||||
FindAndReplace,
|
||||
FontBackgroundColor,
|
||||
FontColor,
|
||||
FontFamily,
|
||||
FontSize,
|
||||
Heading,
|
||||
Highlight,
|
||||
HorizontalLine,
|
||||
HtmlEmbed,
|
||||
ImageBlock,
|
||||
ImageCaption,
|
||||
ImageInline,
|
||||
ImageInsert,
|
||||
ImageInsertViaUrl,
|
||||
ImageResize,
|
||||
ImageStyle,
|
||||
ImageTextAlternative,
|
||||
ImageToolbar,
|
||||
ImageUpload,
|
||||
Indent,
|
||||
IndentBlock,
|
||||
Italic,
|
||||
Link,
|
||||
LinkImage,
|
||||
List,
|
||||
ListProperties,
|
||||
MediaEmbed,
|
||||
Paragraph,
|
||||
PasteFromOffice,
|
||||
SelectAll,
|
||||
ShowBlocks,
|
||||
SimpleUploadAdapter,
|
||||
SourceEditing,
|
||||
SpecialCharacters,
|
||||
SpecialCharactersArrows,
|
||||
SpecialCharactersCurrency,
|
||||
SpecialCharactersEssentials,
|
||||
SpecialCharactersLatin,
|
||||
SpecialCharactersMathematical,
|
||||
SpecialCharactersText,
|
||||
Strikethrough,
|
||||
Table,
|
||||
TableCaption,
|
||||
TableCellProperties,
|
||||
TableColumnResize,
|
||||
TableProperties,
|
||||
TableToolbar,
|
||||
TextTransformation,
|
||||
TodoList,
|
||||
Underline,
|
||||
Undo
|
||||
} from '/assets/vendor/ckeditor5.js';
|
||||
const editorConfig = {
|
||||
toolbar: {
|
||||
items: [
|
||||
'undo',
|
||||
'redo',
|
||||
'|',
|
||||
'sourceEditing',
|
||||
'showBlocks',
|
||||
'findAndReplace',
|
||||
'selectAll',
|
||||
'|',
|
||||
'heading',
|
||||
'|',
|
||||
'fontSize',
|
||||
'fontFamily',
|
||||
'fontColor',
|
||||
'fontBackgroundColor',
|
||||
'|',
|
||||
'bold',
|
||||
'italic',
|
||||
'underline',
|
||||
'strikethrough',
|
||||
'|',
|
||||
'specialCharacters',
|
||||
'horizontalLine',
|
||||
'link',
|
||||
'insertImage',
|
||||
'mediaEmbed',
|
||||
'insertTable',
|
||||
'highlight',
|
||||
'blockQuote',
|
||||
'codeBlock',
|
||||
'htmlEmbed',
|
||||
'|',
|
||||
'alignment',
|
||||
'|',
|
||||
'bulletedList',
|
||||
'numberedList',
|
||||
'todoList',
|
||||
'outdent',
|
||||
'indent',
|
||||
'|',
|
||||
'accessibilityHelp'
|
||||
],
|
||||
shouldNotGroupWhenFull: true
|
||||
},
|
||||
plugins: [
|
||||
AccessibilityHelp,
|
||||
Alignment,
|
||||
Autoformat,
|
||||
AutoImage,
|
||||
AutoLink,
|
||||
Autosave,
|
||||
BalloonToolbar,
|
||||
BlockQuote,
|
||||
Bold,
|
||||
CodeBlock,
|
||||
Essentials,
|
||||
FindAndReplace,
|
||||
FontBackgroundColor,
|
||||
FontColor,
|
||||
FontFamily,
|
||||
FontSize,
|
||||
Heading,
|
||||
Highlight,
|
||||
HorizontalLine,
|
||||
HtmlEmbed,
|
||||
ImageBlock,
|
||||
ImageCaption,
|
||||
ImageInline,
|
||||
ImageInsert,
|
||||
ImageInsertViaUrl,
|
||||
ImageResize,
|
||||
ImageStyle,
|
||||
ImageTextAlternative,
|
||||
ImageToolbar,
|
||||
ImageUpload,
|
||||
Indent,
|
||||
IndentBlock,
|
||||
Italic,
|
||||
Link,
|
||||
LinkImage,
|
||||
List,
|
||||
ListProperties,
|
||||
MediaEmbed,
|
||||
Paragraph,
|
||||
PasteFromOffice,
|
||||
SelectAll,
|
||||
ShowBlocks,
|
||||
SimpleUploadAdapter,
|
||||
SourceEditing,
|
||||
SpecialCharacters,
|
||||
SpecialCharactersArrows,
|
||||
SpecialCharactersCurrency,
|
||||
SpecialCharactersEssentials,
|
||||
SpecialCharactersLatin,
|
||||
SpecialCharactersMathematical,
|
||||
SpecialCharactersText,
|
||||
Strikethrough,
|
||||
Table,
|
||||
TableCaption,
|
||||
TableCellProperties,
|
||||
TableColumnResize,
|
||||
TableProperties,
|
||||
TableToolbar,
|
||||
TextTransformation,
|
||||
TodoList,
|
||||
Underline,
|
||||
Undo
|
||||
],
|
||||
simpleUpload: {
|
||||
uploadUrl: 'https://api.vesmeh.com/api/file/ckeditor',
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
Authorization: 'xuwp4KzU1/YBoevpzgH0cz8+zLKQ+EOaYXeo4JtRxmVIuN7Hqxz97oQ398tNX68+'
|
||||
}
|
||||
},
|
||||
balloonToolbar: ['bold', 'italic', '|', 'link', 'insertImage', '|', 'bulletedList', 'numberedList'],
|
||||
fontFamily: {
|
||||
supportAllValues: true
|
||||
},
|
||||
fontSize: {
|
||||
options: [10, 12, 14, 'default', 18, 20, 22],
|
||||
supportAllValues: true
|
||||
},
|
||||
heading: {
|
||||
options: [
|
||||
{
|
||||
model: 'paragraph',
|
||||
title: 'Paragraph',
|
||||
class: 'ck-heading_paragraph'
|
||||
},
|
||||
{
|
||||
model: 'heading1',
|
||||
view: 'h1',
|
||||
title: 'Heading 1',
|
||||
class: 'ck-heading_heading1'
|
||||
},
|
||||
{
|
||||
model: 'heading2',
|
||||
view: 'h2',
|
||||
title: 'Heading 2',
|
||||
class: 'ck-heading_heading2'
|
||||
},
|
||||
{
|
||||
model: 'heading3',
|
||||
view: 'h3',
|
||||
title: 'Heading 3',
|
||||
class: 'ck-heading_heading3'
|
||||
},
|
||||
{
|
||||
model: 'heading4',
|
||||
view: 'h4',
|
||||
title: 'Heading 4',
|
||||
class: 'ck-heading_heading4'
|
||||
},
|
||||
{
|
||||
model: 'heading5',
|
||||
view: 'h5',
|
||||
title: 'Heading 5',
|
||||
class: 'ck-heading_heading5'
|
||||
},
|
||||
{
|
||||
model: 'heading6',
|
||||
view: 'h6',
|
||||
title: 'Heading 6',
|
||||
class: 'ck-heading_heading6'
|
||||
}
|
||||
]
|
||||
},
|
||||
image: {
|
||||
toolbar: [
|
||||
'toggleImageCaption',
|
||||
'imageTextAlternative',
|
||||
'|',
|
||||
'imageStyle:inline',
|
||||
'imageStyle:wrapText',
|
||||
'imageStyle:breakText',
|
||||
'|',
|
||||
'resizeImage'
|
||||
]
|
||||
},
|
||||
link: {
|
||||
addTargetToExternalLinks: true,
|
||||
defaultProtocol: 'https://',
|
||||
decorators: {
|
||||
toggleDownloadable: {
|
||||
mode: 'manual',
|
||||
label: 'Downloadable',
|
||||
attributes: {
|
||||
download: 'file'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
list: {
|
||||
properties: {
|
||||
styles: true,
|
||||
startIndex: true,
|
||||
reversed: true
|
||||
}
|
||||
},
|
||||
placeholder: 'متن خود را بنویسید یا کپی کنید',
|
||||
table: {
|
||||
contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells', 'tableProperties', 'tableCellProperties']
|
||||
},
|
||||
language: {
|
||||
ui: 'en',
|
||||
content: 'ar'
|
||||
}
|
||||
};
|
||||
export function initializeCKEditor(data) {
|
||||
if (!document.querySelector('.editor')) return;
|
||||
if (window.editor) return;
|
||||
|
||||
ClassicEditor.create(document.querySelector('.editor'), editorConfig)
|
||||
.then(editor => {
|
||||
window.editor = editor;
|
||||
window.editor.setData(data);
|
||||
editor.editing.view.document.on('blur', () => {
|
||||
if (GLOBAL.DotNetReference) {
|
||||
GLOBAL.DotNetReference.invokeMethodAsync('MyMethod', window.editor.getData());
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(handleSampleError);
|
||||
}
|
||||
|
||||
export function destroyEditor() {
|
||||
if (window.editor) {
|
||||
window.editor.destroy();
|
||||
window.editor = null;
|
||||
}
|
||||
}
|
||||
|
||||
export function setData(data) {
|
||||
if (window.editor) {
|
||||
window.editor.setData(data);
|
||||
}
|
||||
}
|
||||
|
||||
function handleSampleError(error) {
|
||||
const issueUrl = 'https://github.com/ckeditor/ckeditor5/issues';
|
||||
const message = [
|
||||
'Oops, something went wrong!',
|
||||
`Please, report the following error on ${issueUrl} with the build id "pws0dnpd0jqj-zi42lsl7aqxa" and the error stack trace:`
|
||||
].join('\n');
|
||||
console.error(message);
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
export var GLOBAL = {
|
||||
DotNetReference: null,
|
||||
SetDotnetReference: function (pDotNetReference) {
|
||||
this.DotNetReference = pDotNetReference;
|
||||
}
|
||||
};
|
|
@ -11,6 +11,7 @@
|
|||
<script src="https://unpkg.com/@dotlottie/player-component@latest/dist/dotlottie-player.mjs" type="module"></script>
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<link rel="stylesheet" href="css/CKEditor.css" />
|
||||
<link rel="stylesheet" href="assets/vendor/ckeditor5.css">
|
||||
<link href="manifest.webmanifest" rel="manifest" />
|
||||
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
|
||||
<link rel="apple-touch-icon" sizes="192x192" href="icon-192.png" />
|
||||
|
@ -43,11 +44,20 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div dir="rtl" id="blazor-error-ui" class="!text-black !z-[9999]">
|
||||
<div id="blazor-error-ui" class="!text-black !z-[9999]">
|
||||
<b>مشکلی رخ داده است</b>
|
||||
<a href="" class="reload">بارگزاری مجدد</a>
|
||||
<a class="dismiss">بستن</a>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import { initializeCKEditor, destroyEditor, setData, GLOBAL } from './ckeditor5New.js';
|
||||
window.initializeCKEditor = initializeCKEditor;
|
||||
window.destroyEditor = destroyEditor;
|
||||
window.setData = setData;
|
||||
window.GLOBAL = GLOBAL;
|
||||
</script>
|
||||
|
||||
<script src="_framework/blazor.webassembly.js"></script>
|
||||
|
||||
<script src="aes-js-3.1.2.js"></script>
|
||||
|
@ -104,7 +114,6 @@
|
|||
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||
<script src="_content/Toolbelt.Blazor.PWA.Updater.Service/script.min.js"></script>
|
||||
<script src="ckeditor.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ VisualStudioVersion = 17.8.34316.72
|
|||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netina.AdminPanel.PWA", "Netina.AdminPanel.PWA\Netina.AdminPanel.PWA.csproj", "{EB154E26-A392-4521-B26D-1B82C8597201}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netina.Domain", "..\Netina\Netina.Domain\Netina.Domain.csproj", "{FD9AD662-66FB-431A-A2C1-8D6262402FCE}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netina.Domain", "..\Api\Netina.Domain\Netina.Domain.csproj", "{FD9AD662-66FB-431A-A2C1-8D6262402FCE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netina.Common", "..\Netina\Netina.Common\Netina.Common.csproj", "{CE60F736-C3F2-4D81-862E-48135E5FFC9C}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netina.Common", "..\Api\Netina.Common\Netina.Common.csproj", "{CE60F736-C3F2-4D81-862E-48135E5FFC9C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
Loading…
Reference in New Issue