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
Executable
+79
View File
@@ -0,0 +1,79 @@
#!/bin/bash
# Build all BFF proto dependencies and copy DLLs to libs folder
# This script is automatically run before build via Directory.Build.targets
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LIBS_DIR="$SCRIPT_DIR/libs"
BFF_PROTOS_DIR="$SCRIPT_DIR/../BackOffice.BFF/src/Protobufs"
echo "🔧 Building all proto dependencies..."
# Create libs directory
mkdir -p "$LIBS_DIR"
# All proto projects
PROTO_PROJECTS=(
"BackOffice.BFF.Common.Protobuf"
"BackOffice.BFF.Category.Protobuf"
"BackOffice.BFF.ClubMembership.Protobuf"
"BackOffice.BFF.Commission.Protobuf"
"BackOffice.BFF.Configuration.Protobuf"
"BackOffice.BFF.DiscountCategory.Protobuf"
"BackOffice.BFF.DiscountOrder.Protobuf"
"BackOffice.BFF.DiscountProduct.Protobuf"
"BackOffice.BFF.DiscountShoppingCart.Protobuf"
"BackOffice.BFF.Health.Protobuf"
"BackOffice.BFF.Inventory.Protobuf"
"BackOffice.BFF.ManualPayment.Protobuf"
"BackOffice.BFF.NetworkMembership.Protobuf"
"BackOffice.BFF.Otp.Protobuf"
"BackOffice.BFF.Package.Protobuf"
"BackOffice.BFF.Products.Protobuf"
"BackOffice.BFF.ProductTag.Protobuf"
"BackOffice.BFF.PublicMessage.Protobuf"
"BackOffice.BFF.Role.Protobuf"
"BackOffice.BFF.Tag.Protobuf"
"BackOffice.BFF.User.Protobuf"
"BackOffice.BFF.UserAddress.Protobuf"
"BackOffice.BFF.UserOrder.Protobuf"
"BackOffice.BFF.UserRole.Protobuf"
)
BUILT_COUNT=0
FAILED_COUNT=0
for PROJECT in "${PROTO_PROJECTS[@]}"; do
PROJECT_DIR="$BFF_PROTOS_DIR/$PROJECT"
if [ -d "$PROJECT_DIR" ]; then
echo "📦 Building $PROJECT..."
if dotnet build "$PROJECT_DIR" -c Release --verbosity quiet 2>/dev/null; then
# Copy DLL and PDB - check both net9.0 and net8.0
if [ -f "$PROJECT_DIR/bin/Release/net9.0/$PROJECT.dll" ]; then
cp "$PROJECT_DIR/bin/Release/net9.0/$PROJECT.dll" "$LIBS_DIR/" && ((BUILT_COUNT++))
cp "$PROJECT_DIR/bin/Release/net9.0/$PROJECT.pdb" "$LIBS_DIR/" 2>/dev/null || true
elif [ -f "$PROJECT_DIR/bin/Release/net8.0/$PROJECT.dll" ]; then
cp "$PROJECT_DIR/bin/Release/net8.0/$PROJECT.dll" "$LIBS_DIR/" && ((BUILT_COUNT++))
cp "$PROJECT_DIR/bin/Release/net8.0/$PROJECT.pdb" "$LIBS_DIR/" 2>/dev/null || true
else
echo "⚠️ DLL not found for: $PROJECT"
((FAILED_COUNT++))
fi
else
echo "⚠️ Failed to build: $PROJECT"
((FAILED_COUNT++))
fi
else
echo "⚠️ Project not found: $PROJECT"
((FAILED_COUNT++))
fi
done
echo ""
echo "✅ Build complete!"
echo " Built: $BUILT_COUNT projects"
echo " Failed: $FAILED_COUNT projects"
echo " Output: $LIBS_DIR"
echo ""
ls -la "$LIBS_DIR"/*.dll 2>/dev/null | wc -l | xargs -I {} echo " Total DLLs: {}"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+117 -54
View File
@@ -109,73 +109,136 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0"/> <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="DateTimeConverterCL" Version="1.0.0"/>
<PackageReference Include="Grpc.Core" Version="2.46.6"/> <PackageReference Include="Grpc.Core" Version="2.46.6"/>
<PackageReference Include="Grpc.Net.Client" Version="2.71.0"/> <PackageReference Include="Grpc.Net.Client" Version="2.71.0"/>
<PackageReference Include="Grpc.Net.Client.Web" 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="Mapster" Version="7.4.0"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.11"/> <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.Authentication" Version="9.0.11"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.11" PrivateAssets="all"/> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.11" PrivateAssets="all"/>
<PackageReference Include="MudBlazor" Version="8.14.0"/> <PackageReference Include="MudBlazor" Version="8.14.0"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4"/> <PackageReference Include="Newtonsoft.Json" Version="13.0.4"/>
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.8.0"/> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.8.0"/>
<PackageReference Include="Tizzani.MudBlazor.HtmlEditor" Version="2.3.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>
<ItemGroup> <ItemGroup>
+3
View File
@@ -5,6 +5,9 @@ WORKDIR /src
COPY ["BackOffice/NuGet.config", "NuGet.config"] COPY ["BackOffice/NuGet.config", "NuGet.config"]
COPY ["BackOffice/BackOffice.csproj", "BackOffice/"] COPY ["BackOffice/BackOffice.csproj", "BackOffice/"]
# Copy libs folder with pre-built DLLs (built by build-deps.sh)
COPY ["libs/", "libs/"]
# Restore dependencies # Restore dependencies
RUN dotnet restore "BackOffice/BackOffice.csproj" --configfile NuGet.config RUN dotnet restore "BackOffice/BackOffice.csproj" --configfile NuGet.config
@@ -14,8 +14,8 @@
Variant="Variant.Outlined" Variant="Variant.Outlined"
Required="true" Required="true"
RequiredError="نوع محصول الزامی است"> RequiredError="نوع محصول الزامی است">
<MudSelectItem Value="InventoryProductType.Regular">محصول عادی</MudSelectItem> <MudSelectItem Value="InventoryProductType.RegularProduct">محصول عادی</MudSelectItem>
<MudSelectItem Value="InventoryProductType.Discount">محصول تخفیفی</MudSelectItem> <MudSelectItem Value="InventoryProductType.DiscountProduct">محصول تخفیفی</MudSelectItem>
</MudSelect> </MudSelect>
</MudItem> </MudItem>
<MudItem xs="12"> <MudItem xs="12">
@@ -102,7 +102,7 @@
private bool _formValid; private bool _formValid;
private bool _isSubmitting; private bool _isSubmitting;
private InventoryProductType _productType = InventoryProductType.Regular; private InventoryProductType _productType = InventoryProductType.RegularProduct;
private long _productId; private long _productId;
private long? _warehouseId; private long? _warehouseId;
private int _quantity = 1; private int _quantity = 1;
@@ -156,16 +156,9 @@
var response = await InventoryContract.AddStockAsync(request); var response = await InventoryContract.AddStockAsync(request);
if (response.Success)
{
Snackbar.Add($"موجودی جدید: {response.NewQuantity} عدد", Severity.Success); Snackbar.Add($"موجودی جدید: {response.NewQuantity} عدد", Severity.Success);
MudDialog.Close(DialogResult.Ok(true)); MudDialog.Close(DialogResult.Ok(true));
} }
else
{
Snackbar.Add(response.Message ?? "خطا در ثبت موجودی", Severity.Error);
}
}
catch (Exception ex) catch (Exception ex)
{ {
Snackbar.Add($"خطا: {ex.Message}", Severity.Error); Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
@@ -6,7 +6,7 @@
<MudStack Spacing="4"> <MudStack Spacing="4">
<MudAlert Severity="Severity.Info"> <MudAlert Severity="Severity.Info">
<MudStack Spacing="1"> <MudStack Spacing="1">
<MudText>محصول: <strong>@Item.ProductName</strong></MudText> <MudText>محصول: <strong>@Item.ProductTitle</strong></MudText>
<MudText>موجودی فعلی: <strong>@Item.Quantity</strong> عدد</MudText> <MudText>موجودی فعلی: <strong>@Item.Quantity</strong> عدد</MudText>
<MudText>رزرو شده: <strong>@Item.ReservedQuantity</strong> عدد</MudText> <MudText>رزرو شده: <strong>@Item.ReservedQuantity</strong> عدد</MudText>
<MudText>قابل فروش: <strong>@Item.AvailableQuantity</strong> عدد</MudText> <MudText>قابل فروش: <strong>@Item.AvailableQuantity</strong> عدد</MudText>
@@ -106,7 +106,7 @@
_isSubmitting = true; _isSubmitting = true;
try try
{ {
var productId = Item.ProductType == ProductType.Regular var productId = Item.ProductType == ProductType.RegularProduct
? (Item.ProductId ?? 0) ? (Item.ProductId ?? 0)
: (Item.DiscountProductId ?? 0); : (Item.DiscountProductId ?? 0);
@@ -115,21 +115,14 @@
ProductId = productId, ProductId = productId,
ProductType = Item.ProductType, ProductType = Item.ProductType,
NewQuantity = _newQuantity, NewQuantity = _newQuantity,
Note = _note ?? string.Empty Reason = _note ?? string.Empty
}; };
var response = await InventoryContract.AdjustStockAsync(request); var response = await InventoryContract.AdjustStockAsync(request);
if (response.Success) Snackbar.Add($"موجودی از {response.PreviousQuantity} به {response.NewQuantity} تغییر کرد (تفاوت: {response.Difference})", Severity.Success);
{
Snackbar.Add(response.Message ?? "موجودی با موفقیت تنظیم شد", Severity.Success);
MudDialog.Close(DialogResult.Ok(true)); MudDialog.Close(DialogResult.Ok(true));
} }
else
{
Snackbar.Add(response.Message ?? "خطا در تنظیم موجودی", Severity.Error);
}
}
catch (Exception ex) catch (Exception ex)
{ {
Snackbar.Add($"خطا: {ex.Message}", Severity.Error); Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
@@ -6,7 +6,7 @@
<MudStack Spacing="4"> <MudStack Spacing="4">
<MudAlert Severity="Severity.Info"> <MudAlert Severity="Severity.Info">
<MudStack Spacing="1"> <MudStack Spacing="1">
<MudText>محصول: <strong>@Item.ProductName</strong></MudText> <MudText>محصول: <strong>@Item.ProductTitle</strong></MudText>
<MudText>انبار: <strong>@Item.WarehouseName</strong></MudText> <MudText>انبار: <strong>@Item.WarehouseName</strong></MudText>
</MudStack> </MudStack>
</MudAlert> </MudAlert>
@@ -110,7 +110,7 @@
{ {
var request = new UpdateInventorySettingsRequest var request = new UpdateInventorySettingsRequest
{ {
InventoryItemId = Item.Id, Id = Item.Id,
LowStockThreshold = _lowStockThreshold, LowStockThreshold = _lowStockThreshold,
ReorderPoint = _reorderPoint, ReorderPoint = _reorderPoint,
MaxStockLevel = _maxStockLevel MaxStockLevel = _maxStockLevel
@@ -6,7 +6,7 @@
<MudStack Spacing="4"> <MudStack Spacing="4">
<MudAlert Severity="Severity.Warning"> <MudAlert Severity="Severity.Warning">
<MudStack Spacing="1"> <MudStack Spacing="1">
<MudText>محصول: <strong>@Item.ProductName</strong></MudText> <MudText>محصول: <strong>@Item.ProductTitle</strong></MudText>
<MudText>موجودی فعلی: <strong>@Item.Quantity</strong> عدد</MudText> <MudText>موجودی فعلی: <strong>@Item.Quantity</strong> عدد</MudText>
</MudStack> </MudStack>
</MudAlert> </MudAlert>
@@ -33,6 +33,16 @@
Variant="Variant.Outlined" Variant="Variant.Outlined"
HelperText="شماره گزارش یا سند داخلی" /> 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) @if (_quantity > 0 && _quantity <= Item.Quantity)
{ {
<MudAlert Severity="Severity.Error"> <MudAlert Severity="Severity.Error">
@@ -73,6 +83,7 @@
private int _quantity = 1; private int _quantity = 1;
private string _reason = string.Empty; private string _reason = string.Empty;
private string _referenceNumber = string.Empty; private string _referenceNumber = string.Empty;
private StockMovementType _lossType = StockMovementType.Loss;
private void Cancel() => MudDialog.Cancel(); private void Cancel() => MudDialog.Cancel();
@@ -93,7 +104,7 @@
_isSubmitting = true; _isSubmitting = true;
try try
{ {
var productId = Item.ProductType == ProductType.Regular var productId = Item.ProductType == ProductType.RegularProduct
? (Item.ProductId ?? 0) ? (Item.ProductId ?? 0)
: (Item.DiscountProductId ?? 0); : (Item.DiscountProductId ?? 0);
@@ -102,6 +113,7 @@
ProductId = productId, ProductId = productId,
ProductType = Item.ProductType, ProductType = Item.ProductType,
Quantity = _quantity, Quantity = _quantity,
LossType = _lossType,
Reason = _reason ?? string.Empty, Reason = _reason ?? string.Empty,
ReferenceNumber = _referenceNumber ?? string.Empty ReferenceNumber = _referenceNumber ?? string.Empty
}; };
@@ -28,8 +28,8 @@
Variant="Variant.Outlined" Variant="Variant.Outlined"
Margin="Margin.Dense"> Margin="Margin.Dense">
<MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem> <MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem>
<MudSelectItem Value="ProductType.Regular">محصول عادی</MudSelectItem> <MudSelectItem Value="ProductType.RegularProduct">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.Discount">محصول تخفیفی</MudSelectItem> <MudSelectItem Value="ProductType.DiscountProduct">محصول تخفیفی</MudSelectItem>
</MudSelect> </MudSelect>
</MudItem> </MudItem>
<MudItem xs="12" sm="6" md="3"> <MudItem xs="12" sm="6" md="3">
@@ -110,10 +110,10 @@
<Columns> <Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" /> <PropertyColumn Property="x => x.Id" Title="شناسه" />
<PropertyColumn Property="x => x.ProductName" Title="نام محصول"> <PropertyColumn Property="x => x.ProductTitle" Title="نام محصول">
<CellTemplate> <CellTemplate>
<MudStack Spacing="0"> <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"> <MudText Typo="Typo.caption" Color="Color.Secondary">
@GetProductTypeLabel(context.Item.ProductType) @GetProductTypeLabel(context.Item.ProductType)
</MudText> </MudText>
@@ -35,7 +35,7 @@ public partial class InventoryMainPage
{ {
var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest
{ {
ActiveOnly = true IsActive = true
}); });
_warehouses = response.Warehouses.ToList(); _warehouses = response.Warehouses.ToList();
} }
@@ -51,7 +51,8 @@ public partial class InventoryMainPage
{ {
var response = await InventoryContract.GetLowStockItemsAsync(new GetLowStockItemsRequest 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; _lowStockCount = response.TotalCount;
} }
@@ -67,10 +68,10 @@ public partial class InventoryMainPage
{ {
var request = new GetAllInventoryItemsRequest var request = new GetAllInventoryItemsRequest
{ {
PageIndex = state.Page + 1, Page = state.Page + 1,
PageSize = state.PageSize, PageSize = state.PageSize,
ProductType = _filterProductType, ProductType = _filterProductType,
SearchTerm = _searchTerm ?? string.Empty Search = _searchTerm ?? string.Empty
}; };
if (_filterWarehouseId.HasValue) if (_filterWarehouseId.HasValue)
@@ -103,8 +104,8 @@ public partial class InventoryMainPage
{ {
return type switch return type switch
{ {
ProductType.Regular => "محصول عادی", ProductType.RegularProduct => "محصول عادی",
ProductType.Discount => "محصول تخفیفی", ProductType.DiscountProduct => "محصول تخفیفی",
_ => "نامشخص" _ => "نامشخص"
}; };
} }
@@ -153,13 +154,13 @@ public partial class InventoryMainPage
var parameters = new DialogParameters var parameters = new DialogParameters
{ {
["Warehouses"] = _warehouses, ["Warehouses"] = _warehouses,
["ProductIdParam"] = item.ProductType == ProductType.Regular ? item.ProductId : item.DiscountProductId, ["ProductIdParam"] = item.ProductType == ProductType.RegularProduct ? item.ProductId : item.DiscountProductId,
["ProductTypeParam"] = item.ProductType, ["ProductTypeParam"] = item.ProductType,
["ProductName"] = item.ProductName, ["ProductName"] = item.ProductTitle,
["WarehouseIdParam"] = item.WarehouseId ["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, CloseButton = true,
MaxWidth = MaxWidth.Medium, MaxWidth = MaxWidth.Medium,
@@ -182,7 +183,7 @@ public partial class InventoryMainPage
["Item"] = item ["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, CloseButton = true,
MaxWidth = MaxWidth.Small, MaxWidth = MaxWidth.Small,
@@ -205,7 +206,7 @@ public partial class InventoryMainPage
["Item"] = item ["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, CloseButton = true,
MaxWidth = MaxWidth.Small, MaxWidth = MaxWidth.Small,
@@ -228,7 +229,7 @@ public partial class InventoryMainPage
["Item"] = item ["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, CloseButton = true,
MaxWidth = MaxWidth.Small, MaxWidth = MaxWidth.Small,
@@ -245,6 +246,6 @@ public partial class InventoryMainPage
private void ViewMovements(InventoryItemDto item) 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" Variant="Variant.Outlined"
Margin="Margin.Dense"> Margin="Margin.Dense">
<MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem> <MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem>
<MudSelectItem Value="ProductType.Regular">محصول عادی</MudSelectItem> <MudSelectItem Value="ProductType.RegularProduct">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.Discount">محصول تخفیفی</MudSelectItem> <MudSelectItem Value="ProductType.DiscountProduct">محصول تخفیفی</MudSelectItem>
</MudSelect> </MudSelect>
</MudItem> </MudItem>
<MudItem xs="12" sm="6" md="4" Class="d-flex align-end"> <MudItem xs="12" sm="6" md="4" Class="d-flex align-end">
@@ -73,14 +73,14 @@
} }
else else
{ {
<MudDataGrid T="LowStockItemDto" Items="_items" Hover="true" Height="60vh"> <MudDataGrid T="InventoryItemDto" Items="_items" Hover="true" Height="60vh">
<Columns> <Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" /> <PropertyColumn Property="x => x.Id" Title="شناسه" />
<PropertyColumn Property="x => x.ProductName" Title="نام محصول"> <PropertyColumn Property="x => x.ProductTitle" Title="نام محصول">
<CellTemplate> <CellTemplate>
<MudStack Spacing="0"> <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"> <MudText Typo="Typo.caption" Color="Color.Secondary">
@GetProductTypeLabel(context.Item.ProductType) @GetProductTypeLabel(context.Item.ProductType)
</MudText> </MudText>
@@ -136,7 +136,7 @@
</TemplateColumn> </TemplateColumn>
</Columns> </Columns>
<PagerContent> <PagerContent>
<MudDataGridPager T="LowStockItemDto" <MudDataGridPager T="InventoryItemDto"
PageSizeOptions="@(new int[] { 20, 50, 100 })" PageSizeOptions="@(new int[] { 20, 50, 100 })"
InfoFormat="سطر {first_item} تا {last_item} از {all_items}" InfoFormat="سطر {first_item} تا {last_item} از {all_items}"
RowsPerPageString="تعداد سطرهای صفحه" /> RowsPerPageString="تعداد سطرهای صفحه" />
@@ -10,7 +10,7 @@ public partial class LowStockPage
{ {
[Inject] public InventoryBFFContract.InventoryBFFContractClient InventoryContract { get; set; } = default!; [Inject] public InventoryBFFContract.InventoryBFFContractClient InventoryContract { get; set; } = default!;
private List<LowStockItemDto> _items = new(); private List<InventoryItemDto> _items = new();
private List<WarehouseDto> _warehouses = new(); private List<WarehouseDto> _warehouses = new();
private bool _isLoading = true; private bool _isLoading = true;
@@ -30,7 +30,7 @@ public partial class LowStockPage
{ {
var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest
{ {
ActiveOnly = true IsActive = true
}); });
_warehouses = response.Warehouses.ToList(); _warehouses = response.Warehouses.ToList();
} }
@@ -49,7 +49,8 @@ public partial class LowStockPage
{ {
var request = new GetLowStockItemsRequest 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 ProductType = _filterProductType
}; };
@@ -77,15 +78,15 @@ public partial class LowStockPage
{ {
return type switch return type switch
{ {
ProductType.Regular => "محصول عادی", ProductType.RegularProduct => "محصول عادی",
ProductType.Discount => "محصول تخفیفی", 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.ProductId ?? 0)
: (item.DiscountProductId ?? 0); : (item.DiscountProductId ?? 0);
@@ -94,11 +95,11 @@ public partial class LowStockPage
["Warehouses"] = _warehouses, ["Warehouses"] = _warehouses,
["ProductIdParam"] = productId, ["ProductIdParam"] = productId,
["ProductTypeParam"] = item.ProductType, ["ProductTypeParam"] = item.ProductType,
["ProductName"] = item.ProductName, ["ProductName"] = item.ProductTitle,
["WarehouseIdParam"] = item.WarehouseId ["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, CloseButton = true,
MaxWidth = MaxWidth.Medium, MaxWidth = MaxWidth.Medium,
@@ -29,7 +29,7 @@
Label="نوع تغییر" Label="نوع تغییر"
Variant="Variant.Outlined" Variant="Variant.Outlined"
Margin="Margin.Dense"> Margin="Margin.Dense">
<MudSelectItem Value="StockMovementType.Unspecified">همه</MudSelectItem> <MudSelectItem Value="StockMovementType.MovementTypeUnspecified">همه</MudSelectItem>
<MudSelectItem Value="StockMovementType.InitialStock">موجودی اولیه</MudSelectItem> <MudSelectItem Value="StockMovementType.InitialStock">موجودی اولیه</MudSelectItem>
<MudSelectItem Value="StockMovementType.Restock">ورود کالا</MudSelectItem> <MudSelectItem Value="StockMovementType.Restock">ورود کالا</MudSelectItem>
<MudSelectItem Value="StockMovementType.Return">برگشت از مشتری</MudSelectItem> <MudSelectItem Value="StockMovementType.Return">برگشت از مشتری</MudSelectItem>
@@ -51,8 +51,8 @@
Variant="Variant.Outlined" Variant="Variant.Outlined"
Margin="Margin.Dense"> Margin="Margin.Dense">
<MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem> <MudSelectItem Value="ProductType.Unspecified">همه</MudSelectItem>
<MudSelectItem Value="ProductType.Regular">محصول عادی</MudSelectItem> <MudSelectItem Value="ProductType.RegularProduct">محصول عادی</MudSelectItem>
<MudSelectItem Value="ProductType.Discount">محصول تخفیفی</MudSelectItem> <MudSelectItem Value="ProductType.DiscountProduct">محصول تخفیفی</MudSelectItem>
</MudSelect> </MudSelect>
</MudItem> </MudItem>
<MudItem xs="12" sm="6" md="3"> <MudItem xs="12" sm="6" md="3">
@@ -103,14 +103,14 @@
<Columns> <Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" /> <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> <CellTemplate>
<MudChip T="string" <MudChip T="string"
Color="@GetMovementColor(context.Item.MovementType)" Color="@GetMovementColor(context.Item.MovementType)"
Size="Size.Small"> Size="Size.Small">
@context.Item.MovementTypeName @GetMovementTypeLabel(context.Item.MovementType)
</MudChip> </MudChip>
</CellTemplate> </CellTemplate>
</PropertyColumn> </PropertyColumn>
@@ -139,11 +139,11 @@
</CellTemplate> </CellTemplate>
</PropertyColumn> </PropertyColumn>
<PropertyColumn Property="x => x.PerformedByUserName" Title="کاربر"> <PropertyColumn Property="x => x.PerformedByUserId" Title="کاربر">
<CellTemplate> <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 else
{ {
@@ -152,12 +152,12 @@
</CellTemplate> </CellTemplate>
</PropertyColumn> </PropertyColumn>
<PropertyColumn Property="x => x.CreatedAt" Title="تاریخ"> <PropertyColumn Property="x => x.Created" Title="تاریخ">
<CellTemplate> <CellTemplate>
@if (context.Item.CreatedAt != null) @if (context.Item.Created != null)
{ {
<MudText Typo="Typo.caption"> <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> </MudText>
} }
</CellTemplate> </CellTemplate>
@@ -20,7 +20,7 @@ public partial class MovementsPage
private int _totalCount; private int _totalCount;
// Filter fields // Filter fields
private StockMovementType _filterMovementType = StockMovementType.Unspecified; private StockMovementType _filterMovementType = StockMovementType.MovementTypeUnspecified;
private ProductType _filterProductType = ProductType.Unspecified; private ProductType _filterProductType = ProductType.Unspecified;
private DateTime? _filterFromDate; private DateTime? _filterFromDate;
private DateTime? _filterToDate; private DateTime? _filterToDate;
@@ -31,7 +31,7 @@ public partial class MovementsPage
{ {
var request = new GetStockMovementsRequest var request = new GetStockMovementsRequest
{ {
PageIndex = state.Page + 1, Page = state.Page + 1,
PageSize = state.PageSize, PageSize = state.PageSize,
MovementType = _filterMovementType, MovementType = _filterMovementType,
ProductType = _filterProductType 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) private bool IsIncreaseMovement(StockMovementType type)
{ {
return type switch return type switch
@@ -118,7 +139,7 @@ public partial class MovementsPage
private async Task ClearFilter() private async Task ClearFilter()
{ {
_filterMovementType = StockMovementType.Unspecified; _filterMovementType = StockMovementType.MovementTypeUnspecified;
_filterProductType = ProductType.Unspecified; _filterProductType = ProductType.Unspecified;
_filterFromDate = null; _filterFromDate = null;
_filterToDate = null; _filterToDate = null;
@@ -28,7 +28,7 @@ public partial class WarehousesPage
{ {
var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest var response = await InventoryContract.GetAllWarehousesAsync(new GetAllWarehousesRequest
{ {
ActiveOnly = _showActiveOnly IsActive = _showActiveOnly
}); });
_warehouses = response.Warehouses.ToList(); _warehouses = response.Warehouses.ToList();
} }