fix(no-scrollbar) , fix(OrdersPagePagination) , feat(ShowOrderBagQuery)

-Fix no-scrollbar in pages
-Fix orders page pageination at page 2
-Add show order bag query in GetOrders
subProduct
Amir Hossein Khademi 2024-06-12 13:18:27 +03:30
parent f64cd7d960
commit 82ace9a4dd
21 changed files with 156 additions and 83 deletions

View File

@ -1,8 +1,9 @@
@inject NavigationManager NavigationManager
@inject IRestWrapper RestWrapper
@inject IUserUtility UserUtility
@inject ISnackbar Snackbar
<MudStack class="w-full pt-4 h-screen bg-[--mud-palette-background]">
<MudStack class="bg-[--mud-palette-background] h-screen w-full pt-4">
<MudNavMenu Rounded="true" Margin="Margin.Dense" Color="Color.Warning" Class="pa-2" Bordered="true">
<MudNavLink Href="home" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Dashboard">داشبورد</MudNavLink>
@ -21,6 +22,9 @@
Icon="@Icons.Material.Outlined.AllInbox">دسته بندی محصولاتـــ</MudNavLink>
<MudNavLink Href="product/brands"
Icon="@Icons.Custom.Brands.Facebook">برند محصولاتــــ</MudNavLink>
<MudNavLink Href="product/shipping"
Icon="@Icons.Material.Outlined.AirportShuttle">روش های ارسال</MudNavLink>
</MudNavGroup>
}
@ -51,18 +55,6 @@
</MudNavGroup>
}
@if (isShop)
{
<MudNavGroup Title="انبارداری" Expanded="false"
Icon="@Icons.Material.Outlined.Inventory">
<MudNavLink Href="inveroty"
Icon="@Icons.Material.Outlined.Inventory2">انبار</MudNavLink>
<MudNavLink Href="inventory/shipping"
Icon="@Icons.Material.Outlined.AirportShuttle">روش های ارسال</MudNavLink>
</MudNavGroup>
}
@if (isShop)
{
<MudNavGroup Title="باشگاه مشتریانـــ" Expanded="false"
@ -70,23 +62,16 @@
<MudNavLink Href="customers"
Icon="@Icons.Material.Outlined.PeopleAlt">مشترکین</MudNavLink>
<MudNavLink Href="smspanel"
Icon="@Icons.Material.Outlined.Sms">پنل پیامکی</MudNavLink>
<MudNavLink Href="newsletler"
Icon="@Icons.Material.Outlined.Newspaper">خبرنامه</MudNavLink>
</MudNavGroup>
}
@if (isShop)
{
<MudNavGroup Title="شخصی سازی" Expanded="false" Icon="@Icons.Material.Outlined.PersonalInjury">
<MudNavLink Href="personalization/nav" Icon="@Icons.Material.Filled.Navigation">فهرست ها</MudNavLink>
</MudNavGroup>
}
@if (isShop)
{
<MudNavGroup Title="فروشگاه من" Expanded="false" Icon="@Icons.Material.Outlined.Settings">
<MudNavLink Href="management/shop" Icon="@Icons.Material.Filled.Shop2">فروشگاه</MudNavLink>
<MudNavLink Href="management/marketer" Icon="@Icons.Material.Filled.Person4">بازاریاب ها</MudNavLink>
<MudNavLink Href="personalization/nav" Icon="@Icons.Material.Filled.MenuOpen">فهرست ها</MudNavLink>
</MudNavGroup>
}
else
@ -101,7 +86,7 @@
<MudNavLink Href="setting/users" Icon="@Icons.Material.Filled.ManageAccounts">نقش ها و کاربران</MudNavLink>
</MudNavGroup>
</MudNavMenu>
<p class="bottom-0 align-bottom mx-auto">Version : @version</p>
<p class="bottom-0 mx-auto align-bottom">Version : @version</p>
</MudStack>
@code
@ -112,20 +97,27 @@
{
try
{
_permissions = await UserUtility.GetPermissionsAsync() ?? new List<string>();
var token = await UserUtility.GetBearerTokenAsync();
if (token == null)
try
{
await UserUtility.LogoutAsync();
NavigationManager.NavigateTo("login", true, true);
return;
}
_permissions = await UserUtility.GetPermissionsAsync() ?? new List<string>();
var token = await UserUtility.GetBearerTokenAsync();
if (token == null)
{
await UserUtility.LogoutAsync();
NavigationManager.NavigateTo("login", true, true);
return;
}
var rest = await RestWrapper.SettingRestApi.GetSettingAsync<NetinaSetting>(nameof(NetinaSetting), token);
if (rest.WebSiteType == 0)
isShop = true;
else
isShop = false;
var rest = await RestWrapper.SettingRestApi.GetSettingAsync<NetinaSetting>(nameof(NetinaSetting), token);
if (rest.WebSiteType == 0)
isShop = true;
else
isShop = false;
}
catch (Exception e)
{
Snackbar.Add("در دریافت اطلاعات مشکلی رخ داده است", Severity.Error);
}
await base.OnInitializedAsync();
}

