fix : order homepage informations

release
Amir Hossein Khademi 2024-05-16 13:52:55 +03:30
parent 684b7783f8
commit 53a7bf501f
24 changed files with 315 additions and 185 deletions

View File

@ -2,6 +2,7 @@
@using Netina.AdminPanel.PWA.Layout @using Netina.AdminPanel.PWA.Layout
@using Netina.AdminPanel.PWA.Pages @using Netina.AdminPanel.PWA.Pages
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject IConfiguration Configuration
<Router AppAssembly="@typeof(App).Assembly"> <Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData"> <Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"> <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
@ -30,3 +31,4 @@
</Router> </Router>

View File

@ -35,6 +35,12 @@
Icon="@Icons.Material.Outlined.WebAsset">دسته بندی های بلاگـــ</MudNavLink> Icon="@Icons.Material.Outlined.WebAsset">دسته بندی های بلاگـــ</MudNavLink>
</MudNavGroup> </MudNavGroup>
<MudNavGroup Title="مدیریت برگه ها" Expanded="false"
Icon="@Icons.Material.Outlined.Pages">
<MudNavLink Href="management/pages" Icon="@Icons.Material.Filled.Pageview">برگه ها</MudNavLink>
<MudNavLink Href="management/faqs" Icon="@Icons.Material.Filled.ManageAccounts">سوالات متداول</MudNavLink>
</MudNavGroup>
@if (isShop) @if (isShop)
{ {
<MudNavGroup Title="حسابداری" Expanded="false" <MudNavGroup Title="حسابداری" Expanded="false"
@ -83,7 +89,6 @@
<MudNavGroup Title="فروشگاه من" Expanded="false" Icon="@Icons.Material.Outlined.Settings"> <MudNavGroup Title="فروشگاه من" Expanded="false" Icon="@Icons.Material.Outlined.Settings">
<MudNavLink Href="management/shop" Icon="@Icons.Material.Filled.Shop2">فروشگاه</MudNavLink> <MudNavLink Href="management/shop" Icon="@Icons.Material.Filled.Shop2">فروشگاه</MudNavLink>
<MudNavLink Href="management/marketer" Icon="@Icons.Material.Filled.Person4">بازاریاب ها</MudNavLink> <MudNavLink Href="management/marketer" Icon="@Icons.Material.Filled.Person4">بازاریاب ها</MudNavLink>
<MudNavLink Href="management/faqs" Icon="@Icons.Material.Filled.ManageAccounts">سوالات متداول</MudNavLink>
</MudNavGroup> </MudNavGroup>
} }
else else

View File

@ -68,7 +68,7 @@
<MudText Typo="Typo.caption">می توانید کتن کامل بلاگــــ خود را کامل وارد کنید</MudText> <MudText Typo="Typo.caption">می توانید کتن کامل بلاگــــ خود را کامل وارد کنید</MudText>
</MudStack> </MudStack>
<MudGrid> <MudGrid>
<MudItem sm="12" class="!text-black"> <MudItem sm="12" class="!text-black max-h-[60vh] !overflow-y-scroll">
<RichTextEditorUi @bind-Text="@ViewModel.Content" /> <RichTextEditorUi @bind-Text="@ViewModel.Content" />

View File

@ -113,7 +113,8 @@ public class BlogActionDialogBoxViewModel : BaseViewModel
if (SelectedCategory == null) if (SelectedCategory == null)
throw new Exception("لطفا یک دسته بندی انتخاب کنید"); throw new Exception("لطفا یک دسته بندی انتخاب کنید");
var token = await _userUtility.GetBearerTokenAsync(); var token = await _userUtility.GetBearerTokenAsync();
if (token == null)
throw new Exception("Token is null");
var request = new BlogLDto var request = new BlogLDto
{ {
Id = Blog.Id, Id = Blog.Id,
@ -126,7 +127,7 @@ public class BlogActionDialogBoxViewModel : BaseViewModel
Summery = Summery, Summery = Summery,
Tags = Tags Tags = Tags
}; };
await _restWrapper.CrudApiRest<Blog, Guid>(Address.BlogController).Create<BlogLDto>(request, token); await _restWrapper.CrudApiRest<Blog, Guid>(Address.BlogController).Update<BlogLDto>(request, token);
_snackbar.Add($"ویرایش بلاگ {Title} با موفقیت انجام شد", Severity.Success); _snackbar.Add($"ویرایش بلاگ {Title} با موفقیت انجام شد", Severity.Success);
_mudDialog.Close(); _mudDialog.Close();
} }

View File

@ -4,7 +4,7 @@ public static class StorageFileExtension
{ {
public static string GetLink(this StorageFileSDto file) public static string GetLink(this StorageFileSDto file)
{ {
var link = $"https://storage.vesmeh.com/{file.FileLocation}"; var link = $"{Address.StorageAddress}{file.FileLocation}";
return link; return link;
} }
} }

View File

