feat : add print order , change question dialog

release
Amir Hossein Khademi 2024-03-03 11:42:13 +03:30
parent d19937dd5c
commit 0bdd783b48
19 changed files with 245 additions and 117 deletions

View File

@ -1,14 +1,17 @@
 @using Color = MudBlazor.Color
@using Size = MudBlazor.Size
@inject ISnackbar Snackbar @inject ISnackbar Snackbar
@inject IRestWrapper RestWrapper @inject IRestWrapper RestWrapper
@inject IUserUtility UserUtility @inject IUserUtility UserUtility
@inject IDialogService DialogService @inject IDialogService DialogService
@inject IPrintingService PrintingService @inject IPrintingService PrintingService
@inject IJSRuntime JsRuntime
<MudDialog class="mx-auto" DisableSidePadding="true"> <MudDialog class="w-full">
<DialogContent> <DialogContent>
<MudContainer class="max-h-[40rem] mt-4" Style="overflow-y: scroll"> <MudStack class="max-h-[50rem] w-full mt-4" Style="overflow-y: scroll">
<MudGrid> <MudGrid class="w-full">
<MudItem xs="12" md="9"> <MudItem xs="12" md="9">
<MudStack> <MudStack>
@ -165,6 +168,8 @@
{ {
<MudStack Row="true"> <MudStack Row="true">
<MudText class="my-auto" Typo="Typo.body2">@item.Type.ToDisplay()</MudText> <MudText class="my-auto" Typo="Typo.body2">@item.Type.ToDisplay()</MudText>
<MudText class="my-auto" Typo="Typo.body2"> - </MudText>
<MudText class="my-auto" Typo="Typo.body2">@item.Status.ToDisplay()</MudText>
<MudSpacer/> <MudSpacer/>
<MudText Typo="Typo.body1"><b>@item.Amount.ToString("N0")</b> ریالــ</MudText> <MudText Typo="Typo.body1"><b>@item.Amount.ToString("N0")</b> ریالــ</MudText>
</MudStack> </MudStack>
@ -174,7 +179,7 @@
</MudPaper> </MudPaper>
</MudItem> </MudItem>
</MudGrid> </MudGrid>
</MudContainer> </MudStack>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<MudStack Row="true" class="w-full h-fit mx-4 mb-3 bottom-0"> <MudStack Row="true" class="w-full h-fit mx-4 mb-3 bottom-0">
@ -193,7 +198,7 @@
Icon="@Icons.Material.Outlined.Print" Icon="@Icons.Material.Outlined.Print"
Size="Size.Small" Size="Size.Small"
Variant="Variant.Outlined" Color="Color.Info" Variant="Variant.Outlined" Color="Color.Info"
OnClickCallback="@(()=> PrintingService.Print("http://localhost:32770/api/order/efc18848-fde5-4687-a9f3-0df6aff8b8ed/invoice?access_token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJQZXJtaXNzaW9uIjpbIk1hbmFnZUJsb2dzIiwiTWFuYWdlQmxvZ3MiLCJNYW5hZ2VCcmFuZHMiLCJWaWV3QnJhbmRzIiwiTWFuYWdlQ2F0ZWdvcmllcyIsIlZpZXdDYXRlZ29yaWVzIiwiTWFuYWdlRGlzY291bnRzIiwiVmlld0Rpc2NvdW50cyIsIk1hbmFnZU9yZGVycyIsIlZpZXdBbGxPcmRlcnMiLCJWaWV3TWluZU9yZGVycyIsIkNyZWF0ZU9yZGVyIiwiTWFuYWdlUHJvZHVjdHMiLCJWaWV3UHJvZHVjdHMiLCJBZGRSZXZpZXciLCJBZGRSZXZpZXciLCJDb25maXJtUmV2aWV3IiwiVmlld0FsbFJldmlld3MiLCJWaWV3TWluZVJldmlld3MiLCJNYW5hZ2VXYXJlaG91c2VzIiwiVmlld1dhcmVob3VzZXMiLCJNYW5hZ2VTaGlwcGluZyIsIlZpZXdTaGlwcGluZyIsIk1hbmFnZVVzZXJzIiwiVmlld1VzZXJzIiwiTWFuYWdlRmlsZXMiLCJWaWV3RmlsZXMiXSwicm9sZSI6IlJvb3RBZG1pbiIsIlJvbGVJZCI6ImVmNjYxYTFkLWE2NGItNDc1NC05NDJhLWQwZTlhMWY2YWQ3NSIsIlNpZ25VcFN0YXR1cyI6IjAiLCJ1bmlxdWVfbmFtZSI6IjA5MjE0ODAyODEzIiwibmFtZWlkIjoiMjRmOTMwMDQtN2E3My00ZmRiLWE4OTMtYTRjOTkxOTRhMjBhIiwiZW1haWwiOiJhdnZhbXBpZXJAZ21haWwuY29tIiwiSnd0SUQiOiIzMmNlYTMzOCIsImdlbmRlciI6IkZlbWFsZSIsIm5iZiI6MTcwODg3MTM0NywiZXhwIjoxNzEwMTY3MzQ3LCJpYXQiOjE3MDg4NzEzNDcsImlzcyI6IkJyaXpjbyIsImF1ZCI6IkJyaXpjbyJ9.rupn8kw0V5hNkMvFkkoKo5gUbLy0k-ZxYQM-RptsRlxLhVeA9024u5tS2hY1QazxE9di8HAsebPZeVDnJ4gGuw",true))" OnClickCallback="@ViewModel.PrintInvoiceAsync"
Content="چاپــ فاکتور" /> Content="چاپــ فاکتور" />
<MudButton Variant="Variant.Outlined" Size="Size.Medium" Color="Color.Error" OnClick="ViewModel.Cancel">بستن</MudButton> <MudButton Variant="Variant.Outlined" Size="Size.Medium" Color="Color.Error" OnClick="ViewModel.Cancel">بستن</MudButton>
</MudStack> </MudStack>
@ -213,9 +218,9 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
if (Order == null) if (Order == null)
ViewModel = new OrderActionDialogBoxViewModel(Snackbar, RestWrapper, UserUtility, DialogService, MudDialog , PrintingService); ViewModel = new OrderActionDialogBoxViewModel(Snackbar, RestWrapper, UserUtility, DialogService, MudDialog, PrintingService, JsRuntime);
else else
ViewModel = new OrderActionDialogBoxViewModel(Snackbar, RestWrapper, UserUtility, DialogService, MudDialog, Order, PrintingService); ViewModel = new OrderActionDialogBoxViewModel(Snackbar, RestWrapper, UserUtility, DialogService, MudDialog, Order , PrintingService , JsRuntime);
await ViewModel.InitializeAsync(); await ViewModel.InitializeAsync();
await base.OnInitializedAsync(); await base.OnInitializedAsync();
} }

