fix ui issues and upload image for guild good

This commit is contained in:
2026-04-18 12:14:39 +03:30
parent ac23d47b79
commit e027b89173
32 changed files with 353 additions and 177 deletions
@@ -1,22 +1,25 @@
import ISummary from '@/core/models/summary';
import { CustomerType } from '@/shared/localEnum/constants/customerTypes';
import { CustomerIndividual, CustomerLegal } from './io';
export interface ICustomerSaleInvoicesRawResponse {
id: string;
code: string;
invoice_date: string;
notes?: string;
total_amount: string;
invoice_date: string;
consumer_account: ConsumerAccount;
pos: Pos;
account: ConsumerAccount;
items: SaleInvoiceItem[];
payments: Payment[];
unknown_customer?: UnknownCustomer;
customer?: Customer;
notes?: string;
created_at: string;
items_count: number;
payments: Payments[];
}
export interface ICustomerSaleInvoicesResponse extends ICustomerSaleInvoicesRawResponse {}
interface ConsumerAccount {
role: string;
user: User;
account: Account;
}
@@ -24,11 +27,6 @@ interface Account {
username: string;
}
interface User {
first_name: string;
last_name: string;
}
interface Pos extends ISummary {
complex: Complex;
}
@@ -37,8 +35,36 @@ interface Complex extends ISummary {
business_activity: ISummary;
}
interface Payments {
interface Payment {
amount: string;
paid_at: string;
payment_method: string;
}
interface SaleInvoiceItem {
id: string;
good: ISummary;
}
interface Customer {
id: string;
type: CustomerType;
customer_legal?: CustomerLegal;
customer_individual?: CustomerIndividual;
}
// interface CustomerIndividual {
// id: string;
// first_name: string;
// last_name: string;
// }
// interface CustomerLegal {
// id: string;
// name: string;
// }
interface UnknownCustomer {
name: string;
national_id: string;
}
@@ -31,7 +31,7 @@
<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!.name" />
<app-key-value label="ایجاد کننده" [value]="invoice()?.account?.account?.username" />
<app-key-value label="ایجاد کننده" [value]="invoice()?.consumer_account?.account?.username" />
</div>
</div>
</app-card-data>
@@ -10,4 +10,8 @@
<ng-template #moreActions>
<a routerLink pButton [routerLink]="invoicesPageRoute" outlined>تمامی فاکتورها</a>
</ng-template>
<ng-template #status let-item>
<p-badge value="ارسال نشده" severity="danger" />
</ng-template>
</app-page-data-list>
@@ -1,8 +1,9 @@
import { consumerSaleInvoicesNamedRoutes } from '@/domains/consumer/modules/saleInvoices/constants';
import { AbstractList } from '@/shared/abstractClasses';
import { PageDataListComponent } from '@/shared/components/pageDataList/page-data-list.component';
import { Component, inject } from '@angular/core';
import { Component, inject, TemplateRef, ViewChild } from '@angular/core';
import { Router, RouterLink } from '@angular/router';
import { Badge } from 'primeng/badge';
import { ButtonDirective } from 'primeng/button';
import { IStatisticsSaleInvoicesResponse } from '../../../models';
import { CustomerStatisticsService } from '../../../services/main.service';
@@ -10,9 +11,11 @@ import { CustomerStatisticsService } from '../../../services/main.service';
@Component({
selector: 'consumer-statistics-latest-Invoices',
templateUrl: './latest-Invoices.component.html',
imports: [PageDataListComponent, ButtonDirective, RouterLink],
imports: [PageDataListComponent, ButtonDirective, RouterLink, Badge],
})
export class ConsumerStatisticsLatestInvoicesComponent extends AbstractList<IStatisticsSaleInvoicesResponse> {
@ViewChild('status', { static: true }) status!: TemplateRef<any>;
private readonly service = inject(CustomerStatisticsService);
private readonly router = inject(Router);
@@ -22,11 +25,7 @@ export class ConsumerStatisticsLatestInvoicesComponent extends AbstractList<ISta
this.columns = [
{ field: 'code', header: 'کد پیگیری' },
{ field: 'total_amount', header: 'مجموع قیمت', type: 'price' },
{
field: 'created_at',
header: 'تاریخ ایجاد',
type: 'date',
},
{ field: 'status', header: 'وضعیت صدور', customDataModel: this.status },
];
}