View File

@ -6,11 +6,11 @@
<MudDialog class="mx-auto h-screen overflow-y-auto p-0">
<DialogContent>
<MudContainer class="p-0">
<MudContainer class="p-0 text-black">
<MudStack Row="true">
<MudText Typo="Typo.h6" class="my-auto">افزودن سریع محصول</MudText>
<MudSpacer />
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="()=>MudDialog.Close()"></MudIconButton>
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="()=>MudDialog.Close(DialogResult.Ok(true))"></MudIconButton>
</MudStack>
<MudAlert Dense="true" NoIcon="true" Variant="Variant.Outlined" ContentAlignment="HorizontalAlignment.Center" class="mb-4 mt-2" Severity="Severity.Warning">در این صفحه تنها اطلاعات اولیه ثبت میشوند و باید برای تکمیل اطلاعات محصول به صحفه اصلی تغییرات محصول بروید</MudAlert>
<MudStack Row="true" class="no-scrollbar h-full w-full overflow-x-auto">
@ -34,7 +34,11 @@
<MudTextField Disabled="@ViewModel.FormEnable.Not()" @bind-Value="@ViewModel.PageDto.PersianName" Variant="Variant.Outlined" T="string" Label="نام فارسی کالا" />
</MudItem>
<MudItem xs="12" md="6">
<MudAutocomplete Disabled="@ViewModel.FormEnable.Not()" Required="true" ToStringFunc="dto => dto.PersianName" @bind-Value="@ViewModel.SelectedBrand"
<MudAutocomplete Disabled="@ViewModel.FormEnable.Not()"
Required="true"
ToStringFunc="dto => dto.PersianName"
Strict="true"
@bind-Value="@ViewModel.SelectedBrand"
SearchFunc="ViewModel.SearchBrand"
@bind-Text="@brandAutocompleteText"
T="BrandSDto"

View File

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Components.Forms;
using Netina.Common.Models.Api;
using Netina.Domain.Entities.Brands;
namespace Netina.AdminPanel.PWA.Dialogs;
@ -83,18 +82,19 @@ public class FastProductCreateDialogBoxViewModel(ISnackbar snackbar, IRestWrappe
{
if (brandName.IsNullOrEmpty())
return;
var brand = new BrandSDto { PersianName = brandName };
brands.Add(brand);
SelectedBrand = brand;
Task.Run(async () =>
{
var token = await userUtility.GetBearerTokenAsync();
if (token == null)
return;
var brand = new BrandSDto { PersianName = brandName };
brands.Add(brand);
var command = brand.Adapt<CreateBrandCommand>() with {Files = new()};
var response = await restWrapper.CrudApiRest<Brand, Guid>(Address.BrandController)
.Create(command, token);
brand.Id = response;
SelectedBrand = brand;
snackbar.Add($"افزودن برند {brand.PersianName} با موفقیت انجام شد");
});
}
public void SubmitCreateProduct()

View File

@ -5,8 +5,8 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<AssemblyVersion>1.0.3.3</AssemblyVersion>
<FileVersion>1.0.3.3</FileVersion>
<AssemblyVersion>1.0.3.4</AssemblyVersion>
<FileVersion>1.0.3.4</FileVersion>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
</PropertyGroup>

View File

@ -7,7 +7,7 @@
@inject IUserUtility UserUtility
@inject IRestWrapper RestWrapper
<MudStack class="no-scrollbar h-full w-full p-8">
<MudStack class="h-full w-full p-8">
<MudGrid>
<MudItem xs="12">
<MudStack Row="true" class="mb-5">

View File

@ -9,7 +9,7 @@
@inject IConfiguration Configuration
@inject IJSRuntime JsRuntime
<MudStack class="no-scrollbar h-full w-full p-8">
<MudStack class="h-full w-full p-8">
<MudGrid>
<MudItem xs="12">
<MudStack Row="true" class="mb-5">

View File

@ -7,7 +7,7 @@
@inject IUserUtility UserUtility
<MudStack class="no-scrollbar h-full w-full p-8">
<MudStack class="h-full w-full p-8">
<MudGrid>
<MudItem xs="12">
<MudStack Row="true" class="mb-5">

View File

@ -10,7 +10,7 @@
background-color: var(--mud-palette-background-grey);
}
</style> *@
<MudPaper class="bg-[--mud-palette-background-grey] h-screen w-full p-3 md:p-8">
<MudPaper class="h-full w-full p-3 md:p-8">
<MudStack Row="true" class="overflow-x-auto pb-3">
<MudStack Spacing="1" class="min-w-[340px]">
<MudStack Row="true" class="mb-5">