View File

@ -1,4 +1,7 @@
using Append.Blazor.Printing; using Append.Blazor.Printing;
using NetinaShop.AdminPanel.PWA.Utilities.Models;
using NetinaShop.Common.Extensions;
using Syncfusion.Pdf.Graphics;
namespace NetinaShop.AdminPanel.PWA.Dialogs; namespace NetinaShop.AdminPanel.PWA.Dialogs;
@ -11,10 +14,11 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
private readonly IDialogService _dialogService; private readonly IDialogService _dialogService;
private readonly MudDialogInstance _mudDialog; private readonly MudDialogInstance _mudDialog;
private readonly IPrintingService _printingService; private readonly IPrintingService _printingService;
private readonly IJSRuntime _jsRuntime;
public OrderActionDialogBoxViewModel(ISnackbar snackbar, IRestWrapper restWrapper, IUserUtility userUtility, IDialogService dialogService, public OrderActionDialogBoxViewModel(ISnackbar snackbar, IRestWrapper restWrapper, IUserUtility userUtility, IDialogService dialogService,
MudDialogInstance mudDialog, MudDialogInstance mudDialog,
IPrintingService printingService) IPrintingService printingService, IJSRuntime jsRuntime)
{ {
_snackbar = snackbar; _snackbar = snackbar;
_restWrapper = restWrapper; _restWrapper = restWrapper;
@ -22,6 +26,7 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
_dialogService = dialogService; _dialogService = dialogService;
_mudDialog = mudDialog; _mudDialog = mudDialog;
_printingService = printingService; _printingService = printingService;
_jsRuntime = jsRuntime;
} }
public OrderActionDialogBoxViewModel(ISnackbar snackbar, public OrderActionDialogBoxViewModel(ISnackbar snackbar,
IRestWrapper restWrapper, IRestWrapper restWrapper,
@ -29,7 +34,8 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
IDialogService dialogService, IDialogService dialogService,
MudDialogInstance mudDialog, MudDialogInstance mudDialog,
OrderSDto order, OrderSDto order,
IPrintingService printingService) IPrintingService printingService,
IJSRuntime jsRuntime)
{ {
_snackbar = snackbar; _snackbar = snackbar;
_restWrapper = restWrapper; _restWrapper = restWrapper;
@ -39,6 +45,7 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
PageDto.Id = order.Id; PageDto.Id = order.Id;
IsEditing = true; IsEditing = true;
_printingService = printingService; _printingService = printingService;
_jsRuntime = jsRuntime;
} }
@ -104,6 +111,7 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
public async Task PrintInvoiceAsync() public async Task PrintInvoiceAsync()
{ {
return;
try try
{ {
var token = await _userUtility.GetBearerTokenAsync(); var token = await _userUtility.GetBearerTokenAsync();
@ -112,11 +120,11 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
IsProcessing = true; IsProcessing = true;
string fileUrl = $"{Address.OrderController}/{PageDto.Id}/invoice?access_token={token.Split("Bearer").Last().Trim()}"; string fileUrl = $"{Address.OrderController}/{PageDto.Id}/invoice?access_token={token.Split("Bearer").Last().Trim()}";
var content = await _restWrapper.OrderRestApi.GetOrderInvoice(PageDto.Id, token);
var bytes = await content.ReadAsByteArrayAsync(); PdfStringFormat format = new PdfStringFormat(PdfTextAlignment.Left);
var base64 = Convert.ToBase64String(bytes); format.TextDirection = PdfTextDirection.RightToLeft;
await _printingService.Print(fileUrl, showModal: true); await _jsRuntime.InvokeVoidAsync("openFile", new {fileName = "invoice.pdf",url=fileUrl});
Console.WriteLine(fileUrl);
} }
catch (ApiException ex) catch (ApiException ex)
{ {
@ -136,20 +144,6 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
public async Task SubmitConfirmAsync() public async Task SubmitConfirmAsync()
{ {
var options = new DialogOptions { CloseOnEscapeKey = true };
var parameters = new DialogParameters<QuestionDialog>();
parameters.Add(x => x.ContentText, "آیا از حذف دسته بندی اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف شرح حال", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled)
{
try
{
var token = await _userUtility.GetBearerTokenAsync();
if (token == null)
throw new Exception("Token is null");
IsProcessing = true;
OrderStatus nextOrderStatus = OrderStatus.Canceled; OrderStatus nextOrderStatus = OrderStatus.Canceled;
switch (PageDto.OrderStatus) switch (PageDto.OrderStatus)
{ {
@ -177,9 +171,22 @@ public class OrderActionDialogBoxViewModel : BaseViewModel<OrderLDto>
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
var reference = await _dialogService.ShowQuestionDialog($"آیا از ثبت سفارش به {nextOrderStatus.ToDisplay()} اطمینان دارید ?");
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.ConfirmOrderStepAsync(PageDto.Id, nextOrderStatus, token); await _restWrapper.OrderRestApi.ConfirmOrderStepAsync(PageDto.Id, nextOrderStatus, token);
_snackbar.Add($"ویرایش سفارش {PageDto.FactorCode} با موفقیت انجام شد", Severity.Success); _snackbar.Add($"سفارش {PageDto.FactorCode} به {nextOrderStatus.ToDisplay()} تغییر یافت", Severity.Success);
_mudDialog.Close(); _mudDialog.Close();
} }
catch (ApiException ex) catch (ApiException ex)

View File

@ -1,13 +1,21 @@
<MudDialog> <MudDialog class="overflow-y-hidden overflow-x-hidden">
<DialogContent> <DialogContent>
<p>@ContentText</p> <MudStack class=" pt-8 py-8 -mb-3 w-full">
<MudText Typo="Typo.h5" class="font-bold" Align="Align.Center">@ContentText</MudText>
<dotlottie-player src="https://lottie.host/ca020ceb-7c2d-446f-bab7-172289c31a45/ygESvTvwHy.json"
background="transparent" speed="1" class="mx-auto mt-4 w-40 h-40 lg:w-60 lg:h-60" loop autoplay />
</MudStack>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<div class="flex flex-row w-full mt-3"> <MudGrid class="p-2">
<MudButton Color="Color.Info" Variant="Variant.Filled" OnClick="Submit" DisableElevation="true">تایید</MudButton> <MudItem lg="6">
<MudButton class="w-full py-3 font-bold" Color="Color.Info" Variant="Variant.Filled" OnClick="Submit" DisableElevation="true">تایید</MudButton>
</MudItem>
<MudButton Variant="Variant.Outlined" Color="Color.Error" OnClick="Cancel" class="mx-4">انصراف</MudButton> <MudItem lg="6">
</div> <MudButton class="w-full py-3 font-bold" Variant="Variant.Outlined" Color="Color.Error" OnClick="Cancel">انصراف</MudButton>
</MudItem>
</MudGrid>
</DialogActions> </DialogActions>
</MudDialog> </MudDialog>
@code @code

View File

@ -5,8 +5,8 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest> <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<AssemblyVersion>0.17.18.25</AssemblyVersion> <AssemblyVersion>0.17.19.26</AssemblyVersion>
<FileVersion>0.17.18.25</FileVersion> <FileVersion>0.17.19.26</FileVersion>
<AssemblyName>$(MSBuildProjectName)</AssemblyName> <AssemblyName>$(MSBuildProjectName)</AssemblyName>
</PropertyGroup> </PropertyGroup>
@ -14,6 +14,26 @@
<Exec Command="npm run buildcss" /> <Exec Command="npm run buildcss" />
</Target> </Target>
<ItemGroup>
<Content Remove="wwwroot\assets\fonts\Shabnam-Bold.ttf" />
</ItemGroup>
<ItemGroup>
<None Remove="tailwind.config.js" />
</ItemGroup>
<ItemGroup>
<Content Include="tailwind.config.js">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\assets\fonts\Shabnam-Bold.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Append.Blazor.Printing" Version="6.3.0" /> <PackageReference Include="Append.Blazor.Printing" Version="6.3.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.4.0" /> <PackageReference Include="Blazored.LocalStorage" Version="4.4.0" />
@ -29,6 +49,7 @@
<PackageReference Include="Refit" Version="7.0.0" /> <PackageReference Include="Refit" Version="7.0.0" />
<PackageReference Include="Refit.HttpClientFactory" Version="7.0.0" /> <PackageReference Include="Refit.HttpClientFactory" Version="7.0.0" />
<PackageReference Include="Refit.Newtonsoft.Json" Version="7.0.0" /> <PackageReference Include="Refit.Newtonsoft.Json" Version="7.0.0" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="24.2.8" />
<PackageReference Include="Toolbelt.Blazor.PWA.Updater" Version="2.1.0.1" /> <PackageReference Include="Toolbelt.Blazor.PWA.Updater" Version="2.1.0.1" />
</ItemGroup> </ItemGroup>
@ -53,6 +74,7 @@
<Using Include="NetinaShop.AdminPanel.PWA.Models.Api" /> <Using Include="NetinaShop.AdminPanel.PWA.Models.Api" />
<Using Include="NetinaShop.AdminPanel.PWA.Services.RestServices" /> <Using Include="NetinaShop.AdminPanel.PWA.Services.RestServices" />
<Using Include="NetinaShop.AdminPanel.PWA.Utilities" /> <Using Include="NetinaShop.AdminPanel.PWA.Utilities" />
<Using Include="NetinaShop.AdminPanel.PWA.Utilities.Models" />
<Using Include="NetinaShop.Common.Models.Api" /> <Using Include="NetinaShop.Common.Models.Api" />
<Using Include="NetinaShop.Common.Models.Exception" /> <Using Include="NetinaShop.Common.Models.Exception" />
<Using Include="NetinaShop.Domain.CommandQueries.Commands" /> <Using Include="NetinaShop.Domain.CommandQueries.Commands" />

View File

@ -111,11 +111,8 @@ public class BlogCategoriesPageViewModel:BaseViewModel<ObservableCollection<Blog
public async Task DeleteBlogCategoryAsync(Guid selectedCategoryId) public async Task DeleteBlogCategoryAsync(Guid selectedCategoryId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف دسته بلاگ اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف بلاگ اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف بلاگ", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {

View File

@ -111,11 +111,8 @@ public class BlogsPageViewModel : BaseViewModel<ObservableCollection<BlogSDto>>
public async Task DeleteBlogAsync(Guid selectedCategoryId) public async Task DeleteBlogAsync(Guid selectedCategoryId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف بلاگ اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف بلاگ اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف بلاگ", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {

View File

@ -62,11 +62,8 @@ public class BrandsPageViewModel : BaseViewModel<List<BrandSDto>>
} }
public async Task DeleteBrandAsync(Guid selectedCategoryId) public async Task DeleteBrandAsync(Guid selectedCategoryId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف برند اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف برند اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف برند", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {

View File

@ -1,5 +1,6 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using MudBlazor; using MudBlazor;
using NetinaShop.AdminPanel.PWA.Utilities.Models;
using NetinaShop.Common.Models.Exception; using NetinaShop.Common.Models.Exception;
namespace NetinaShop.AdminPanel.PWA.Pages; namespace NetinaShop.AdminPanel.PWA.Pages;
@ -114,11 +115,8 @@ public class CategoriesPageViewModel : BaseViewModel<ObservableCollection<Produc
public async Task DeleteProductCategoryAsync(Guid selectedCategoryId) public async Task DeleteProductCategoryAsync(Guid selectedCategoryId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف دسته بندی اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف دسته بندی اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف شرح حال", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {

View File

@ -1,4 +1,5 @@
using MudBlazor; using MudBlazor;
using NetinaShop.AdminPanel.PWA.Utilities.Models;
using NetinaShop.Domain.Entities.Discounts; using NetinaShop.Domain.Entities.Discounts;
namespace NetinaShop.AdminPanel.PWA.Pages; namespace NetinaShop.AdminPanel.PWA.Pages;
@ -127,11 +128,8 @@ public class DiscountPageViewModel : BaseViewModel<ObservableCollection<Discount
public async Task DeleteAsync(Guid selectedDiscountId) public async Task DeleteAsync(Guid selectedDiscountId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف تخفیف اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف تخفیف اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف تخفیف", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {

View File

@ -94,7 +94,7 @@ public class OrdersPageViewModel : BaseViewModel
public async Task ShowClicked(OrderSDto order) public async Task ShowClicked(OrderSDto order)
{ {
DialogOptions maxWidth = new DialogOptions() { MaxWidth = MaxWidth.Large, NoHeader = true, FullWidth = true, DisableBackdropClick = true }; DialogOptions maxWidth = new DialogOptions() { MaxWidth = MaxWidth.False, NoHeader = true, FullWidth = true, DisableBackdropClick = true };
var parameters = new DialogParameters<OrderActionDialogBox>(); var parameters = new DialogParameters<OrderActionDialogBox>();
parameters.Add(x => x.Order, order); parameters.Add(x => x.Order, order);
var dialogResult = await _dialogService.ShowAsync<OrderActionDialogBox>($" سفارش {order.FactorCode}", parameters, maxWidth); var dialogResult = await _dialogService.ShowAsync<OrderActionDialogBox>($" سفارش {order.FactorCode}", parameters, maxWidth);

View File

@ -132,11 +132,8 @@ public class ProductsPageViewModel : BaseViewModel<ObservableCollection<ProductS
public async Task DeleteProductAsync(Guid selectedCategoryId) public async Task DeleteProductAsync(Guid selectedCategoryId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف محصول اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف محصول اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف شرح حال", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {

View File

@ -121,11 +121,8 @@ public class ShippingPageViewModel : BaseViewModel<ObservableCollection<Shipping
public async Task DeleteAsync(Guid selectedCategoryId) public async Task DeleteAsync(Guid selectedCategoryId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف روش ارسال اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف روش ارسال اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف روش ارسال", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {

View File

@ -182,11 +182,8 @@ public class UserSettingsPageViewModel : BaseViewModel
public async Task DeleteRoleAsync(Guid selectedRoleId) public async Task DeleteRoleAsync(Guid selectedRoleId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف نقش اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف نقش اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف نقش", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {
@ -245,11 +242,8 @@ public class UserSettingsPageViewModel : BaseViewModel
public async Task DeleteUserAsync(Guid selectedUserId) public async Task DeleteUserAsync(Guid selectedUserId)
{ {
var options = new DialogOptions { CloseOnEscapeKey = true }; var reference = await _dialogService.ShowQuestionDialog($"آیا از حذف کاربر اطمینان دارید ?");
var parameters = new DialogParameters<QuestionDialog>(); var result = await reference.Result;
parameters.Add(x => x.ContentText, "آیا از حذف کاربر اطمینان دارید ?");
var dialogReference = await _dialogService.ShowAsync<QuestionDialog>("حذف کاربر", parameters, options);
var result = await dialogReference.Result;
if (!result.Canceled) if (!result.Canceled)
{ {

View File

@ -0,0 +1,13 @@
namespace NetinaShop.AdminPanel.PWA.Utilities.Models;
public static class DialogUtility
{
public static async Task<IDialogReference> ShowQuestionDialog(this IDialogService dialogService, string question)
{
var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true,NoHeader = true, CloseOnEscapeKey = true };
var parameters = new DialogParameters<QuestionDialog>();
parameters.Add(x => x.ContentText, question);
var dialogReference = await dialogService.ShowAsync<QuestionDialog>(string.Empty, parameters, options);
return dialogReference;
}
}

View File

@ -1,13 +1,14 @@
{ {
"version": "0.17.18.25", "version": "0.17.19.26",
"versionNumber": 0.171825, "versionNumber": 0.171926,
"versionName": "چرتکه", "versionName": "چرتکه",
"description": "", "description": "",
"features": [ "features": [
"افزودن تم دارک", "افزودن تم دارک",
"تکمیل پروسه سفارش گیری", "تکمیل پروسه سفارش گیری",
"قابلیت افزودن تصویر به برند ها", "قابلیت افزودن تصویر به برند ها",
"قابلیت افزودن تصویر به دسته بندی محصولات" "قابلیت افزودن تصویر به دسته بندی محصولات",
"تغییر دیالوگ پرسشی"
], ],
"bugFixes": [ "bugFixes": [
"حل مشکلات امنیتی", "حل مشکلات امنیتی",

View File

@ -1104,6 +1104,9 @@ input:checked + .toggle-bg {
margin-top: auto; margin-top: auto;
margin-bottom: auto; margin-bottom: auto;
} }
.-mb-3 {
margin-bottom: -0.75rem;
}
.-ml-4 { .-ml-4 {
margin-left: -1rem; margin-left: -1rem;
} }
@ -1230,6 +1233,9 @@ input:checked + .toggle-bg {
.h-4 { .h-4 {
height: 1rem; height: 1rem;
} }
.h-40 {
height: 10rem;
}
.h-5 { .h-5 {
height: 1.25rem; height: 1.25rem;
} }
@ -1273,8 +1279,8 @@ input:checked + .toggle-bg {
.max-h-\[30rem\] { .max-h-\[30rem\] {
max-height: 30rem; max-height: 30rem;
} }
.max-h-\[40rem\] { .max-h-\[50rem\] {
max-height: 40rem; max-height: 50rem;
} }
.min-h-\[33rem\] { .min-h-\[33rem\] {
min-height: 33rem; min-height: 33rem;
@ -1300,6 +1306,9 @@ input:checked + .toggle-bg {
.w-4 { .w-4 {
width: 1rem; width: 1rem;
} }
.w-40 {
width: 10rem;
}
.w-5 { .w-5 {
width: 1.25rem; width: 1.25rem;
} }
@ -1671,6 +1680,9 @@ input:checked + .toggle-bg {
.pt-4 { .pt-4 {
padding-top: 1rem; padding-top: 1rem;
} }
.pt-8 {
padding-top: 2rem;
}
.text-center { .text-center {
text-align: center; text-align: center;
} }
@ -2126,6 +2138,10 @@ code {
@media (min-width: 1024px) { @media (min-width: 1024px) {
.lg\:h-60 {
height: 15rem;
}
.lg\:h-96 { .lg\:h-96 {
height: 24rem; height: 24rem;
} }
@ -2142,6 +2158,10 @@ code {
max-height: 35rem; max-height: 35rem;
} }
.lg\:w-60 {
width: 15rem;
}
.lg\:w-96 { .lg\:w-96 {
width: 24rem; width: 24rem;
} }

View File

@ -1298,6 +1298,10 @@ input:checked + .toggle-bg {
margin-top: 2rem; margin-top: 2rem;
} }
.-mb-3 {
margin-bottom: -0.75rem;
}
.line-clamp-1 { .line-clamp-1 {
overflow: hidden; overflow: hidden;
display: -webkit-box; display: -webkit-box;
@ -1402,6 +1406,10 @@ input:checked + .toggle-bg {
height: 100vh; height: 100vh;
} }
.h-40 {
height: 10rem;
}
.\!max-h-\[80vh\] { .\!max-h-\[80vh\] {
max-height: 80vh !important; max-height: 80vh !important;
} }
@ -1414,8 +1422,8 @@ input:checked + .toggle-bg {
max-height: 30rem; max-height: 30rem;
} }
.max-h-\[40rem\] { .max-h-\[50rem\] {
max-height: 40rem; max-height: 50rem;
} }
.min-h-\[33rem\] { .min-h-\[33rem\] {
@ -1483,6 +1491,10 @@ input:checked + .toggle-bg {
width: 100vw; width: 100vw;
} }
.w-40 {
width: 10rem;
}
.flex-1 { .flex-1 {
flex: 1 1 0%; flex: 1 1 0%;
} }
@ -1920,6 +1932,11 @@ input:checked + .toggle-bg {
padding-bottom: 2rem; padding-bottom: 2rem;
} }
.py-5 {
padding-top: 1.25rem;
padding-bottom: 1.25rem;
}
.pt-2 { .pt-2 {
padding-top: 0.5rem; padding-top: 0.5rem;
} }
@ -1928,6 +1945,18 @@ input:checked + .toggle-bg {
padding-top: 1rem; padding-top: 1rem;
} }
.pl-8 {
padding-left: 2rem;
}
.pr-8 {
padding-right: 2rem;
}
.pt-8 {
padding-top: 2rem;
}
.text-center { .text-center {
text-align: center; text-align: center;
} }
@ -2461,6 +2490,14 @@ code {
height: 38rem; height: 38rem;
} }
.lg\:h-80 {
height: 20rem;
}
.lg\:h-60 {
height: 15rem;
}
.lg\:max-h-\[25rem\] { .lg\:max-h-\[25rem\] {
max-height: 25rem; max-height: 25rem;
} }
@ -2477,6 +2514,14 @@ code {
width: 38rem; width: 38rem;
} }
.lg\:w-80 {
width: 20rem;
}
.lg\:w-60 {
width: 15rem;
}
.lg\:p-8 { .lg\:p-8 {
padding: 2rem; padding: 2rem;
} }

View File

@ -76,6 +76,38 @@
} }
</script>
<script type="text/javascript">
function saveAsFile(filename, bytesBase64) {
if (navigator.msSaveBlob) {
var data = window.atob(bytesBase64);
var bytes = new Unit8Array(data.length);
for (var i = 0; i < data.length; i++) {
bytes[i] = data.charCodeAt(i);
}
var blob = new Blob([bytes.buffer], { type: "application/octet-stream" });
navigator.msSaveBlob(blob, filename);
}
else {
var link = document.createElement('a');
link.download = filename;
link.href = "data:application/octet-stream;base64," + bytesBase64;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
</script>
<script type="text/javascript">
function openFile(data) {
var link = this.document.createElement('a');
link.download = data.fileName;
link.href = data.url;
link.target = "_blank";
this.document.body.appendChild(link);
link.click();
this.document.body.removeChild(link);
}
</script> </script>
<script src="ckeditor.js"></script> <script src="ckeditor.js"></script>