@ -2,32 +2,25 @@
public static class Address public static class Address
{ {
public static string WebSiteAddress = string.Empty; public static string WebSiteAddress = string.Empty;
public static string StorageAddress = string.Empty; public static string StorageAddress = string.Empty;
#if DEBUG public static string AuthController = $"/auth";
public static string BaseAddress = "http://localhost:32770/api"; public static string UserController = $"/user";
//public static string BaseAddress = "https://api.vesmeh.com/api"; public static string ProductCategoryController = $"/product/category";
#else public static string ProductController = $"/product";
public static string BaseAddress = "https://api.vesmeh.com/api"; public static string BrandController = $"/brand";
#endif public static string FileController => $"/file";
public static string AuthController = $"{BaseAddress}/auth"; public static string BlogController => $"/blog";
public static string UserController = $"{BaseAddress}/user"; public static string BlogCategoryController => $"/blog/category";
public static string ProductCategoryController = $"{BaseAddress}/product/category"; public static string DiscountController => $"/discount";
public static string ProductController = $"{BaseAddress}/product"; public static string RoleController => $"/user/role";
public static string BrandController = $"{BaseAddress}/brand"; public static string ShippingController => $"/warehouse/shipping";
public static string FileController => $"{BaseAddress}/file"; public static string OrderController => $"/order";
public static string BlogController => $"{BaseAddress}/blog"; public static string PaymentController => $"/accounting/pay";
public static string BlogCategoryController => $"{BaseAddress}/blog/category"; public static string PageController => $"/page";
public static string DiscountController => $"{BaseAddress}/discount"; public static string ScraperController => $"/scraper";
public static string RoleController => $"{BaseAddress}/user/role"; public static string NewsletterMemberController => $"/newsletter/member";
public static string ShippingController => $"{BaseAddress}/warehouse/shipping"; public static string DashboardController => $"/dashboard";
public static string OrderController => $"{BaseAddress}/order"; public static string SettingController => $"/setting";
public static string PaymentController => $"{BaseAddress}/accounting/pay"; public static string DistrictController => $"/district";
public static string PageController => $"{BaseAddress}/page";
public static string ScraperController => $"{BaseAddress}/scraper";
public static string NewsletterMemberController => $"{BaseAddress}/newsletter/member";
public static string DashboardController => $"{BaseAddress}/dashboard";
public static string SettingController => $"{BaseAddress}/setting";
public static string DistrictController => $"{BaseAddress}/district";
} }

View File

@ -0,0 +1,6 @@
namespace Netina.AdminPanel.PWA.Models;
public static class StatConfigs
{
public static bool IsShop { get; set; } = false;
}

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.25.27.48</AssemblyVersion> <AssemblyVersion>0.27.31.52</AssemblyVersion>
<FileVersion>0.25.27.48</FileVersion> <FileVersion>0.27.31.52</FileVersion>
<AssemblyName>$(MSBuildProjectName)</AssemblyName> <AssemblyName>$(MSBuildProjectName)</AssemblyName>
</PropertyGroup> </PropertyGroup>

View File