View File

@ -7,7 +7,7 @@
@inject IUserUtility UserUtility
@inject IRestWrapper RestWrapper
<MudStack class="no-scrollbar h-full w-full p-8">
<MudStack class="h-full w-full p-8">
<MudGrid>
<MudItem xs="12">
<MudStack Row="true" class="mb-5">

View File

@ -8,7 +8,7 @@
@inject IUserUtility UserUtility
@inject IRestWrapper RestWrapper
<MudStack class="no-scrollbar h-full w-full overflow-x-hidden px-0 md:p-5 lg:p-8">
<MudStack class="h-full w-full overflow-x-hidden px-0 md:p-5 lg:p-8">
<MudHidden Breakpoint="Breakpoint.Xs">
<MudGrid>
<MudItem xs="12" sm="4" lg="2">

View File

@ -7,7 +7,7 @@
@inject IUserUtility UserUtility
@inject IRestWrapper RestWrapper
<MudStack class="no-scrollbar h-full w-full p-8">
<MudStack class="h-full w-full p-8">
<MudGrid>
<MudItem xs="12">
<MudPaper class="px-5 py-5">

View File

@ -8,7 +8,7 @@
@inject IRestWrapper RestWrapper
@inject IBrowserViewportService BrowserViewportService
<MudStack class="no-scrollbar h-full w-full overflow-x-hidden overflow-y-scroll md:p-5 lg:px-8">
<MudStack class="h-full w-full overflow-x-hidden overflow-y-scroll md:p-5 lg:px-8">
<MudHidden Breakpoint="Breakpoint.Xs">
<MudGrid>
@ -108,7 +108,7 @@
</MudItem>
</MudGrid>
</MudHidden>
<MudPaper >
<MudPaper>
<MudDataGrid FixedFooter="true" FixedHeader="true" Striped="true"
T="OrderSDto" Items="@ViewModel.MainOrders" CurrentPage="@ViewModel.MainGridCurrentPage"
RowsPerPage="20" Filterable="false" Loading="@ViewModel.IsProcessing"
@ -116,7 +116,7 @@
<ToolBarContent>
<MudGrid class="collapse md:visible">
<MudItem md="6">
<MudItem md="5">
<MudTextField T="string" Placeholder="جست جو بر اساس کد فاکتور" OnClearButtonClick="@ViewModel.SearchAsync"
Adornment="Adornment.Start"
Immediate="true"
@ -127,12 +127,12 @@
@bind-Value="@ViewModel.FactorCodeSearch"
OnAdornmentClick="@ViewModel.SearchAsync"></MudTextField>
</MudItem>
<MudItem md="6">
<MudItem md="5">
<MudAutocomplete ToStringFunc="arg => arg.Title" ValueChanged="@ViewModel.SearchByOrderStatusAsync"
Value="@ViewModel.OrderStatusSearch"
SearchFunc="@ViewModel.OrderStatusSearchAsync"
T="FilterOptionDto<OrderStatus>"
class="-mt-0.5"
class="my-auto"
OnClearButtonClick="async () => await ViewModel.SearchByOrderStatusAsync(null)"
Clearable="true"
Label="وظعیت سفارش">
@ -144,6 +144,9 @@
</ItemTemplate>
</MudAutocomplete>
</MudItem>
<MudItem md="2">
<MudSwitch class="mt-4" T="bool" Value="@ViewModel.ShowOrderBags" ValueChanged="async (flag) => await ViewModel.ChangeShowOrderBagsAsync(flag) " Label="نمایش سبد خرید ها" Color="Color.Info" />
</MudItem>
</MudGrid>
</ToolBarContent>
<Columns>

View File

