feat: Refactor sale invoice store to use new response model and improve state management

fix: Update single component to correctly bind invoice data

feat: Enhance partner info model with detailed license status

refactor: Simplify account list component by removing unnecessary details

fix: Correctly reference username in consumer account form

feat: Add POS related fields to consumer account list

chore: Update models to include charge account details for partners

feat: Implement charge account dialog for partner consumers

feat: Create API routes for accounts charge functionality

feat: Add charge account service for handling requests

feat: Introduce license info template component for dashboard

refactor: Update dashboard view to display license information

fix: Improve layout component to handle POS information more effectively

chore: Clean up unused imports and components in various files

feat: Add loading state handling in landing views

feat: Implement charge account form dialog for partner consumers
This commit is contained in:
2026-04-25 15:19:19 +03:30
parent a816c05777
commit 095ae31249
53 changed files with 554 additions and 196 deletions
@@ -0,0 +1,22 @@
<p-card class="border border-surface-border bg-surface-card rounded-2xl p-4 text-text-color">
<div class="text-center w-full flex items-center justify-center gap-1">
<span class="text-xl font-semibold">وضعیت {{ title }}</span>
</div>
<hr class="mb-6!" />
<div class="grid grid-cols-3 gap-2">
<div class="flex flex-col gap-1 items-center justify-center">
<span class="text-sm text-muted-color">فروخته شده</span>
<span class="text-lg font-semibold">{{ activated }}</span>
</div>
<div class="flex flex-col gap-1 items-center justify-center">
<span class="text-sm text-muted-color">منقضی شده</span>
<span class="text-lg font-semibold">{{ expired }}</span>
</div>
<div class="flex flex-col gap-1 items-center justify-center">
<span class="text-sm text-muted-color">قابل فروش</span>
<span class="text-lg font-semibold">
{{ remained }}
</span>
</div>
</div>
</p-card>
@@ -0,0 +1,16 @@
import { Component, Input } from '@angular/core';
import { Card } from 'primeng/card';
@Component({
selector: 'partner-license-info-template',
templateUrl: './license-info-template.component.html',
imports: [Card],
})
export class PartnerLicenseInfoTemplateComponent {
@Input({ required: true }) title!: string;
@Input({ required: true }) total!: number;
@Input({ required: true }) activated!: number;
@Input({ required: true }) expired!: number;
@Input({ required: true }) remained!: number;
constructor() {}
}
@@ -1,7 +1,6 @@
import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
import { IPartnerInfoResponse } from '@/domains/partner/models';
import { PartnerService } from '@/domains/partner/services/main.service';
import { LayoutService } from '@/layout/service/layout.service';
import { inject, Injectable } from '@angular/core';
import { catchError, finalize } from 'rxjs';
@@ -12,7 +11,6 @@ interface PartnerInfoState extends EntityState<IPartnerInfoResponse> {}
})
export class PartnerInfoStore extends EntityStore<IPartnerInfoResponse, PartnerInfoState> {
private readonly service = inject(PartnerService);
private readonly layoutService = inject(LayoutService);
constructor() {
super(defaultBaseStateData);
@@ -1 +1,37 @@
<div class="grid grid-cols-2 gap-10">به پنل مدیریتی شریک تجاری خوش آمدید.</div>
<div class="grid grid-cols-3 w-full gap-4">
<partner-license-info-template
title="لایسنس‌ها"
[total]="entity()?.licenses_status?.total_purchased || 0"
[expired]="entity()?.licenses_status?.total_expired || 0"
[activated]="entity()?.licenses_status?.total_activated || 0"
[remained]="
(entity()?.licenses_status?.total_purchased || 0) -
(entity()?.licenses_status?.total_activated || 0) -
(entity()?.licenses_status?.total_expired || 0)
"
/>
<partner-license-info-template
title="شارژ کاربران"
[total]="entity()?.account_quotas_status?.total_purchased || 0"
[expired]="entity()?.account_quotas_status?.total_expired || 0"
[activated]="entity()?.account_quotas_status?.total_activated || 0"
[remained]="
(entity()?.account_quotas_status?.total_purchased || 0) -
(entity()?.account_quotas_status?.total_activated || 0) -
(entity()?.account_quotas_status?.total_expired || 0)
"
/>
<partner-license-info-template
title="تمدید لایسنس‌ها"
[total]="entity()?.license_renews_status?.total_purchased || 0"
[expired]="entity()?.license_renews_status?.total_expired || 0"
[activated]="entity()?.license_renews_status?.total_activated || 0"
[remained]="
(entity()?.license_renews_status?.total_purchased || 0) -
(entity()?.license_renews_status?.total_activated || 0) -
(entity()?.license_renews_status?.total_expired || 0)
"
/>
</div>
@@ -1,9 +1,11 @@
import { Component, computed, inject } from '@angular/core';
import { PartnerLicenseInfoTemplateComponent } from '../components/licenseInfo/license-info-template.component';
import { PartnerInfoStore } from '../store/main.store';
@Component({
selector: 'partner-dashboard',
templateUrl: './index.component.html',
imports: [PartnerLicenseInfoTemplateComponent],
})
export class DashboardComponent {
private readonly store = inject(PartnerInfoStore);