Refactor code structure for improved readability and maintainability
Build and Deploy / build (push) Failing after 16s

This commit is contained in:
masoodafar-web
2026-01-03 15:38:50 +03:30
parent 2d833605b4
commit c062bd358c
38 changed files with 296 additions and 130 deletions
+117 -54
View File
@@ -109,73 +109,136 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0"/>
<PackageReference Include="Foursat.BackOffice.BFF.Category.Protobuf" Version="0.0.5"/>
<PackageReference Include="Foursat.BackOffice.BFF.ClubMembership.Protobuf" Version="0.0.7"/>
<PackageReference Include="Foursat.BackOffice.BFF.Commission.Protobuf" Version="0.0.15"/>
<PackageReference Include="Foursat.BackOffice.BFF.Common.Protobuf" Version="0.0.3"/>
<PackageReference Include="Foursat.BackOffice.BFF.Configuration.Protobuf" Version="1.0.20"/>
<PackageReference Include="Foursat.BackOffice.BFF.DiscountCategory.Protobuf" Version="0.0.4"/>
<PackageReference Include="Foursat.BackOffice.BFF.DiscountOrder.Protobuf" Version="0.0.4"/>
<PackageReference Include="Foursat.BackOffice.BFF.DiscountProduct.Protobuf" Version="0.0.4"/>
<PackageReference Include="Foursat.BackOffice.BFF.DiscountShoppingCart.Protobuf" Version="0.0.4"/>
<PackageReference Include="Foursat.BackOffice.BFF.Health.Protobuf" Version="1.0.5"/>
<PackageReference Include="Foursat.BackOffice.BFF.ManualPayment.Protobuf" Version="0.0.14"/>
<PackageReference Include="Foursat.BackOffice.BFF.NetworkMembership.Protobuf" Version="0.0.11"/>
<PackageReference Include="Foursat.BackOffice.BFF.Otp.Protobuf" Version="0.0.113"/>
<PackageReference Include="FourSat.BackOffice.BFF.Package.Protobuf" Version="0.0.113"/>
<PackageReference Include="Foursat.BackOffice.BFF.Products.Protobuf" Version="0.0.11"/>
<PackageReference Include="Foursat.BackOffice.BFF.ProductTag.Protobuf" Version="0.0.4"/>
<PackageReference Include="Foursat.BackOffice.BFF.PublicMessage.Protobuf" Version="0.0.5"/>
<PackageReference Include="Foursat.BackOffice.BFF.Role.Protobuf" Version="0.0.113"/>
<PackageReference Include="Foursat.BackOffice.BFF.Tag.Protobuf" Version="0.0.5"/>
<PackageReference Include="Foursat.BackOffice.BFF.User.Protobuf" Version="0.0.114"/>
<PackageReference Include="Foursat.BackOffice.BFF.UserAddress.Protobuf" Version="0.0.113"/>
<PackageReference Include="Foursat.BackOffice.BFF.UserOrder.Protobuf" Version="0.0.116"/>
<PackageReference Include="Foursat.BackOffice.BFF.UserRole.Protobuf" Version="0.0.113"/>
<PackageReference Include="Foursat.BackOffice.BFF.Inventory.Protobuf" Version="0.0.1"/>
<!-- Proto Projects - Using ProjectReference for latest changes -->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Category.Protobuf/BackOffice.BFF.Category.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.ClubMembership.Protobuf/BackOffice.BFF.ClubMembership.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Commission.Protobuf/BackOffice.BFF.Commission.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Common.Protobuf/BackOffice.BFF.Common.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Configuration.Protobuf/BackOffice.BFF.Configuration.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.DiscountCategory.Protobuf/BackOffice.BFF.DiscountCategory.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.DiscountOrder.Protobuf/BackOffice.BFF.DiscountOrder.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.DiscountProduct.Protobuf/BackOffice.BFF.DiscountProduct.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.DiscountShoppingCart.Protobuf/BackOffice.BFF.DiscountShoppingCart.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Health.Protobuf/BackOffice.BFF.Health.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.ManualPayment.Protobuf/BackOffice.BFF.ManualPayment.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.NetworkMembership.Protobuf/BackOffice.BFF.NetworkMembership.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Otp.Protobuf/BackOffice.BFF.Otp.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Package.Protobuf/BackOffice.BFF.Package.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Products.Protobuf/BackOffice.BFF.Products.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.ProductTag.Protobuf/BackOffice.BFF.ProductTag.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.PublicMessage.Protobuf/BackOffice.BFF.PublicMessage.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Role.Protobuf/BackOffice.BFF.Role.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/BackOffice.BFF.Tag.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.User.Protobuf/BackOffice.BFF.User.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.UserAddress.Protobuf/BackOffice.BFF.UserAddress.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.UserOrder.Protobuf/BackOffice.BFF.UserOrder.Protobuf.csproj" />-->
<!-- <ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.UserRole.Protobuf/BackOffice.BFF.UserRole.Protobuf.csproj" />-->
<PackageReference Include="HtmlAgilityPack" Version="1.12.1"/>
<PackageReference Include="DateTimeConverterCL" Version="1.0.0"/>
<PackageReference Include="Grpc.Core" Version="2.46.6"/>
<PackageReference Include="Grpc.Net.Client" Version="2.71.0"/>
<PackageReference Include="Grpc.Net.Client.Web" Version="2.71.0"/>
<PackageReference Include="HtmlAgilityPack" Version="1.12.1"/>
<PackageReference Include="Mapster" Version="7.4.0"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.11"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.11"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.11" PrivateAssets="all"/>
<PackageReference Include="MudBlazor" Version="8.14.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4"/>
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.8.0"/>
<PackageReference Include="Tizzani.MudBlazor.HtmlEditor" Version="2.3.0"/>
<!-- Proto dependencies (needed when using DLL references) -->
<PackageReference Include="Google.Protobuf" Version="3.28.3"/>
<PackageReference Include="Google.Api.CommonProtos" Version="2.10.0"/>
<PackageReference Include="FluentValidation" Version="11.2.2"/>
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.2.2"/>
</ItemGroup>
<!-- ============================================================ -->
<!-- Proto References: Uses libs/ DLLs if available (CI/CD mode) -->
<!-- Falls back to ProjectReference if libs/ missing (dev mode) -->
<!-- Run ./build-deps.sh to populate libs/ folder -->
<!-- ============================================================ -->
<!-- CI/CD Mode: Use pre-built DLLs from libs/ folder -->
<ItemGroup Condition="Exists('../../libs/BackOffice.BFF.Common.Protobuf.dll')">
<Reference Include="BackOffice.BFF.Common.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Common.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Category.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Category.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.ClubMembership.Protobuf">
<HintPath>../../libs/BackOffice.BFF.ClubMembership.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Commission.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Commission.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Configuration.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Configuration.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.DiscountCategory.Protobuf">
<HintPath>../../libs/BackOffice.BFF.DiscountCategory.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.DiscountOrder.Protobuf">
<HintPath>../../libs/BackOffice.BFF.DiscountOrder.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.DiscountProduct.Protobuf">
<HintPath>../../libs/BackOffice.BFF.DiscountProduct.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.DiscountShoppingCart.Protobuf">
<HintPath>../../libs/BackOffice.BFF.DiscountShoppingCart.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Health.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Health.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Inventory.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Inventory.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.ManualPayment.Protobuf">
<HintPath>../../libs/BackOffice.BFF.ManualPayment.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.NetworkMembership.Protobuf">
<HintPath>../../libs/BackOffice.BFF.NetworkMembership.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Otp.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Otp.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Package.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Package.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Products.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Products.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.ProductTag.Protobuf">
<HintPath>../../libs/BackOffice.BFF.ProductTag.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.PublicMessage.Protobuf">
<HintPath>../../libs/BackOffice.BFF.PublicMessage.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Role.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Role.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.Tag.Protobuf">
<HintPath>../../libs/BackOffice.BFF.Tag.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.User.Protobuf">
<HintPath>../../libs/BackOffice.BFF.User.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.UserAddress.Protobuf">
<HintPath>../../libs/BackOffice.BFF.UserAddress.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.UserOrder.Protobuf">
<HintPath>../../libs/BackOffice.BFF.UserOrder.Protobuf.dll</HintPath>
</Reference>
<Reference Include="BackOffice.BFF.UserRole.Protobuf">
<HintPath>../../libs/BackOffice.BFF.UserRole.Protobuf.dll</HintPath>
</Reference>
</ItemGroup>
<!-- Dev Mode: Use ProjectReference when libs/ doesn't exist -->
<ItemGroup Condition="!Exists('../../libs/BackOffice.BFF.Common.Protobuf.dll')">
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Common.Protobuf/BackOffice.BFF.Common.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Category.Protobuf/BackOffice.BFF.Category.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.ClubMembership.Protobuf/BackOffice.BFF.ClubMembership.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Commission.Protobuf/BackOffice.BFF.Commission.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Configuration.Protobuf/BackOffice.BFF.Configuration.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.DiscountCategory.Protobuf/BackOffice.BFF.DiscountCategory.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.DiscountOrder.Protobuf/BackOffice.BFF.DiscountOrder.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.DiscountProduct.Protobuf/BackOffice.BFF.DiscountProduct.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.DiscountShoppingCart.Protobuf/BackOffice.BFF.DiscountShoppingCart.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Health.Protobuf/BackOffice.BFF.Health.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Inventory.Protobuf/BackOffice.BFF.Inventory.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.ManualPayment.Protobuf/BackOffice.BFF.ManualPayment.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.NetworkMembership.Protobuf/BackOffice.BFF.NetworkMembership.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Otp.Protobuf/BackOffice.BFF.Otp.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Package.Protobuf/BackOffice.BFF.Package.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Products.Protobuf/BackOffice.BFF.Products.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.ProductTag.Protobuf/BackOffice.BFF.ProductTag.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.PublicMessage.Protobuf/BackOffice.BFF.PublicMessage.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Role.Protobuf/BackOffice.BFF.Role.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.Tag.Protobuf/BackOffice.BFF.Tag.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.User.Protobuf/BackOffice.BFF.User.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.UserAddress.Protobuf/BackOffice.BFF.UserAddress.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.UserOrder.Protobuf/BackOffice.BFF.UserOrder.Protobuf.csproj" />
<ProjectReference Include="../../../BackOffice.BFF/src/Protobufs/BackOffice.BFF.UserRole.Protobuf/BackOffice.BFF.UserRole.Protobuf.csproj" />
</ItemGroup>
<ItemGroup>
+3
View File
@@ -5,6 +5,9 @@ WORKDIR /src
COPY ["BackOffice/NuGet.config", "NuGet.config"]
COPY ["BackOffice/BackOffice.csproj", "BackOffice/"]
# Copy libs folder with pre-built DLLs (built by build-deps.sh)
COPY ["libs/", "libs/"]
# Restore dependencies
RUN dotnet restore "BackOffice/BackOffice.csproj" --configfile NuGet.config
@@ -14,8 +14,8 @@
Variant="Variant.Outlined"
Required="true"
RequiredError="نوع محصول الزامی است">
<MudSelectItem Value="InventoryProductType.Regular">محصول عادی</MudSelectItem>
<MudSelectItem Value="InventoryProductType.Discount">محصول تخفیفی</MudSelectItem>
<MudSelectItem Value="InventoryProductType.RegularProduct">محصول عادی</MudSelectItem>
<MudSelectItem Value="InventoryProductType.DiscountProduct">محصول تخفیفی</MudSelectItem>
</MudSelect>
</MudItem>
<MudItem xs="12">
@@ -102,7 +102,7 @@
private bool _formValid;
private bool _isSubmitting;
private InventoryProductType _productType = InventoryProductType.Regular;
private InventoryProductType _productType = InventoryProductType.RegularProduct;
private long _productId;
private long? _warehouseId;
private int _quantity = 1;
@@ -156,15 +156,8 @@
var response = await InventoryContract.AddStockAsync(request);
if (response.Success)
{
Snackbar.Add($"موجودی جدید: {response.NewQuantity} عدد", Severity.Success);
MudDialog.Close(DialogResult.Ok(true));
}
else
{
Snackbar.Add(response.Message ?? "خطا در ثبت موجودی", Severity.Error);
}
Snackbar.Add($"موجودی جدید: {response.NewQuantity} عدد", Severity.Success);
MudDialog.Close(DialogResult.Ok(true));
}
catch (Exception ex)
{
@@ -6,7 +6,7 @@
<MudStack Spacing="4">
<MudAlert Severity="Severity.Info">
<MudStack Spacing="1">
<MudText>محصول: <strong>@Item.ProductName</strong></MudText>
<MudText>محصول: <strong>@Item.ProductTitle</strong></MudText>
<MudText>موجودی فعلی: <strong>@Item.Quantity</strong> عدد</MudText>
<MudText>رزرو شده: <strong>@Item.ReservedQuantity</strong> عدد</MudText>
<MudText>قابل فروش: <strong>@Item.AvailableQuantity</strong> عدد</MudText>
@@ -106,7 +106,7 @@
_isSubmitting = true;
try
{
var productId = Item.ProductType == ProductType.Regular
var productId = Item.ProductType == ProductType.RegularProduct
? (Item.ProductId ?? 0)
: (Item.DiscountProductId ?? 0);
@@ -115,20 +115,13 @@
ProductId = productId,
ProductType = Item.ProductType,
NewQuantity = _newQuantity,
Note = _note ?? string.Empty
Reason = _note ?? string.Empty
};
var response = await InventoryContract.AdjustStockAsync(request);
if (response.Success)
{
Snackbar.Add(response.Message ?? "موجودی با موفقیت تنظیم شد", Severity.Success);
MudDialog.Close(DialogResult.Ok(true));
}
else
{
Snackbar.Add(response.Message ?? "خطا در تنظیم موجودی", Severity.Error);
}
Snackbar.Add($"موجودی از {response.PreviousQuantity} به {response.NewQuantity} تغییر کرد (تفاوت: {response.Difference})", Severity.Success);
MudDialog.Close(DialogResult.Ok(true));
}
catch (Exception ex)
{
@@ -6,7 +6,7 @@
<MudStack Spacing="4">
<MudAlert Severity="Severity.Info">
<MudStack Spacing="1">
<MudText>محصول: <strong>@Item.ProductName</strong></MudText>
<MudText>محصول: <strong>@Item.ProductTitle</strong></MudText>
<MudText>انبار: <strong>@Item.WarehouseName</strong></MudText>
</MudStack>
</MudAlert>
@@ -110,7 +110,7 @@
{
var request = new UpdateInventorySettingsRequest
{
InventoryItemId = Item.Id,
Id = Item.Id,
LowStockThreshold = _lowStockThreshold,
ReorderPoint = _reorderPoint,
MaxStockLevel = _maxStockLevel
@@ -6,7 +6,7 @@
<MudStack Spacing="4">
<MudAlert Severity="Severity.Warning">
<MudStack Spacing="1">
<MudText>محصول: <strong>@Item.ProductName</strong></MudText>
<MudText>محصول: <strong>@Item.ProductTitle</strong></MudText>
<MudText>موجودی فعلی: <strong>@Item.Quantity</strong> عدد</MudText>
</MudStack>
</MudAlert>
@@ -33,6 +33,16 @@
Variant="Variant.Outlined"
HelperText="شماره گزارش یا سند داخلی" />
<MudSelect T="StockMovementType" @bind-Value="_lossType"
Label="نوع خسارت"
Variant="Variant.Outlined"
Required="true"
RequiredError="نوع خسارت الزامی است">
<MudSelectItem Value="StockMovementType.Loss">خسارت عمومی</MudSelectItem>
<MudSelectItem Value="StockMovementType.Damaged">آسیب‌دیده</MudSelectItem>
<MudSelectItem Value="StockMovementType.Expired">منقضی شده</MudSelectItem>
</MudSelect>
@if (_quantity > 0 && _quantity <= Item.Quantity)
{
<MudAlert Severity="Severity.Error">
@@ -73,6 +83,7 @@
private int _quantity = 1;
private string _reason = string.Empty;
private string _referenceNumber = string.Empty;
private StockMovementType _lossType = StockMovementType.Loss;
private void Cancel() => MudDialog.Cancel();
@@ -93,7 +104,7 @@
_isSubmitting = true;
try
{
var productId = Item.ProductType == ProductType.Regular
var productId = Item.ProductType == ProductType.RegularProduct
? (Item.ProductId ?? 0)
: (Item.DiscountProductId ?? 0);
@@ -102,6 +113,7 @@
ProductId = productId,
ProductType = Item.ProductType,
Quantity = _quantity,
LossType = _lossType,
Reason = _reason ?? string.Empty,
ReferenceNumber = _referenceNumber ?? string.Empty
};
@@ -28,8 +28,8 @@
Variant="Variant.Outlined"
Margin="Margin.Dense">
<MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem>
<MudSelectItem Value="ProductType.Regular">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.Discount">محصول تخفیفی</MudSelectItem>
<MudSelectItem Value="ProductType.RegularProduct">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.DiscountProduct">محصول تخفیفی</MudSelectItem>
</MudSelect>
</MudItem>
<MudItem xs="12" sm="6" md="3">
@@ -110,10 +110,10 @@
<Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" />
<PropertyColumn Property="x => x.ProductName" Title="نام محصول">
<PropertyColumn Property="x => x.ProductTitle" Title="نام محصول">
<CellTemplate>
<MudStack Spacing="0">
<MudText Typo="Typo.body2"><strong>@context.Item.ProductName</strong></MudText>
<MudText Typo="Typo.body2"><strong>@context.Item.ProductTitle</strong></MudText>
<MudText Typo="Typo.caption" Color="Color.Secondary">
@GetProductTypeLabel(context.Item.ProductType)
</MudText>
@@ -35,7 +35,7 @@ public partial class InventoryMainPage
{
var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest
{
ActiveOnly = true
IsActive = true
});
_warehouses = response.Warehouses.ToList();
}
@@ -51,7 +51,8 @@ public partial class InventoryMainPage
{
var response = await InventoryContract.GetLowStockItemsAsync(new GetLowStockItemsRequest
{
Count = 100 // Get up to 100 low stock items to count
Page = 1,
PageSize = 100 // Get up to 100 low stock items to count
});
_lowStockCount = response.TotalCount;
}
@@ -67,10 +68,10 @@ public partial class InventoryMainPage
{
var request = new GetAllInventoryItemsRequest
{
PageIndex = state.Page + 1,
Page = state.Page + 1,
PageSize = state.PageSize,
ProductType = _filterProductType,
SearchTerm = _searchTerm ?? string.Empty
Search = _searchTerm ?? string.Empty
};
if (_filterWarehouseId.HasValue)
@@ -103,8 +104,8 @@ public partial class InventoryMainPage
{
return type switch
{
ProductType.Regular => "محصول عادی",
ProductType.Discount => "محصول تخفیفی",
ProductType.RegularProduct => "محصول عادی",
ProductType.DiscountProduct => "محصول تخفیفی",
_ => "نامشخص"
};
}
@@ -153,13 +154,13 @@ public partial class InventoryMainPage
var parameters = new DialogParameters
{
["Warehouses"] = _warehouses,
["ProductIdParam"] = item.ProductType == ProductType.Regular ? item.ProductId : item.DiscountProductId,
["ProductIdParam"] = item.ProductType == ProductType.RegularProduct ? item.ProductId : item.DiscountProductId,
["ProductTypeParam"] = item.ProductType,
["ProductName"] = item.ProductName,
["ProductName"] = item.ProductTitle,
["WarehouseIdParam"] = item.WarehouseId
};
var dialog = await DialogService.ShowAsync<AddStockDialog>($"ورود کالا - {item.ProductName}", parameters, new DialogOptions
var dialog = await DialogService.ShowAsync<AddStockDialog>($"ورود کالا - {item.ProductTitle}", parameters, new DialogOptions
{
CloseButton = true,
MaxWidth = MaxWidth.Medium,
@@ -182,7 +183,7 @@ public partial class InventoryMainPage
["Item"] = item
};
var dialog = await DialogService.ShowAsync<AdjustStockDialog>($"تنظیم موجودی - {item.ProductName}", parameters, new DialogOptions
var dialog = await DialogService.ShowAsync<AdjustStockDialog>($"تنظیم موجودی - {item.ProductTitle}", parameters, new DialogOptions
{
CloseButton = true,
MaxWidth = MaxWidth.Small,
@@ -205,7 +206,7 @@ public partial class InventoryMainPage
["Item"] = item
};
var dialog = await DialogService.ShowAsync<RecordLossDialog>($"ثبت خسارت - {item.ProductName}", parameters, new DialogOptions
var dialog = await DialogService.ShowAsync<RecordLossDialog>($"ثبت خسارت - {item.ProductTitle}", parameters, new DialogOptions
{
CloseButton = true,
MaxWidth = MaxWidth.Small,
@@ -228,7 +229,7 @@ public partial class InventoryMainPage
["Item"] = item
};
var dialog = await DialogService.ShowAsync<InventorySettingsDialog>($"تنظیمات - {item.ProductName}", parameters, new DialogOptions
var dialog = await DialogService.ShowAsync<InventorySettingsDialog>($"تنظیمات - {item.ProductTitle}", parameters, new DialogOptions
{
CloseButton = true,
MaxWidth = MaxWidth.Small,
@@ -245,6 +246,6 @@ public partial class InventoryMainPage
private void ViewMovements(InventoryItemDto item)
{
Navigation.NavigateTo($"{RouteConstance.InventoryMovements}?itemId={item.Id}&productName={item.ProductName}");
Navigation.NavigateTo($"{RouteConstance.InventoryMovements}?itemId={item.Id}&productName={item.ProductTitle}");
}
}
@@ -43,8 +43,8 @@
Variant="Variant.Outlined"
Margin="Margin.Dense">
<MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem>
<MudSelectItem Value="ProductType.Regular">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.Discount">محصول تخفیفی</MudSelectItem>
<MudSelectItem Value="ProductType.RegularProduct">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.DiscountProduct">محصول تخفیفی</MudSelectItem>
</MudSelect>
</MudItem>
<MudItem xs="12" sm="6" md="4" Class="d-flex align-end">
@@ -73,14 +73,14 @@
}
else
{
<MudDataGrid T="LowStockItemDto" Items="_items" Hover="true" Height="60vh">
<MudDataGrid T="InventoryItemDto" Items="_items" Hover="true" Height="60vh">
<Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" />
<PropertyColumn Property="x => x.ProductName" Title="نام محصول">
<PropertyColumn Property="x => x.ProductTitle" Title="نام محصول">
<CellTemplate>
<MudStack Spacing="0">
<MudText Typo="Typo.body2"><strong>@context.Item.ProductName</strong></MudText>
<MudText Typo="Typo.body2"><strong>@context.Item.ProductTitle</strong></MudText>
<MudText Typo="Typo.caption" Color="Color.Secondary">
@GetProductTypeLabel(context.Item.ProductType)
</MudText>
@@ -136,7 +136,7 @@
</TemplateColumn>
</Columns>
<PagerContent>
<MudDataGridPager T="LowStockItemDto"
<MudDataGridPager T="InventoryItemDto"
PageSizeOptions="@(new int[] { 20, 50, 100 })"
InfoFormat="سطر {first_item} تا {last_item} از {all_items}"
RowsPerPageString="تعداد سطرهای صفحه" />
@@ -10,7 +10,7 @@ public partial class LowStockPage
{
[Inject] public InventoryBFFContract.InventoryBFFContractClient InventoryContract { get; set; } = default!;
private List<LowStockItemDto> _items = new();
private List<InventoryItemDto> _items = new();
private List<WarehouseDto> _warehouses = new();
private bool _isLoading = true;
@@ -30,7 +30,7 @@ public partial class LowStockPage
{
var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest
{
ActiveOnly = true
IsActive = true
});
_warehouses = response.Warehouses.ToList();
}
@@ -49,7 +49,8 @@ public partial class LowStockPage
{
var request = new GetLowStockItemsRequest
{
Count = 200, // Get up to 200 low stock items
Page = 1,
PageSize = 200, // Get up to 200 low stock items
ProductType = _filterProductType
};
@@ -77,15 +78,15 @@ public partial class LowStockPage
{
return type switch
{
ProductType.Regular => "محصول عادی",
ProductType.Discount => "محصول تخفیفی",
ProductType.RegularProduct => "محصول عادی",
ProductType.DiscountProduct => "محصول تخفیفی",
_ => "نامشخص"
};
}
private async Task OpenAddStockDialog(LowStockItemDto item)
private async Task OpenAddStockDialog(InventoryItemDto item)
{
var productId = item.ProductType == ProductType.Regular
var productId = item.ProductType == ProductType.RegularProduct
? (item.ProductId ?? 0)
: (item.DiscountProductId ?? 0);
@@ -94,11 +95,11 @@ public partial class LowStockPage
["Warehouses"] = _warehouses,
["ProductIdParam"] = productId,
["ProductTypeParam"] = item.ProductType,
["ProductName"] = item.ProductName,
["ProductName"] = item.ProductTitle,
["WarehouseIdParam"] = item.WarehouseId
};
var dialog = await DialogService.ShowAsync<AddStockDialog>($"ورود کالا - {item.ProductName}", parameters, new DialogOptions
var dialog = await DialogService.ShowAsync<AddStockDialog>($"ورود کالا - {item.ProductTitle}", parameters, new DialogOptions
{
CloseButton = true,
MaxWidth = MaxWidth.Medium,
@@ -29,7 +29,7 @@
Label="نوع تغییر"
Variant="Variant.Outlined"
Margin="Margin.Dense">
<MudSelectItem Value="StockMovementType.Unspecified">همه</MudSelectItem>
<MudSelectItem Value="StockMovementType.MovementTypeUnspecified">همه</MudSelectItem>
<MudSelectItem Value="StockMovementType.InitialStock">موجودی اولیه</MudSelectItem>
<MudSelectItem Value="StockMovementType.Restock">ورود کالا</MudSelectItem>
<MudSelectItem Value="StockMovementType.Return">برگشت از مشتری</MudSelectItem>
@@ -51,8 +51,8 @@
Variant="Variant.Outlined"
Margin="Margin.Dense">
<MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem>
<MudSelectItem Value="ProductType.Regular">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.Discount">محصول تخفیفی</MudSelectItem>
<MudSelectItem Value="ProductType.RegularProduct">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.DiscountProduct">محصول تخفیفی</MudSelectItem>
</MudSelect>
</MudItem>
<MudItem xs="12" sm="6" md="3">
@@ -103,14 +103,14 @@
<Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" />
<PropertyColumn Property="x => x.ProductName" Title="محصول" />
<PropertyColumn Property="x => x.ProductTitle" Title="محصول" />
<PropertyColumn Property="x => x.MovementTypeName" Title="نوع تغییر">
<PropertyColumn Property="x => x.MovementType" Title="نوع تغییر">
<CellTemplate>
<MudChip T="string"
Color="@GetMovementColor(context.Item.MovementType)"
Size="Size.Small">
@context.Item.MovementTypeName
@GetMovementTypeLabel(context.Item.MovementType)
</MudChip>
</CellTemplate>
</PropertyColumn>
@@ -139,11 +139,11 @@
</CellTemplate>
</PropertyColumn>
<PropertyColumn Property="x => x.PerformedByUserName" Title="کاربر">
<PropertyColumn Property="x => x.PerformedByUserId" Title="کاربر">
<CellTemplate>
@if (!string.IsNullOrEmpty(context.Item.PerformedByUserName))
@if (context.Item.PerformedByUserId != null && context.Item.PerformedByUserId > 0)
{
<MudText Typo="Typo.caption">@context.Item.PerformedByUserName</MudText>
<MudText Typo="Typo.caption">کاربر #@context.Item.PerformedByUserId</MudText>
}
else
{
@@ -152,12 +152,12 @@
</CellTemplate>
</PropertyColumn>
<PropertyColumn Property="x => x.CreatedAt" Title="تاریخ">
<PropertyColumn Property="x => x.Created" Title="تاریخ">
<CellTemplate>
@if (context.Item.CreatedAt != null)
@if (context.Item.Created != null)
{
<MudText Typo="Typo.caption">
@context.Item.CreatedAt.ToDateTime().ToLocalTime().ToString("yyyy/MM/dd HH:mm")
@context.Item.Created.ToDateTime().ToLocalTime().ToString("yyyy/MM/dd HH:mm")
</MudText>
}
</CellTemplate>
@@ -20,7 +20,7 @@ public partial class MovementsPage
private int _totalCount;
// Filter fields
private StockMovementType _filterMovementType = StockMovementType.Unspecified;
private StockMovementType _filterMovementType = StockMovementType.MovementTypeUnspecified;
private ProductType _filterProductType = ProductType.Unspecified;
private DateTime? _filterFromDate;
private DateTime? _filterToDate;
@@ -31,7 +31,7 @@ public partial class MovementsPage
{
var request = new GetStockMovementsRequest
{
PageIndex = state.Page + 1,
Page = state.Page + 1,
PageSize = state.PageSize,
MovementType = _filterMovementType,
ProductType = _filterProductType
@@ -94,6 +94,27 @@ public partial class MovementsPage
};
}
private string GetMovementTypeLabel(StockMovementType type)
{
return type switch
{
StockMovementType.InitialStock => "موجودی اولیه",
StockMovementType.Restock => "ورود کالا",
StockMovementType.Return => "برگشت از مشتری",
StockMovementType.Sale => "فروش",
StockMovementType.AdjustmentIncrease => "افزایش موجودی",
StockMovementType.AdjustmentDecrease => "کاهش موجودی",
StockMovementType.Reserved => "رزرو",
StockMovementType.Released => "آزادسازی رزرو",
StockMovementType.Loss => "خسارت",
StockMovementType.Damaged => "آسیب‌دیده",
StockMovementType.Expired => "منقضی",
StockMovementType.TransferOut => "انتقال به بیرون",
StockMovementType.TransferIn => "انتقال به داخل",
_ => "نامشخص"
};
}
private bool IsIncreaseMovement(StockMovementType type)
{
return type switch
@@ -118,7 +139,7 @@ public partial class MovementsPage
private async Task ClearFilter()
{
_filterMovementType = StockMovementType.Unspecified;
_filterMovementType = StockMovementType.MovementTypeUnspecified;
_filterProductType = ProductType.Unspecified;
_filterFromDate = null;
_filterToDate = null;
@@ -28,7 +28,7 @@ public partial class WarehousesPage
{
var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest
{
ActiveOnly = _showActiveOnly
IsActive = _showActiveOnly
});
_warehouses = response.Warehouses.ToList();
}