@ -85,10 +85,14 @@ public class OrdersPageViewModel : BaseViewModel<OrderDashboardDto>
throw new Exception("Token is null");
var dto = await _restWrapper.OrderRestApi.ReadAll(MainGridCurrentPage, FactorCodeSearch, null,
OrderStatusSearch?.Value, null, token);
var dto = await _restWrapper.OrderRestApi.ReadAll(MainGridCurrentPage, token,
FactorCodeSearch,
null,
OrderStatusSearch?.Value,
null,
ShowOrderBags == false ? null : true);
dto.ForEach(d => MainOrders.Add(d));
if (MainOrders.Count == 15)
if (MainOrders.Count % 15 == 0)
MainGridPageCount = MainGridCurrentPage + 2;
}
@ -128,6 +132,8 @@ public class OrdersPageViewModel : BaseViewModel<OrderDashboardDto>
}
public string? FactorCodeSearch { get; set; } = null;
public bool ShowOrderBags { get; set; } = false;
public async Task SearchAsync()
{
try
@ -139,8 +145,12 @@ public class OrdersPageViewModel : BaseViewModel<OrderDashboardDto>
MainOrders.Clear();
List<OrderSDto> dto;
dto = await _restWrapper.OrderRestApi.ReadAll(MainGridCurrentPage, FactorCodeSearch, null,
OrderStatusSearch?.Value, null, token);
dto = await _restWrapper.OrderRestApi.ReadAll(MainGridCurrentPage, token,
FactorCodeSearch,
null,
OrderStatusSearch?.Value,
null,
ShowOrderBags == false ? null : true);
dto.ForEach(d => MainOrders.Add(d));
if (MainOrders.Count == 15)
@ -187,10 +197,15 @@ public class OrdersPageViewModel : BaseViewModel<OrderDashboardDto>
return OrderStatusFilterOptions;
return OrderStatusFilterOptions.Where(o => o.Title == orderStatus).ToList();
}
public async Task SearchByOrderStatusAsync(FilterOptionDto<OrderStatus>? arg)
{
OrderStatusSearch = arg;
await SearchAsync();
}
public async Task ChangeShowOrderBagsAsync(bool? arg)
{
ShowOrderBags = arg ?? false;
await SearchAsync();
}
}

View File

@ -7,7 +7,7 @@
@inject IUserUtility UserUtility
@inject IRestWrapper RestWrapper
<MudStack class="no-scrollbar h-full w-full p-8">
<MudStack class="h-full w-full p-8">
<MudGrid>
<MudItem xs="12">
<MudStack Row="true" class="mb-5">

View File

@ -8,7 +8,7 @@
@inject IRestWrapper RestWrapper
@inject IBrowserViewportService BrowserViewportService
<MudStack class="no-scrollbar h-full w-full p-8">
<MudStack class="h-full w-full p-8">
<MudGrid>
<MudItem xs="12">
<MudStack Row="@ViewModel.IsXs.Not()" class="mb-5">

View File

@ -1,4 +1,4 @@
@page "/inventory/shipping"
@page "/product/shipping"
@attribute [Microsoft.AspNetCore.Authorization.Authorize]
@inject IDialogService DialogService

View File

@ -3,11 +3,13 @@
public interface IOrderRestApi
{
[Get("")]
Task<List<OrderSDto>> ReadAll([Query]int page, [Query] string? factorCode, [Query] long? selectedDate, [Query] OrderStatus? orderStatus, [Query] OrderQueryDateFilter? dateFilter, [Header("Authorization")] string authorization);
[Get("")]
Task<List<OrderSDto>> ReadAll([Query] int page, [Header("Authorization")] string authorization);
Task<List<OrderSDto>> ReadAll([Query]int page,
[Header("Authorization")] string authorization,
[Query] string? factorCode = null,
[Query] long? selectedDate = null,
[Query] OrderStatus? orderStatus = null,
[Query] OrderQueryDateFilter? dateFilter = null,
[Query] bool? orderBags = null);
[Get("/{id}")]
Task<OrderLDto> ReadOne(Guid id, [Header("Authorization")] string authorization);
@ -16,7 +18,4 @@ public interface IOrderRestApi
Task<bool> ConfirmOrderStepAsync(Guid id,[Query] OrderStatus nextOrderStatus, [Header("Authorization")] string authorization);
[Post("/{id}/confirm")]
Task<bool> ConfirmOrderStepAsync(Guid id, [Query] OrderStatus nextOrderStatus, [Query]string trackingCode, [Header("Authorization")] string authorization);
[Get("/{id}/invoice")]
Task<HttpContent> GetOrderInvoice(Guid id, [Header("Authorization")] string authorization);
}

View File

