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:
@@ -1,28 +1,31 @@
|
|||||||
<div class="flex flex-col gap-6">
|
@if (loading) {
|
||||||
|
<shared-page-loading />
|
||||||
|
} @else if (!invoice) {
|
||||||
|
<uikit-empty-state> </uikit-empty-state>
|
||||||
|
} @else {
|
||||||
|
<div class="flex flex-col gap-6">
|
||||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false">
|
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false">
|
||||||
<ng-template #moreActions>
|
<ng-template #moreActions>
|
||||||
<button pButton type="button" label="چاپ" icon="pi pi-print" outlined (click)="printInvoice()"></button>
|
<button pButton type="button" label="چاپ" icon="pi pi-print" outlined (click)="printInvoice()"></button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="grid grid-cols-3 gap-4 items-center">
|
<div class="grid grid-cols-3 gap-4 items-center">
|
||||||
<app-key-value label="کد رهگیری" [value]="invoice()?.code" />
|
<app-key-value label="کد رهگیری" [value]="invoice.code" />
|
||||||
<app-key-value label="تاریخ فاکتور" [value]="invoice()?.invoice_date" type="dateTime" />
|
<app-key-value label="تاریخ فاکتور" [value]="invoice.invoice_date" type="dateTime" />
|
||||||
<app-key-value label="تاریخ ایجاد فاکتور" [value]="invoice()?.created_at" type="dateTime" />
|
<app-key-value label="تاریخ ایجاد فاکتور" [value]="invoice.created_at" type="dateTime" />
|
||||||
<app-key-value label="وضعیت صدور به سامانهی مودیان">
|
<app-key-value label="وضعیت صدور به سامانهی مودیان">
|
||||||
<p-badge value="ارسال نشده" severity="danger" />
|
<p-badge value="ارسال نشده" severity="danger" />
|
||||||
</app-key-value>
|
</app-key-value>
|
||||||
<div class="col-span-3">
|
<div class="col-span-3">
|
||||||
<app-key-value label="توضیحات" [value]="invoice()?.notes" />
|
<app-key-value label="توضیحات" [value]="invoice.notes" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
||||||
<div class="grid grid-cols-3 gap-4 items-center">
|
<div class="grid grid-cols-3 gap-4 items-center">
|
||||||
<app-key-value label="مجموع قابل پرداخت" [value]="invoice()?.total_amount" type="price" />
|
<app-key-value label="مجموع قابل پرداخت" [value]="invoice.total_amount" type="price" />
|
||||||
@for (payment of invoice()?.payments; track $index) {
|
@for (payment of invoice.payments; track $index) {
|
||||||
<app-key-value
|
<app-key-value
|
||||||
[label]="
|
[label]="`${payment.payment_method === 'SET_OF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پایانه' : 'نقدی'}`"
|
||||||
`${payment.payment_method === 'SET_OF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پایانه' : 'نقدی'}`
|
|
||||||
"
|
|
||||||
[value]="payment.amount"
|
[value]="payment.amount"
|
||||||
type="price"
|
type="price"
|
||||||
/>
|
/>
|
||||||
@@ -31,21 +34,40 @@
|
|||||||
|
|
||||||
<p-divider align="center"> اطلاعات صادر کننده </p-divider>
|
<p-divider align="center"> اطلاعات صادر کننده </p-divider>
|
||||||
<div class="grid grid-cols-3 gap-4 items-center">
|
<div class="grid grid-cols-3 gap-4 items-center">
|
||||||
<app-key-value label="کسب و کار" [value]="invoice()?.pos!.complex.business_activity.name" />
|
<app-key-value label="کسب و کار" [value]="invoice.pos!.complex.business_activity.name" />
|
||||||
<app-key-value label="مجموعه" [value]="invoice()?.pos!.complex.name" />
|
<app-key-value label="مجموعه" [value]="invoice.pos!.complex.name" />
|
||||||
<app-key-value label="پایانهی فروش" [value]="invoice()?.pos!.name" />
|
<app-key-value label="پایانهی فروش" [value]="invoice.pos!.name" />
|
||||||
<app-key-value label="ایجاد کننده" [value]="invoice()?.consumer_account?.account?.username" />
|
<app-key-value label="ایجاد کننده" [value]="invoice.consumer_account.account.username" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (variant !== "customer") {
|
@if (variant !== "customer") {
|
||||||
<p-divider align="center"> اطلاعات مشتری </p-divider>
|
<p-divider align="center"> اطلاعات مشتری </p-divider>
|
||||||
|
@if (invoice.customer) {
|
||||||
<div class="grid grid-cols-3 gap-4 items-center">
|
<div class="grid grid-cols-3 gap-4 items-center">
|
||||||
@if (invoice()?.customer) {}
|
@if (invoice.customer.type === "INDIVIDUAL") {
|
||||||
<!-- <app-key-value label="کسب و کار" [value]="invoice()?.pos!.complex.business_activity.name" />
|
<app-key-value label="نوع مشتری" value="حقیقی" />
|
||||||
<app-key-value label="مجموعه" [value]="invoice()?.pos!.complex.name" />
|
<app-key-value label="نام" [value]="invoice.customer.customer_individual?.first_name" />
|
||||||
<app-key-value label="پایانهی فروش" [value]="invoice()?.pos!.name" />
|
<app-key-value label="نام خانوادگی" [value]="invoice.customer.customer_individual?.last_name" />
|
||||||
<app-key-value label="ایجاد کننده" [value]="invoice()?.account?.account?.username" /> -->
|
<app-key-value label="کد اقتصادی" [value]="invoice.customer.customer_individual?.economic_code" />
|
||||||
|
<app-key-value label="کد ملی" [value]="invoice.customer.customer_individual?.national_id" />
|
||||||
|
<app-key-value label="کد پستی" [value]="invoice.customer.customer_individual?.postal_code" />
|
||||||
|
} @else {
|
||||||
|
<app-key-value label="نوع مشتری" value="حقوقی" />
|
||||||
|
<app-key-value label="نام شرکت" [value]="invoice.customer.customer_legal?.company_name" />
|
||||||
|
<app-key-value label="کد اقتصادی" [value]="invoice.customer.customer_legal?.economic_code" />
|
||||||
|
<app-key-value label="کد ثبتی" [value]="invoice.customer.customer_legal?.registration_number" />
|
||||||
|
<app-key-value label="کد پستی" [value]="invoice.customer.customer_legal?.postal_code" />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
} @else if (invoice.unknown_customer) {
|
||||||
|
<div class="grid grid-cols-3 gap-4 items-center">
|
||||||
|
<app-key-value label="نوع مشتری" value="نوع دوم" />
|
||||||
|
<app-key-value label="عنوان" [value]="invoice.unknown_customer.name" />
|
||||||
|
<app-key-value label="کد ثبتی" [value]="invoice.unknown_customer.national_code" />
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<p class="text-center text-text-color pt-3 pb-5">اطلاعات مشتری ثبت نشده است.</p>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</app-card-data>
|
</app-card-data>
|
||||||
@@ -55,10 +77,23 @@
|
|||||||
[expandColumns]="expandableColumns"
|
[expandColumns]="expandableColumns"
|
||||||
[expandable]="true"
|
[expandable]="true"
|
||||||
expandableItemKey="payload"
|
expandableItemKey="payload"
|
||||||
[items]="invoice()?.items"
|
[items]="invoice.items"
|
||||||
[loading]="loading"
|
[loading]="loading"
|
||||||
pageTitle=""
|
pageTitle=""
|
||||||
(onRefresh)="refresh()"
|
[showRefresh]="false"
|
||||||
/>
|
>
|
||||||
|
<ng-template #totalAmount let-item>
|
||||||
|
aaa
|
||||||
|
@if (!item.discount_amount) {
|
||||||
|
<span [appPriceMask]="item.total_amount"></span>
|
||||||
|
} @else {
|
||||||
|
<!-- <div class="flex flex-col items-end">
|
||||||
|
<span class="line-through text-muted-color text-xs" [appPriceMask]="item.total_amount"></span>
|
||||||
|
<span [appPriceMask]="item.total_amount - item.discount_amount"></span>
|
||||||
|
</div> -->
|
||||||
|
}
|
||||||
|
</ng-template>
|
||||||
|
</app-page-data-list>
|
||||||
</app-card-data>
|
</app-card-data>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
|
import { Maybe } from '@/core';
|
||||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||||
|
import { PageLoadingComponent } from '@/shared/components/page-loading.component';
|
||||||
import {
|
import {
|
||||||
IColumn,
|
IColumn,
|
||||||
PageDataListComponent,
|
PageDataListComponent,
|
||||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||||
|
import { PriceMaskDirective } from '@/shared/directives';
|
||||||
|
import { UikitEmptyStateComponent } from '@/uikit';
|
||||||
import { getGoodUnitTypeProperties } from '@/utils';
|
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 { Badge } from 'primeng/badge';
|
||||||
import { ButtonDirective } from 'primeng/button';
|
import { ButtonDirective } from 'primeng/button';
|
||||||
import { Divider } from 'primeng/divider';
|
import { Divider } from 'primeng/divider';
|
||||||
import { TableModule } from 'primeng/table';
|
import { TableModule } from 'primeng/table';
|
||||||
|
import { ISaleInvoiceFullResponse } from '../../models';
|
||||||
|
|
||||||
export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
||||||
|
|
||||||
@@ -23,15 +28,20 @@ export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
|||||||
ButtonDirective,
|
ButtonDirective,
|
||||||
PageDataListComponent,
|
PageDataListComponent,
|
||||||
TableModule,
|
TableModule,
|
||||||
|
PageLoadingComponent,
|
||||||
|
UikitEmptyStateComponent,
|
||||||
|
PriceMaskDirective,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ConsumerSaleInvoiceSharedComponent {
|
export class ConsumerSaleInvoiceSharedComponent {
|
||||||
@Input({ required: true }) loading!: boolean;
|
@Input({ required: true }) loading!: boolean;
|
||||||
@Input({ required: true }) invoice!: any;
|
@Input() invoice?: Maybe<ISaleInvoiceFullResponse>;
|
||||||
@Input() variant: TConsumerSaleInvoice = 'full';
|
@Input() variant: TConsumerSaleInvoice = 'full';
|
||||||
|
|
||||||
@Output() onRefresh = new EventEmitter<void>();
|
@Output() onRefresh = new EventEmitter<void>();
|
||||||
|
|
||||||
|
@ViewChild('totalAmount', { static: false }) totalAmount!: TemplateRef<any>;
|
||||||
|
|
||||||
printInvoice = () => {
|
printInvoice = () => {
|
||||||
window.print();
|
window.print();
|
||||||
};
|
};
|
||||||
@@ -66,6 +76,7 @@ export class ConsumerSaleInvoiceSharedComponent {
|
|||||||
field: 'total_amount',
|
field: 'total_amount',
|
||||||
header: 'قیمت نهایی',
|
header: 'قیمت نهایی',
|
||||||
type: 'price',
|
type: 'price',
|
||||||
|
// customDataModel: this.totalAmount,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -76,13 +87,13 @@ export class ConsumerSaleInvoiceSharedComponent {
|
|||||||
type: 'price',
|
type: 'price',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'profit',
|
field: 'wages',
|
||||||
header: 'سود',
|
header: 'اجرت',
|
||||||
type: 'price',
|
type: 'price',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'wages',
|
field: 'profit',
|
||||||
header: 'اجرت',
|
header: 'سود',
|
||||||
type: 'price',
|
type: 'price',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ export const CONSUMER_MENU_ITEMS = [
|
|||||||
routerLink: ['/consumer'],
|
routerLink: ['/consumer'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'حسابهای کاربری',
|
label: 'فعالیتهای اقتصادی',
|
||||||
icon: 'pi pi-fw pi-home',
|
icon: 'pi pi-fw pi-home',
|
||||||
routerLink: ['/consumer/accounts'],
|
routerLink: ['/consumer/business_activities'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'پایانههای فروش',
|
label: 'پایانههای فروش',
|
||||||
@@ -18,15 +18,21 @@ export const CONSUMER_MENU_ITEMS = [
|
|||||||
routerLink: ['/consumer/poses'],
|
routerLink: ['/consumer/poses'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'فعالیتهای اقتصادی',
|
label: 'لیست فاکتورها',
|
||||||
icon: 'pi pi-fw pi-home',
|
icon: 'pi pi-fw pi-home',
|
||||||
routerLink: ['/consumer/business_activities'],
|
routerLink: ['/consumer/sale_invoices'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'مشتریان',
|
label: 'مشتریان',
|
||||||
icon: 'pi pi-fw pi-home',
|
icon: 'pi pi-fw pi-home',
|
||||||
routerLink: ['/consumer/customers'],
|
routerLink: ['/consumer/customers'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: 'حسابهای کاربری',
|
||||||
|
icon: 'pi pi-fw pi-home',
|
||||||
|
routerLink: ['/consumer/accounts'],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
] as MenuItem[];
|
] as MenuItem[];
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { LayoutService } from '@/layout/service/layout.service';
|
import { LayoutService } from '@/layout/service/layout.service';
|
||||||
import { Component, inject, signal, TemplateRef, ViewChild } from '@angular/core';
|
import { Component, inject, signal, TemplateRef, ViewChild } from '@angular/core';
|
||||||
import { RouterOutlet } from '@angular/router';
|
import { RouterOutlet } from '@angular/router';
|
||||||
import { Button, ButtonIcon } from 'primeng/button';
|
|
||||||
import { ConsumerLicenseInfoDialogComponent } from '../components/license-info-dialog.component';
|
import { ConsumerLicenseInfoDialogComponent } from '../components/license-info-dialog.component';
|
||||||
import { CONSUMER_MENU_ITEMS } from '../constants';
|
import { CONSUMER_MENU_ITEMS } from '../constants';
|
||||||
import { ConsumerStore } from '../store/main.store';
|
import { ConsumerStore } from '../store/main.store';
|
||||||
@@ -9,7 +8,7 @@ import { ConsumerStore } from '../store/main.store';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'consumer-layout',
|
selector: 'consumer-layout',
|
||||||
templateUrl: './layout.component.html',
|
templateUrl: './layout.component.html',
|
||||||
imports: [RouterOutlet, Button, ButtonIcon, ConsumerLicenseInfoDialogComponent],
|
imports: [RouterOutlet, ConsumerLicenseInfoDialogComponent],
|
||||||
})
|
})
|
||||||
export class LayoutComponent {
|
export class LayoutComponent {
|
||||||
@ViewChild('topBarMoreAction') topBarMoreAction!: TemplateRef<any>;
|
@ViewChild('topBarMoreAction') topBarMoreAction!: TemplateRef<any>;
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
export * from './io';
|
export * from './io';
|
||||||
|
export * from './saleInvoice.io';
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -19,9 +19,9 @@ import { ConsumerBusinessActivityFormComponent } from './form.component';
|
|||||||
export class ConsumerBusinessActivityListComponent extends AbstractList<IBusinessActivityResponse> {
|
export class ConsumerBusinessActivityListComponent extends AbstractList<IBusinessActivityResponse> {
|
||||||
@Input() fullHeight?: boolean;
|
@Input() fullHeight?: boolean;
|
||||||
@Input() header: IColumn[] = [
|
@Input() header: IColumn[] = [
|
||||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
|
||||||
{ field: 'name', header: 'عنوان' },
|
{ field: 'name', header: 'عنوان' },
|
||||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } },
|
{ field: 'guild', header: 'صنف', type: 'nested', nestedOption: { path: 'guild.name' } },
|
||||||
|
{ field: 'economic_code', header: 'کد اقتصادی' },
|
||||||
{
|
{
|
||||||
field: 'license_info',
|
field: 'license_info',
|
||||||
header: 'محدودیت کاربر',
|
header: 'محدودیت کاربر',
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ export class ConsumerCustomerSaleInvoiceListComponent extends AbstractList<ICust
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'pos',
|
field: 'pos',
|
||||||
header: 'شعبه',
|
header: 'پایانه',
|
||||||
customDataModel(item: ICustomerSaleInvoicesResponse) {
|
customDataModel(item: ICustomerSaleInvoicesResponse) {
|
||||||
return `${item.pos.complex.business_activity.name}، شعبه ${item.pos.complex.name}، پایانهی فروش ${item.pos.name}`;
|
return `${item.pos.complex.business_activity.name}، شعبه ${item.pos.complex.name}، پایانهی فروش ${item.pos.name}`;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,21 +1,9 @@
|
|||||||
import ISummary from '@/core/models/summary';
|
import ISummary from '@/core/models/summary';
|
||||||
|
import { ISaleInvoiceFullRawResponse } from '@/domains/consumer/models';
|
||||||
import { CustomerType } from '@/shared/localEnum/constants/customerTypes';
|
import { CustomerType } from '@/shared/localEnum/constants/customerTypes';
|
||||||
import { CustomerIndividual, CustomerLegal } from './io';
|
import { CustomerIndividual, CustomerLegal } from './io';
|
||||||
|
|
||||||
export interface ICustomerSaleInvoicesRawResponse {
|
export interface ICustomerSaleInvoicesRawResponse extends ISaleInvoiceFullRawResponse {}
|
||||||
id: string;
|
|
||||||
code: string;
|
|
||||||
total_amount: string;
|
|
||||||
invoice_date: string;
|
|
||||||
consumer_account: ConsumerAccount;
|
|
||||||
pos: Pos;
|
|
||||||
items: SaleInvoiceItem[];
|
|
||||||
payments: Payment[];
|
|
||||||
unknown_customer?: UnknownCustomer;
|
|
||||||
customer?: Customer;
|
|
||||||
notes?: string;
|
|
||||||
created_at: string;
|
|
||||||
}
|
|
||||||
export interface ICustomerSaleInvoicesResponse extends ICustomerSaleInvoicesRawResponse {}
|
export interface ICustomerSaleInvoicesResponse extends ICustomerSaleInvoicesRawResponse {}
|
||||||
|
|
||||||
interface ConsumerAccount {
|
interface ConsumerAccount {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice" variant="customer" />
|
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice()" variant="customer" />
|
||||||
|
|||||||
+14
-1
@@ -24,7 +24,20 @@ export class ConsumerStatisticsLatestInvoicesComponent extends AbstractList<ISta
|
|||||||
override setColumns(): void {
|
override setColumns(): void {
|
||||||
this.columns = [
|
this.columns = [
|
||||||
{ field: 'code', header: 'کد پیگیری' },
|
{ field: 'code', header: 'کد پیگیری' },
|
||||||
{ field: 'total_amount', header: 'مجموع قیمت', type: 'price' },
|
{ field: 'total_amount', header: 'قیمت نهایی', type: 'price' },
|
||||||
|
{
|
||||||
|
field: 'pos',
|
||||||
|
header: 'پایانه',
|
||||||
|
customDataModel(item) {
|
||||||
|
return `${item.pos.name} - ${item.pos.complex.name} - ${item.pos.complex.business_activity.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'consumer_account',
|
||||||
|
header: 'ایجاد شده توسط',
|
||||||
|
type: 'nested',
|
||||||
|
nestedOption: { path: 'consumer_account.account.username' },
|
||||||
|
},
|
||||||
{ field: 'status', header: 'وضعیت صدور', customDataModel: this.status },
|
{ field: 'status', header: 'وضعیت صدور', customDataModel: this.status },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="grid grid-cols-2 gap-10">
|
<div class="flex gap-10">
|
||||||
<div class="h-[300px] flex">
|
<div class="h-75 flex w-full">
|
||||||
<consumer-statistics-latest-Invoices class="w-full" />
|
<consumer-statistics-latest-Invoices class="w-full" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,16 +26,16 @@ export class ConsumerSaleInvoiceListComponent extends AbstractList<IConsumerSale
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'pos',
|
field: 'pos',
|
||||||
header: 'شعبه',
|
header: 'پایانه',
|
||||||
customDataModel(item: IConsumerSaleInvoicesResponse) {
|
customDataModel(item: IConsumerSaleInvoicesResponse) {
|
||||||
return `${item.pos.complex.business_activity.name}، شعبه ${item.pos.complex.name}، پایانهی فروش ${item.pos.name}`;
|
return `${item.pos.name} (${item.pos.complex.name} - ${item.pos.complex.business_activity.name})`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'account',
|
field: 'consumer_account',
|
||||||
header: 'ایجاد شده توسط',
|
header: 'ایجاد شده توسط',
|
||||||
type: 'nested',
|
type: 'nested',
|
||||||
nestedOption: { path: 'account.account.username' },
|
nestedOption: { path: 'consumer_account.account.username' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'invoice_date',
|
field: 'invoice_date',
|
||||||
|
|||||||
@@ -5,21 +5,21 @@ export type TConsumerSaleInvoicesRouteNames = 'saleInvoices' | 'saleInvoice';
|
|||||||
|
|
||||||
export const consumerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerSaleInvoicesRouteNames> = {
|
export const consumerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerSaleInvoicesRouteNames> = {
|
||||||
saleInvoices: {
|
saleInvoices: {
|
||||||
path: 'saleInvoices',
|
path: 'sale_invoices',
|
||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
import('../../views/list.component').then((m) => m.ConsumerSaleInvoicesComponent),
|
import('../../views/list.component').then((m) => m.ConsumerSaleInvoicesComponent),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'فاکتورهای صادر شده',
|
title: 'فاکتورهای صادر شده',
|
||||||
pagePath: () => `/consumer/saleInvoices`,
|
pagePath: () => `/consumer/sale_invoices`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
saleInvoice: {
|
saleInvoice: {
|
||||||
path: 'saleInvoices/:invoiceId',
|
path: 'sale_invoices/:invoiceId',
|
||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
import('../../views/single.component').then((m) => m.ConsumerSaleInvoiceComponent),
|
import('../../views/single.component').then((m) => m.ConsumerSaleInvoiceComponent),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'فاکتور صادر شده',
|
title: 'فاکتور صادر شده',
|
||||||
pagePath: (saleInvoiceId: string) => `/consumer/saleInvoices/${saleInvoiceId}`,
|
pagePath: (saleInvoiceId: string) => `/consumer/sale_invoices/${saleInvoiceId}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export interface IConsumerSaleInvoicesRawResponse {
|
|||||||
notes?: string;
|
notes?: string;
|
||||||
total_amount: string;
|
total_amount: string;
|
||||||
pos: Pos;
|
pos: Pos;
|
||||||
account: ConsumerAccount;
|
consumer_account: ConsumerAccount;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
items_count: number;
|
items_count: number;
|
||||||
payments: Payments[];
|
payments: Payments[];
|
||||||
@@ -16,7 +16,6 @@ export interface IConsumerSaleInvoicesResponse extends IConsumerSaleInvoicesRawR
|
|||||||
|
|
||||||
interface ConsumerAccount {
|
interface ConsumerAccount {
|
||||||
role: string;
|
role: string;
|
||||||
user: User;
|
|
||||||
account: Account;
|
account: Account;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,11 +23,6 @@ interface Account {
|
|||||||
username: string;
|
username: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface User {
|
|
||||||
first_name: string;
|
|
||||||
last_name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Pos extends ISummary {
|
interface Pos extends ISummary {
|
||||||
complex: Complex;
|
complex: Complex;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { IPaginatedResponse } from '@/core/models/service.model';
|
import { IPaginatedResponse } from '@/core/models/service.model';
|
||||||
|
import { ISaleInvoiceFullRawResponse, ISaleInvoiceFullResponse } from '@/domains/consumer/models';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
@@ -16,7 +17,7 @@ export class ConsumerSaleInvoicesService {
|
|||||||
this.apiRoutes.list(),
|
this.apiRoutes.list(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
getSingle(invoiceId: string): Observable<IConsumerSaleInvoicesResponse> {
|
getSingle(invoiceId: string): Observable<ISaleInvoiceFullResponse> {
|
||||||
return this.http.get<IConsumerSaleInvoicesRawResponse>(this.apiRoutes.single(invoiceId));
|
return this.http.get<ISaleInvoiceFullRawResponse>(this.apiRoutes.single(invoiceId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 { computed, inject, Injectable } from '@angular/core';
|
||||||
import { MenuItem } from 'primeng/api';
|
import { MenuItem } from 'primeng/api';
|
||||||
import { catchError, finalize } from 'rxjs';
|
import { catchError, finalize } from 'rxjs';
|
||||||
import { consumerSaleInvoicesNamedRoutes } from '../constants';
|
import { consumerSaleInvoicesNamedRoutes } from '../constants';
|
||||||
import { IConsumerSaleInvoicesResponse } from '../models';
|
|
||||||
import { ConsumerSaleInvoicesService } from '../services/main.service';
|
import { ConsumerSaleInvoicesService } from '../services/main.service';
|
||||||
|
|
||||||
interface ConsumerSaleInvoiceState extends EntityState<IConsumerSaleInvoicesResponse> {
|
interface ConsumerSaleInvoiceState extends EntityState<ISaleInvoiceFullResponse> {
|
||||||
breadcrumbItems: MenuItem[];
|
breadcrumbItems: MenuItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,17 +14,13 @@ interface ConsumerSaleInvoiceState extends EntityState<IConsumerSaleInvoicesResp
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ConsumerSaleInvoiceStore extends EntityStore<
|
export class ConsumerSaleInvoiceStore extends EntityStore<
|
||||||
IConsumerSaleInvoicesResponse,
|
ISaleInvoiceFullResponse,
|
||||||
ConsumerSaleInvoiceState
|
ConsumerSaleInvoiceState
|
||||||
> {
|
> {
|
||||||
private readonly service = inject(ConsumerSaleInvoicesService);
|
private readonly service = inject(ConsumerSaleInvoicesService);
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -67,11 +63,7 @@ export class ConsumerSaleInvoiceStore extends EntityStore<
|
|||||||
|
|
||||||
override reset(): void {
|
override reset(): void {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
...defaultBaseStateData,
|
||||||
error: null,
|
|
||||||
entity: null,
|
|
||||||
initialized: false,
|
|
||||||
isRefreshing: false,
|
|
||||||
breadcrumbItems: [],
|
breadcrumbItems: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice" />
|
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice()" />
|
||||||
|
|||||||
+15
-1
@@ -10,5 +10,19 @@ export interface IPartnerRawResponse {
|
|||||||
}
|
}
|
||||||
export interface IPartnerResponse extends 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 {}
|
export interface IPartnerInfoResponse extends IPartnerInfoRawResponse {}
|
||||||
|
|
||||||
|
interface LicensesStatus {
|
||||||
|
total_purchased: number;
|
||||||
|
total_activated: number;
|
||||||
|
total_expired: number;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
[columns]="columns"
|
[columns]="columns"
|
||||||
emptyPlaceholderTitle="حساب کاربریای یافت نشد"
|
emptyPlaceholderTitle="حساب کاربریای یافت نشد"
|
||||||
[items]="items()"
|
[items]="items()"
|
||||||
[showDetails]="true"
|
|
||||||
[loading]="loading()"
|
[loading]="loading()"
|
||||||
(onDetails)="toSinglePage($event)"
|
|
||||||
(onRefresh)="refresh()"
|
(onRefresh)="refresh()"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class ConsumerAccountFormComponent extends AbstractFormDialog<
|
|||||||
if (this.editMode) {
|
if (this.editMode) {
|
||||||
return this.fb.group(
|
return this.fb.group(
|
||||||
{
|
{
|
||||||
username: [this.initialValues?.username || '', [Validators.required]],
|
username: [this.initialValues?.account.username || '', [Validators.required]],
|
||||||
password: ['', [password()]],
|
password: ['', [password()]],
|
||||||
confirmPassword: [''],
|
confirmPassword: [''],
|
||||||
},
|
},
|
||||||
@@ -49,7 +49,7 @@ export class ConsumerAccountFormComponent extends AbstractFormDialog<
|
|||||||
}
|
}
|
||||||
return this.fb.group(
|
return this.fb.group(
|
||||||
{
|
{
|
||||||
username: [this.initialValues?.username || '', [Validators.required]],
|
username: [this.initialValues?.account.username || '', [Validators.required]],
|
||||||
role: ['', [Validators.required]],
|
role: ['', [Validators.required]],
|
||||||
password: ['', [Validators.required, password()]],
|
password: ['', [Validators.required, password()]],
|
||||||
confirmPassword: ['', [Validators.required]],
|
confirmPassword: ['', [Validators.required]],
|
||||||
|
|||||||
@@ -26,17 +26,27 @@ export class ConsumerAccountListComponent extends AbstractList<IConsumerAccountR
|
|||||||
nestedOption: { path: 'account.username' },
|
nestedOption: { path: 'account.username' },
|
||||||
},
|
},
|
||||||
{ field: 'role', header: 'نوع حساب' },
|
{ field: 'role', header: 'نوع حساب' },
|
||||||
|
{
|
||||||
|
field: 'pos',
|
||||||
|
header: 'پایانهی مرتبط',
|
||||||
|
customDataModel(item: IConsumerAccountResponse) {
|
||||||
|
if (item.pos) {
|
||||||
|
return `${item.pos.name} (${item.pos.complex.name} - ${item.pos.complex.business_activity.name})`;
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
header: 'وضعیت',
|
header: 'وضعیت',
|
||||||
type: 'nested',
|
type: 'nested',
|
||||||
nestedOption: { path: 'account.status' },
|
nestedOption: { path: 'account.status' },
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
field: 'created_at',
|
// field: 'created_at',
|
||||||
header: 'تاریخ ایجاد',
|
// header: 'تاریخ ایجاد',
|
||||||
type: 'date',
|
// type: 'date',
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
private readonly service = inject(PartnerConsumerAccountsService);
|
private readonly service = inject(PartnerConsumerAccountsService);
|
||||||
|
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
<p-dialog
|
||||||
|
header="شارژ کاربر"
|
||||||
|
[(visible)]="visible"
|
||||||
|
[modal]="true"
|
||||||
|
[style]="{ width: '300px' }"
|
||||||
|
[closable]="true"
|
||||||
|
(onHide)="close()"
|
||||||
|
>
|
||||||
|
<form [formGroup]="form" (submit)="submit()" class="flex flex-col gap-4">
|
||||||
|
<app-input label="تعداد شارژ کاربران" [control]="form.controls.quantity" type="number" [min]="1" />
|
||||||
|
<app-form-footer-actions [submitLabel]="'ذخیره'" [loading]="submitLoading()" (onCancel)="close()" />
|
||||||
|
</form>
|
||||||
|
</p-dialog>
|
||||||
+31
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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)}`,
|
||||||
|
};
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
import { TAccountType } from '@/core/constants/accountTypes.const';
|
import { TAccountType } from '@/core/constants/accountTypes.const';
|
||||||
|
import ISummary from '@/core/models/summary';
|
||||||
|
|
||||||
export interface IConsumerAccountRawResponse {
|
export interface IConsumerAccountRawResponse {
|
||||||
username: string;
|
|
||||||
id: string;
|
id: string;
|
||||||
|
role: string;
|
||||||
|
created_at: string;
|
||||||
|
pos: Pos;
|
||||||
|
account: Account;
|
||||||
}
|
}
|
||||||
export interface IConsumerAccountResponse extends IConsumerAccountRawResponse {}
|
export interface IConsumerAccountResponse extends IConsumerAccountRawResponse {}
|
||||||
|
|
||||||
@@ -11,3 +15,17 @@ export interface IConsumerAccountRequest {
|
|||||||
password?: string;
|
password?: string;
|
||||||
type: TAccountType;
|
type: TAccountType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Account {
|
||||||
|
username: string;
|
||||||
|
status: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Pos extends ISummary {
|
||||||
|
complex: Complex;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Complex extends ISummary {
|
||||||
|
branch_code: string;
|
||||||
|
business_activity: ISummary;
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
export * from './accounts_io';
|
export * from './accounts_io';
|
||||||
export * from './businessActivities_io';
|
export * from './businessActivities_io';
|
||||||
|
export * from './chargeAccount_io';
|
||||||
export * from './complexes_io';
|
export * from './complexes_io';
|
||||||
export * from './io';
|
export * from './io';
|
||||||
export * from './licenses_io';
|
export * from './licenses_io';
|
||||||
|
|||||||
@@ -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<IPaginatedResponse<IPartnerChargeAccountRequest>> {
|
||||||
|
// return this.http.get<IPaginatedResponse<IPartnerChargeAccountRequest>>(
|
||||||
|
// this.apiRoutes.single(partnerId),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
charge(
|
||||||
|
consumerId: string,
|
||||||
|
businessId: string,
|
||||||
|
data: IPartnerChargeAccountRequest,
|
||||||
|
): Observable<IPartnerChargeAccountRequest> {
|
||||||
|
return this.http.post<IPartnerChargeAccountRequest>(
|
||||||
|
this.apiRoutes.single(consumerId, businessId),
|
||||||
|
data,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -1,5 +1,8 @@
|
|||||||
<div class="flex flex-col gap-6">
|
<div class="flex flex-col gap-6">
|
||||||
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
||||||
|
<ng-template #moreActions>
|
||||||
|
<button pButton outlined (click)="showAccountsChargeDialog()">افزایش محدودیت کاربر</button>
|
||||||
|
</ng-template>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="grid grid-cols-3 gap-4 items-center">
|
<div class="grid grid-cols-3 gap-4 items-center">
|
||||||
<app-key-value label="عنوان" [value]="businessActivity()?.name" />
|
<app-key-value label="عنوان" [value]="businessActivity()?.name" />
|
||||||
@@ -21,4 +24,11 @@
|
|||||||
[initialValues]="businessActivity() || undefined"
|
[initialValues]="businessActivity() || undefined"
|
||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()"
|
||||||
/>
|
/>
|
||||||
|
<partner-charge-account-form-dialog
|
||||||
|
[(visible)]="visibleAccountsChargeForm"
|
||||||
|
[consumerId]="consumerId()"
|
||||||
|
[businessId]="businessId()"
|
||||||
|
(onSubmit)="getData()"
|
||||||
|
>
|
||||||
|
</partner-charge-account-form-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import pageParamsUtils from '@/utils/page-params.utils';
|
|||||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
import { ButtonDirective } from 'primeng/button';
|
||||||
import { ConsumerBusinessActivitiesFormComponent } from '../../components/businessActivities/form.component';
|
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 { ConsumerComplexesComponent } from '../../components/complexes/list.component';
|
||||||
import { BusinessActivityStore } from '../../store/businessActivity.store';
|
import { BusinessActivityStore } from '../../store/businessActivity.store';
|
||||||
import { ConsumerStore } from '../../store/consumer.store';
|
import { ConsumerStore } from '../../store/consumer.store';
|
||||||
@@ -17,6 +19,8 @@ import { ConsumerStore } from '../../store/consumer.store';
|
|||||||
KeyValueComponent,
|
KeyValueComponent,
|
||||||
ConsumerBusinessActivitiesFormComponent,
|
ConsumerBusinessActivitiesFormComponent,
|
||||||
ConsumerComplexesComponent,
|
ConsumerComplexesComponent,
|
||||||
|
ButtonDirective,
|
||||||
|
PartnerChargeAccountFormDialogComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class PartnerUserBusinessActivityComponent {
|
export class PartnerUserBusinessActivityComponent {
|
||||||
@@ -30,6 +34,7 @@ export class PartnerUserBusinessActivityComponent {
|
|||||||
readonly consumerId = signal<string>(this.pageParams()['consumerId']!);
|
readonly consumerId = signal<string>(this.pageParams()['consumerId']!);
|
||||||
readonly businessId = signal<string>(this.pageParams()['businessActivityId']!);
|
readonly businessId = signal<string>(this.pageParams()['businessActivityId']!);
|
||||||
editMode = signal<boolean>(false);
|
editMode = signal<boolean>(false);
|
||||||
|
visibleAccountsChargeForm = signal<boolean>(false);
|
||||||
|
|
||||||
readonly loading = computed(() => this.store.loading());
|
readonly loading = computed(() => this.store.loading());
|
||||||
readonly businessActivity = computed(() => this.store.entity());
|
readonly businessActivity = computed(() => this.store.entity());
|
||||||
@@ -52,4 +57,8 @@ export class PartnerUserBusinessActivityComponent {
|
|||||||
...this.store.breadcrumbItems(),
|
...this.store.breadcrumbItems(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showAccountsChargeDialog() {
|
||||||
|
this.visibleAccountsChargeForm.set(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
import { BreadcrumbService } from '@/core/services';
|
import { BreadcrumbService } from '@/core/services';
|
||||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||||
import { JalaliDateDirective } from '@/shared/directives';
|
|
||||||
import { getLicenseStatus } from '@/utils';
|
import { getLicenseStatus } from '@/utils';
|
||||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Button } from 'primeng/button';
|
|
||||||
import { ConsumerAccountListComponent } from '../components/accounts/list.component';
|
import { ConsumerAccountListComponent } from '../components/accounts/list.component';
|
||||||
import { ConsumerBusinessActivitiesComponent } from '../components/businessActivities/list.component';
|
import { ConsumerBusinessActivitiesComponent } from '../components/businessActivities/list.component';
|
||||||
import { ConsumerUserFormComponent } from '../components/form.component';
|
import { ConsumerUserFormComponent } from '../components/form.component';
|
||||||
import { ConsumerLicenseFormComponent } from '../components/licenses/form.component';
|
|
||||||
import { ConsumerStore } from '../store/consumer.store';
|
import { ConsumerStore } from '../store/consumer.store';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -20,9 +17,6 @@ import { ConsumerStore } from '../store/consumer.store';
|
|||||||
ConsumerUserFormComponent,
|
ConsumerUserFormComponent,
|
||||||
ConsumerAccountListComponent,
|
ConsumerAccountListComponent,
|
||||||
ConsumerBusinessActivitiesComponent,
|
ConsumerBusinessActivitiesComponent,
|
||||||
Button,
|
|
||||||
JalaliDateDirective,
|
|
||||||
ConsumerLicenseFormComponent,
|
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ConsumerComponent {
|
export class ConsumerComponent {
|
||||||
|
|||||||
+22
@@ -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>
|
||||||
+16
@@ -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 { defaultBaseStateData, EntityState, EntityStore } from '@/core/state';
|
||||||
import { IPartnerInfoResponse } from '@/domains/partner/models';
|
import { IPartnerInfoResponse } from '@/domains/partner/models';
|
||||||
import { PartnerService } from '@/domains/partner/services/main.service';
|
import { PartnerService } from '@/domains/partner/services/main.service';
|
||||||
import { LayoutService } from '@/layout/service/layout.service';
|
|
||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { catchError, finalize } from 'rxjs';
|
import { catchError, finalize } from 'rxjs';
|
||||||
|
|
||||||
@@ -12,7 +11,6 @@ interface PartnerInfoState extends EntityState<IPartnerInfoResponse> {}
|
|||||||
})
|
})
|
||||||
export class PartnerInfoStore extends EntityStore<IPartnerInfoResponse, PartnerInfoState> {
|
export class PartnerInfoStore extends EntityStore<IPartnerInfoResponse, PartnerInfoState> {
|
||||||
private readonly service = inject(PartnerService);
|
private readonly service = inject(PartnerService);
|
||||||
private readonly layoutService = inject(LayoutService);
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(defaultBaseStateData);
|
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 { Component, computed, inject } from '@angular/core';
|
||||||
|
import { PartnerLicenseInfoTemplateComponent } from '../components/licenseInfo/license-info-template.component';
|
||||||
import { PartnerInfoStore } from '../store/main.store';
|
import { PartnerInfoStore } from '../store/main.store';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'partner-dashboard',
|
selector: 'partner-dashboard',
|
||||||
templateUrl: './index.component.html',
|
templateUrl: './index.component.html',
|
||||||
|
imports: [PartnerLicenseInfoTemplateComponent],
|
||||||
})
|
})
|
||||||
export class DashboardComponent {
|
export class DashboardComponent {
|
||||||
private readonly store = inject(PartnerInfoStore);
|
private readonly store = inject(PartnerInfoStore);
|
||||||
|
|||||||
@@ -4,11 +4,13 @@
|
|||||||
<div class="w-svw h-svh bg-surface-ground flex flex-col gap-4 p-4">
|
<div class="w-svw h-svh bg-surface-ground flex flex-col gap-4 p-4">
|
||||||
<div class="w-full flex items-center gap-4 shrink-0 justify-between">
|
<div class="w-full flex items-center gap-4 shrink-0 justify-between">
|
||||||
<div class="flex gap-2 items-center">
|
<div class="flex gap-2 items-center">
|
||||||
|
@if (posInfo()) {
|
||||||
<div class="w-10 h-10">
|
<div class="w-10 h-10">
|
||||||
<img [src]="placeholderLogo" alt="Logo" class="w-full h-full object-cover rounded-md bg-surface-card" />
|
<img [src]="placeholderLogo" alt="Logo" class="w-full h-full object-cover rounded-md bg-surface-card" />
|
||||||
</div>
|
</div>
|
||||||
@if (posInfo()) {
|
<span class="text-lg font-bold">
|
||||||
<span class="text-lg font-bold">{{ posInfo()?.name }} - شعبه {{ posInfo()?.complex?.name }}</span>
|
{{ posInfo()?.name }} ({{ posInfo()?.complex!.name }} - {{ posInfo()?.businessActivity!.name }})
|
||||||
|
</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2 items-center">
|
<div class="flex gap-2 items-center">
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import { ButtonDirective } from 'primeng/button';
|
|||||||
import { Card } from 'primeng/card';
|
import { Card } from 'primeng/card';
|
||||||
import { Menu } from 'primeng/menu';
|
import { Menu } from 'primeng/menu';
|
||||||
import images from 'src/assets/images';
|
import images from 'src/assets/images';
|
||||||
import { PosProfileStore } from '../store';
|
import { PosInfoStore, PosProfileStore } from '../store';
|
||||||
import { PosStore } from '../store/pos.store';
|
|
||||||
import { PosChooseCardsComponent } from './choose-pos.component';
|
import { PosChooseCardsComponent } from './choose-pos.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -28,19 +27,20 @@ import { PosChooseCardsComponent } from './choose-pos.component';
|
|||||||
export class PosLayoutComponent {
|
export class PosLayoutComponent {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
private readonly posInfoStore = inject(PosStore);
|
|
||||||
private readonly posProfileStore = inject(PosProfileStore);
|
private readonly posProfileStore = inject(PosProfileStore);
|
||||||
|
private readonly posInfoStore = inject(PosInfoStore);
|
||||||
private readonly authService = inject(AuthService);
|
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 posProfileLoading = computed(() => this.posProfileStore.loading());
|
||||||
readonly posProfile = computed(() => this.posProfileStore.entity());
|
readonly posProfile = computed(() => this.posProfileStore.entity());
|
||||||
readonly posProfileError = computed(() => this.posProfileStore.error());
|
readonly posProfileError = computed(() => this.posProfileStore.error());
|
||||||
|
|
||||||
readonly loading = computed(() => this.posInfoLoading() || this.posProfileLoading());
|
readonly posInfoLoading = computed(() => this.posInfoStore.loading());
|
||||||
readonly error = computed(() => this.posInfoError() || this.posProfileError());
|
readonly posInfo = computed(() => this.posInfoStore.entity());
|
||||||
|
readonly posInfoError = computed(() => this.posInfoStore.error());
|
||||||
|
|
||||||
|
readonly loading = computed(() => this.posProfileLoading());
|
||||||
|
readonly error = computed(() => this.posProfileError());
|
||||||
|
|
||||||
logout = () => {
|
logout = () => {
|
||||||
this.authService.logout();
|
this.authService.logout();
|
||||||
@@ -64,8 +64,11 @@ export class PosLayoutComponent {
|
|||||||
now = new Date();
|
now = new Date();
|
||||||
|
|
||||||
getData() {
|
getData() {
|
||||||
this.posProfileStore.getData().subscribe();
|
this.posProfileStore.getData().subscribe({
|
||||||
|
next: () => {
|
||||||
this.posInfoStore.getData().subscribe();
|
this.posInfoStore.getData().subscribe();
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onChoosePos() {
|
onChoosePos() {
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ export class PosGoldPayloadFormComponent extends AbstractForm<
|
|||||||
const baseTotalAmount = totalAmountBeforeProfit + profitAmount;
|
const baseTotalAmount = totalAmountBeforeProfit + profitAmount;
|
||||||
const baseAmountForDiscountCalculation =
|
const baseAmountForDiscountCalculation =
|
||||||
this.discountType() === 1 ? profitAmount : baseTotalAmount;
|
this.discountType() === 1 ? profitAmount : baseTotalAmount;
|
||||||
|
|
||||||
const taxAmount = (profitAmount + commissionAmount + wageAmount - discountAmount) * 0.1;
|
const taxAmount = (profitAmount + commissionAmount + wageAmount - discountAmount) * 0.1;
|
||||||
const totalAmount = baseTotalAmount - discountAmount + taxAmount;
|
const totalAmount = baseTotalAmount - discountAmount + taxAmount;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
<div class="flex gap-4 grow overflow-hidden h-full">
|
@if (loading()) {
|
||||||
@if (posInfo()) {
|
<shared-page-loading />
|
||||||
|
|
||||||
|
} @else if (pos()) {
|
||||||
|
<div class="flex gap-4 grow overflow-hidden h-full">
|
||||||
<div class="grow h-full overflow-auto">
|
<div class="grow h-full overflow-auto">
|
||||||
<pos-goods />
|
<pos-goods />
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0 h-full">
|
<div class="shrink-0 h-full">
|
||||||
<pos-order-section />
|
<pos-order-section />
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
</div>
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// import { CatalogRoleTagComponent } from '@/shared/catalog/roles';
|
// 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 { Component, computed, inject } from '@angular/core';
|
||||||
import { PosGoodsComponent } from '../components/goods.component';
|
import { PosGoodsComponent } from '../components/goods.component';
|
||||||
import { PosOrderSectionComponent } from '../components/order/order-section.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',
|
templateUrl: './root.component.html',
|
||||||
host: { class: 'grow overflow-hidden' },
|
host: { class: 'grow overflow-hidden' },
|
||||||
|
|
||||||
imports: [PosGoodsComponent, PosOrderSectionComponent],
|
imports: [PosGoodsComponent, PosOrderSectionComponent, PageLoadingComponent],
|
||||||
})
|
})
|
||||||
export class PosLandingComponent {
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ interface PosState extends EntityState<IPosInfoResponse> {
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class PosStore extends EntityStore<IPosInfoResponse, PosState> {
|
export class PosInfoStore extends EntityStore<IPosInfoResponse, PosState> {
|
||||||
private readonly service = inject(PosService);
|
private readonly service = inject(PosService);
|
||||||
|
|
||||||
constructor(private readonly cookieService: CookieService) {
|
constructor(private readonly cookieService: CookieService) {
|
||||||
|
|||||||
+5
-5
@@ -6,11 +6,11 @@ import { nowJalali } from '@/utils';
|
|||||||
import { Component, inject, Input } from '@angular/core';
|
import { Component, inject, Input } from '@angular/core';
|
||||||
import { ReactiveFormsModule, Validators } from '@angular/forms';
|
import { ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
import { Dialog } from 'primeng/dialog';
|
import { Dialog } from 'primeng/dialog';
|
||||||
import { IPartnerChargeAccountRequest } from '../../models/chargeAccount_io';
|
import { IAdminPartnerChargeAccountRequest } from '../../models/chargeAccount_io';
|
||||||
import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.service';
|
import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'partner-charge-account-form-dialog',
|
selector: 'admin-partner-charge-account-form-dialog',
|
||||||
templateUrl: './charge-account-form-dialog.component.html',
|
templateUrl: './charge-account-form-dialog.component.html',
|
||||||
imports: [
|
imports: [
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -20,8 +20,8 @@ import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.s
|
|||||||
UikitFlatpickrJalaliComponent,
|
UikitFlatpickrJalaliComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class PartnerChargeAccountFormDialogComponent extends AbstractFormDialog<
|
export class AdminPartnerChargeAccountFormDialogComponent extends AbstractFormDialog<
|
||||||
IPartnerChargeAccountRequest,
|
IAdminPartnerChargeAccountRequest,
|
||||||
any
|
any
|
||||||
> {
|
> {
|
||||||
@Input({ required: true }) partnerId!: string;
|
@Input({ required: true }) partnerId!: string;
|
||||||
@@ -35,7 +35,7 @@ export class PartnerChargeAccountFormDialogComponent extends AbstractFormDialog<
|
|||||||
|
|
||||||
minDate = nowJalali();
|
minDate = nowJalali();
|
||||||
|
|
||||||
submitForm(payload: IPartnerChargeAccountRequest) {
|
submitForm(payload: IAdminPartnerChargeAccountRequest) {
|
||||||
return this.service.charge(this.partnerId, payload);
|
return this.service.charge(this.partnerId, payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||||
import { Component, inject, Input } from '@angular/core';
|
import { Component, inject, Input } from '@angular/core';
|
||||||
import { IPartnerChargeAccountRawResponse } from '../../models';
|
import { IAdminPartnerChargeAccountRawResponse } from '../../models';
|
||||||
import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.service';
|
import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -9,7 +9,7 @@ import { AdminPartnerChargeAccountService } from '../../services/chargeAccount.s
|
|||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
imports: [PageDataListComponent],
|
imports: [PageDataListComponent],
|
||||||
})
|
})
|
||||||
export class AdminPartnerChargeAccountListComponent extends AbstractList<IPartnerChargeAccountRawResponse> {
|
export class AdminPartnerChargeAccountListComponent extends AbstractList<IAdminPartnerChargeAccountRawResponse> {
|
||||||
@Input({ required: true }) partnerId!: string;
|
@Input({ required: true }) partnerId!: string;
|
||||||
|
|
||||||
private readonly service = inject(AdminPartnerChargeAccountService);
|
private readonly service = inject(AdminPartnerChargeAccountService);
|
||||||
|
|||||||
@@ -2,14 +2,13 @@
|
|||||||
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
import { AbstractList } from '@/shared/abstractClasses/abstract-list';
|
||||||
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
|
||||||
import { Component, inject, Input } from '@angular/core';
|
import { Component, inject, Input } from '@angular/core';
|
||||||
import { ButtonDirective } from 'primeng/button';
|
|
||||||
import { IPartnerActivatedLicenseResponse } from '../../models';
|
import { IPartnerActivatedLicenseResponse } from '../../models';
|
||||||
import { AdminPartnerActivatedLicensesService } from '../../services/licenses.service';
|
import { AdminPartnerActivatedLicensesService } from '../../services/licenses.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'admin-partner-licenses',
|
selector: 'admin-partner-licenses',
|
||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
imports: [PageDataListComponent, ButtonDirective],
|
imports: [PageDataListComponent],
|
||||||
})
|
})
|
||||||
export class AdminPartnerLicensesComponent extends AbstractList<IPartnerActivatedLicenseResponse> {
|
export class AdminPartnerLicensesComponent extends AbstractList<IPartnerActivatedLicenseResponse> {
|
||||||
@Input({ required: true }) partnerId!: string;
|
@Input({ required: true }) partnerId!: string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export interface IPartnerChargeAccountRawResponse {
|
export interface IAdminPartnerChargeAccountRawResponse {
|
||||||
id: string;
|
id: string;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
tracking_code: string;
|
tracking_code: string;
|
||||||
@@ -8,9 +8,9 @@ export interface IPartnerChargeAccountRawResponse {
|
|||||||
remained_license_count: number;
|
remained_license_count: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPartnerChargeAccountResponse extends IPartnerChargeAccountRawResponse {}
|
export interface IAdminPartnerChargeAccountResponse extends IAdminPartnerChargeAccountRawResponse {}
|
||||||
|
|
||||||
export interface IPartnerChargeAccountRequest {
|
export interface IAdminPartnerChargeAccountRequest {
|
||||||
quantity: number;
|
quantity: number;
|
||||||
activated_expires_at: string;
|
activated_expires_at: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { Injectable } from '@angular/core';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { PARTNER_CHARGE_ACCOUNT_API_ROUTES } from '../constants';
|
import { PARTNER_CHARGE_ACCOUNT_API_ROUTES } from '../constants';
|
||||||
import {
|
import {
|
||||||
IPartnerChargeAccountRawResponse,
|
IAdminPartnerChargeAccountRawResponse,
|
||||||
IPartnerChargeAccountRequest,
|
IAdminPartnerChargeAccountRequest,
|
||||||
IPartnerChargeAccountResponse,
|
IAdminPartnerChargeAccountResponse,
|
||||||
} from '../models';
|
} from '../models';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
@@ -15,16 +15,19 @@ export class AdminPartnerChargeAccountService {
|
|||||||
|
|
||||||
private apiRoutes = PARTNER_CHARGE_ACCOUNT_API_ROUTES;
|
private apiRoutes = PARTNER_CHARGE_ACCOUNT_API_ROUTES;
|
||||||
|
|
||||||
getAll(partnerId: string): Observable<IPaginatedResponse<IPartnerChargeAccountRawResponse>> {
|
getAll(partnerId: string): Observable<IPaginatedResponse<IAdminPartnerChargeAccountResponse>> {
|
||||||
return this.http.get<IPaginatedResponse<IPartnerChargeAccountResponse>>(
|
return this.http.get<IPaginatedResponse<IAdminPartnerChargeAccountRawResponse>>(
|
||||||
this.apiRoutes.single(partnerId),
|
this.apiRoutes.single(partnerId),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
charge(
|
charge(
|
||||||
partnerId: string,
|
partnerId: string,
|
||||||
data: IPartnerChargeAccountRequest,
|
data: IAdminPartnerChargeAccountRequest,
|
||||||
): Observable<IPartnerChargeAccountRawResponse> {
|
): Observable<IAdminPartnerChargeAccountResponse> {
|
||||||
return this.http.post<IPartnerChargeAccountResponse>(this.apiRoutes.single(partnerId), data);
|
return this.http.post<IAdminPartnerChargeAccountRawResponse>(
|
||||||
|
this.apiRoutes.single(partnerId),
|
||||||
|
data,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,8 +79,8 @@
|
|||||||
(onSubmit)="getData()"
|
(onSubmit)="getData()"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<partner-charge-account-form-dialog
|
<admin-partner-charge-account-form-dialog
|
||||||
[(visible)]="visibleChargeAccountFormDialog"
|
[(visible)]="visibleChargeAccountFormDialog"
|
||||||
[partnerId]="partnerId()"
|
[partnerId]="partnerId()"
|
||||||
(onSubmit)="getData()"
|
(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 { Divider } from 'primeng/divider';
|
||||||
import { ConsumerAccountListComponent } from '../components/accounts/list.component';
|
import { ConsumerAccountListComponent } from '../components/accounts/list.component';
|
||||||
import { PartnerChargeLicenseFormDialogComponent } from '../components/charge-license-form-dialog.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 { AdminPartnerChargeAccountListComponent } from '../components/chargeAccount/list.component';
|
||||||
import { AdminPartnerChargeLicenseTransactionListComponent } from '../components/chargeLicenseTransactions/list.component';
|
import { AdminPartnerChargeLicenseTransactionListComponent } from '../components/chargeLicenseTransactions/list.component';
|
||||||
import { GuildFormComponent } from '../components/form.component';
|
import { GuildFormComponent } from '../components/form.component';
|
||||||
@@ -24,7 +24,7 @@ import { PartnerStore } from '../store/partner.store';
|
|||||||
ConsumerAccountListComponent,
|
ConsumerAccountListComponent,
|
||||||
Button,
|
Button,
|
||||||
AdminPartnerChargeAccountListComponent,
|
AdminPartnerChargeAccountListComponent,
|
||||||
PartnerChargeAccountFormDialogComponent,
|
AdminPartnerChargeAccountFormDialogComponent,
|
||||||
PartnerChargeLicenseFormDialogComponent,
|
PartnerChargeLicenseFormDialogComponent,
|
||||||
AdminPartnerLicensesComponent,
|
AdminPartnerLicensesComponent,
|
||||||
AdminPartnerChargeLicenseTransactionListComponent,
|
AdminPartnerChargeLicenseTransactionListComponent,
|
||||||
|
|||||||
@@ -2,9 +2,12 @@
|
|||||||
<ng-template #title>
|
<ng-template #title>
|
||||||
<ng-container [ngTemplateOutlet]="header">
|
<ng-container [ngTemplateOutlet]="header">
|
||||||
<div class="flex items-center gap-10 justify-between">
|
<div class="flex items-center gap-10 justify-between">
|
||||||
<h5 class="font-bold">{{ cardTitle }}</h5>
|
<h5 class="font-bold py-1.5">{{ cardTitle }}</h5>
|
||||||
<div class="flex items-center gap-2 shrink-0">
|
<div class="flex items-center gap-2 shrink-0">
|
||||||
<ng-container [ngTemplateOutlet]="moreActions"></ng-container>
|
<ng-container [ngTemplateOutlet]="moreActions"></ng-container>
|
||||||
|
@if (showRefresh) {
|
||||||
|
<p-button icon="pi pi-refresh" outlined (click)="refresh()"></p-button>
|
||||||
|
}
|
||||||
@if (editable) {
|
@if (editable) {
|
||||||
<button
|
<button
|
||||||
pButton
|
pButton
|
||||||
|
|||||||
@@ -9,18 +9,19 @@ import {
|
|||||||
signal,
|
signal,
|
||||||
TemplateRef,
|
TemplateRef,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { ButtonDirective } from 'primeng/button';
|
import { Button, ButtonDirective } from 'primeng/button';
|
||||||
import { Card } from 'primeng/card';
|
import { Card } from 'primeng/card';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-card-data',
|
selector: 'app-card-data',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
templateUrl: './card-data.component.html',
|
templateUrl: './card-data.component.html',
|
||||||
imports: [Card, CommonModule, ButtonDirective],
|
imports: [Card, CommonModule, ButtonDirective, Button],
|
||||||
})
|
})
|
||||||
export class AppCardComponent {
|
export class AppCardComponent {
|
||||||
@Input() cardTitle!: string;
|
@Input() cardTitle!: string;
|
||||||
@Input() editable: boolean = false;
|
@Input() editable: boolean = false;
|
||||||
|
@Input() showRefresh: boolean = false;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set editMode(v: boolean) {
|
set editMode(v: boolean) {
|
||||||
@@ -32,6 +33,7 @@ export class AppCardComponent {
|
|||||||
}
|
}
|
||||||
private editModeSignal = signal(false);
|
private editModeSignal = signal(false);
|
||||||
@Output() editModeChange = new EventEmitter<boolean>();
|
@Output() editModeChange = new EventEmitter<boolean>();
|
||||||
|
@Output() onRefresh = new EventEmitter<void>();
|
||||||
|
|
||||||
@ContentChild('header', { static: true }) header?: Maybe<TemplateRef<any>>;
|
@ContentChild('header', { static: true }) header?: Maybe<TemplateRef<any>>;
|
||||||
@ContentChild('moreActions', { static: true }) moreActions?: Maybe<TemplateRef<any>>;
|
@ContentChild('moreActions', { static: true }) moreActions?: Maybe<TemplateRef<any>>;
|
||||||
@@ -47,4 +49,8 @@ export class AppCardComponent {
|
|||||||
onEditClick() {
|
onEditClick() {
|
||||||
this.editModeChange.emit(!this.editMode);
|
this.editModeChange.emit(!this.editMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refresh() {
|
||||||
|
this.onRefresh.emit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,7 +232,6 @@ export class PageDataListComponent<I> {
|
|||||||
|
|
||||||
getTemplate(col: IColumn): TemplateRef<any> | null {
|
getTemplate(col: IColumn): TemplateRef<any> | null {
|
||||||
const v = col.customDataModel;
|
const v = col.customDataModel;
|
||||||
|
|
||||||
return v instanceof TemplateRef ? (v as TemplateRef<any>) : null;
|
return v instanceof TemplateRef ? (v as TemplateRef<any>) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user