Compare commits

..

42 Commits

Author SHA1 Message Date
masoodafar-web 7189ed2b96 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 14m33s
2026-09-24 21:48:27 +03:30
masoodafar-web 6d32957236 chore(k8s): deploy staging apps to namespace kbs-stage
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 13s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-24 21:26:22 +03:30
masoodafar-web 7c3ee765d4 feat(reports): enhance weekly and ledger transaction reports with additional package and user details
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 17m28s
- Added 'PackageTitle' to the weekly reports for better clarity on package information.
- Updated CSV export for weekly reports to include package details.
- Introduced 'UserId' and 'UserFullName' columns in ledger transaction reports for improved user tracking.
- Modified CSV export for ledger transactions to reflect new user information.
- Bumped Foursat.CMSMicroservice.Protobuf version to 0.0.214 for compatibility with recent changes.
2026-09-24 19:53:57 +03:30
masoodafar-web 0d71c143a1 chore(infra): point staging registry to 185.252.31.44; keep prod K8S on 45.149.79.127
Build and Deploy to Production / build-and-deploy (push) Failing after 1s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-23 15:17:10 +03:30
masoodafar-web 059920e782 chore(staging): point registry and K8S to 185.252.31.44 after server migration
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 21m6s
2026-09-22 22:18:43 +03:30
masoodafar-web fc006ed731 fix(deps): bump CMS Protobuf to 0.0.213 for invitation report types
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-22 21:41:15 +03:30
masoodafar-web c5e7d1dead feat(nav-menu): add link to Invitations Report in navigation menu
Build and Deploy to Kubernetes / build-and-deploy (push) Failing after 6m13s
- Introduced a new navigation link for the Invitations Report page in NavMenu.razor.
- Updated RouteConstance.cs to include the new InvitationsReport constant.
- Made minor adjustments to .gitignore for improved clarity.
2026-09-20 23:35:33 +03:30
masoodafar-web 6b8fe191b4 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 5m44s
2026-09-04 07:26:24 +03:30
masoodafar-web 4338d0ed1a refactor(club-members): remove activation dialog and related functionality
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m21s
- Deleted the ActivateClubDialog component and its associated logic from ClubMembers.razor and ClubMembers.razor.cs.
- Removed the button for activating new club members from the ClubMembers page.
- Streamlined the codebase by eliminating unused methods and components related to member activation.
2026-08-27 21:28:53 +03:30
masoodafar-web fe79089770 feat(user-page): enhance user main page with additional address and postal code fields in export
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 6m4s
- Added new columns for default address and postal code in the user export functionality.
- Updated the export logic to handle the new fields and changed the file format from CSV to Excel (.xls) for better compatibility.
- Bumped Foursat.CMSMicroservice.Protobuf version to 0.0.209 to align with recent changes.
- Made minor adjustments to the .gitignore for clarity.
2026-08-14 03:19:10 +03:30
masoodafar-web 3eff5b6dfa Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 10m5s
2026-08-09 02:33:49 +03:30
masoodafar-web aa97d25302 feat(report): optimize customer package purchases report by removing pagination and enhancing filter application
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m55s
- Simplified the data retrieval process by eliminating pagination, allowing for all matching records to be fetched in a single request.
- Improved filter application logic to streamline the report generation process.
- Updated the handling of the result set to ensure compatibility with the new data retrieval method.
2026-08-09 00:40:36 +03:30
masoodafar-web 24ae4ec15c feat(date-range-picker): enhance date range picker functionality with external parameters and notifications
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 7m20s
- Added support for external From and To parameters to synchronize date range selections.
- Implemented OnParametersSet to handle updates from parent components without triggering unnecessary updates.
- Introduced NotifyRangeChangedAsync to streamline notifications for date range changes.
- Refactored date range application logic to improve clarity and maintainability.
2026-08-09 00:02:54 +03:30
masoodafar-web e63b80fe47 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Failing after 24m44s
2026-07-26 00:52:14 +03:30
masoodafar-web 7d892c2f6a Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Failing after 20m45s
2026-06-26 19:30:31 +03:30
masoodafar-web 5d83eb4e05 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 5m32s
2026-06-20 23:46:06 +03:30
masoodafar-web 0a2c5f913b Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 6m49s
2026-06-08 02:09:47 +03:30
masoodafar-web 933cdb1094 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Has been cancelled
Deploy blog slug UI fix to production.
2026-06-08 02:06:52 +03:30
masoodafar-web f2316eafe4 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 19m22s
2026-05-18 01:57:57 +03:30
masoodafar-web c4712a00ac Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 8m43s
2026-05-04 23:54:56 +03:30
masoodafar-web 52c8965704 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 5m44s
2026-05-01 00:15:07 +03:30
masoodafar-web 6d8d681046 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 6m29s
2026-04-28 23:30:42 +03:30
masoodafar-web aed6258fb3 fix: update GW_URL in Dockerfile to correct endpoint
Build and Deploy to Production / build-and-deploy (push) Successful in 15m55s
2026-03-15 13:27:48 +03:30
masoodafar-web e6d1d833ec fix: update GW_URL in backoffice deployment to correct endpoint
Build and Deploy to Production / build-and-deploy (push) Successful in 15m40s
2026-03-15 13:04:13 +03:30
masoodafar-web c0c7bb3ac5 fix: resolve MudBlazor v8 breaking changes (MUD0002 warnings)
Build and Deploy to Production / build-and-deploy (push) Successful in 16m3s
- MudListItem: Selected → Class with conditional CSS
- MudTextField: Dense → Margin="Margin.Dense"
- MudSwitch: remove HelperText (merged into Label)
- MudDatePicker: remove T parameter (no longer generic in v8)
2026-03-15 11:58:37 +03:30
masoodafar-web d0fe99492d fix: update proto to 0.0.192 on production (merge conflict chose wrong version) 2026-03-15 05:29:46 +03:30
masoodafar-web d38f50584c fix: resolve version conflict for Foursat.CMSMicroservice.Protobuf package
Build and Deploy to Production / build-and-deploy (push) Failing after 13m13s
2026-03-15 03:21:52 +03:30
masoodafar-web 1c67d7798a Merge branch 'kub-stage' into production 2026-03-15 03:21:44 +03:30
masoodafar-web ea7414dc7f fix: update Foursat.CMSMicroservice.Protobuf package version to 0.0.191
Build and Deploy to Production / build-and-deploy (push) Successful in 8m40s
2026-02-28 05:07:46 +03:30
masoodafar-web a450d9a001 Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Failing after 2m41s
2026-02-28 04:46:38 +03:30
masoodafar-web 60c91438ec fix: rename wallet labels — اصلی، اعتباری، پاداش تیمی
Build and Deploy to Production / build-and-deploy (push) Successful in 11m53s
- شبکه → پاداش تیمی (WalletManagement, ManualPayments)
- تخفیف → اعتباری (ManualPayments, OrderDetails, DiscountOrders)
- طلایی → پاداش تیمی (WithdrawalReports)