@ -91,9 +91,9 @@
--color-primary: rgba(9, 16, 68, 1);
--color-secondary: rgba(229, 159, 46, 1);
--color-background: rgba(243, 244, 246, 1);
}
}
.revert-tailwind {
all: initial;
}
@ -113,6 +113,16 @@
scrollbar-width: none; /* Firefox */
}
.auto-scrollbar {
-ms-overflow-style: auto; /* IE and Edge */
scrollbar-width: auto; /* Firefox */
}
.auto-scrollbar::-webkit-scrollbar {
display: block;
}
.mud-dialog-title {
font-family: iranyekan !important;
}
@ -132,7 +142,7 @@ a, .btn-link {
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}
.content {

View File

@ -864,7 +864,6 @@ input:checked + .toggle-bg {
--color-primary: rgba(9, 16, 68, 1);
--color-secondary: rgba(229, 159, 46, 1);
--color-background: rgba(243, 244, 246, 1);
}
*, ::before, ::after {
@ -1785,6 +1784,10 @@ input:checked + .toggle-bg {
--tw-text-opacity: 1;
color: rgb(217 119 6 / var(--tw-text-opacity));
}
.text-black {
--tw-text-opacity: 1;
color: rgb(0 0 0 / var(--tw-text-opacity));
}
.text-blue-600 {
--tw-text-opacity: 1;
color: rgb(28 100 242 / var(--tw-text-opacity));
@ -1956,6 +1959,7 @@ input:checked + .toggle-bg {
url('../assets/fonts/woff/iranyekanwebextrablackfanum.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('../assets/fonts/ttf/iranyekanwebextrablackfanum.ttf') format('truetype');
}
.revert-tailwind {
all: initial;
}
@ -1975,6 +1979,16 @@ input:checked + .toggle-bg {
scrollbar-width: none; /* Firefox */
}
.auto-scrollbar {
-ms-overflow-style: auto; /* IE and Edge */
scrollbar-width: auto; /* Firefox */
}
.auto-scrollbar::-webkit-scrollbar {
display: block;
}
.mud-dialog-title {
font-family: iranyekan !important;
}
@ -1994,7 +2008,7 @@ a, .btn-link {
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}
.content {

View File

@ -1259,6 +1259,10 @@ input:checked + .toggle-bg {
margin-top: -0.75rem;
}
.-mt-\[3px\] {
margin-top: -3px;
}
.mb-1 {
margin-bottom: 0.25rem;
}
@ -1335,6 +1339,22 @@ input:checked + .toggle-bg {
margin-top: 2rem;
}
.-mt-\[4px\] {
margin-top: -4px;
}
.-mt-\[2px\] {
margin-top: -2px;
}
.-mt-\[5px\] {
margin-top: -5px;
}
.-mt-\[0\.15rem\] {
margin-top: -0.15rem;
}
.block {
display: block;
}
@ -2075,6 +2095,11 @@ input:checked + .toggle-bg {
color: rgb(217 119 6 / var(--tw-text-opacity));
}
.text-black {
--tw-text-opacity: 1;
color: rgb(0 0 0 / var(--tw-text-opacity));
}
.text-blue-600 {
--tw-text-opacity: 1;
color: rgb(28 100 242 / var(--tw-text-opacity));
@ -2323,6 +2348,17 @@ input:checked + .toggle-bg {
/* Firefox */
}
.auto-scrollbar {
-ms-overflow-style: auto;
/* IE and Edge */
scrollbar-width: auto;
/* Firefox */
}
.auto-scrollbar::-webkit-scrollbar {
display: block;
}
.mud-dialog-title {
font-family: iranyekan !important;
}

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
@ -32,8 +32,8 @@
<h1 class="text-5xl"><b>پنـــــل ادمین فروشگاه</b></h1>
<div class="my-10" style="display:flex; gap:10px; justify-content:center; align-items:center">
<div class="relative">
<div class="h-24 w-24 rounded-full border-t-8 border-b-8 border-gray-200"></div>
<div class="absolute top-0 left-0 h-24 w-24 rounded-full border-t-8 border-b-8 border-indigo-500 animate-spin">
<div class="border-t-8 border-b-8 h-24 w-24 rounded-full border-gray-200"></div>
<div class="border-t-8 border-b-8 absolute left-0 top-0 h-24 w-24 animate-spin rounded-full border-indigo-500">
</div>
</div>
</div>
@ -43,10 +43,10 @@
</div>
</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
<div dir="rtl" id="blazor-error-ui" class="!text-black">
<b>مشکلی رخ داده است</b>
<a href="" class="reload">بارگزاری مجدد</a>
<a class="dismiss">بستن</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>