Compare commits
2 Commits
production
...
kub-stage
| Author | SHA1 | Date | |
|---|---|---|---|
| 307302e33d | |||
| c243b59113 |
@@ -101,7 +101,6 @@
|
||||
| 6.6 | `UserOrderContract.SubmitShopBuyOrder` | `UserOrderContract` | `/checkout-summary` | ثبت سفارش و پرداخت از کیف پول |
|
||||
| 6.7 | `OrderService.GetOrdersAsync` | `UserOrderContract.GetCustomerOrders` | `/orders` | لیست سفارشهای کاربر |
|
||||
| 6.8 | `OrderService.GetOrderAsync` | `UserOrderContract.GetCustomerOrder` | `/order/{id}`, `/order-tracking/{id}` | جزئیات یک سفارش |
|
||||
| 6.9 | `OrderService.CalculateOrderPVAsync` | `UserOrderContract.CalculateOrderPV` | `/order/{id}` | محاسبه PV سفارش |
|
||||
| 6.10 | `VATService.GetRateAsync` | `UserOrderContract` (via scope) | Store/Discount صفحات قیمت | نرخ مالیات بر ارزش افزوده (کش روزانه) |
|
||||
| 6.11 | `WalletService.GetBalancesAsync` | `UserWalletContract` | `/checkout-summary` | بررسی موجودی برای پرداخت سفارش |
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DateTimeConverterCL" Version="1.0.0" />
|
||||
<!-- Replace all FrontOffice.BFF protobuf packages with CMS protobuf -->
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.204" />
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.210" />
|
||||
<!-- <ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />-->
|
||||
<PackageReference Include="MudBlazor" Version="8.14.0" />
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
else if (_addresses.Count == 0)
|
||||
{
|
||||
<MudAlert Severity="Severity.Warning">
|
||||
هیچ آدرسی ثبت نشده است. لطفاً از بخش پروفایل آدرس خود را اضافه کنید.
|
||||
هیچ آدرسی ثبت نشده است. میتوانید همینجا آدرس جدید اضافه کنید.
|
||||
</MudAlert>
|
||||
<MudButton Class="mt-2" Variant="Variant.Outlined" Href="/profile/addresses">افزودن آدرس</MudButton>
|
||||
<MudButton Class="mt-2" Variant="Variant.Outlined" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.Add"
|
||||
OnClick="OpenAddAddressDialog">افزودن آدرس</MudButton>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -41,13 +43,25 @@
|
||||
<MudText Typo="Typo.subtitle2">@address.Title</MudText>
|
||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">@address.Address</MudText>
|
||||
</MudStack>
|
||||
@if (address.IsDefault)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Variant="Variant.Outlined">پیشفرض</MudChip>
|
||||
}
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
|
||||
@if (address.IsDefault)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Variant="Variant.Outlined" Size="Size.Small">پیشفرض</MudChip>
|
||||
}
|
||||
<span @onclick:stopPropagation="true">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Edit"
|
||||
Size="Size.Small"
|
||||
Color="Color.Primary"
|
||||
aria-label="ویرایش آدرس"
|
||||
OnClick="@(() => OpenEditAddressDialog(address))" />
|
||||
</span>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
}
|
||||
<MudButton Class="mt-2" Variant="Variant.Text" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.Add"
|
||||
OnClick="OpenAddAddressDialog">افزودن آدرس جدید</MudButton>
|
||||
</MudStack>
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using CMSMicroservice.Protobuf.Protos.UserAddress;
|
||||
using FrontOffice.Main.Pages.Profile.Components;
|
||||
using FrontOffice.Main.Utilities;
|
||||
using MudBlazor;
|
||||
|
||||
@@ -61,12 +62,14 @@ public partial class Checkout
|
||||
else
|
||||
{
|
||||
_addresses = new();
|
||||
_selectedAddress = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"خطا در بارگذاری آدرسها: {ex.Message}", Severity.Error);
|
||||
_addresses = new();
|
||||
_selectedAddress = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -75,6 +78,30 @@ public partial class Checkout
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OpenAddAddressDialog()
|
||||
{
|
||||
var dialog = await DialogService.ShowAsync<AddAddressDialog>("افزودن آدرس جدید");
|
||||
var result = await dialog.Result;
|
||||
if (result is { Canceled: false })
|
||||
{
|
||||
await AuthService.RefreshTokenAsync();
|
||||
await LoadAddresses();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OpenEditAddressDialog(CustomerAddressModel address)
|
||||
{
|
||||
var dialog = await DialogService.ShowAsync<EditAddressDialog>("ویرایش آدرس", new DialogParameters<EditAddressDialog>
|
||||
{
|
||||
{ x => x.Model, address }
|
||||
});
|
||||
var result = await dialog.Result;
|
||||
if (result is { Canceled: false })
|
||||
{
|
||||
await LoadAddresses();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task PlaceOrder()
|
||||
{
|
||||
if (!CanPlaceOrder || _selectedAddress is null)
|
||||
|
||||
@@ -110,7 +110,11 @@ public partial class OrganizationChart : IAsyncDisposable
|
||||
activationWeekNumber = n.ActivationWeekNumber,
|
||||
joinedAt = n.JoinedAt,
|
||||
referralCode = n.ReferralCode,
|
||||
packageName = n.PackageName ?? string.Empty
|
||||
packageName = n.PackageName ?? string.Empty,
|
||||
goldLeftLegTotal = n.GoldLeftLegTotal,
|
||||
goldRightLegTotal = n.GoldRightLegTotal,
|
||||
silverLeftLegTotal = n.SilverLeftLegTotal,
|
||||
silverRightLegTotal = n.SilverRightLegTotal
|
||||
}).ToArray();
|
||||
|
||||
await JSRuntime.InvokeVoidAsync("OrgChart.init", "org-chart-container", flatData, _dotNetHelper);
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
else if (_addresses.Count == 0)
|
||||
{
|
||||
<MudAlert Severity="Severity.Warning">
|
||||
هیچ آدرسی ثبت نشده است. لطفاً از بخش پروفایل آدرس خود را اضافه کنید.
|
||||
هیچ آدرسی ثبت نشده است. میتوانید همینجا آدرس جدید اضافه کنید.
|
||||
</MudAlert>
|
||||
<MudButton Class="mt-2" Variant="Variant.Outlined" Href="/profile/addresses">افزودن آدرس</MudButton>
|
||||
<MudButton Class="mt-2" Variant="Variant.Outlined" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.Add"
|
||||
OnClick="OpenAddAddressDialog">افزودن آدرس</MudButton>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -40,13 +42,25 @@
|
||||
<MudText Typo="Typo.subtitle2">@address.Title</MudText>
|
||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">@address.Address</MudText>
|
||||
</MudStack>
|
||||
@if (address.IsDefault)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Variant="Variant.Outlined">پیشفرض</MudChip>
|
||||
}
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
|
||||
@if (address.IsDefault)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Variant="Variant.Outlined" Size="Size.Small">پیشفرض</MudChip>
|
||||
}
|
||||
<span @onclick:stopPropagation="true">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Edit"
|
||||
Size="Size.Small"
|
||||
Color="Color.Primary"
|
||||
aria-label="ویرایش آدرس"
|
||||
OnClick="@(() => OpenEditAddressDialog(address))" />
|
||||
</span>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
}
|
||||
<MudButton Class="mt-2" Variant="Variant.Text" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.Add"
|
||||
OnClick="OpenAddAddressDialog">افزودن آدرس جدید</MudButton>
|
||||
</MudStack>
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CMSMicroservice.Protobuf.Protos.UserAddress;
|
||||
using CMSMicroservice.Protobuf.Protos.UserOrder;
|
||||
using FrontOffice.Main.Pages.Profile.Components;
|
||||
using FrontOffice.Main.Shared;
|
||||
using FrontOffice.Main.Utilities;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
@@ -72,12 +73,14 @@ public partial class CheckoutSummary : ComponentBase
|
||||
else
|
||||
{
|
||||
_addresses = new();
|
||||
_selectedAddress = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"خطا در بارگذاری آدرسها: {ex.Message}", Severity.Error);
|
||||
_addresses = new();
|
||||
_selectedAddress = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -86,6 +89,30 @@ public partial class CheckoutSummary : ComponentBase
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OpenAddAddressDialog()
|
||||
{
|
||||
var dialog = await DialogService.ShowAsync<AddAddressDialog>("افزودن آدرس جدید");
|
||||
var result = await dialog.Result;
|
||||
if (result is { Canceled: false })
|
||||
{
|
||||
await AuthService.RefreshTokenAsync();
|
||||
await LoadAddresses();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OpenEditAddressDialog(CustomerAddressModel address)
|
||||
{
|
||||
var dialog = await DialogService.ShowAsync<EditAddressDialog>("ویرایش آدرس", new DialogParameters<EditAddressDialog>
|
||||
{
|
||||
{ x => x.Model, address }
|
||||
});
|
||||
var result = await dialog.Result;
|
||||
if (result is { Canceled: false })
|
||||
{
|
||||
await LoadAddresses();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task PlaceOrder()
|
||||
{
|
||||
if (!CanPlaceOrder || _selectedAddress is null)
|
||||
|
||||
@@ -112,30 +112,6 @@ else
|
||||
</MudStack>
|
||||
}
|
||||
</MudStack>
|
||||
|
||||
@* نمایش PV سفارش *@
|
||||
@if (_pvData != null && _pvData.TotalPv > 0)
|
||||
{
|
||||
<MudDivider Class="my-2" />
|
||||
<MudStack Spacing="1" Class="pa-2" Style="background-color: var(--mud-palette-background-grey); border-radius: 8px;">
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
|
||||
<MudIcon Icon="@Icons.Material.Filled.TrendingUp" Color="Color.Info" Size="Size.Small" />
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Info">امتیاز فروش (PV)</MudText>
|
||||
</MudStack>
|
||||
@foreach (var product in _pvData.Products)
|
||||
{
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween">
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">@product.ProductTitle × @product.Quantity</MudText>
|
||||
<MudText Typo="Typo.caption">@string.Format("{0:N0}", product.TotalPv) PV</MudText>
|
||||
</MudStack>
|
||||
}
|
||||
<MudDivider Class="my-1" />
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween">
|
||||
<MudText Typo="Typo.body2" Class="fw-bold">جمع PV:</MudText>
|
||||
<MudText Typo="Typo.body2" Color="Color.Info" Class="fw-bold">@string.Format("{0:N0}", _pvData.TotalPv) PV</MudText>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
}
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
</MudContainer>
|
||||
|
||||
@@ -12,17 +12,12 @@ public partial class OrderDetail : ComponentBase
|
||||
[Parameter] public long id { get; set; }
|
||||
|
||||
private GetUserOrderResponse? _order;
|
||||
private CalculateOrderPVResponse? _pvData;
|
||||
private bool _loading;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_loading = true;
|
||||
_order = await OrderService.GetOrderAsync(id);
|
||||
if (_order != null)
|
||||
{
|
||||
_pvData = await OrderService.CalculateOrderPVAsync(id);
|
||||
}
|
||||
_loading = false;
|
||||
}
|
||||
|
||||
@@ -52,4 +47,3 @@ public partial class OrderDetail : ComponentBase
|
||||
private static string GetProductImageUrl(string? imageUrl)
|
||||
=> string.IsNullOrWhiteSpace(imageUrl) ? "/images/product-placeholder.svg" : imageUrl.TrimStart('/');
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,18 @@ public class NetworkNodeDto
|
||||
/// نام پکیج موثر (مثلاً پکیج طلایی / نقرهای)
|
||||
/// </summary>
|
||||
public string? PackageName { get; set; }
|
||||
|
||||
/// <summary>آخرین امتیاز پای چپ پکیج طلایی</summary>
|
||||
public int GoldLeftLegTotal { get; set; }
|
||||
|
||||
/// <summary>آخرین امتیاز پای راست پکیج طلایی</summary>
|
||||
public int GoldRightLegTotal { get; set; }
|
||||
|
||||
/// <summary>آخرین امتیاز پای چپ پکیج نقرهای</summary>
|
||||
public int SilverLeftLegTotal { get; set; }
|
||||
|
||||
/// <summary>آخرین امتیاز پای راست پکیج نقرهای</summary>
|
||||
public int SilverRightLegTotal { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,6 +65,11 @@ public class FlatNetworkNodeDto
|
||||
/// نام پکیج موثر (مثلاً پکیج طلایی / نقرهای)
|
||||
/// </summary>
|
||||
public string? PackageName { get; set; }
|
||||
|
||||
public int GoldLeftLegTotal { get; set; }
|
||||
public int GoldRightLegTotal { get; set; }
|
||||
public int SilverLeftLegTotal { get; set; }
|
||||
public int SilverRightLegTotal { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -92,7 +109,11 @@ public class NetworkTreeDto
|
||||
ActivationWeekNumber = node.ActivationWeekNumber,
|
||||
JoinedAt = node.JoinedAt,
|
||||
ReferralCode = node.ReferralCode,
|
||||
PackageName = node.PackageName
|
||||
PackageName = node.PackageName,
|
||||
GoldLeftLegTotal = node.GoldLeftLegTotal,
|
||||
GoldRightLegTotal = node.GoldRightLegTotal,
|
||||
SilverLeftLegTotal = node.SilverLeftLegTotal,
|
||||
SilverRightLegTotal = node.SilverRightLegTotal
|
||||
};
|
||||
|
||||
result.Add(flatNode);
|
||||
|
||||
@@ -138,6 +138,10 @@ public class NetworkMembershipService
|
||||
IsClubActive = node.IsClubActive,
|
||||
ReferralCode = node.ReferralCode,
|
||||
PackageName = string.IsNullOrWhiteSpace(node.PackageName) ? null : node.PackageName,
|
||||
GoldLeftLegTotal = node.GoldLeftLegTotal,
|
||||
GoldRightLegTotal = node.GoldRightLegTotal,
|
||||
SilverLeftLegTotal = node.SilverLeftLegTotal,
|
||||
SilverRightLegTotal = node.SilverRightLegTotal,
|
||||
ActivationWeekNumber = node.ActivationWeekDefinitionId?.ToString(),
|
||||
JoinedAt = node.JoinedAt?.ToDateTime(),
|
||||
LeftChild = MapNodeFromProto(node.LeftChild),
|
||||
|
||||
@@ -97,22 +97,4 @@ public class OrderService
|
||||
return 0.10;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// محاسبه PV سفارش
|
||||
/// </summary>
|
||||
public async Task<CalculateOrderPVResponse?> CalculateOrderPVAsync(long orderId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _userOrderContractClient.CalculateOrderPVAsync(new CalculateOrderPVRequest
|
||||
{
|
||||
OrderId = orderId
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,10 +72,10 @@
|
||||
/* Compact Header */
|
||||
.node-header-compact {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
padding: 6px 8px;
|
||||
height: 100%;
|
||||
min-height: 100%;
|
||||
background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
|
||||
}
|
||||
|
||||
@@ -141,6 +141,22 @@
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
/* D3: طلایی / نقرهای — پای چپ و راست */
|
||||
.node-leg-scores {
|
||||
margin-top: 3px;
|
||||
line-height: 1.25;
|
||||
font-size: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.node-leg-scores .leg-score-line.gold {
|
||||
color: #b8860b;
|
||||
}
|
||||
|
||||
.node-leg-scores .leg-score-line.silver {
|
||||
color: #607d8b;
|
||||
}
|
||||
|
||||
/* Referral Code - only for club active members */
|
||||
.node-referral {
|
||||
display: flex;
|
||||
|
||||
@@ -37,8 +37,8 @@ window.OrgChart = {
|
||||
this.chart = new d3.OrgChart()
|
||||
.container('#' + containerId)
|
||||
.data(data)
|
||||
.nodeWidth((d) => 140)
|
||||
.nodeHeight((d) => 85)
|
||||
.nodeWidth((d) => 150)
|
||||
.nodeHeight((d) => 112)
|
||||
.childrenMargin((d) => 50)
|
||||
.compactMarginBetween((d) => 15)
|
||||
.compactMarginPair((d) => 15)
|
||||
@@ -80,6 +80,16 @@ window.OrgChart = {
|
||||
</div>`
|
||||
: '';
|
||||
|
||||
const gL = data.goldLeftLegTotal ?? 0;
|
||||
const gR = data.goldRightLegTotal ?? 0;
|
||||
const sL = data.silverLeftLegTotal ?? 0;
|
||||
const sR = data.silverRightLegTotal ?? 0;
|
||||
const legScoresHtml = `
|
||||
<div class="node-leg-scores" title="آخرین امتیاز هفتگی پای چپ / راست">
|
||||
<div class="leg-score-line gold">طلایی: چپ ${gL} · راست ${gR}</div>
|
||||
<div class="leg-score-line silver">نقرهای: چپ ${sL} · راست ${sR}</div>
|
||||
</div>`;
|
||||
|
||||
return `
|
||||
<div class="org-node-card ${positionClass} ${activeClass} ${clubActiveClass}" data-user-id="${data.id}">
|
||||
<div class="node-header-compact ${isRoot ? 'root' : ''}">
|
||||
@@ -88,6 +98,7 @@ window.OrgChart = {
|
||||
<div class="node-name-sm">${data.fullName || 'بدون نام'}</div>
|
||||
<div class="node-level-sm">L${data.level || 0}${!isRoot ? ' • ' + (data.position === 'Left' ? 'چپ' : 'راست') : ''}</div>
|
||||
${packageBadge}
|
||||
${legScoresHtml}
|
||||
${referralCodeHtml}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user