From 095ae31249fc0b7c90052fefc76a63dd563df299 Mon Sep 17 00:00:00 2001 From: ahasani194 Date: Sat, 25 Apr 2026 15:19:19 +0330 Subject: [PATCH] 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 --- .../shared-saleInvoice.component.html | 157 +++++++++++------- .../invoices/shared-saleInvoice.component.ts | 23 ++- .../consumer/constants/menuItems.const.ts | 14 +- .../consumer/layouts/layout.component.ts | 3 +- src/app/domains/consumer/models/index.ts | 1 + .../domains/consumer/models/saleInvoice.io.ts | 70 ++++++++ .../components/list.component.ts | 2 +- .../components/saleInvoices/list.component.ts | 2 +- .../customers/models/saleInvoices.io.d.ts | 16 +- .../views/saleInvoices/single.component.html | 2 +- .../latest-Invoices.component.ts | 15 +- .../dashboard/views/index.component.html | 4 +- .../saleInvoices/components/list.component.ts | 8 +- .../saleInvoices/constants/routes/index.ts | 8 +- .../modules/saleInvoices/models/io.d.ts | 8 +- .../saleInvoices/services/main.service.ts | 5 +- .../modules/saleInvoices/store/main.store.ts | 20 +-- .../saleInvoices/views/single.component.html | 2 +- src/app/domains/partner/models/io.d.ts | 16 +- .../accounts/views/list.component.html | 2 - .../components/accounts/form.component.ts | 4 +- .../components/accounts/list.component.ts | 20 ++- .../charge-account-form-dialog.component.html | 13 ++ .../charge-account-form-dialog.component.ts | 31 ++++ .../constants/apiRoutes/accountsCharge.ts | 6 + .../modules/consumers/models/accounts_io.d.ts | 20 ++- .../consumers/models/chargeAccount_io.d.ts | 15 ++ .../partner/modules/consumers/models/index.ts | 1 + .../services/chargeAccount.service.ts | 29 ++++ .../businessActivities/single.component.html | 10 ++ .../businessActivities/single.component.ts | 9 + .../consumers/views/single.component.ts | 6 - .../license-info-template.component.html | 22 +++ .../license-info-template.component.ts | 16 ++ .../modules/dashboard/store/main.store.ts | 2 - .../dashboard/views/index.component.html | 38 ++++- .../dashboard/views/index.component.ts | 2 + .../domains/pos/layouts/layout.component.html | 10 +- .../domains/pos/layouts/layout.component.ts | 23 +-- .../payloads/gold/form.component.ts | 1 + .../modules/landing/views/root.component.html | 11 +- .../modules/landing/views/root.component.ts | 15 +- src/app/domains/pos/store/pos.store.ts | 2 +- .../charge-account-form-dialog.component.ts | 10 +- .../chargeAccount/list.component.ts | 4 +- .../components/licenses/list.component.ts | 3 +- .../partners/models/chargeAccount_io.d.ts | 6 +- .../services/chargeAccount.service.ts | 19 ++- .../partners/views/single.component.html | 4 +- .../partners/views/single.component.ts | 4 +- .../components/card-data.component.html | 5 +- .../shared/components/card-data.component.ts | 10 +- .../pageDataList/page-data-list.component.ts | 1 - 53 files changed, 554 insertions(+), 196 deletions(-) create mode 100644 src/app/domains/consumer/models/saleInvoice.io.ts create mode 100644 src/app/domains/partner/modules/consumers/components/chargeAccount/charge-account-form-dialog.component.html create mode 100644 src/app/domains/partner/modules/consumers/components/chargeAccount/charge-account-form-dialog.component.ts create mode 100644 src/app/domains/partner/modules/consumers/constants/apiRoutes/accountsCharge.ts create mode 100644 src/app/domains/partner/modules/consumers/models/chargeAccount_io.d.ts create mode 100644 src/app/domains/partner/modules/consumers/services/chargeAccount.service.ts create mode 100644 src/app/domains/partner/modules/dashboard/components/licenseInfo/license-info-template.component.html create mode 100644 src/app/domains/partner/modules/dashboard/components/licenseInfo/license-info-template.component.ts diff --git a/src/app/domains/consumer/components/invoices/shared-saleInvoice.component.html b/src/app/domains/consumer/components/invoices/shared-saleInvoice.component.html index 66ff9ca..4d969e2 100644 --- a/src/app/domains/consumer/components/invoices/shared-saleInvoice.component.html +++ b/src/app/domains/consumer/components/invoices/shared-saleInvoice.component.html @@ -1,64 +1,99 @@ -
- - - - -
-
- - - - - - -
- +@if (loading) { + +} @else if (!invoice) { + +} @else { +
+ + + + +
+
+ + + + + + +
+ +
-
- اطلاعات پرداخت -
- - @for (payment of invoice()?.payments; track $index) { - + اطلاعات پرداخت +
+ + @for (payment of invoice.payments; track $index) { + + } +
+ + اطلاعات صادر کننده +
+ + + + +
+ + @if (variant !== "customer") { + اطلاعات مشتری + @if (invoice.customer) { +
+ @if (invoice.customer.type === "INDIVIDUAL") { + + + + + + + } @else { + + + + + + } +
+ } @else if (invoice.unknown_customer) { +
+ + + +
+ } @else { +

اطلاعات مشتری ثبت نشده است.

+ } }
- - اطلاعات صادر کننده -
- - - - -
- - @if (variant !== "customer") { - اطلاعات مشتری -
- @if (invoice()?.customer) {} - -
- } -
- - - - -
+ + + + + aaa + @if (!item.discount_amount) { + + } @else { + + } + + + +
+} diff --git a/src/app/domains/consumer/components/invoices/shared-saleInvoice.component.ts b/src/app/domains/consumer/components/invoices/shared-saleInvoice.component.ts index 5368a24..3e43e6d 100644 --- a/src/app/domains/consumer/components/invoices/shared-saleInvoice.component.ts +++ b/src/app/domains/consumer/components/invoices/shared-saleInvoice.component.ts @@ -1,14 +1,19 @@ +import { Maybe } from '@/core'; import { AppCardComponent, KeyValueComponent } from '@/shared/components'; +import { PageLoadingComponent } from '@/shared/components/page-loading.component'; import { IColumn, PageDataListComponent, } from '@/shared/components/pageDataList/page-data-list.component'; +import { PriceMaskDirective } from '@/shared/directives'; +import { UikitEmptyStateComponent } from '@/uikit'; import { getGoodUnitTypeProperties } from '@/utils'; -import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output, TemplateRef, ViewChild } from '@angular/core'; import { Badge } from 'primeng/badge'; import { ButtonDirective } from 'primeng/button'; import { Divider } from 'primeng/divider'; import { TableModule } from 'primeng/table'; +import { ISaleInvoiceFullResponse } from '../../models'; export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos'; @@ -23,15 +28,20 @@ export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos'; ButtonDirective, PageDataListComponent, TableModule, + PageLoadingComponent, + UikitEmptyStateComponent, + PriceMaskDirective, ], }) export class ConsumerSaleInvoiceSharedComponent { @Input({ required: true }) loading!: boolean; - @Input({ required: true }) invoice!: any; + @Input() invoice?: Maybe; @Input() variant: TConsumerSaleInvoice = 'full'; @Output() onRefresh = new EventEmitter(); + @ViewChild('totalAmount', { static: false }) totalAmount!: TemplateRef; + printInvoice = () => { window.print(); }; @@ -66,6 +76,7 @@ export class ConsumerSaleInvoiceSharedComponent { field: 'total_amount', header: 'قیمت نهایی', type: 'price', + // customDataModel: this.totalAmount, }, ]; @@ -76,13 +87,13 @@ export class ConsumerSaleInvoiceSharedComponent { type: 'price', }, { - field: 'profit', - header: 'سود', + field: 'wages', + header: 'اجرت', type: 'price', }, { - field: 'wages', - header: 'اجرت', + field: 'profit', + header: 'سود', type: 'price', }, ]; diff --git a/src/app/domains/consumer/constants/menuItems.const.ts b/src/app/domains/consumer/constants/menuItems.const.ts index 2269090..ad36fe4 100644 --- a/src/app/domains/consumer/constants/menuItems.const.ts +++ b/src/app/domains/consumer/constants/menuItems.const.ts @@ -8,9 +8,9 @@ export const CONSUMER_MENU_ITEMS = [ routerLink: ['/consumer'], }, { - label: 'حساب‌های کاربری', + label: 'فعالیت‌های اقتصادی', icon: 'pi pi-fw pi-home', - routerLink: ['/consumer/accounts'], + routerLink: ['/consumer/business_activities'], }, { label: 'پایانه‌های فروش', @@ -18,15 +18,21 @@ export const CONSUMER_MENU_ITEMS = [ routerLink: ['/consumer/poses'], }, { - label: 'فعالیت‌های اقتصادی', + label: 'لیست فاکتورها', icon: 'pi pi-fw pi-home', - routerLink: ['/consumer/business_activities'], + routerLink: ['/consumer/sale_invoices'], }, { label: 'مشتریان', icon: 'pi pi-fw pi-home', routerLink: ['/consumer/customers'], }, + + { + label: 'حساب‌های کاربری', + icon: 'pi pi-fw pi-home', + routerLink: ['/consumer/accounts'], + }, ], }, ] as MenuItem[]; diff --git a/src/app/domains/consumer/layouts/layout.component.ts b/src/app/domains/consumer/layouts/layout.component.ts index 795f970..ad4fd45 100644 --- a/src/app/domains/consumer/layouts/layout.component.ts +++ b/src/app/domains/consumer/layouts/layout.component.ts @@ -1,7 +1,6 @@ import { LayoutService } from '@/layout/service/layout.service'; import { Component, inject, signal, TemplateRef, ViewChild } from '@angular/core'; import { RouterOutlet } from '@angular/router'; -import { Button, ButtonIcon } from 'primeng/button'; import { ConsumerLicenseInfoDialogComponent } from '../components/license-info-dialog.component'; import { CONSUMER_MENU_ITEMS } from '../constants'; import { ConsumerStore } from '../store/main.store'; @@ -9,7 +8,7 @@ import { ConsumerStore } from '../store/main.store'; @Component({ selector: 'consumer-layout', templateUrl: './layout.component.html', - imports: [RouterOutlet, Button, ButtonIcon, ConsumerLicenseInfoDialogComponent], + imports: [RouterOutlet, ConsumerLicenseInfoDialogComponent], }) export class LayoutComponent { @ViewChild('topBarMoreAction') topBarMoreAction!: TemplateRef; diff --git a/src/app/domains/consumer/models/index.ts b/src/app/domains/consumer/models/index.ts index 61a518a..5a80221 100644 --- a/src/app/domains/consumer/models/index.ts +++ b/src/app/domains/consumer/models/index.ts @@ -1 +1,2 @@ export * from './io'; +export * from './saleInvoice.io'; diff --git a/src/app/domains/consumer/models/saleInvoice.io.ts b/src/app/domains/consumer/models/saleInvoice.io.ts new file mode 100644 index 0000000..45e3d97 --- /dev/null +++ b/src/app/domains/consumer/models/saleInvoice.io.ts @@ -0,0 +1,70 @@ +import ISummary from '@/core/models/summary'; + +export interface ISaleInvoiceFullRawResponse { + id: string; + code: string; + total_amount: string; + invoice_date: string; + consumer_account: ConsumerAccount; + pos: Pos; + payments: Payment[]; + items: Item[]; + created_at: string; + notes?: string; + customer?: Customer; + unknown_customer?: UnknownCustomer; +} + +export interface ISaleInvoiceFullResponse extends ISaleInvoiceFullRawResponse {} + +interface Item { + id: string; + good: ISummary; +} + +interface Payment { + amount: string; + payment_method: string; +} + +interface Customer { + id: string; + type: string; + customer_legal?: CustomerLegal; + customer_individual?: CustomerIndividual; +} + +interface CustomerIndividual { + first_name: string; + last_name: string; + national_id: string; + postal_code: string; + economic_code: string; +} + +interface CustomerLegal { + company_name: string; + registration_number: string; + postal_code: string; + economic_code: string; +} + +interface Pos extends ISummary { + complex: Complex; +} + +interface Complex extends ISummary { + business_activity: ISummary; +} + +interface ConsumerAccount { + role: string; + account: { + username: string; + }; +} + +interface UnknownCustomer { + name?: string; + national_code?: string; +} diff --git a/src/app/domains/consumer/modules/businessActivities/components/list.component.ts b/src/app/domains/consumer/modules/businessActivities/components/list.component.ts index 6bf7cd7..67e99ff 100644 --- a/src/app/domains/consumer/modules/businessActivities/components/list.component.ts +++ b/src/app/domains/consumer/modules/businessActivities/components/list.component.ts @@ -19,9 +19,9 @@ import { ConsumerBusinessActivityFormComponent } from './form.component'; export class ConsumerBusinessActivityListComponent extends AbstractList { @Input() fullHeight?: boolean; @Input() header: IColumn[] = [ - { field: 'id', header: 'شناسه', type: 'id' }, { field: 'name', header: 'عنوان' }, { field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } }, + { field: 'economic_code', header: 'کد اقتصادی' }, { field: 'license_info', header: 'محدودیت کاربر', diff --git a/src/app/domains/consumer/modules/customers/components/saleInvoices/list.component.ts b/src/app/domains/consumer/modules/customers/components/saleInvoices/list.component.ts index 5fce05f..c3c80ec 100644 --- a/src/app/domains/consumer/modules/customers/components/saleInvoices/list.component.ts +++ b/src/app/domains/consumer/modules/customers/components/saleInvoices/list.component.ts @@ -27,7 +27,7 @@ export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList + diff --git a/src/app/domains/consumer/modules/dashboard/components/statistics/latestInvoices/latest-Invoices.component.ts b/src/app/domains/consumer/modules/dashboard/components/statistics/latestInvoices/latest-Invoices.component.ts index 0855231..2db6912 100644 --- a/src/app/domains/consumer/modules/dashboard/components/statistics/latestInvoices/latest-Invoices.component.ts +++ b/src/app/domains/consumer/modules/dashboard/components/statistics/latestInvoices/latest-Invoices.component.ts @@ -24,7 +24,20 @@ export class ConsumerStatisticsLatestInvoicesComponent extends AbstractList -
+
+
diff --git a/src/app/domains/consumer/modules/saleInvoices/components/list.component.ts b/src/app/domains/consumer/modules/saleInvoices/components/list.component.ts index f0e470e..4bbc099 100644 --- a/src/app/domains/consumer/modules/saleInvoices/components/list.component.ts +++ b/src/app/domains/consumer/modules/saleInvoices/components/list.component.ts @@ -26,16 +26,16 @@ export class ConsumerSaleInvoiceListComponent extends AbstractList = { saleInvoices: { - path: 'saleInvoices', + path: 'sale_invoices', loadComponent: () => import('../../views/list.component').then((m) => m.ConsumerSaleInvoicesComponent), meta: { title: 'فاکتورهای صادر شده', - pagePath: () => `/consumer/saleInvoices`, + pagePath: () => `/consumer/sale_invoices`, }, }, saleInvoice: { - path: 'saleInvoices/:invoiceId', + path: 'sale_invoices/:invoiceId', loadComponent: () => import('../../views/single.component').then((m) => m.ConsumerSaleInvoiceComponent), meta: { title: 'فاکتور صادر شده', - pagePath: (saleInvoiceId: string) => `/consumer/saleInvoices/${saleInvoiceId}`, + pagePath: (saleInvoiceId: string) => `/consumer/sale_invoices/${saleInvoiceId}`, }, }, }; diff --git a/src/app/domains/consumer/modules/saleInvoices/models/io.d.ts b/src/app/domains/consumer/modules/saleInvoices/models/io.d.ts index 2221860..60125e5 100644 --- a/src/app/domains/consumer/modules/saleInvoices/models/io.d.ts +++ b/src/app/domains/consumer/modules/saleInvoices/models/io.d.ts @@ -7,7 +7,7 @@ export interface IConsumerSaleInvoicesRawResponse { notes?: string; total_amount: string; pos: Pos; - account: ConsumerAccount; + consumer_account: ConsumerAccount; created_at: string; items_count: number; payments: Payments[]; @@ -16,7 +16,6 @@ export interface IConsumerSaleInvoicesResponse extends IConsumerSaleInvoicesRawR interface ConsumerAccount { role: string; - user: User; account: Account; } @@ -24,11 +23,6 @@ interface Account { username: string; } -interface User { - first_name: string; - last_name: string; -} - interface Pos extends ISummary { complex: Complex; } diff --git a/src/app/domains/consumer/modules/saleInvoices/services/main.service.ts b/src/app/domains/consumer/modules/saleInvoices/services/main.service.ts index e335667..0d3b15c 100644 --- a/src/app/domains/consumer/modules/saleInvoices/services/main.service.ts +++ b/src/app/domains/consumer/modules/saleInvoices/services/main.service.ts @@ -1,4 +1,5 @@ import { IPaginatedResponse } from '@/core/models/service.model'; +import { ISaleInvoiceFullRawResponse, ISaleInvoiceFullResponse } from '@/domains/consumer/models'; import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; @@ -16,7 +17,7 @@ export class ConsumerSaleInvoicesService { this.apiRoutes.list(), ); } - getSingle(invoiceId: string): Observable { - return this.http.get(this.apiRoutes.single(invoiceId)); + getSingle(invoiceId: string): Observable { + return this.http.get(this.apiRoutes.single(invoiceId)); } } diff --git a/src/app/domains/consumer/modules/saleInvoices/store/main.store.ts b/src/app/domains/consumer/modules/saleInvoices/store/main.store.ts index ea42a85..0332752 100644 --- a/src/app/domains/consumer/modules/saleInvoices/store/main.store.ts +++ b/src/app/domains/consumer/modules/saleInvoices/store/main.store.ts @@ -1,12 +1,12 @@ -import { EntityState, EntityStore } from '@/core/state'; +import { defaultBaseStateData, EntityState, EntityStore } from '@/core/state'; +import { ISaleInvoiceFullResponse } from '@/domains/consumer/models'; import { computed, inject, Injectable } from '@angular/core'; import { MenuItem } from 'primeng/api'; import { catchError, finalize } from 'rxjs'; import { consumerSaleInvoicesNamedRoutes } from '../constants'; -import { IConsumerSaleInvoicesResponse } from '../models'; import { ConsumerSaleInvoicesService } from '../services/main.service'; -interface ConsumerSaleInvoiceState extends EntityState { +interface ConsumerSaleInvoiceState extends EntityState { breadcrumbItems: MenuItem[]; } @@ -14,17 +14,13 @@ interface ConsumerSaleInvoiceState extends EntityState { private readonly service = inject(ConsumerSaleInvoicesService); constructor() { super({ - loading: false, - error: null, - entity: null, - initialized: false, - isRefreshing: false, + ...defaultBaseStateData, breadcrumbItems: [], }); } @@ -67,11 +63,7 @@ export class ConsumerSaleInvoiceStore extends EntityStore< override reset(): void { this.setState({ - loading: false, - error: null, - entity: null, - initialized: false, - isRefreshing: false, + ...defaultBaseStateData, breadcrumbItems: [], }); } diff --git a/src/app/domains/consumer/modules/saleInvoices/views/single.component.html b/src/app/domains/consumer/modules/saleInvoices/views/single.component.html index 1a9ea8a..66c3cb3 100644 --- a/src/app/domains/consumer/modules/saleInvoices/views/single.component.html +++ b/src/app/domains/consumer/modules/saleInvoices/views/single.component.html @@ -1 +1 @@ - + diff --git a/src/app/domains/partner/models/io.d.ts b/src/app/domains/partner/models/io.d.ts index 79fdc14..9ad27e6 100644 --- a/src/app/domains/partner/models/io.d.ts +++ b/src/app/domains/partner/models/io.d.ts @@ -10,5 +10,19 @@ export interface IPartnerRawResponse { } export interface IPartnerResponse extends IPartnerRawResponse {} -export interface IPartnerInfoRawResponse extends ISummary {} +export interface IPartnerInfoRawResponse { + licenses_status: LicensesStatus; + license_renews_status: LicensesStatus; + account_quotas_status: LicensesStatus; + id: string; + name: string; + code: string; + created_at: string; +} export interface IPartnerInfoResponse extends IPartnerInfoRawResponse {} + +interface LicensesStatus { + total_purchased: number; + total_activated: number; + total_expired: number; +} diff --git a/src/app/domains/partner/modules/accounts/views/list.component.html b/src/app/domains/partner/modules/accounts/views/list.component.html index ed61b67..704076d 100644 --- a/src/app/domains/partner/modules/accounts/views/list.component.html +++ b/src/app/domains/partner/modules/accounts/views/list.component.html @@ -3,9 +3,7 @@ [columns]="columns" emptyPlaceholderTitle="حساب‌ کاربری‌ای یافت نشد" [items]="items()" - [showDetails]="true" [loading]="loading()" - (onDetails)="toSinglePage($event)" (onRefresh)="refresh()" /> diff --git a/src/app/domains/partner/modules/consumers/components/accounts/form.component.ts b/src/app/domains/partner/modules/consumers/components/accounts/form.component.ts index 2c4a26f..86e659c 100644 --- a/src/app/domains/partner/modules/consumers/components/accounts/form.component.ts +++ b/src/app/domains/partner/modules/consumers/components/accounts/form.component.ts @@ -38,7 +38,7 @@ export class ConsumerAccountFormComponent extends AbstractFormDialog< if (this.editMode) { return this.fb.group( { - username: [this.initialValues?.username || '', [Validators.required]], + username: [this.initialValues?.account.username || '', [Validators.required]], password: ['', [password()]], confirmPassword: [''], }, @@ -49,7 +49,7 @@ export class ConsumerAccountFormComponent extends AbstractFormDialog< } return this.fb.group( { - username: [this.initialValues?.username || '', [Validators.required]], + username: [this.initialValues?.account.username || '', [Validators.required]], role: ['', [Validators.required]], password: ['', [Validators.required, password()]], confirmPassword: ['', [Validators.required]], diff --git a/src/app/domains/partner/modules/consumers/components/accounts/list.component.ts b/src/app/domains/partner/modules/consumers/components/accounts/list.component.ts index f7e7c7c..3bd5e27 100644 --- a/src/app/domains/partner/modules/consumers/components/accounts/list.component.ts +++ b/src/app/domains/partner/modules/consumers/components/accounts/list.component.ts @@ -26,17 +26,27 @@ export class ConsumerAccountListComponent extends AbstractList +
+ + + + diff --git a/src/app/domains/partner/modules/consumers/components/chargeAccount/charge-account-form-dialog.component.ts b/src/app/domains/partner/modules/consumers/components/chargeAccount/charge-account-form-dialog.component.ts new file mode 100644 index 0000000..6ec8c89 --- /dev/null +++ b/src/app/domains/partner/modules/consumers/components/chargeAccount/charge-account-form-dialog.component.ts @@ -0,0 +1,31 @@ +import { AbstractFormDialog } from '@/shared/abstractClasses'; +import { InputComponent } from '@/shared/components'; +import { FormFooterActionsComponent } from '@/shared/components/formFooterActions/form-footer-actions.component'; +import { Component, inject, Input } from '@angular/core'; +import { ReactiveFormsModule, Validators } from '@angular/forms'; +import { Dialog } from 'primeng/dialog'; +import { IPartnerChargeAccountRequest } from '../../models'; +import { PartnerChargeAccountService } from '../../services/chargeAccount.service'; + +@Component({ + selector: 'partner-charge-account-form-dialog', + templateUrl: './charge-account-form-dialog.component.html', + imports: [Dialog, ReactiveFormsModule, InputComponent, FormFooterActionsComponent], +}) +export class PartnerChargeAccountFormDialogComponent extends AbstractFormDialog< + IPartnerChargeAccountRequest, + any +> { + @Input({ required: true }) consumerId!: string; + @Input({ required: true }) businessId!: string; + + private readonly service = inject(PartnerChargeAccountService); + + form = this.fb.group({ + quantity: [0, [Validators.required, Validators.min(1)]], + }); + + submitForm(payload: IPartnerChargeAccountRequest) { + return this.service.charge(this.consumerId, this.businessId, payload); + } +} diff --git a/src/app/domains/partner/modules/consumers/constants/apiRoutes/accountsCharge.ts b/src/app/domains/partner/modules/consumers/constants/apiRoutes/accountsCharge.ts new file mode 100644 index 0000000..fc6b414 --- /dev/null +++ b/src/app/domains/partner/modules/consumers/constants/apiRoutes/accountsCharge.ts @@ -0,0 +1,6 @@ +const baseUrl = (consumerId: string, businessId: string) => + `/api/v1/partner/consumers/${consumerId}/business-activities/${businessId}/accounts-charge`; + +export const PARTNER_BA_ACCOUNTS_CHARGE_API_ROUTES = { + single: (consumerId: string, businessId: string) => `${baseUrl(consumerId, businessId)}`, +}; diff --git a/src/app/domains/partner/modules/consumers/models/accounts_io.d.ts b/src/app/domains/partner/modules/consumers/models/accounts_io.d.ts index f95fd73..acf3afc 100644 --- a/src/app/domains/partner/modules/consumers/models/accounts_io.d.ts +++ b/src/app/domains/partner/modules/consumers/models/accounts_io.d.ts @@ -1,8 +1,12 @@ import { TAccountType } from '@/core/constants/accountTypes.const'; +import ISummary from '@/core/models/summary'; export interface IConsumerAccountRawResponse { - username: string; id: string; + role: string; + created_at: string; + pos: Pos; + account: Account; } export interface IConsumerAccountResponse extends IConsumerAccountRawResponse {} @@ -11,3 +15,17 @@ export interface IConsumerAccountRequest { password?: string; type: TAccountType; } + +interface Account { + username: string; + status: string; +} + +interface Pos extends ISummary { + complex: Complex; +} + +interface Complex extends ISummary { + branch_code: string; + business_activity: ISummary; +} diff --git a/src/app/domains/partner/modules/consumers/models/chargeAccount_io.d.ts b/src/app/domains/partner/modules/consumers/models/chargeAccount_io.d.ts new file mode 100644 index 0000000..0079cbf --- /dev/null +++ b/src/app/domains/partner/modules/consumers/models/chargeAccount_io.d.ts @@ -0,0 +1,15 @@ +export interface IPartnerChargeAccountRawResponse { + id: string; + created_at: string; + // tracking_code: string; + // activation_expires_at: string; + // charged_license_count: number; + // activated_license_count: number; + // remained_license_count: number; +} + +export interface IPartnerChargeAccountResponse extends IPartnerChargeAccountRawResponse {} + +export interface IPartnerChargeAccountRequest { + quantity: number; +} diff --git a/src/app/domains/partner/modules/consumers/models/index.ts b/src/app/domains/partner/modules/consumers/models/index.ts index 3fd584e..cc4fdb9 100644 --- a/src/app/domains/partner/modules/consumers/models/index.ts +++ b/src/app/domains/partner/modules/consumers/models/index.ts @@ -1,5 +1,6 @@ export * from './accounts_io'; export * from './businessActivities_io'; +export * from './chargeAccount_io'; export * from './complexes_io'; export * from './io'; export * from './licenses_io'; diff --git a/src/app/domains/partner/modules/consumers/services/chargeAccount.service.ts b/src/app/domains/partner/modules/consumers/services/chargeAccount.service.ts new file mode 100644 index 0000000..281815b --- /dev/null +++ b/src/app/domains/partner/modules/consumers/services/chargeAccount.service.ts @@ -0,0 +1,29 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { PARTNER_BA_ACCOUNTS_CHARGE_API_ROUTES } from '../constants/apiRoutes/accountsCharge'; +import { IPartnerChargeAccountRequest } from '../models'; + +@Injectable({ providedIn: 'root' }) +export class PartnerChargeAccountService { + constructor(private http: HttpClient) {} + + private apiRoutes = PARTNER_BA_ACCOUNTS_CHARGE_API_ROUTES; + + // getAll(consumerId: string, businessId: string): Observable> { + // return this.http.get>( + // this.apiRoutes.single(partnerId), + // ); + // } + + charge( + consumerId: string, + businessId: string, + data: IPartnerChargeAccountRequest, + ): Observable { + return this.http.post( + this.apiRoutes.single(consumerId, businessId), + data, + ); + } +} diff --git a/src/app/domains/partner/modules/consumers/views/businessActivities/single.component.html b/src/app/domains/partner/modules/consumers/views/businessActivities/single.component.html index 6603c20..b01cda9 100644 --- a/src/app/domains/partner/modules/consumers/views/businessActivities/single.component.html +++ b/src/app/domains/partner/modules/consumers/views/businessActivities/single.component.html @@ -1,5 +1,8 @@
+ + +
@@ -21,4 +24,11 @@ [initialValues]="businessActivity() || undefined" (onSubmit)="getData()" /> + +
diff --git a/src/app/domains/partner/modules/consumers/views/businessActivities/single.component.ts b/src/app/domains/partner/modules/consumers/views/businessActivities/single.component.ts index 30e8f97..7bff5a7 100644 --- a/src/app/domains/partner/modules/consumers/views/businessActivities/single.component.ts +++ b/src/app/domains/partner/modules/consumers/views/businessActivities/single.component.ts @@ -4,7 +4,9 @@ import pageParamsUtils from '@/utils/page-params.utils'; import { Component, computed, effect, inject, signal } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; +import { ButtonDirective } from 'primeng/button'; import { ConsumerBusinessActivitiesFormComponent } from '../../components/businessActivities/form.component'; +import { PartnerChargeAccountFormDialogComponent } from '../../components/chargeAccount/charge-account-form-dialog.component'; import { ConsumerComplexesComponent } from '../../components/complexes/list.component'; import { BusinessActivityStore } from '../../store/businessActivity.store'; import { ConsumerStore } from '../../store/consumer.store'; @@ -17,6 +19,8 @@ import { ConsumerStore } from '../../store/consumer.store'; KeyValueComponent, ConsumerBusinessActivitiesFormComponent, ConsumerComplexesComponent, + ButtonDirective, + PartnerChargeAccountFormDialogComponent, ], }) export class PartnerUserBusinessActivityComponent { @@ -30,6 +34,7 @@ export class PartnerUserBusinessActivityComponent { readonly consumerId = signal(this.pageParams()['consumerId']!); readonly businessId = signal(this.pageParams()['businessActivityId']!); editMode = signal(false); + visibleAccountsChargeForm = signal(false); readonly loading = computed(() => this.store.loading()); readonly businessActivity = computed(() => this.store.entity()); @@ -52,4 +57,8 @@ export class PartnerUserBusinessActivityComponent { ...this.store.breadcrumbItems(), ]); } + + showAccountsChargeDialog() { + this.visibleAccountsChargeForm.set(true); + } } diff --git a/src/app/domains/partner/modules/consumers/views/single.component.ts b/src/app/domains/partner/modules/consumers/views/single.component.ts index 0ae73e6..7800494 100644 --- a/src/app/domains/partner/modules/consumers/views/single.component.ts +++ b/src/app/domains/partner/modules/consumers/views/single.component.ts @@ -1,14 +1,11 @@ import { BreadcrumbService } from '@/core/services'; import { AppCardComponent, KeyValueComponent } from '@/shared/components'; -import { JalaliDateDirective } from '@/shared/directives'; import { getLicenseStatus } from '@/utils'; import { Component, computed, effect, inject, signal } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { Button } from 'primeng/button'; import { ConsumerAccountListComponent } from '../components/accounts/list.component'; import { ConsumerBusinessActivitiesComponent } from '../components/businessActivities/list.component'; import { ConsumerUserFormComponent } from '../components/form.component'; -import { ConsumerLicenseFormComponent } from '../components/licenses/form.component'; import { ConsumerStore } from '../store/consumer.store'; @Component({ @@ -20,9 +17,6 @@ import { ConsumerStore } from '../store/consumer.store'; ConsumerUserFormComponent, ConsumerAccountListComponent, ConsumerBusinessActivitiesComponent, - Button, - JalaliDateDirective, - ConsumerLicenseFormComponent, ], }) export class ConsumerComponent { diff --git a/src/app/domains/partner/modules/dashboard/components/licenseInfo/license-info-template.component.html b/src/app/domains/partner/modules/dashboard/components/licenseInfo/license-info-template.component.html new file mode 100644 index 0000000..ce80359 --- /dev/null +++ b/src/app/domains/partner/modules/dashboard/components/licenseInfo/license-info-template.component.html @@ -0,0 +1,22 @@ + +
+ وضعیت {{ title }} +
+
+
+
+ فروخته شده + {{ activated }} +
+
+ منقضی شده + {{ expired }} +
+
+ قابل فروش + + {{ remained }} + +
+
+
diff --git a/src/app/domains/partner/modules/dashboard/components/licenseInfo/license-info-template.component.ts b/src/app/domains/partner/modules/dashboard/components/licenseInfo/license-info-template.component.ts new file mode 100644 index 0000000..53caa50 --- /dev/null +++ b/src/app/domains/partner/modules/dashboard/components/licenseInfo/license-info-template.component.ts @@ -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() {} +} diff --git a/src/app/domains/partner/modules/dashboard/store/main.store.ts b/src/app/domains/partner/modules/dashboard/store/main.store.ts index ebbfb8e..1d47606 100644 --- a/src/app/domains/partner/modules/dashboard/store/main.store.ts +++ b/src/app/domains/partner/modules/dashboard/store/main.store.ts @@ -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 {} }) export class PartnerInfoStore extends EntityStore { private readonly service = inject(PartnerService); - private readonly layoutService = inject(LayoutService); constructor() { super(defaultBaseStateData); diff --git a/src/app/domains/partner/modules/dashboard/views/index.component.html b/src/app/domains/partner/modules/dashboard/views/index.component.html index 541972f..23cb9ff 100644 --- a/src/app/domains/partner/modules/dashboard/views/index.component.html +++ b/src/app/domains/partner/modules/dashboard/views/index.component.html @@ -1 +1,37 @@ -
به پنل مدیریتی شریک تجاری خوش آمدید.
+
+ + + + + +
diff --git a/src/app/domains/partner/modules/dashboard/views/index.component.ts b/src/app/domains/partner/modules/dashboard/views/index.component.ts index 4c4b7c8..3829591 100644 --- a/src/app/domains/partner/modules/dashboard/views/index.component.ts +++ b/src/app/domains/partner/modules/dashboard/views/index.component.ts @@ -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); diff --git a/src/app/domains/pos/layouts/layout.component.html b/src/app/domains/pos/layouts/layout.component.html index bddad05..8f7991c 100644 --- a/src/app/domains/pos/layouts/layout.component.html +++ b/src/app/domains/pos/layouts/layout.component.html @@ -4,11 +4,13 @@
-
- Logo -
@if (posInfo()) { - {{ posInfo()?.name }} - شعبه {{ posInfo()?.complex?.name }} +
+ Logo +
+ + {{ posInfo()?.name }} ({{ posInfo()?.complex!.name }} - {{ posInfo()?.businessActivity!.name }}) + }
diff --git a/src/app/domains/pos/layouts/layout.component.ts b/src/app/domains/pos/layouts/layout.component.ts index 95c011d..70b9c55 100644 --- a/src/app/domains/pos/layouts/layout.component.ts +++ b/src/app/domains/pos/layouts/layout.component.ts @@ -8,8 +8,7 @@ import { ButtonDirective } from 'primeng/button'; import { Card } from 'primeng/card'; import { Menu } from 'primeng/menu'; import images from 'src/assets/images'; -import { PosProfileStore } from '../store'; -import { PosStore } from '../store/pos.store'; +import { PosInfoStore, PosProfileStore } from '../store'; import { PosChooseCardsComponent } from './choose-pos.component'; @Component({ @@ -28,19 +27,20 @@ import { PosChooseCardsComponent } from './choose-pos.component'; export class PosLayoutComponent { constructor() {} - private readonly posInfoStore = inject(PosStore); private readonly posProfileStore = inject(PosProfileStore); + private readonly posInfoStore = inject(PosInfoStore); private readonly authService = inject(AuthService); - readonly posInfoLoading = computed(() => this.posInfoStore.loading()); - readonly posInfo = computed(() => this.posInfoStore.entity()); - readonly posInfoError = computed(() => this.posInfoStore.error()); readonly posProfileLoading = computed(() => this.posProfileStore.loading()); readonly posProfile = computed(() => this.posProfileStore.entity()); readonly posProfileError = computed(() => this.posProfileStore.error()); - readonly loading = computed(() => this.posInfoLoading() || this.posProfileLoading()); - readonly error = computed(() => this.posInfoError() || this.posProfileError()); + readonly posInfoLoading = computed(() => this.posInfoStore.loading()); + readonly posInfo = computed(() => this.posInfoStore.entity()); + readonly posInfoError = computed(() => this.posInfoStore.error()); + + readonly loading = computed(() => this.posProfileLoading()); + readonly error = computed(() => this.posProfileError()); logout = () => { this.authService.logout(); @@ -64,8 +64,11 @@ export class PosLayoutComponent { now = new Date(); getData() { - this.posProfileStore.getData().subscribe(); - this.posInfoStore.getData().subscribe(); + this.posProfileStore.getData().subscribe({ + next: () => { + this.posInfoStore.getData().subscribe(); + }, + }); } onChoosePos() { diff --git a/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.ts b/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.ts index c4d34df..acbd92e 100644 --- a/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.ts +++ b/src/app/domains/pos/modules/landing/components/payloads/gold/form.component.ts @@ -120,6 +120,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm< const baseTotalAmount = totalAmountBeforeProfit + profitAmount; const baseAmountForDiscountCalculation = this.discountType() === 1 ? profitAmount : baseTotalAmount; + const taxAmount = (profitAmount + commissionAmount + wageAmount - discountAmount) * 0.1; const totalAmount = baseTotalAmount - discountAmount + taxAmount; diff --git a/src/app/domains/pos/modules/landing/views/root.component.html b/src/app/domains/pos/modules/landing/views/root.component.html index 1bcb707..d658399 100644 --- a/src/app/domains/pos/modules/landing/views/root.component.html +++ b/src/app/domains/pos/modules/landing/views/root.component.html @@ -1,10 +1,13 @@ -
- @if (posInfo()) { +@if (loading()) { + + +} @else if (pos()) { +
- } -
+
+} diff --git a/src/app/domains/pos/modules/landing/views/root.component.ts b/src/app/domains/pos/modules/landing/views/root.component.ts index 283f7a2..93447b4 100644 --- a/src/app/domains/pos/modules/landing/views/root.component.ts +++ b/src/app/domains/pos/modules/landing/views/root.component.ts @@ -1,5 +1,6 @@ // import { CatalogRoleTagComponent } from '@/shared/catalog/roles'; -import { PosStore } from '@/domains/pos/store/pos.store'; +import { PosInfoStore } from '@/domains/pos/store/pos.store'; +import { PageLoadingComponent } from '@/shared/components/page-loading.component'; import { Component, computed, inject } from '@angular/core'; import { PosGoodsComponent } from '../components/goods.component'; import { PosOrderSectionComponent } from '../components/order/order-section.component'; @@ -9,10 +10,16 @@ import { PosOrderSectionComponent } from '../components/order/order-section.comp templateUrl: './root.component.html', host: { class: 'grow overflow-hidden' }, - imports: [PosGoodsComponent, PosOrderSectionComponent], + imports: [PosGoodsComponent, PosOrderSectionComponent, PageLoadingComponent], }) export class PosLandingComponent { - private readonly posStore = inject(PosStore); + private readonly store = inject(PosInfoStore); - readonly posInfo = computed(() => this.posStore.entity()); + readonly loading = computed(() => this.store.loading()); + readonly pos = computed(() => this.store.entity()); + readonly error = computed(() => this.store.error()); + + getData() { + this.store.getData().subscribe(); + } } diff --git a/src/app/domains/pos/store/pos.store.ts b/src/app/domains/pos/store/pos.store.ts index 84f43c2..811abea 100644 --- a/src/app/domains/pos/store/pos.store.ts +++ b/src/app/domains/pos/store/pos.store.ts @@ -14,7 +14,7 @@ interface PosState extends EntityState { @Injectable({ providedIn: 'root', }) -export class PosStore extends EntityStore { +export class PosInfoStore extends EntityStore { private readonly service = inject(PosService); constructor(private readonly cookieService: CookieService) { diff --git a/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.ts b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.ts index 0df0b11..975760b 100644 --- a/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.ts +++ b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/charge-account-form-dialog.component.ts @@ -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); } } diff --git a/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.ts b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.ts index ec47171..87349df 100644 --- a/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.ts +++ b/src/app/domains/superAdmin/modules/partners/components/chargeAccount/list.component.ts @@ -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 { +export class AdminPartnerChargeAccountListComponent extends AbstractList { @Input({ required: true }) partnerId!: string; private readonly service = inject(AdminPartnerChargeAccountService); diff --git a/src/app/domains/superAdmin/modules/partners/components/licenses/list.component.ts b/src/app/domains/superAdmin/modules/partners/components/licenses/list.component.ts index f3fcbcf..33d6ac7 100644 --- a/src/app/domains/superAdmin/modules/partners/components/licenses/list.component.ts +++ b/src/app/domains/superAdmin/modules/partners/components/licenses/list.component.ts @@ -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 { @Input({ required: true }) partnerId!: string; diff --git a/src/app/domains/superAdmin/modules/partners/models/chargeAccount_io.d.ts b/src/app/domains/superAdmin/modules/partners/models/chargeAccount_io.d.ts index 2982f90..521b72e 100644 --- a/src/app/domains/superAdmin/modules/partners/models/chargeAccount_io.d.ts +++ b/src/app/domains/superAdmin/modules/partners/models/chargeAccount_io.d.ts @@ -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; } diff --git a/src/app/domains/superAdmin/modules/partners/services/chargeAccount.service.ts b/src/app/domains/superAdmin/modules/partners/services/chargeAccount.service.ts index 6d41840..c20ce23 100644 --- a/src/app/domains/superAdmin/modules/partners/services/chargeAccount.service.ts +++ b/src/app/domains/superAdmin/modules/partners/services/chargeAccount.service.ts @@ -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> { - return this.http.get>( + getAll(partnerId: string): Observable> { + return this.http.get>( this.apiRoutes.single(partnerId), ); } charge( partnerId: string, - data: IPartnerChargeAccountRequest, - ): Observable { - return this.http.post(this.apiRoutes.single(partnerId), data); + data: IAdminPartnerChargeAccountRequest, + ): Observable { + return this.http.post( + this.apiRoutes.single(partnerId), + data, + ); } } diff --git a/src/app/domains/superAdmin/modules/partners/views/single.component.html b/src/app/domains/superAdmin/modules/partners/views/single.component.html index 2ef9b76..b0fadd2 100644 --- a/src/app/domains/superAdmin/modules/partners/views/single.component.html +++ b/src/app/domains/superAdmin/modules/partners/views/single.component.html @@ -79,8 +79,8 @@ (onSubmit)="getData()" /> - +> diff --git a/src/app/domains/superAdmin/modules/partners/views/single.component.ts b/src/app/domains/superAdmin/modules/partners/views/single.component.ts index cb1fc73..dddce19 100644 --- a/src/app/domains/superAdmin/modules/partners/views/single.component.ts +++ b/src/app/domains/superAdmin/modules/partners/views/single.component.ts @@ -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, diff --git a/src/app/shared/components/card-data.component.html b/src/app/shared/components/card-data.component.html index e586ed3..44c6b59 100644 --- a/src/app/shared/components/card-data.component.html +++ b/src/app/shared/components/card-data.component.html @@ -2,9 +2,12 @@
-
{{ cardTitle }}
+
{{ cardTitle }}
+ @if (showRefresh) { + + } @if (editable) {