This commit is contained in:
MeysamMoghaddam
2025-10-07 19:53:33 +03:30
parent edf71d7bf5
commit 52e7b84a86
4 changed files with 128 additions and 53 deletions

View File

@@ -142,34 +142,41 @@
<MudText Typo="Typo.subtitle1" Class="mud-text-secondary mb-8">
بر اساس اندازهٔ تیم خود انتخاب کنید.
</MudText>
<MudGrid Spacing="3" Justify="Justify.Center" Class="stretch-grid">
@foreach (var p in _packs)
{
<MudItem xs="12" md="4" Class="d-flex">
<MudPaper Elevation="2" Class="rounded-2xl d-flex flex-column flex-grow-1 overflow-hidden">
<MudImage Src="@p.Image"
Alt="@p.Title"
Height="300"
ObjectFit="ObjectFit.Cover"
ObjectPosition="ObjectPosition.Center"
Class="feature-img" />
<div class="pa-5">
<MudText Typo="Typo.h6" Class="mb-1">@(p.Title)</MudText>
<MudText Typo="Typo.body2" Class="mud-text-secondary mb-2">@(p.Body)</MudText>
<MudList T="string" Dense="true">
@foreach (var item in p.Items)
{
<MudListItem T="string" Value="@item">
<MudIcon Icon="@Icons.Material.Filled.Verified" Size="Size.Small" Class="ml-2" />
@item
</MudListItem>
}
</MudList>
</div>
</MudPaper>
</MudItem>
}
</MudGrid>
@if (_isLoadingPackages)
{
<MudStack AlignItems="AlignItems.Center" Class="py-8">
<MudProgressCircular Color="Color.Primary" Indeterminate="true" Size="Size.Large" />
<MudText Typo="Typo.body1" Class="mud-text-secondary mt-2">در حال بارگذاری پکیج‌ها...</MudText>
</MudStack>
}
else if (_packs.Any())
{
<MudGrid Spacing="3" Justify="Justify.Center" Class="stretch-grid">
@foreach (var p in _packs)
{
<MudItem xs="12" md="4" Class="d-flex">
<MudPaper Elevation="2" Class="rounded-2xl d-flex flex-column flex-grow-1 overflow-hidden">
<MudImage Src="@p.Image"
Alt="@p.Title"
Height="300"
ObjectFit="ObjectFit.Cover"
ObjectPosition="ObjectPosition.Center"
Class="feature-img" />
<div class="pa-5">
<MudText Typo="Typo.h6" Class="mb-2">@(p.Title)</MudText>
@((MarkupString)p.Body)
</div>
</MudPaper>
</MudItem>
}
</MudGrid>
}
else
{
<MudStack AlignItems="AlignItems.Center" Class="py-8">
<MudText Typo="Typo.body1" Class="mud-text-secondary">هیچ پکیجی یافت نشد.</MudText>
</MudStack>
}
</MudContainer>
</section>

View File

@@ -1,10 +1,53 @@
using FrontOffice.Main.Utilities;
using FrontOffice.BFF.Package.Protobuf.Protos.Package;
using FrontOffice.Main.Utilities;
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using Microsoft.AspNetCore.Components;
using MudBlazor;
namespace FrontOffice.Main.Pages;
public partial class Index
{
[Inject] private PackageContract.PackageContractClient PackageClient { get; set; } = default!;
private string? _email;
private bool _isLoadingPackages;
private List<Pack> _packs = new();
protected override async Task OnInitializedAsync()
{
await LoadPackagesAsync();
}
private async Task LoadPackagesAsync()
{
_isLoadingPackages = true;
try
{
var response = await PackageClient.GetAllPackageByFilterAsync(request: new());
if (response?.Models?.Any() == true)
{
_packs = response.Models.Select(p => new Pack(
p.Title,
p.Description,
Image: UrlUtility.DownloadUrl + p.ImagePath
)).ToList();
}
else
_packs = new List<Pack>();
}
catch (Exception ex)
{
Snackbar.Add($"خطا در بارگذاری پکیج‌ها: {ex.Message}", Severity.Error);
// Fallback to empty list
_packs = new List<Pack>();
}
finally
{
_isLoadingPackages = false;
await InvokeAsync(StateHasChanged);
}
}
private void JoinWaitlist()
{
@@ -17,30 +60,9 @@ public partial class Index
_email = string.Empty;
}
private record Pack(string Title, string Body, IEnumerable<string> Items, string Image);
private record Pack(string Title, string Body, string Image);
private record Plan(string Name, string Price, bool Highlight, IEnumerable<string> Features);
private record QA(string Q, string A);
private readonly List<Pack> _packs = new()
{
new("پکیج استارتر", "برای تیم‌های کوچک و شروع سریع.", new []{
"تا ۲۰۰ عضو فعال",
"نمایش شجره‌نامه پایه",
"گزارش‌های ماهانه"
}, "https://images.unsplash.com/photo-1517245386807-bb43f82c33c4?q=80&w=1200&auto=format&fit=crop"),
new("پکیج رشد", "برای تیم‌های در حال توسعه.", new []{
"تا ۵۰۰۰ عضو",
"موتور کارمزد پیشرفته",
"پشتیبانی اولویت‌دار"
}, "https://images.unsplash.com/photo-1551836022-4e32a88b5f16?q=80&w=1200&auto=format&fit=crop"),
new("پکیج اسکیل", "برای سازمان‌های بزرگ و حساس.", new []{
"اعضای نامحدود",
"قوانین سفارشی کارمزد",
"SLA و آن‌بوردینگ اختصاصی"
}, "https://images.unsplash.com/photo-1522075469751-3a6694fb2f61?q=80&w=1200&auto=format&fit=crop"),
};
private readonly List<Plan> _plans = new()
{
new("استارتر", "رایگان", false, new []{ "تا ۲۰۰ عضو", "شجره‌نامه پایه", "پشتیبانی ایمیلی" }),

View File

@@ -1,6 +1,6 @@
{
//"GwUrl": "https://afrinogw.afrino.co",
"GwUrl": "https://localhost:34781",
"GwUrl": "https://fogw.kbs1.ir",
//"GwUrl": "https://localhost:34781",
"DownloadUrl": "https://dl.afrino.co",
"Logging": {
"LogLevel": {