From 566ec21555eb709b39e4ae805e4f0626e0cbfdad Mon Sep 17 00:00:00 2001 From: MeysamMoghaddam <65253484+MeysamMoghaddam@users.noreply.github.com> Date: Mon, 20 Oct 2025 15:33:26 +0330 Subject: [PATCH] u --- .../Components/OrganizationChart.razor | 4 +- .../Components/OrganizationChartLevel.razor | 18 ++++++++- .../OrganizationChartLevel.razor.cs | 37 +++++++++++++++++++ .../OrganizationChartLevel.razor.css | 30 +++++++++++++++ 4 files changed, 85 insertions(+), 4 deletions(-) diff --git a/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChart.razor b/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChart.razor index 0fc1412..38ea96f 100644 --- a/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChart.razor +++ b/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChart.razor @@ -36,7 +36,7 @@ {
@_currentUser.Mobile
} -
+ @*
خرید شخصی: @(_currentUser?.PersonalPurchase?.ToThousands().ToCurrencyUnitIRT() ?? "0 تومان") @@ -45,7 +45,7 @@ خرید تیمی: @(_currentUser?.TeamPurchase?.ToThousands().ToCurrencyUnitIRT() ?? "0 تومان")
-
+
*@ diff --git a/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor b/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor index 2d33a28..fc1cf30 100644 --- a/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor +++ b/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor @@ -38,7 +38,21 @@ {
@node.Mobile
} -
+ @if (!string.IsNullOrWhiteSpace(node.ReferralCode)) + { +
+ @node.ReferralCode + + +
+ } + @*
خرید شخصی: @(node.PersonalPurchase?.ToThousands().ToCurrencyUnitIRT() ?? "0 تومان") @@ -47,7 +61,7 @@ خرید تیمی: @(node.TeamPurchase?.ToThousands().ToCurrencyUnitIRT() ?? "0 تومان")
-
+
*@ diff --git a/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor.cs b/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor.cs index 3f3a4f5..4500b89 100644 --- a/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor.cs +++ b/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; using MudBlazor; namespace FrontOffice.Main.Pages.Profile.Components; @@ -35,6 +36,42 @@ public partial class OrganizationChartLevel } } + private async Task CopyReferralCode(string referralCode) + { + try + { + await JSRuntime.InvokeVoidAsync("navigator.clipboard.writeText", $"{Navigation.BaseUri}?ref={referralCode}"); + Snackbar.Add("کد دعوت کپی شد!", Severity.Success); + } + catch (Exception ex) + { + Snackbar.Add("خطا در کپی کردن کد دعوت.", Severity.Error); + } + } + + private async Task ShareReferralCode(string referralCode) + { + var shareText = $"کد دعوت من: {referralCode}"; + + try + { + // Try to use Web Share API if available + await JSRuntime.InvokeVoidAsync("navigator.share", + new + { + title = "کد دعوت", + text = shareText, + url = $"{Navigation.BaseUri}?ref={referralCode}" + }); + } + catch + { + // Fallback: copy to clipboard + await JSRuntime.InvokeVoidAsync("navigator.clipboard.writeText", $"{Navigation.BaseUri}?ref={referralCode}"); + Snackbar.Add("لینک دعوت در کلیپ‌بورد کپی شد.", Severity.Success); + } + } + public class UserNode { public long Id { get; set; } diff --git a/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor.css b/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor.css index 2cdb067..d7b0ec9 100644 --- a/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor.css +++ b/src/FrontOffice.Main/Pages/Profile/Components/OrganizationChartLevel.razor.css @@ -109,6 +109,36 @@ margin-bottom: 8px; } +.node-referral { + display: flex; + align-items: center; + justify-content: center; + gap: 4px; + margin-bottom: 8px; + padding: 4px 8px; + background: rgba(3, 128, 192, 0.1); + border-radius: 6px; +} + +.referral-code { + font-size: 12px; + font-weight: 500; + color: #0380C0; + font-family: 'Courier New', monospace; +} + +.referral-icon { + --mud-icon-size-small: 16px; + padding: 2px; + min-width: auto; + width: 20px; + height: 20px; +} + +.referral-icon:hover { + background-color: rgba(3, 128, 192, 0.2); +} + .node-amounts { font-size: 12px; }