Files: WalletManagementPage, ManualPayments, ManualPaymentDialog,
       WithdrawalReports, DiscountOrdersMainPage, OrderDetailsDialog
2026-02-23 23:26:59 +03:30
masoodafar-web 1d8f34ae6c chore: prevent appsettings.Production.json from merging — keep ours strategy
Build and Deploy to Production / build-and-deploy (push) Successful in 8m7s
2026-02-23 00:03:28 +03:30
masoodafar-web bdea2e8aef Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 7m46s
2026-02-22 22:23:35 +03:30
masoodafar-web e541aec115 merge: kub-stage → production (discount autocomplete + smart AddStockDialog + site pages admin)
Build and Deploy to Production / build-and-deploy (push) Successful in 8m9s
2026-02-18 01:01:29 +03:30
masoodafar-web 743403e4d4 fix: nginx image path library/nginx:alpine → nginx:alpine on production
Build and Deploy to Production / build-and-deploy (push) Successful in 7m20s
2026-02-17 02:09:03 +03:30
masoodafar-web 44fd5f29d9 merge: kub-stage into production — fix prod workflow + appsettings GwUrl=cms.kbs2.ir
Build and Deploy to Production / build-and-deploy (push) Has been cancelled
2026-02-17 02:00:29 +03:30
masoodafar-web fac3d2c85e Fix production workflow: use SERVER_PASSWORD, add docker login, use set image for deploy
Build and Deploy to Production / build-and-deploy (push) Failing after 6m25s
2026-02-17 01:24:32 +03:30
masoodafar-web 51c20116a7 Remove staging workflow files from production branch to prevent cross-deployment 2026-02-17 01:16:13 +03:30
masoodafar-web 4454b8dd3a Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Failing after 6s
Features merged:
- Discount shop management (CRUD, inventory, bulk edit)
- Blog and content management improvements
- Docker build fixes (NuGet package reference)
- UI improvements across multiple components

