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
@@ -6,11 +6,11 @@ import { nowJalali } from '@/utils';
import { Component, inject, Input } from '@angular/core';
import { ReactiveFormsModule, Validators } from '@angular/forms';
import { Dialog } from 'primeng/dialog';
import { IPartnerChargeAccountRequest } from '../../models/chargeAccount_io';
import { IAdminPartnerChargeAccountRequest } from '../../models/chargeAccount_io';
import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.service';
@Component({
selector: 'partner-charge-account-form-dialog',
selector: 'admin-partner-charge-account-form-dialog',
templateUrl: './charge-account-form-dialog.component.html',
imports: [
Dialog,
@@ -20,8 +20,8 @@ import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.s
UikitFlatpickrJalaliComponent,
],
})
export class PartnerChargeAccountFormDialogComponent extends AbstractFormDialog<
IPartnerChargeAccountRequest,
export class AdminPartnerChargeAccountFormDialogComponent extends AbstractFormDialog<
IAdminPartnerChargeAccountRequest,
any
> {
@Input({ required: true }) partnerId!: string;
@@ -35,7 +35,7 @@ export class PartnerChargeAccountFormDialogComponent extends AbstractFormDialog<
minDate = nowJalali();
submitForm(payload: IPartnerChargeAccountRequest) {
submitForm(payload: IAdminPartnerChargeAccountRequest) {
return this.service.charge(this.partnerId, payload);
}
}
@@ -1,7 +1,7 @@
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
import { Component, inject, Input } from '@angular/core';
import { IPartnerChargeAccountRawResponse } from '../../models';
import { IAdminPartnerChargeAccountRawResponse } from '../../models';
import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.service';
@Component({
@@ -9,7 +9,7 @@ import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.s
templateUrl: './list.component.html',
imports: [PageDataListComponent],
})
export class AdminPartnerChargeAccountListComponent extends AbstractList<IPartnerChargeAccountRawResponse> {
export class AdminPartnerChargeAccountListComponent extends AbstractList<IAdminPartnerChargeAccountRawResponse> {
@Input({ required: true }) partnerId!: string;
private readonly service = inject(AdminPartnerChargeAccountService);
@@ -2,14 +2,13 @@
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
import { Component, inject, Input } from '@angular/core';
import { ButtonDirective } from 'primeng/button';
import { IPartnerActivatedLicenseResponse } from '../../models';
import { AdminPartnerActivatedLicensesService } from '../../services/licenses.service';
@Component({
selector: 'admin-partner-licenses',
templateUrl: './list.component.html',
imports: [PageDataListComponent, ButtonDirective],
imports: [PageDataListComponent],
})
export class AdminPartnerLicensesComponent extends AbstractList<IPartnerActivatedLicenseResponse> {
@Input({ required: true }) partnerId!: string;
@@ -1,4 +1,4 @@
export interface IPartnerChargeAccountRawResponse {
export interface IAdminPartnerChargeAccountRawResponse {
id: string;
created_at: string;
tracking_code: string;
@@ -8,9 +8,9 @@ export interface IPartnerChargeAccountRawResponse {
remained_license_count: number;
}
export interface IPartnerChargeAccountResponse extends IPartnerChargeAccountRawResponse {}
export interface IAdminPartnerChargeAccountResponse extends IAdminPartnerChargeAccountRawResponse {}
export interface IPartnerChargeAccountRequest {
export interface IAdminPartnerChargeAccountRequest {
quantity: number;
activated_expires_at: string;
}
@@ -4,9 +4,9 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PARTNER_CHARGE_ACCOUNT_API_ROUTES } from '../constants';
import {
IPartnerChargeAccountRawResponse,
IPartnerChargeAccountRequest,
IPartnerChargeAccountResponse,
IAdminPartnerChargeAccountRawResponse,
IAdminPartnerChargeAccountRequest,
IAdminPartnerChargeAccountResponse,
} from '../models';
@Injectable({ providedIn: 'root' })
@@ -15,16 +15,19 @@ export class AdminPartnerChargeAccountService {
private apiRoutes = PARTNER_CHARGE_ACCOUNT_API_ROUTES;
getAll(partnerId: string): Observable<IPaginatedResponse<IPartnerChargeAccountRawResponse>> {
return this.http.get<IPaginatedResponse<IPartnerChargeAccountResponse>>(
getAll(partnerId: string): Observable<IPaginatedResponse<IAdminPartnerChargeAccountResponse>> {
return this.http.get<IPaginatedResponse<IAdminPartnerChargeAccountRawResponse>>(
this.apiRoutes.single(partnerId),
);
}
charge(
partnerId: string,
data: IPartnerChargeAccountRequest,
): Observable<IPartnerChargeAccountRawResponse> {
return this.http.post<IPartnerChargeAccountResponse>(this.apiRoutes.single(partnerId), data);
data: IAdminPartnerChargeAccountRequest,
): Observable<IAdminPartnerChargeAccountResponse> {
return this.http.post<IAdminPartnerChargeAccountRawResponse>(
this.apiRoutes.single(partnerId),
data,
);
}
}
@@ -79,8 +79,8 @@
(onSubmit)="getData()"
/>
<partner-charge-account-form-dialog
<admin-partner-charge-account-form-dialog
[(visible)]="visibleChargeAccountFormDialog"
[partnerId]="partnerId()"
(onSubmit)="getData()"
></partner-charge-account-form-dialog>
></admin-partner-charge-account-form-dialog>
@@ -6,7 +6,7 @@ import { Button } from 'primeng/button';
import { Divider } from 'primeng/divider';
import { ConsumerAccountListComponent } from '../components/accounts/list.component';
import { PartnerChargeLicenseFormDialogComponent } from '../components/charge-license-form-dialog.component';
import { PartnerChargeAccountFormDialogComponent } from '../components/chargeAccount/charge-account-form-dialog.component';
import { AdminPartnerChargeAccountFormDialogComponent } from '../components/chargeAccount/charge-account-form-dialog.component';
import { AdminPartnerChargeAccountListComponent } from '../components/chargeAccount/list.component';
import { AdminPartnerChargeLicenseTransactionListComponent } from '../components/chargeLicenseTransactions/list.component';
import { GuildFormComponent } from '../components/form.component';
@@ -24,7 +24,7 @@ import { PartnerStore } from '../store/partner.store';
ConsumerAccountListComponent,
Button,
AdminPartnerChargeAccountListComponent,
PartnerChargeAccountFormDialogComponent,
AdminPartnerChargeAccountFormDialogComponent,
PartnerChargeLicenseFormDialogComponent,
AdminPartnerLicensesComponent,
AdminPartnerChargeLicenseTransactionListComponent,