fix ui issues and upload image for guild good
This commit is contained in:
@@ -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>
|
||||
|
||||
@if (variant !== "customer") {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { KeyValueComponent } from '@/shared/components';
|
||||
import { licenseStatus } from '@/shared/localEnum/constants/licenseStatus';
|
||||
import { getLicenseStatus } from '@/utils';
|
||||
import { Component, computed, inject } from '@angular/core';
|
||||
import { Dialog } from 'primeng/dialog';
|
||||
import { Message } from 'primeng/message';
|
||||
@@ -14,15 +14,7 @@ import { ConsumerStore } from '../store/main.store';
|
||||
export class ConsumerLicenseInfoDialogComponent extends AbstractDialog {
|
||||
private readonly store = inject(ConsumerStore);
|
||||
|
||||
license = computed(() => this.store.entity()?.license);
|
||||
license = computed(() => this.store.entity()?.license_info);
|
||||
|
||||
licenseStatus = computed(() => {
|
||||
if (!this.store.entity()?.license?.expires_at) {
|
||||
return null;
|
||||
}
|
||||
if (new Date().getTime() > new Date(this.store.entity()?.license?.expires_at || '').getTime()) {
|
||||
return licenseStatus.EXPIRED;
|
||||
}
|
||||
return licenseStatus.ACTIVE;
|
||||
});
|
||||
licenseStatus = computed(() => getLicenseStatus(getLicenseStatus(this.license()?.expires_at)));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LayoutService } from '@/layout/service/layout.service';
|
||||
import { licenseStatus } from '@/shared/localEnum/constants/licenseStatus';
|
||||
import { getLicenseStatus } from '@/utils';
|
||||
import { Component, computed, inject, signal, TemplateRef, ViewChild } from '@angular/core';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { Button, ButtonIcon } from 'primeng/button';
|
||||
@@ -20,15 +20,9 @@ export class LayoutComponent {
|
||||
|
||||
visibleLicenseInfo = signal(false);
|
||||
|
||||
licenseStatus = computed(() => {
|
||||
if (!this.store.entity()?.license?.expires_at) {
|
||||
return null;
|
||||
}
|
||||
if (new Date().getTime() > new Date(this.store.entity()?.license?.expires_at || '').getTime()) {
|
||||
return licenseStatus.EXPIRED;
|
||||
}
|
||||
return licenseStatus.ACTIVE;
|
||||
});
|
||||
licenseStatus = computed(() =>
|
||||
getLicenseStatus(getLicenseStatus(this.store.entity()?.license_info?.expires_at)),
|
||||
);
|
||||
|
||||
ngOnInit() {
|
||||
this.layoutService.setMenuItems(CONSUMER_MENU_ITEMS);
|
||||
|
||||
+12
-10
@@ -1,17 +1,19 @@
|
||||
import ISummary from '@/core/models/summary';
|
||||
import { TLicenseStatus } from '@/shared/localEnum/constants/licenseStatus';
|
||||
|
||||
export interface IConsumerInfoRawResponse {
|
||||
id: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
full_name: string;
|
||||
mobile_number: string;
|
||||
license: {
|
||||
starts_at: string;
|
||||
expires_at: string;
|
||||
status: TLicenseStatus;
|
||||
partner?: ISummary;
|
||||
};
|
||||
status: string;
|
||||
fullname: string;
|
||||
license_info: LicenseInfo;
|
||||
}
|
||||
export interface IConsumerInfoResponse extends IConsumerInfoRawResponse {}
|
||||
|
||||
interface LicenseInfo {
|
||||
id: string;
|
||||
starts_at: string;
|
||||
expires_at: string;
|
||||
partner: {
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
+4
@@ -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>
|
||||
|
||||
+6
-7
@@ -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 },
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user