Production workflow and Dockerfile preserved.
2026-02-17 00:57:14 +03:30
masoodafar-web 2bbb1ba4c7 chore: Update production workflow to use Nexus registry (no proxy needed)
Build and Deploy to Production / build-and-deploy (push) Failing after 0s
- Changed Dockerfile base images to use 194.5.195.53:32082 (Nexus)
- Updated workflow to use docker-sshpass image from Nexus
- Removed HTTP_PROXY/HTTPS_PROXY dependencies
- Changed deploy method to SSH instead of kubeconfig
- Registry: 194.5.195.53:30080 (Gitea internal)
- K8S Server: 45.149.79.127 (Production)
2026-01-29 22:04:31 +03:30
masoodafar-web 978475360c Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 2m23s
2025-12-29 00:43:04 +03:30
masoodafar-web 230453e491 feat(config): add production configuration for gateway URL and authentication
Build and Deploy to Production / build-and-deploy (push) Successful in 4m5s
2025-12-27 07:46:54 +03:30
24 changed files with 351 additions and 328 deletions
-46
View File
@@ -1,46 +0,0 @@
name: Push nuget and docker image Actions Workflow
on:
push:
branches:
- stage-new
jobs:
Deploy:
runs-on: windows
steps:
- name: Checkout
uses: https://git.afrino.co/actions/checkout@v3
- name: Setup dotnet
uses: https://git.afrino.co/actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Remove Package Source
run: dotnet nuget remove source FourSat
continue-on-error: true
- name: Add Package Source
run: dotnet nuget add source --name FourSat --username systemuser --password sZSA7PTiv3pUSQZ https://git.afrino.co/api/packages/FourSat/nuget/index.json --store-password-in-clear-text
- name: Install dependencies
run: dotnet restore ".\src\BackOffice\BackOffice.csproj"
- name: Build
run: dotnet build ".\src\BackOffice\BackOffice.csproj" --configuration Release --no-restore
- name: Test
run: dotnet test ".\src\BackOffice\BackOffice.csproj" --no-restore --verbosity normal
- name: Recycle Apppool
run: |
& "C:\Windows\System32\inetsrv\appcmd.exe" recycle apppool /apppool.name:admin.kbs1.ir
shell: powershell
- name: Stop Website
run: |
& "C:\Windows\System32\inetsrv\appcmd.exe" stop site /site.name:admin.kbs1.ir
shell: powershell
- name: Publish
run: dotnet publish ".\src\BackOffice\BackOffice.csproj" -c Release -o publish
- name: Copy Publish To IIS Directory
run: Get-ChildItem -Path "publish\*" | Copy-Item -Destination "E:\kbs1.ir\admin.kbs1.ir\" -Recurse -Force
- name: Start Website
run: |
& "C:\Windows\System32\inetsrv\appcmd.exe" start site /site.name:admin.kbs1.ir
shell: powershell
+8 -8
View File
@@ -6,15 +6,15 @@ on:
- kub-stage - kub-stage
env: env:
REGISTRY: 194.5.195.53:30080 REGISTRY: 185.252.31.44:30080
IMAGE_NAME: admin/backoffice IMAGE_NAME: admin/backoffice
K8S_SERVER: 194.5.195.53 K8S_SERVER: 185.252.31.44
jobs: jobs:
build-and-deploy: build-and-deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: 194.5.195.53:32082/docker-sshpass:latest image: 185.252.31.44:32082/docker-sshpass:latest
options: --privileged options: --privileged
steps: steps:
- name: Start Docker daemon - name: Start Docker daemon
@@ -22,7 +22,7 @@ jobs:
mkdir -p /etc/docker mkdir -p /etc/docker
cat > /etc/docker/daemon.json << 'DAEMON' cat > /etc/docker/daemon.json << 'DAEMON'
{ {
"insecure-registries": ["194.5.195.53:30080", "194.5.195.53:32500", "194.5.195.53:32082"] "insecure-registries": ["185.252.31.44:30080", "185.252.31.44:32500", "185.252.31.44:32082"]
} }
DAEMON DAEMON
echo "🚀 Starting Docker daemon..." echo "🚀 Starting Docker daemon..."
@@ -52,7 +52,7 @@ jobs:
- name: Login to Docker registries - name: Login to Docker registries
run: | run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login 194.5.195.53:32082 -u admin --password-stdin echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login 185.252.31.44:32082 -u admin --password-stdin
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin
- name: Build Docker Image - name: Build Docker Image
@@ -73,9 +73,9 @@ jobs:
# Apply manifests and restart # Apply manifests and restart
sshpass -e ssh -o StrictHostKeyChecking=no root@${{ env.K8S_SERVER }} " sshpass -e ssh -o StrictHostKeyChecking=no root@${{ env.K8S_SERVER }} "
kubectl apply -f /tmp/backoffice-deployment.yaml && kubectl apply -n kbs-stage -f /tmp/backoffice-deployment.yaml &&
kubectl rollout restart deployment/backoffice && kubectl -n kbs-stage rollout restart deployment/backoffice &&
kubectl rollout status deployment/backoffice --timeout=180s && kubectl -n kbs-stage rollout status deployment/backoffice --timeout=180s &&
rm -f /tmp/backoffice-deployment.yaml rm -f /tmp/backoffice-deployment.yaml
" "
echo "✅ Deployed!" echo "✅ Deployed!"
+8 -7
View File
@@ -6,7 +6,7 @@ on:
- production - production
env: env:
REGISTRY: 194.5.195.53:30080 REGISTRY: 185.252.31.44:30080
IMAGE_NAME: admin/backoffice IMAGE_NAME: admin/backoffice
K8S_SERVER: 45.149.79.127 K8S_SERVER: 45.149.79.127
@@ -14,7 +14,7 @@ jobs:
build-and-deploy: build-and-deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: 194.5.195.53:32082/docker-sshpass:latest image: 185.252.31.44:32082/docker-sshpass:latest
options: --privileged options: --privileged
steps: steps:
- name: Start Docker daemon - name: Start Docker daemon
@@ -22,7 +22,7 @@ jobs:
mkdir -p /etc/docker mkdir -p /etc/docker
cat > /etc/docker/daemon.json << 'DAEMON' cat > /etc/docker/daemon.json << 'DAEMON'
{ {
"insecure-registries": ["194.5.195.53:30080", "194.5.195.53:32500", "194.5.195.53:32082"] "insecure-registries": ["185.252.31.44:30080", "185.252.31.44:32500", "185.252.31.44:32082"]
} }
DAEMON DAEMON
echo "🚀 Starting Docker daemon..." echo "🚀 Starting Docker daemon..."
@@ -40,7 +40,7 @@ jobs:
done done
if ! docker info >/dev/null 2>&1; then if ! docker info >/dev/null 2>&1; then
echo "❌ Docker daemon failed to start after 3 minutes" echo "❌ Docker daemon failed to start"
exit 1 exit 1
fi fi
@@ -50,15 +50,16 @@ jobs:
- name: Login to Docker registries - name: Login to Docker registries
run: | run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login 194.5.195.53:32082 -u admin --password-stdin echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login 185.252.31.44:32082 -u admin --password-stdin
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin
- name: Build Docker Image - name: Build Docker Image
run: | run: |
cd src cd src
DOCKER_BUILDKIT=0 docker build --network host -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ DOCKER_BUILDKIT=0 docker build --network host -f BackOffice/Dockerfile \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:prod \ -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:prod \
-f BackOffice/Dockerfile . .
- name: Push to Registry - name: Push to Registry
run: | run: |
+5 -5
View File
@@ -4,7 +4,7 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: backoffice name: backoffice
namespace: default namespace: kbs-stage
labels: labels:
app: backoffice app: backoffice
spec: spec:
@@ -19,8 +19,8 @@ spec:
spec: spec:
containers: containers:
- name: backoffice - name: backoffice
image: 194.5.195.53:30080/admin/backoffice:latest image: 185.252.31.44:30080/admin/backoffice:latest
imagePullPolicy: Always imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 80 - containerPort: 80
name: http name: http
@@ -43,7 +43,7 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: backoffice-svc name: backoffice-svc
namespace: default namespace: kbs-stage
spec: spec:
selector: selector:
app: backoffice app: backoffice
@@ -58,7 +58,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: backoffice-ingress name: backoffice-ingress
namespace: default namespace: kbs-stage
annotations: annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod" cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/ssl-redirect: "true"
+1 -1
View File
@@ -143,7 +143,7 @@
<ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" /> <ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="!Exists('../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj')"> <ItemGroup Condition="!Exists('../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj')">
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.208" /> <PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.214" />
</ItemGroup> </ItemGroup>
<!-- ============================================================ --> <!-- ============================================================ -->
@@ -8,21 +8,46 @@ namespace BackOffice.Common.BaseComponents;
public partial class DateRangePicker public partial class DateRangePicker
{ {
private DateRange _dateRange = new(); private DateRange _dateRange = new();
private MudDateRangePicker _picker = default!;
private DateTime? _lastSyncedFrom;
private DateTime? _lastSyncedTo;
private MudDateRangePicker _picker;
[Parameter] public string Label { get; set; } = "انتخاب بازه زمانی"; [Parameter] public string Label { get; set; } = "انتخاب بازه زمانی";
[Parameter] public DateTime? DefaultStart { get; set; } [Parameter] public DateTime? DefaultStart { get; set; }
[Parameter] public DateTime? DefaultEnd { get; set; } [Parameter] public DateTime? DefaultEnd { get; set; }
[Parameter] public EventCallback<DateRange> OnChanged { get; set; } [Parameter] public EventCallback<DateRange> OnChanged { get; set; }
[Parameter] public DateTime? From { get; set; }
[Parameter] public EventCallback<DateTime?> FromChanged { get; set; }
[Parameter] public DateTime? To { get; set; }
[Parameter] public EventCallback<DateTime?> ToChanged { get; set; }
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized(); base.OnInitialized();
if (DefaultStart.HasValue) var start = From ?? DefaultStart;
_dateRange.Start = DefaultStart.Value.Date; var end = To ?? DefaultEnd;
ApplyExternalRange(start, end);
if (DefaultEnd.HasValue) _lastSyncedFrom = From;
_dateRange.End = DefaultEnd.Value.Date; _lastSyncedTo = To;
} }
protected override void OnParametersSet()
{
// فقط وقتی والد From/To را عوض کرده (مثلاً پاک کردن فیلتر)، نه هنگام انتخاب داخل پیکر
if (From == _lastSyncedFrom && To == _lastSyncedTo)
return;
_lastSyncedFrom = From;
_lastSyncedTo = To;
ApplyExternalRange(From, To);
}
private void ApplyExternalRange(DateTime? start, DateTime? end)
{
_dateRange = new DateRange(start?.Date, end?.Date);
}
public CultureInfo GetPersianCulture() public CultureInfo GetPersianCulture()
{ {
var culture = new CultureInfo("fa-IR"); var culture = new CultureInfo("fa-IR");
@@ -53,19 +78,35 @@ public partial class DateRangePicker
culture.NumberFormat.NumberNegativePattern = 0; culture.NumberFormat.NumberNegativePattern = 0;
return culture; return culture;
} }
private async Task OnClickOK() private async Task OnClickOK()
{ {
if (_picker.DateRange is not null) var range = _picker.DateRange ?? _dateRange;
{ _dateRange = range ?? new DateRange();
await OnChanged.InvokeAsync(_picker.DateRange); await NotifyRangeChangedAsync(_dateRange);
}
await _picker.CloseAsync(); await _picker.CloseAsync();
} }
private async Task OnClickClear() private async Task OnClickClear()
{ {
_dateRange = new DateRange(); _dateRange = new DateRange();
await OnChanged.InvokeAsync(_dateRange); await NotifyRangeChangedAsync(_dateRange);
await _picker.CloseAsync(); await _picker.CloseAsync();
} }
private async Task NotifyRangeChangedAsync(DateRange range)
{
var start = range.Start?.Date;
var end = range.End?.Date;
_lastSyncedFrom = start;
_lastSyncedTo = end;
if (From != start)
await FromChanged.InvokeAsync(start);
if (To != end)
await ToChanged.InvokeAsync(end);
await OnChanged.InvokeAsync(range);
}
} }
@@ -8,6 +8,7 @@ public static class RouteConstance
public const string Package = "/PackagePage/"; public const string Package = "/PackagePage/";
public const string Role = "/RolePage/"; public const string Role = "/RolePage/";
public const string UserPage = "/UserPage/"; public const string UserPage = "/UserPage/";
public const string InvitationsReport = "/InvitationsReportPage/";
public const string UserOrder = "/UserOrderPage/"; public const string UserOrder = "/UserOrderPage/";
public const string Orders = "/OrdersPage/"; public const string Orders = "/OrdersPage/";
public const string OrdersSalesReports = "/OrdersSalesReportsPage/"; public const string OrdersSalesReports = "/OrdersSalesReportsPage/";
+3 -3
View File
@@ -1,4 +1,4 @@
FROM 194.5.195.53:32082/dotnet/sdk:9.0 AS build FROM 185.252.31.44:32082/dotnet/sdk:9.0 AS build
WORKDIR /src WORKDIR /src
# Copy NuGet config and project file # Copy NuGet config and project file
@@ -16,7 +16,7 @@ WORKDIR "/src/BackOffice"
RUN dotnet publish "BackOffice.csproj" -c Release -o /app/publish RUN dotnet publish "BackOffice.csproj" -c Release -o /app/publish
# Runtime stage - nginx for Blazor WebAssembly # Runtime stage - nginx for Blazor WebAssembly
FROM 194.5.195.53:32082/nginx:alpine AS final FROM 185.252.31.44:32082/nginx:alpine AS final
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html
# Remove default nginx files # Remove default nginx files
@@ -32,7 +32,7 @@ RUN chmod +x /docker-entrypoint.sh
# Default Blazor environment (override via K8s env var BLAZOR_ENVIRONMENT) # Default Blazor environment (override via K8s env var BLAZOR_ENVIRONMENT)
ENV BLAZOR_ENVIRONMENT=Staging ENV BLAZOR_ENVIRONMENT=Staging
# Default gateway URL for gRPC calls (injected into appsettings at startup) # Default gateway URL for gRPC calls (injected into appsettings at startup)
ENV GW_URL=https://cms.se.kbs1.ir ENV GW_URL=https://cms.kbs2.ir
EXPOSE 80 EXPOSE 80
CMD ["/docker-entrypoint.sh"] CMD ["/docker-entrypoint.sh"]
+3 -1
View File
@@ -2,8 +2,10 @@
<configuration> <configuration>
<packageSources> <packageSources>
<clear /> <clear />
<!-- Local packages (dev builds) -->
<!-- <add key="Local" value="/home/masoud/Apps/project/FourSat/nupkg" /> -->
<!-- Nexus (hosts FourSat packages + proxies nuget.org) --> <!-- Nexus (hosts FourSat packages + proxies nuget.org) -->
<add key="Nexus" value="http://194.5.195.53:32081/repository/nuget-all/index.json" allowInsecureConnections="true" /> <add key="Nexus" value="http://185.252.31.44:32081/repository/nuget-all/index.json" allowInsecureConnections="true" />
</packageSources> </packageSources>
<packageSourceCredentials> <packageSourceCredentials>
<Nexus> <Nexus>
@@ -33,12 +33,6 @@
StartIcon="@Icons.Material.Filled.Refresh"> StartIcon="@Icons.Material.Filled.Refresh">
بارگذاری بارگذاری
</MudButton> </MudButton>
<MudButton Variant="Variant.Filled"
Color="Color.Success"
OnClick="OpenActivateDialog"
StartIcon="@Icons.Material.Filled.Add">
فعال‌سازی عضو جدید
</MudButton>
<MudButton Variant="Variant.Outlined" <MudButton Variant="Variant.Outlined"
Color="Color.Info" Color="Color.Info"
OnClick="ExportToExcel" OnClick="ExportToExcel"
@@ -62,23 +62,6 @@ public partial class ClubMembers
} }
} }
private async Task OpenActivateDialog()
{
var dialog = await DialogService.ShowAsync<ActivateClubDialog>("فعال‌سازی عضویت باشگاه", new DialogOptions
{
CloseButton = true,
MaxWidth = MaxWidth.Small,
FullWidth = true
});
var result = await dialog.Result;
if (!result.Canceled)
{
Snackbar.Add("عضویت با موفقیت فعال شد", Severity.Success);
await ApplyFilter();
}
}
private async Task ViewDetails(ClubMembershipModel member) private async Task ViewDetails(ClubMembershipModel member)
{ {
var parameters = new DialogParameters var parameters = new DialogParameters
@@ -1,156 +0,0 @@
@using CMSMicroservice.Protobuf.Protos.ClubMembership
@using CMSMicroservice.Protobuf.Protos.Package
@using BackOffice.Pages.AutoComplete
<MudDialog>
<DialogContent>
<MudForm @ref="_form" @bind-IsValid="_formValid">
<MudStack Spacing="3">
<UserAutoComplete Label="انتخاب کاربر" @bind-SelectedUserId="_model.UserId" />
@if (_isLoadingPackages)
{
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Height="56px" />
}
else
{
<MudSelect T="long" @bind-Value="_model.PackageId"
Label="انتخاب پکیج"
Required="true"
RequiredError="انتخاب پکیج الزامی است"
Variant="Variant.Outlined"
AnchorOrigin="Origin.BottomCenter">
@foreach (var pkg in _packages)
{
<MudSelectItem T="long" Value="pkg.Id">
@pkg.Title — @($"{pkg.Price:N0}") ریال
</MudSelectItem>
}
</MudSelect>
}
<MudAlert Severity="Severity.Info" Dense="true">
<MudText Typo="Typo.body2">
با تایید، عضویت باشگاه برای کاربر فعال می‌شود.
<br/>
<small>عضویت باشگاه بدون محدودیت زمانی است.</small>
</MudText>
</MudAlert>
</MudStack>
</MudForm>
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">لغو</MudButton>
<MudButton Color="Color.Success"
Variant="Variant.Filled"
OnClick="Submit"
Disabled="@(!_formValid || _isSubmitting || _isLoadingPackages)">
@if (_isSubmitting)
{
<MudProgressCircular Size="Size.Small" Indeterminate="true" />
<MudText Class="ms-2">در حال پردازش...</MudText>
}
else
{
<text>تایید و فعال‌سازی</text>
}
</MudButton>
</DialogActions>
</MudDialog>
@code {
[CascadingParameter] IMudDialogInstance MudDialog { get; set; }
[Inject] public ClubMembershipContract.ClubMembershipContractClient ClubContract { get; set; }
[Inject] public PackageContract.PackageContractClient PackageClient { get; set; }
private MudForm _form;
private bool _formValid;
private bool _isSubmitting;
private bool _isLoadingPackages = true;
private List<GetAllPackageByFilterResponseModel> _packages = new();
private ActivateModel _model = new();
protected override async Task OnInitializedAsync()
{
await LoadPackages();
}
private async Task LoadPackages()
{
_isLoadingPackages = true;
try
{
var request = new GetAllPackageByFilterRequest
{
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState
{
PageNumber = 1,
PageSize = 50
}
};
var result = await PackageClient.GetAllPackageByFilterAsync(request);
if (result?.Models != null)
{
_packages = result.Models.ToList();
}
}
catch (Exception ex)
{
Snackbar.Add($"خطا در بارگذاری پکیج‌ها: {ex.Message}", Severity.Error);
}
finally
{
_isLoadingPackages = false;
}
}
private void Cancel() => MudDialog.Cancel();
private async Task Submit()
{
await _form.Validate();
if (!_formValid) return;
if (!_model.UserId.HasValue || _model.UserId.Value <= 0)
{
Snackbar.Add("لطفاً کاربر را انتخاب کنید.", Severity.Warning);
return;
}
if (_model.PackageId <= 0)
{
Snackbar.Add("لطفاً پکیج را انتخاب کنید.", Severity.Warning);
return;
}
_isSubmitting = true;
try
{
var request = new ActivateClubMembershipRequest
{
UserId = _model.UserId.Value,
PackageId = _model.PackageId,
ForceActivation = true
};
var response = await ClubContract.ActivateClubMembershipAsync(request);
Snackbar.Add("عضویت با موفقیت فعال شد.", Severity.Success);
MudDialog.Close(DialogResult.Ok(true));
}
catch (Exception ex)
{
Snackbar.Add($"خطا: {ex.Message}", Severity.Error);
}
finally
{
_isSubmitting = false;
}
}
private class ActivateModel
{
public long? UserId { get; set; }
public long PackageId { get; set; }
}
}
@@ -205,31 +205,19 @@
_exporting = true; _exporting = true;
try try
{ {
var filter = BuildFilter(); // PageSize=0 → همهٔ ردیف‌های مطابق فیلتر، مستقل از صفحه‌بندی گرید
var all = new List<CustomerPackagePurchaseRollupModel>();
const int pageSize = 500;
var page = 1;
long totalCount;
do
{
var result = await PurchaseClient.GetCustomerPackagePurchaseRollupAsync( var result = await PurchaseClient.GetCustomerPackagePurchaseRollupAsync(
new GetCustomerPackagePurchaseRollupRequest new GetCustomerPackagePurchaseRollupRequest
{ {
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState
{ {
PageNumber = page, PageNumber = 1,
PageSize = pageSize PageSize = 0
}, },
Filter = filter Filter = BuildFilter()
}); });
var batch = result?.Models?.ToList() ?? new(); var all = result?.Models?.ToList() ?? new();
all.AddRange(batch);
totalCount = result?.MetaData?.TotalCount ?? 0;
page++;
} while (all.Count < totalCount && page <= 50);
if (all.Count == 0) if (all.Count == 0)
{ {
Snackbar.Add("داده‌ای برای خروجی با فیلتر فعلی وجود ندارد.", Severity.Info); Snackbar.Add("داده‌ای برای خروجی با فیلتر فعلی وجود ندارد.", Severity.Info);
@@ -65,6 +65,11 @@
SortMode="SortMode.Multiple"> SortMode="SortMode.Multiple">
<Columns> <Columns>
<PropertyColumn Property="x => x.WeekDisplayName" Title="هفته" /> <PropertyColumn Property="x => x.WeekDisplayName" Title="هفته" />
<PropertyColumn Property="x => x.PackageTitle" Title="پکیج">
<CellTemplate>
@(string.IsNullOrEmpty(context.Item.PackageTitle) ? "—" : context.Item.PackageTitle)
</CellTemplate>
</PropertyColumn>
<PropertyColumn Property="x => x.TotalPoolAmount" Title="مبلغ کل استخر" Format="N0"> <PropertyColumn Property="x => x.TotalPoolAmount" Title="مبلغ کل استخر" Format="N0">
<CellTemplate> <CellTemplate>
<MudText>@context.Item.TotalPoolAmount.ToString("N0") تومان</MudText> <MudText>@context.Item.TotalPoolAmount.ToString("N0") تومان</MudText>
@@ -203,6 +208,8 @@
{ {
WeekDefinitionId = x.WeekDefinitionId, WeekDefinitionId = x.WeekDefinitionId,
WeekDisplayName = x.WeekDisplayName, WeekDisplayName = x.WeekDisplayName,
PackageId = x.PackageId,
PackageTitle = x.PackageTitle,
TotalPoolAmount = x.TotalPoolAmount, TotalPoolAmount = x.TotalPoolAmount,
TotalBalances = x.TotalBalances, TotalBalances = x.TotalBalances,
ValuePerBalance = x.ValuePerBalance, ValuePerBalance = x.ValuePerBalance,
@@ -249,6 +256,8 @@
{ {
public long WeekDefinitionId { get; set; } public long WeekDefinitionId { get; set; }
public string WeekDisplayName { get; set; } = ""; public string WeekDisplayName { get; set; } = "";
public long PackageId { get; set; }
public string PackageTitle { get; set; } = "";
public long TotalPoolAmount { get; set; } public long TotalPoolAmount { get; set; }
public int TotalBalances { get; set; } public int TotalBalances { get; set; }
public long ValuePerBalance { get; set; } public long ValuePerBalance { get; set; }
@@ -18,12 +18,13 @@ public partial class WeeklyReports
try try
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
sb.AppendLine("هفته,مبلغ کل استخر,مجموع موجودی‌ها,ارزش هر موجودی,وضعیت,تاریخ محاسبه"); sb.AppendLine("هفته,پکیج,مبلغ کل استخر,مجموع موجودی‌ها,ارزش هر موجودی,وضعیت,تاریخ محاسبه");
foreach (var r in _reports) foreach (var r in _reports)
{ {
sb.AppendLine(string.Join(",", sb.AppendLine(string.Join(",",
EscapeCsv(r.WeekDisplayName), EscapeCsv(r.WeekDisplayName),
EscapeCsv(r.PackageTitle),
r.TotalPoolAmount, r.TotalPoolAmount,
r.TotalBalances, r.TotalBalances,
r.ValuePerBalance, r.ValuePerBalance,
@@ -96,6 +96,16 @@
</ToolBarContent> </ToolBarContent>
<Columns> <Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" /> <PropertyColumn Property="x => x.Id" Title="شناسه" />
<TemplateColumn Title="کاربر">
<CellTemplate>
@(context.Item.UserId != null ? context.Item.UserId.ToString() : "—")
</CellTemplate>
</TemplateColumn>
<TemplateColumn Title="نام کاربر">
<CellTemplate>
@(string.IsNullOrWhiteSpace(context.Item.UserFullName) ? "—" : context.Item.UserFullName)
</CellTemplate>
</TemplateColumn>
<TemplateColumn Title="نوع"> <TemplateColumn Title="نوع">
<CellTemplate> <CellTemplate>
<MudChip T="string" Size="Size.Small" Variant="Variant.Text"> <MudChip T="string" Size="Size.Small" Variant="Variant.Text">
@@ -232,13 +242,13 @@
Filter = BuildFilter() Filter = BuildFilter()
}); });
var sb = new System.Text.StringBuilder(); var sb = new System.Text.StringBuilder();
sb.AppendLine("Id,Type,Amount,Description,Status,RefId,PaymentDate,Created"); sb.AppendLine("Id,UserId,UserFullName,Type,Amount,Description,Status,RefId,PaymentDate,Created");
foreach (var r in result.Models) foreach (var r in result.Models)
{ {
var type = r.HasType ? ReportLabels.GetTransactionTypeLabel(r.Type) : ""; var type = r.HasType ? ReportLabels.GetTransactionTypeLabel(r.Type) : "";
var status = r.HasPaymentStatus ? ReportLabels.GetTransactionPaymentStatusLabel(r.PaymentStatus) : ""; var status = r.HasPaymentStatus ? ReportLabels.GetTransactionPaymentStatusLabel(r.PaymentStatus) : "";
var paymentDate = r.PaymentDate != null ? r.PaymentDate.ToDateTime().ToString("yyyy-MM-dd HH:mm") : ""; var paymentDate = r.PaymentDate != null ? r.PaymentDate.ToDateTime().ToString("yyyy-MM-dd HH:mm") : "";
sb.AppendLine($"{r.Id},{type},{r.Amount},\"{r.Description}\",{status},{r.RefId},{paymentDate},{r.Created.ToDateTime():yyyy-MM-dd HH:mm}"); sb.AppendLine($"{r.Id},{r.UserId},\"{r.UserFullName}\",{type},{r.Amount},\"{r.Description}\",{status},{r.RefId},{paymentDate},{r.Created.ToDateTime():yyyy-MM-dd HH:mm}");
} }
await jsRuntime.InvokeVoidAsync("jsSaveAsFile", "ledger-transactions.csv", sb.ToString()); await jsRuntime.InvokeVoidAsync("jsSaveAsFile", "ledger-transactions.csv", sb.ToString());
} }
@@ -82,6 +82,11 @@
<Columns> <Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" /> <PropertyColumn Property="x => x.Id" Title="شناسه" />
<PropertyColumn Property="x => x.UserId" Title="کاربر" /> <PropertyColumn Property="x => x.UserId" Title="کاربر" />
<TemplateColumn Title="نام کاربر">
<CellTemplate>
@(string.IsNullOrWhiteSpace(context.Item.UserFullName) ? "—" : context.Item.UserFullName)
</CellTemplate>
</TemplateColumn>
<PropertyColumn Property="x => x.Mobile" Title="موبایل" /> <PropertyColumn Property="x => x.Mobile" Title="موبایل" />
<PropertyColumn Property="x => x.GatewayProvider" Title="درگاه" /> <PropertyColumn Property="x => x.GatewayProvider" Title="درگاه" />
<TemplateColumn Title="مبلغ (تومان)"> <TemplateColumn Title="مبلغ (تومان)">
@@ -193,9 +198,9 @@
Filter = BuildFilter() Filter = BuildFilter()
}); });
var sb = new System.Text.StringBuilder(); var sb = new System.Text.StringBuilder();
sb.AppendLine("Id,UserId,Mobile,Gateway,Amount,Authority,RefId,Status,OrderId,Created"); sb.AppendLine("Id,UserId,UserFullName,Mobile,Gateway,Amount,Authority,RefId,Status,OrderId,Created");
foreach (var r in result.Models) foreach (var r in result.Models)
sb.AppendLine($"{r.Id},{r.UserId},{r.Mobile},{r.GatewayProvider},{r.Amount},{r.Authority},{r.RefId},{r.PaymentStatus},{r.OrderId},{r.CreatedAt.ToDateTime():yyyy-MM-dd HH:mm}"); sb.AppendLine($"{r.Id},{r.UserId},\"{r.UserFullName}\",{r.Mobile},{r.GatewayProvider},{r.Amount},{r.Authority},{r.RefId},{r.PaymentStatus},{r.OrderId},{r.CreatedAt.ToDateTime():yyyy-MM-dd HH:mm}");
await jsRuntime.InvokeVoidAsync("jsSaveAsFile", "payment-transactions.csv", sb.ToString()); await jsRuntime.InvokeVoidAsync("jsSaveAsFile", "payment-transactions.csv", sb.ToString());
} }
catch (Exception ex) { Snackbar.Add($"خطا در export: {ex.Message}", Severity.Error); } catch (Exception ex) { Snackbar.Add($"خطا در export: {ex.Message}", Severity.Error); }
@@ -0,0 +1,85 @@
@attribute [Route(RouteConstance.InvitationsReport)]
@using CMSMicroservice.Protobuf.Protos.User
@using BackOffice.Common.BaseComponents
@using DataModel = CMSMicroservice.Protobuf.Protos.User.InvitationReportModel
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleared" OnSubmitClick="OnFilterSubmit">
<Filters>
<MudItem xs="12" sm="6" md="3">
<MudTextField T="string" Clearable="true" Label="موبایل دعوت‌کننده" @bind-Value="@_request.Filter.InviterMobile" Variant="Variant.Outlined" Margin="Margin.Dense" />
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudTextField T="string" Clearable="true" Label="نام دعوت‌کننده" @bind-Value="@_request.Filter.InviterFirstName" Variant="Variant.Outlined" Margin="Margin.Dense" />
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudTextField T="string" Clearable="true" Label="نام‌خانوادگی دعوت‌کننده" @bind-Value="@_request.Filter.InviterLastName" Variant="Variant.Outlined" Margin="Margin.Dense" />
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudTextField T="string" Clearable="true" Label="موبایل دعوت‌شونده" @bind-Value="@_request.Filter.InviteeMobile" Variant="Variant.Outlined" Margin="Margin.Dense" />
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudTextField T="string" Clearable="true" Label="نام دعوت‌شونده" @bind-Value="@_request.Filter.InviteeFirstName" Variant="Variant.Outlined" Margin="Margin.Dense" />
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudTextField T="string" Clearable="true" Label="نام‌خانوادگی دعوت‌شونده" @bind-Value="@_request.Filter.InviteeLastName" Variant="Variant.Outlined" Margin="Margin.Dense" />
</MudItem>
<MudItem xs="12" sm="6" md="3">
<MudSelect T="string" Label="وضعیت باشگاه دعوت‌شونده" @bind-Value="_clubActiveFilter" Clearable="true" Variant="Variant.Outlined" Margin="Margin.Dense">
<MudSelectItem Value="@("")">همه</MudSelectItem>
<MudSelectItem Value="@("true")">فعال</MudSelectItem>
<MudSelectItem Value="@("false")">غیرفعال</MudSelectItem>
</MudSelect>
</MudItem>
</Filters>
<Content>
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
Hover="true" @ref="_gridData" Height="calc(100vh - 240px)">
<ToolBarContent>
<MudText>گزارش دعوت‌ها (جدیدترین اول)</MudText>
</ToolBarContent>
<Columns>
<PropertyColumn Property="x => x.Id" Title="شناسه" />
<TemplateColumn Title="دعوت‌کننده">
<CellTemplate>
<MudText Typo="Typo.body2">@($"{context.Item.InviterFirstName} {context.Item.InviterLastName}".Trim())</MudText>
<MudText Typo="Typo.caption" Class="mud-text-secondary">@context.Item.InviterMobile</MudText>
</CellTemplate>
</TemplateColumn>
<TemplateColumn Title="دعوت‌شونده">
<CellTemplate>
<MudText Typo="Typo.body2">@($"{context.Item.InviteeFirstName} {context.Item.InviteeLastName}".Trim())</MudText>
<MudText Typo="Typo.caption" Class="mud-text-secondary">@context.Item.InviteeMobile</MudText>
</CellTemplate>
</TemplateColumn>
<TemplateColumn Title="ثبت‌نام دعوت‌شونده">
<CellTemplate>
@(context.Item.InviteeRegisteredAt?.ToDateTime().ToLocalTime().ToString("yyyy/MM/dd HH:mm") ?? "—")
</CellTemplate>
</TemplateColumn>
<TemplateColumn Title="باشگاه">
<CellTemplate>
@if (context.Item.InviteeClubActive)
{
<MudChip T="string" Size="Size.Small" Color="Color.Success">فعال</MudChip>
}
else
{
<MudChip T="string" Size="Size.Small" Color="Color.Default">غیرفعال</MudChip>
}
</CellTemplate>
</TemplateColumn>
<TemplateColumn Title="تاریخ دعوت">
<CellTemplate>
@(context.Item.InvitedAt?.ToDateTime().ToLocalTime().ToString("yyyy/MM/dd HH:mm") ?? "—")
</CellTemplate>
</TemplateColumn>
</Columns>
<PagerContent>
<MudDataGridPager T="DataModel" />
</PagerContent>
<NoRecordsContent>
<MudText>موردی یافت نشد</MudText>
</NoRecordsContent>
</MudDataGrid>
</Content>
</BackOffice.Common.BaseComponents.BasePageComponent>
@@ -0,0 +1,74 @@
using CMSMicroservice.Protobuf.Protos.User;
using BackOffice.Common.BaseComponents;
using Microsoft.AspNetCore.Components;
using MudBlazor;
using DataModel = CMSMicroservice.Protobuf.Protos.User.InvitationReportModel;
namespace BackOffice.Pages.User;
public partial class InvitationsReportPage
{
[Inject] public UserContract.UserContractClient UserContract { get; set; } = default!;
private MudDataGrid<DataModel> _gridData = default!;
private BasePageComponent _basePage = default!;
private GetInvitationsByFilterRequest _request = new() { Filter = new() };
private string _clubActiveFilter = string.Empty;
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
{
_request.Filter ??= new();
ApplyClubFilter();
_request.PaginationState ??= new();
_request.PaginationState.PageNumber = state.Page + 1;
_request.PaginationState.PageSize = state.PageSize;
_request.SortBy = "newest";
var result = await UserContract.GetInvitationsByFilterAsync(_request);
if (result?.Models != null && result.Models.Any())
{
return new GridData<DataModel>
{
Items = result.Models.ToList(),
TotalItems = (int)result.MetaData.TotalCount
};
}
return new GridData<DataModel>();
}
private void ApplyClubFilter()
{
_request.Filter ??= new();
if (_clubActiveFilter == "true")
_request.Filter.InviteeClubActive = true;
else if (_clubActiveFilter == "false")
_request.Filter.InviteeClubActive = false;
else
_request.Filter.InviteeClubActive = null;
}
private void ReLoadData()
{
_ = _gridData.ReloadServerData();
}
public async Task OnFilterSubmit()
{
ApplyClubFilter();
_basePage.IsFiltered = true;
StateHasChanged();
ReLoadData();
await Task.CompletedTask;
}
public async Task OnFilterCleared()
{
_basePage.IsFiltered = false;
_clubActiveFilter = string.Empty;
_request = new() { Filter = new() };
StateHasChanged();
ReLoadData();
await Task.CompletedTask;
}
}
+17 -2
View File
@@ -28,6 +28,8 @@
<col /> <col />
<col /> <col />
<col /> <col />
<col style="min-width: 180px;" />
<col />
<col style="width: 58px;" /> <col style="width: 58px;" />
</ColGroup> </ColGroup>
<ToolBarContent> <ToolBarContent>
@@ -46,8 +48,21 @@
</CellTemplate> </CellTemplate>
</PropertyColumn> </PropertyColumn>
<PropertyColumn Property="x => x.NationalCode" Title="کدملی" /> <PropertyColumn Property="x => x.NationalCode" Title="کدملی" />
<TemplateColumn Title="آدرس پیش‌فرض">
<CellTemplate>
<MudText Typo="Typo.caption" Style="max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"
Title="@(context.Item.DefaultAddress ?? "")">
@(string.IsNullOrWhiteSpace(context.Item.DefaultAddress) ? "-" : context.Item.DefaultAddress)
</MudText>
</CellTemplate>
</TemplateColumn>
<TemplateColumn Title="کدپستی پیش‌فرض">
<CellTemplate>
<MudText Typo="Typo.caption">
@(string.IsNullOrWhiteSpace(context.Item.DefaultPostalCode) ? "-" : context.Item.DefaultPostalCode)
</MudText>
</CellTemplate>
</TemplateColumn>
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;"> <TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
<CellTemplate> <CellTemplate>
+43 -32
View File
@@ -1,11 +1,10 @@
using CMSMicroservice.Protobuf.Protos.User; using CMSMicroservice.Protobuf.Protos.User;
using BackOffice.Common.BaseComponents; using BackOffice.Common.BaseComponents;
using BackOffice.Common.Utilities;
using BackOffice.Pages.User.Components; using BackOffice.Pages.User.Components;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using MudBlazor; using MudBlazor;
using System.Text;
using DateTimeConverterCL;
using DataModel = CMSMicroservice.Protobuf.Protos.User.GetAllUserByFilterResponseModel; using DataModel = CMSMicroservice.Protobuf.Protos.User.GetAllUserByFilterResponseModel;
namespace BackOffice.Pages.User; namespace BackOffice.Pages.User;
@@ -84,51 +83,63 @@ public partial class UserMainPage
{ {
try try
{ {
var exportRequest = new GetAllUserByFilterRequest var filter = _request.Filter?.Clone() ?? new();
var all = new List<DataModel>();
const int pageSize = 200;
var page = 1;
while (page <= 500)
{ {
Filter = _request.Filter?.Clone() ?? new(), var result = await UserContract.GetAllUserByFilterAsync(new GetAllUserByFilterRequest
PaginationState = new() { PageNumber = 1, PageSize = 1000 } {
}; Filter = filter,
PaginationState = new() { PageNumber = page, PageSize = pageSize }
});
var result = await UserContract.GetAllUserByFilterAsync(exportRequest); var batch = result?.Models?.ToList() ?? new();
if (batch.Count == 0)
break;
if (result?.Models == null || !result.Models.Any()) all.AddRange(batch);
var hasNext = result?.MetaData?.HasNext == true;
if (!hasNext || batch.Count < pageSize)
break;
page++;
}
if (all.Count == 0)
{ {
Snackbar.Add("داده‌ای برای خروجی وجود ندارد.", Severity.Info); Snackbar.Add("داده‌ای برای خروجی وجود ندارد.", Severity.Info);
return; return;
} }
var sb = new StringBuilder(); var headers = new[]
sb.AppendLine("شناسه,موبایل,نام,نام خانوادگی,کدملی"); {
"شناسه", "موبایل", "نام", "نام خانوادگی", "کدملی",
foreach (var u in result.Models) "آدرس پیش‌فرض", "کدپستی پیش‌فرض"
};
var rows = all.Select(u => new object?[]
{ {
sb.AppendLine(string.Join(",",
u.Id, u.Id,
EscapeCsv(u.Mobile), u.Mobile,
EscapeCsv(u.FirstName), u.FirstName,
EscapeCsv(u.LastName), u.LastName,
EscapeCsv(u.NationalCode))); u.NationalCode,
} u.DefaultAddress,
u.DefaultPostalCode
});
var bytes = Encoding.UTF8.GetPreamble().Concat(Encoding.UTF8.GetBytes(sb.ToString())).ToArray(); var filename = $"users-{DateTime.Now:yyyyMMddHHmmss}.xls";
var base64 = Convert.ToBase64String(bytes); await JsRuntime.InvokeVoidAsync("jsSaveAsFile", filename,
var filename = $"users-{DateTime.Now:yyyyMMddHHmmss}.csv"; CsvExportHelper.ToExcelXmlBase64("کاربران", headers, rows));
Snackbar.Add($"خروجی Excel آماده شد ({all.Count} کاربر).", Severity.Success);
await JsRuntime.InvokeVoidAsync("jsSaveAsFile", filename, base64);
Snackbar.Add("خروجی Excel (CSV) آماده شد.", Severity.Success);
} }
catch (Exception ex) catch (Exception ex)
{ {
Snackbar.Add($"خطا در خروجی Excel: {ex.Message}", Severity.Error); Snackbar.Add($"خطا در خروجی Excel: {ex.Message}", Severity.Error);
} }
} }
private static string EscapeCsv(string value)
{
if (string.IsNullOrEmpty(value)) return "";
if (value.Contains(',') || value.Contains('"') || value.Contains('\n'))
return $"\"{value.Replace("\"", "\"\"")}\"";
return value;
}
} }
+5
View File
@@ -185,6 +185,11 @@
Icon="@Icons.Material.Filled.People"> Icon="@Icons.Material.Filled.People">
کاربران کاربران
</MudNavLink> </MudNavLink>
<MudNavLink Match="NavLinkMatch.Prefix"
Href="@(RouteConstance.InvitationsReport)"
Icon="@Icons.Material.Filled.GroupAdd">
گزارش دعوت‌ها
</MudNavLink>
} }
@if (CanManageRoles) @if (CanManageRoles)
@@ -1,5 +1,5 @@
{ {
"GwUrl": "https://cms.kbs1.ir", "GwUrl": "https://cms.kbs2.ir",
"Authentication": { "Authentication": {
"Authority": "https://ids.afrino.co/", "Authority": "https://ids.afrino.co/",
"ClientId": "client_backoffice_spa" "ClientId": "client_backoffice_spa"