@ -38,7 +38,7 @@ public class FaqManagementPageViewModel : BaseViewModel<FAQPage>
PageDto = dto.GetData<FAQPage>(); PageDto = dto.GetData<FAQPage>();
_request = new PageActionRequestDto _request = new PageActionRequestDto
{ {
Name = dto.Name, Title = dto.Title,
Content = dto.Content, Content = dto.Content,
Description = dto.Description, Description = dto.Description,
Id = dto.Id, Id = dto.Id,
@ -76,7 +76,7 @@ public class FaqManagementPageViewModel : BaseViewModel<FAQPage>
IsProcessing = true; IsProcessing = true;
var request = new PageActionRequestDto var request = new PageActionRequestDto
{ {
Name = "سوالات متداول", Title = "سوالات متداول",
Content = string.Empty, Content = string.Empty,
Description = string.Empty, Description = string.Empty,
Data = PageDto, Data = PageDto,

View File

@ -69,7 +69,8 @@
</div> </div>
<div class="h-full basis-full md:basis-1/2 md:rounded-tr-none md:rounded-bl-xl md:rounded-tl-xl flex md:px-10 lg:px-20 py-8 px-4"> <div class="h-full basis-full md:basis-1/2 md:rounded-tr-none md:rounded-bl-xl md:rounded-tl-xl flex md:px-10 lg:px-20 py-8 px-4">
@if (StatConfigs.IsShop)
{
<div class="mx-auto my-auto"> <div class="mx-auto my-auto">
<dotlottie-player src="https://lottie.host/235bcb2d-0f2c-4f06-9c36-7e6677b82e00/9tGECPkU5J.json" <dotlottie-player src="https://lottie.host/235bcb2d-0f2c-4f06-9c36-7e6677b82e00/9tGECPkU5J.json"
background="transparent" speed="1" class="mx-auto w-64 h-64 lg:w-96 lg:h-96" loop autoplay /> background="transparent" speed="1" class="mx-auto w-64 h-64 lg:w-96 lg:h-96" loop autoplay />
@ -78,6 +79,20 @@
<MudText Align="Align.Center">شما میتوانید با ورود به داشبورد تخصصی نتینا فروشگاه خود را مدیریت کنید </MudText> <MudText Align="Align.Center">شما میتوانید با ورود به داشبورد تخصصی نتینا فروشگاه خود را مدیریت کنید </MudText>
</div> </div>
}
else
{
<div class="mx-auto my-auto">
<dotlottie-player src="https://s3.ir-thr-at1.arvanstorage.ir/amir-content/Lotties/SEO-strategy-animation_management.json"
background="transparent" speed="1" class="mx-auto w-64 h-64 lg:w-96 lg:h-96" loop autoplay />
<MudText Typo="Typo.h5" Align="Align.Center"><b>داشبورد وب سایت شما</b></MudText>
<MudText Align="Align.Center">شما میتوانید با ورود به داشبورد ، وب سایت خود را مدیریت کنید </MudText>
</div>
}
</div> </div>
</div> </div>
@code { @code {

View File

@ -15,28 +15,28 @@
<MudItem xs="12" sm="6" lg="3"> <MudItem xs="12" sm="6" lg="3">
<MudPaper class="p-3 m-2 rounded-md" Elevation="2"> <MudPaper class="p-3 m-2 rounded-md" Elevation="2">
<MudText Typo="Typo.body1" class="mb-4">سفارشات امروز</MudText> <MudText Typo="Typo.body1" class="mb-4">سفارشات امروز</MudText>
<MudText Typo="Typo.h3" Align="Align.Center" class="text-amber-600"><b>1124</b></MudText> <MudText Typo="Typo.h3" Align="Align.Center" class="text-amber-600"><b>@ViewModel.PageDto.TodayOrdersCount</b></MudText>
<MudText Typo="Typo.h6" Align="Align.Center" class="mb-4 -mt-1"><b>عدد</b></MudText> <MudText Typo="Typo.h6" Align="Align.Center" class="mb-4 -mt-1"><b>عدد</b></MudText>
</MudPaper> </MudPaper>
</MudItem> </MudItem>
<MudItem xs="12" sm="6" lg="3"> <MudItem xs="12" sm="6" lg="3">
<MudPaper class="p-3 m-2 rounded-md" Elevation="2"> <MudPaper class="p-3 m-2 rounded-md" Elevation="2">
<MudText Typo="Typo.body1" class="mb-4">سفارشات در انتظار تایید</MudText> <MudText Typo="Typo.body1" class="mb-4">سفارشات در انتظار تایید</MudText>
<MudText Typo="Typo.h3" Align="Align.Center" class="text-blue-600"><b>845</b></MudText> <MudText Typo="Typo.h3" Align="Align.Center" class="text-blue-600"><b>@ViewModel.PageDto.PayedOrdersCount</b></MudText>
<MudText Typo="Typo.h6" Align="Align.Center" class="mb-4 -mt-1"><b>عدد</b></MudText> <MudText Typo="Typo.h6" Align="Align.Center" class="mb-4 -mt-1"><b>عدد</b></MudText>
</MudPaper> </MudPaper>
</MudItem> </MudItem>
<MudItem xs="12" sm="6" lg="3"> <MudItem xs="12" sm="6" lg="3">
<MudPaper class="p-3 m-2 rounded-md" Elevation="2"> <MudPaper class="p-3 m-2 rounded-md" Elevation="2">
<MudText Typo="Typo.body1" class="mb-4">تغییر نسبت هفته پیش</MudText> <MudText Typo="Typo.body1" class="mb-4">سفارشات ارسال نشده</MudText>
<MudText Typo="Typo.h3" Align="Align.Center" class="text-lime-600"><b>125</b></MudText> <MudText Typo="Typo.h3" Align="Align.Center" class="text-lime-600"><b>@ViewModel.PageDto.UnSendOrdersCount</b></MudText>
<MudText Typo="Typo.h6" Align="Align.Center" class="mb-4 -mt-1"><b>عدد</b></MudText> <MudText Typo="Typo.h6" Align="Align.Center" class="mb-4 -mt-1"><b>عدد</b></MudText>
</MudPaper> </MudPaper>
</MudItem> </MudItem>
<MudItem xs="12" sm="6" lg="3"> <MudItem xs="12" sm="6" lg="3">
<MudPaper class="p-3 m-2 rounded-md" Elevation="2"> <MudPaper class="p-3 m-2 rounded-md" Elevation="2">
<MudText Typo="Typo.body1" class="mb-4">تغییر نسبت به ماه پیش</MudText> <MudText Typo="Typo.body1" class="mb-4">مجموع سفارش ماه</MudText>
<MudText Typo="Typo.h3" Align="Align.Center" class="text-rose-600"><b>10</b></MudText> <MudText Typo="Typo.h3" Align="Align.Center" class="text-rose-600"><b>@ViewModel.PageDto.ThisMonthOrdersCount</b></MudText>
<MudText Typo="Typo.h6" Align="Align.Center" class="mb-4 -mt-1"><b>عدد</b></MudText> <MudText Typo="Typo.h6" Align="Align.Center" class="mb-4 -mt-1"><b>عدد</b></MudText>
</MudPaper> </MudPaper>
</MudItem> </MudItem>

View File

@ -1,6 +1,6 @@
namespace Netina.AdminPanel.PWA.Pages; namespace Netina.AdminPanel.PWA.Pages;
public class OrdersPageViewModel : BaseViewModel public class OrdersPageViewModel : BaseViewModel<OrderDashboardDto>
{ {
private readonly NavigationManager _navigationManager; private readonly NavigationManager _navigationManager;
private readonly ISnackbar _snackbar; private readonly ISnackbar _snackbar;
@ -36,6 +36,9 @@ public class OrdersPageViewModel : BaseViewModel
dto.ForEach(d => MainOrders.Add(d)); dto.ForEach(d => MainOrders.Add(d));
if (MainOrders.Count == 15) if (MainOrders.Count == 15)
MainGridPageCount = 2; MainGridPageCount = 2;
var orderDashboardDto = await _restWrapper.DashboardApiRest.GetOrdersDashboardAsync(token);
PageDto = orderDashboardDto;
} }
catch (ApiException ex) catch (ApiException ex)
{ {

View File

@ -1,4 +1,4 @@
@page "/pages" @page "/management/pages"
@attribute [Microsoft.AspNetCore.Authorization.Authorize] @attribute [Microsoft.AspNetCore.Authorization.Authorize]
@inject IDialogService DialogService @inject IDialogService DialogService
@ -8,87 +8,69 @@
@inject IRestWrapper RestWrapper @inject IRestWrapper RestWrapper
<MudStack class="w-full p-8 h-screen bg-[--mud-palette-background-grey]"> <MudStack class="w-full p-8 h-screen bg-[--mud-palette-background-grey]">
<MudGrid> <MudPaper class="px-5 py-5">
<MudItem xs="12"> <MudStack>
<MudStack Row="true" class="mb-5">
<MudText Typo="Typo.h4">پرداختـــ ها</MudText>
<MudSpacer />
</MudStack>
<MudPaper>
<MudDataGrid FixedFooter="true" FixedHeader="true" Striped="true"
T="PaymentSDto" Items="@ViewModel.PageDto" CurrentPage="@ViewModel.CurrentPage"
RowsPerPage="20" Filterable="false" Loading="@ViewModel.IsProcessing"
SortMode="@SortMode.None" Groupable="false">
@* <ToolBarContent>
<MudTextField T="string" Placeholder="جست جو بر اساس کد پیگیری" Adornment="Adornment.Start" Immediate="true"
Clearable="true"
ValueChanged="@ViewModel.SearchChanged"
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" class="my-auto"
OnAdornmentClick="@ViewModel.SearchAsync"></MudTextField>
</ToolBarContent> *@
<Columns>
<PropertyColumn Title="شماره فاکتور" Property="arg => arg.FactorNumber" />
<PropertyColumn Title="پرداخت کننده" Property="arg => arg.CustomerFullName" />
<PropertyColumn Title="شماره تماس" Property="arg => arg.CustomerPhoneNumber" />
<TemplateColumn T="PaymentSDto" Title="نوع پرداخت">
<CellTemplate>
<p>@context.Item.Type.ToDisplay()</p>
</CellTemplate>
</TemplateColumn>
<TemplateColumn T="PaymentSDto" Title="وظعیت پرداخت">
<CellTemplate>
<p>@context.Item.Status.ToDisplay()</p>
</CellTemplate>
</TemplateColumn>
<TemplateColumn T="PaymentSDto" Title="مبلغ سفارش ">
<CellTemplate>
<p>@context.Item.Amount.ToString("N0") ریالــ</p>
</CellTemplate>
</TemplateColumn>
<TemplateColumn T="PaymentSDto" Title="تاریخ پرداخت">
<CellTemplate>
<p>@context.Item.CreatedAt.ToPersianDateTime().ToLongDateString()</p>
</CellTemplate>
</TemplateColumn>
<TemplateColumn CellClass="d-flex justify-end">
<CellTemplate>
<MudStack Row="true"> <MudStack Row="true">
<MudIconButton Icon="@Icons.Material.Filled.PanoramaFishEye" <MudStack class="mb-5 mx-2">
Size="@Size.Small" <MudText Typo="Typo.h4">تنظیمات برگه ها</MudText>
Variant="@Variant.Outlined" <MudText Typo="Typo.caption">برگه های وب سایت خود را ویرایش نمایید</MudText>
Color="@Color.Info"
OnClick="async()=>await ViewModel.ShowClicked(context.Item)" />
</MudStack>
</CellTemplate>
</TemplateColumn>
</Columns>
<PagerContent>
<MudStack Row="true" class="w-full">
<MudPagination Rectangular="true" Variant="Variant.Filled" Count="@ViewModel.PageCount"
SelectedChanged="@ViewModel.ChangePageAsync" class="my-4 mx-auto" />
</MudStack> </MudStack>
</PagerContent> <MudSpacer />
</MudDataGrid> @* <BaseButtonUi Size="Size.Large"
</MudPaper> OnClickCallback="ViewModel.SubmitPagesSettingAsync"
class="mt-2 mb-8 w-64 rounded-md"
IsProcessing="@ViewModel.IsProcessing"
Icon="@Icons.Material.Outlined.Check"
Content="ثبتـــ اطلاعات" Variant="Variant.Filled" Color="Color.Success" /> *@
</MudStack>
<MudGrid class="!max-h-[80vh] overflow-auto">
<MudItem xs="6">
<MudDivider />
<MudText class="mt-4 mb-5" Typo="Typo.h6">افزودن برگه جدید</MudText>
<MudTextField @bind-Value="@ViewModel.NewPageDto.Title" T="string" Label="عنوان" Variant="Variant.Outlined" />
<MudTextField class="my-3" @bind-Value="@ViewModel.NewPageDto.Slug" T="string" Label="اسلاگ" Variant="Variant.Outlined" />
<MudButton class="w-full py-3 mt-1" Variant="Variant.Outlined" Color="Color.Secondary" OnClick="ViewModel.AddPageAsync">افزودن +</MudButton>
</MudItem>
<MudItem xs="6">
<MudExpansionPanels>
@foreach (var navMenuItem in ViewModel.PageDto)
{
<MudExpansionPanel>
<TitleContent>
<MudStack Row="true">
<MudText class="my-auto">@navMenuItem.Title</MudText>
<MudSpacer />
<MudIconButton Icon="@Icons.Material.Filled.Delete" OnClick="async ()=>{await ViewModel.RemovePageAsync(navMenuItem.Id);}" Color="Color.Error"></MudIconButton>
</MudStack>
</TitleContent>
<ChildContent>
<MudTextField class="my-3" @bind-Value="@navMenuItem.Title" T="string" Label="عنوان" Variant="Variant.Outlined" />
<MudTextField class="my-3" @bind-Value="@navMenuItem.Slug" T="string" Label="اسلاگ" Variant="Variant.Outlined" />
</ChildContent>
</MudExpansionPanel>
}
</MudExpansionPanels>
</MudItem> </MudItem>
</MudGrid> </MudGrid>
</MudStack> </MudStack>
</MudPaper>
</MudStack>
@code @code
{ {
public PaymentsPageViewModel ViewModel { get; set; } public PagesManagementPageViewModel ViewModel { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
ViewModel = new PaymentsPageViewModel(NavigationManager, Snackbar, UserUtility, RestWrapper, DialogService); ViewModel = new PagesManagementPageViewModel(NavigationManager, Snackbar, UserUtility, RestWrapper, DialogService);
await ViewModel.InitializeAsync(); await ViewModel.InitializeAsync();
await base.OnInitializedAsync(); await base.OnInitializedAsync();
} }

View File

@ -1,6 +1,138 @@
namespace Netina.AdminPanel.PWA.Pages; using Force.DeepCloner;
public class PagesManagementPageViewModel namespace Netina.AdminPanel.PWA.Pages;
public class PagesManagementPageViewModel : BaseViewModel<ObservableCollection<BasePageSDto>>
{ {
private readonly NavigationManager _navigationManager;
private readonly ISnackbar _snackbar;
private readonly IUserUtility _userUtility;
private readonly IDialogService _dialogService;
private readonly IRestWrapper _restWrapper;
public PagesManagementPageViewModel(
NavigationManager navigationManager,
ISnackbar snackbar,
IUserUtility userUtility,
IRestWrapper restWrapper,
IDialogService dialogService)
{
_navigationManager = navigationManager;
_snackbar = snackbar;
_userUtility = userUtility;
_restWrapper = restWrapper;
_dialogService = dialogService;
}
public override async Task InitializeAsync()
{
try
{
IsProcessing = true;
var token = await _userUtility.GetBearerTokenAsync();
if (token == null)
throw new Exception("Token is null");
var pages = await _restWrapper.PageRestApi.ReadAll(token);
PageDto.Clear();
pages.ForEach(p=>PageDto.Add(p));
}
catch (ApiException e)
{
var exe = await e.GetContentAsAsync<ApiResult>();
if (e.StatusCode == HttpStatusCode.Unauthorized)
{
await _userUtility.LogoutAsync();
_navigationManager.NavigateTo("login", true, true);
}
_snackbar.Add(exe != null ? exe.Message : e.Content, Severity.Error);
}
catch (Exception ex)
{
_snackbar.Add(ex.Message, Severity.Error);
}
finally
{
IsProcessing = false;
}
await base.InitializeAsync();
}
public PageActionRequestDto NewPageDto { get; set; } = new();
public async Task AddPageAsync()
{
try
{
IsProcessing = true;
var token = await _userUtility.GetBearerTokenAsync();
if (token == null)
throw new Exception("Token is null");
if (NewPageDto.Title.IsNullOrEmpty())
throw new AppException("عنوان صفحه را وارد کنید");
if (NewPageDto.Slug.IsNullOrEmpty())
throw new AppException("اسلاگ صفحه را وارد کنید");
await _restWrapper.PageRestApi.CreatePage(NewPageDto.DeepClone(), token);
NewPageDto = new PageActionRequestDto();
_snackbar.Add("برگه مورد نظر با موفقیت افزوده شد", Severity.Success);
await InitializeAsync();
}
catch (ApiException e)
{
var exe = await e.GetContentAsAsync<ApiResult>();
if (e.StatusCode == HttpStatusCode.Unauthorized)
{
await _userUtility.LogoutAsync();
_navigationManager.NavigateTo("login", true, true);
}
_snackbar.Add(exe != null ? exe.Message : e.Content, Severity.Error);
}
catch (Exception ex)
{
_snackbar.Add(ex.Message, Severity.Error);
}
finally
{
IsProcessing = false;
}
}
public async Task RemovePageAsync(Guid pageId)
{
try
{
IsProcessing = true;
var token = await _userUtility.GetBearerTokenAsync();
if (token == null)
throw new Exception("Token is null");
await _restWrapper.PageRestApi.DeletePage(pageId, token);
_snackbar.Add("برگه مورد نظر با موفقیت حذف شد", Severity.Success);
await InitializeAsync();
}
catch (ApiException e)
{
var exe = await e.GetContentAsAsync<ApiResult>();
if (e.StatusCode == HttpStatusCode.Unauthorized)
{
await _userUtility.LogoutAsync();
_navigationManager.NavigateTo("login", true, true);
}
_snackbar.Add(exe != null ? exe.Message : e.Content, Severity.Error);
}
catch (Exception ex)
{
_snackbar.Add(ex.Message, Severity.Error);
}
finally
{
IsProcessing = false;
}
}
} }

View File

@ -1,7 +0,0 @@
<head>
</head>
<RichTextEditorUi />
@code {
}

View File

@ -12,7 +12,7 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args);
Address.WebSiteAddress = builder.Configuration.GetValue<string>($"WebSiteUrl") ?? string.Empty; Address.WebSiteAddress = builder.Configuration.GetValue<string>($"WebSiteUrl") ?? string.Empty;
Address.StorageAddress = builder.Configuration.GetValue<string>("StorageBaseUrl") ?? string.Empty; Address.StorageAddress = builder.Configuration.GetValue<string>("StorageBaseUrl") ?? string.Empty;
StatConfigs.IsShop = builder.Configuration.GetValue<bool>("IsShop");
builder.RootComponents.Add<App>("#app"); builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after"); builder.RootComponents.Add<HeadOutlet>("head::after");

View File

@ -4,4 +4,6 @@ public interface IDashboardApiRest
{ {
[Get("/home")] [Get("/home")]
public Task<HomeDashboardDto> GetHomeDashboardAsync([Header("Authorization")] string authorization); public Task<HomeDashboardDto> GetHomeDashboardAsync([Header("Authorization")] string authorization);
[Get("/orders")]
public Task<OrderDashboardDto> GetOrdersDashboardAsync([Header("Authorization")] string authorization);
} }

View File

@ -2,6 +2,9 @@
public interface IPageRestApi public interface IPageRestApi
{ {
[Get("")]
Task<List<BasePageSDto>> ReadAll([Header("Authorization")] string authorization);
[Get("/type/{type}")] [Get("/type/{type}")]
Task<BasePageSDto> ReadByType([Query] string type, [Header("Authorization")] string authorization); Task<BasePageSDto> ReadByType([Query] string type, [Header("Authorization")] string authorization);
@ -11,4 +14,7 @@ public interface IPageRestApi
[Post("")] [Post("")]
Task CreatePage([Body] PageActionRequestDto request, [Header("Authorization")] string authorization); Task CreatePage([Body] PageActionRequestDto request, [Header("Authorization")] string authorization);
[Delete("/{id}")]
Task DeletePage(Guid id, [Header("Authorization")] string authorization);
} }

View File

@ -2,7 +2,11 @@
public class RestWrapper : IRestWrapper public class RestWrapper : IRestWrapper
{ {
private string baseApiAddress;
public RestWrapper(IConfiguration configuration)
{
baseApiAddress = configuration.GetValue<string>("ApiUrl") ?? string.Empty;
}
private static RefitSettings setting = new RefitSettings(new NewtonsoftJsonContentSerializer(new JsonSerializerSettings private static RefitSettings setting = new RefitSettings(new NewtonsoftJsonContentSerializer(new JsonSerializerSettings
{ {
Formatting = Newtonsoft.Json.Formatting.Indented, Formatting = Newtonsoft.Json.Formatting.Indented,
@ -12,27 +16,27 @@ public class RestWrapper : IRestWrapper
public ICrudApiRest<T, TKey> CrudApiRest<T, TKey>(string address) where T : class public ICrudApiRest<T, TKey> CrudApiRest<T, TKey>(string address) where T : class
{ {
return RestService.For<ICrudApiRest<T, TKey>>(address, setting); return RestService.For<ICrudApiRest<T, TKey>>(baseApiAddress + address, setting);
} }
public ICrudDtoApiRest<T, TDto, TKey> CrudDtoApiRest<T, TDto, TKey>(string address) where T : class where TDto : class public ICrudDtoApiRest<T, TDto, TKey> CrudDtoApiRest<T, TDto, TKey>(string address) where T : class where TDto : class
{ {
return RestService.For<ICrudDtoApiRest<T, TDto, TKey>>(address, setting); return RestService.For<ICrudDtoApiRest<T, TDto, TKey>>(baseApiAddress + address, setting);
} }
public IAuthRestApi AuthRestApi => RestService.For<IAuthRestApi>(Address.AuthController, setting); public IAuthRestApi AuthRestApi => RestService.For<IAuthRestApi>($"{baseApiAddress}{Address.AuthController}", setting);
public IUserRestApi UserRestApi => RestService.For<IUserRestApi>(Address.UserController, setting); public IUserRestApi UserRestApi => RestService.For<IUserRestApi>($"{baseApiAddress}{Address.UserController}", setting);
public IProductCategoryRestApi ProductCategoryRestApi => RestService.For<IProductCategoryRestApi>(Address.ProductCategoryController, setting); public IProductCategoryRestApi ProductCategoryRestApi => RestService.For<IProductCategoryRestApi>($"{baseApiAddress}{Address.ProductCategoryController}", setting);
public IProductRestApi ProductRestApi => RestService.For<IProductRestApi>(Address.ProductController, setting); public IProductRestApi ProductRestApi => RestService.For<IProductRestApi>($"{baseApiAddress}{Address.ProductController}", setting);
public IBrandRestApi BrandRestApi => RestService.For<IBrandRestApi>(Address.BrandController, setting); public IBrandRestApi BrandRestApi => RestService.For<IBrandRestApi>($"{baseApiAddress}{Address.BrandController}", setting);
public IFileRestApi FileRestApi => RestService.For<IFileRestApi>(Address.FileController, setting); public IFileRestApi FileRestApi => RestService.For<IFileRestApi>($"{baseApiAddress}{Address.FileController}", setting);
public IBlogRestApi BlogRestApi => RestService.For<IBlogRestApi>(Address.BlogController, setting); public IBlogRestApi BlogRestApi => RestService.For<IBlogRestApi>($"{baseApiAddress}{Address.BlogController}", setting);
public IDiscountRestApi DiscountRest => RestService.For<IDiscountRestApi>(Address.DiscountController, setting); public IDiscountRestApi DiscountRest => RestService.For<IDiscountRestApi>($"{baseApiAddress}{Address.DiscountController}",setting);
public IBlogCategoryRestApi BlogCategoryRestApi => RestService.For<IBlogCategoryRestApi>(Address.BlogCategoryController, setting); public IBlogCategoryRestApi BlogCategoryRestApi => RestService.For<IBlogCategoryRestApi>($"{baseApiAddress}{Address.BlogCategoryController}", setting);
public IRoleRestApi RoleRestApi => RestService.For<IRoleRestApi>(Address.RoleController, setting); public IRoleRestApi RoleRestApi => RestService.For<IRoleRestApi>($"{baseApiAddress}{Address.RoleController}", setting);
public IOrderRestApi OrderRestApi => RestService.For<IOrderRestApi>(Address.OrderController, setting); public IOrderRestApi OrderRestApi => RestService.For<IOrderRestApi>($"{baseApiAddress}{Address.OrderController}", setting);
public IPaymentRestApi PaymentRestApi => RestService.For<IPaymentRestApi>(Address.PaymentController, setting); public IPaymentRestApi PaymentRestApi => RestService.For<IPaymentRestApi>($"{baseApiAddress}{Address.PaymentController}", setting);
public IPageRestApi PageRestApi => RestService.For<IPageRestApi>(Address.PageController, setting); public IPageRestApi PageRestApi => RestService.For<IPageRestApi>($"{baseApiAddress}{Address.PageController}", setting);
public IScraperRestApi ScraperRestApi => RestService.For<IScraperRestApi>(Address.ScraperController, setting); public IScraperRestApi ScraperRestApi => RestService.For<IScraperRestApi>($"{baseApiAddress}{Address.ScraperController}", setting);
public ISettingRestApi SettingRestApi => RestService.For<ISettingRestApi>(Address.SettingController, setting); public ISettingRestApi SettingRestApi => RestService.For<ISettingRestApi>($"{baseApiAddress}{Address.SettingController}", setting);
public IDashboardApiRest DashboardApiRest => RestService.For<IDashboardApiRest>(Address.DashboardController, setting); public IDashboardApiRest DashboardApiRest => RestService.For<IDashboardApiRest>($"{baseApiAddress}{Address.DashboardController}", setting);
public IDistrictApiRest DistrictApiRest => RestService.For<IDistrictApiRest>(Address.DistrictController, setting); public IDistrictApiRest DistrictApiRest => RestService.For<IDistrictApiRest>($"{baseApiAddress}{Address.DistrictController}", setting);
} }

View File

@ -4,25 +4,9 @@
"versionName": "چرتکه", "versionName": "چرتکه",
"description": "", "description": "",
"features": [ "features": [
"افزودن تم دارک", ""
"تغییر دیالوگ پرسشی",
"افزودن تنظیمات درگاه",
"افزودن کد رهگیری پستی",
"تکمیل پروسه سفارش گیری",
"افزودن بخش تنظیمات فروشگاه",
"قابلیت افزودن تصویر به برند ها",
"قابلیت افزودن تصویر به دسته بندی محصولات",
"عدم نمایش محصولات غیرقابل نمایش برای مشتری",
"افزودن فاکتور برای فروش ها"
], ],
"bugFixes": [ "bugFixes": [
"حل مشکلات امنیتی", "نمایش اطلاعات صحیح در صفحه سفارشات"
"رفع مشکلات رسپانسیو",
"رفع مشکل دریافت تصاویر",
"رفع مشکل عدم اتصال به درگاه",
"رفع مشکل عدم نمایش لیست بلاگ ها",
"رفع مشکل عدم ویرایش تگ ها در محصولات",
"رفع مشکل ادیتور متن در بلاگ و محصولات",
"رفع مشکلات ساختاری در ریسپانس"
] ]
} }

View File

@ -10,5 +10,12 @@
}, },
"WebSiteUrl": "https://vesmeh.com", "WebSiteUrl": "https://vesmeh.com",
"AdminPanelBaseUrl": "https://admin.vesmeh.com", "AdminPanelBaseUrl": "https://admin.vesmeh.com",
"StorageBaseUrl": "https://storage.vesmeh.com" "StorageBaseUrl": "https://storage.vesmeh.com",
"ApiUrl": "http://192.168.1.12:32770/api",
"IsShop": true
//"WebSiteUrl": "https://hamyanedalat.com",
//"AdminPanelBaseUrl": "https://admin.hamyanedalat.com",
//"StorageBaseUrl": "https://storage.hamyanedalat.com",
//"ApiUrl": "https://api.hamyanedalat.com/api",
//"IsShop": false
} }

View File

@ -10,5 +10,7 @@
}, },
"WebSiteUrl": "https://hamyanedalat.com", "WebSiteUrl": "https://hamyanedalat.com",
"AdminPanelBaseUrl": "https://admin.hamyanedalat.com", "AdminPanelBaseUrl": "https://admin.hamyanedalat.com",
"StorageBaseUrl": "https://storage.hamyanedalat.com" "StorageBaseUrl": "https://storage.hamyanedalat.com",
"ApiUrl": "https://api.hamyanedalat.com/api",
"IsShop": false
} }

View File

@ -1307,6 +1307,9 @@ input:checked + .toggle-bg {
.max-h-\[50rem\] { .max-h-\[50rem\] {
max-height: 50rem; max-height: 50rem;
} }
.max-h-\[60vh\] {
max-height: 60vh;
}
.min-h-\[33rem\] { .min-h-\[33rem\] {
min-height: 33rem; min-height: 33rem;
} }
@ -1484,6 +1487,9 @@ input:checked + .toggle-bg {
.overflow-x-scroll { .overflow-x-scroll {
overflow-x: scroll; overflow-x: scroll;
} }
.\!overflow-y-scroll {
overflow-y: scroll !important;
}
.overflow-y-scroll { .overflow-y-scroll {
overflow-y: scroll; overflow-y: scroll;
} }

View File

@ -1455,25 +1455,8 @@ input:checked + .toggle-bg {
max-height: 50rem; max-height: 50rem;
} }
.\!max-h-\[75vh\] { .max-h-\[60vh\] {
max-height: 75vh !important; max-height: 60vh;
}
.\!max-h-\[70vh\] {
max-height: 70vh !important;
}
.\!max-h-full {
max-height: 100% !important;
}
.\!max-h-\[70\%\] {
max-height: 70% !important;
}
.\!max-h-max {
max-height: -moz-max-content !important;
max-height: max-content !important;
} }
.min-h-\[33rem\] { .min-h-\[33rem\] {
@ -1707,6 +1690,10 @@ input:checked + .toggle-bg {
overflow-x: scroll; overflow-x: scroll;
} }
.\!overflow-y-scroll {
overflow-y: scroll !important;
}
.overflow-y-scroll { .overflow-y-scroll {
overflow-y: scroll; overflow-y: scroll;
} }