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,64 +1,99 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false">
|
||||
<ng-template #moreActions>
|
||||
<button pButton type="button" label="چاپ" icon="pi pi-print" outlined (click)="printInvoice()"></button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="کد رهگیری" [value]="invoice()?.code" />
|
||||
<app-key-value label="تاریخ فاکتور" [value]="invoice()?.invoice_date" type="dateTime" />
|
||||
<app-key-value label="تاریخ ایجاد فاکتور" [value]="invoice()?.created_at" type="dateTime" />
|
||||
<app-key-value label="وضعیت صدور به سامانهی مودیان">
|
||||
<p-badge value="ارسال نشده" severity="danger" />
|
||||
</app-key-value>
|
||||
<div class="col-span-3">
|
||||
<app-key-value label="توضیحات" [value]="invoice()?.notes" />
|
||||
@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">
|
||||
<ng-template #moreActions>
|
||||
<button pButton type="button" label="چاپ" icon="pi pi-print" outlined (click)="printInvoice()"></button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="کد رهگیری" [value]="invoice.code" />
|
||||
<app-key-value label="تاریخ فاکتور" [value]="invoice.invoice_date" type="dateTime" />
|
||||
<app-key-value label="تاریخ ایجاد فاکتور" [value]="invoice.created_at" type="dateTime" />
|
||||
<app-key-value label="وضعیت صدور به سامانهی مودیان">
|
||||
<p-badge value="ارسال نشده" severity="danger" />
|
||||
</app-key-value>
|
||||
<div class="col-span-3">
|
||||
<app-key-value label="توضیحات" [value]="invoice.notes" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="مجموع قابل پرداخت" [value]="invoice()?.total_amount" type="price" />
|
||||
@for (payment of invoice()?.payments; track $index) {
|
||||
<app-key-value
|
||||
[label]="
|
||||
`${payment.payment_method === 'SET_OF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پایانه' : 'نقدی'}`
|
||||
"
|
||||
[value]="payment.amount"
|
||||
type="price"
|
||||
/>
|
||||
<p-divider align="center"> اطلاعات پرداخت </p-divider>
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="مجموع قابل پرداخت" [value]="invoice.total_amount" type="price" />
|
||||
@for (payment of invoice.payments; track $index) {
|
||||
<app-key-value
|
||||
[label]="`${payment.payment_method === 'SET_OF' ? 'تهاتر' : payment.payment_method === 'TERMINAL' ? 'پایانه' : 'نقدی'}`"
|
||||
[value]="payment.amount"
|
||||
type="price"
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p-divider align="center"> اطلاعات صادر کننده </p-divider>
|
||||
<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.name" />
|
||||
<app-key-value label="پایانهی فروش" [value]="invoice.pos!.name" />
|
||||
<app-key-value label="ایجاد کننده" [value]="invoice.consumer_account.account.username" />
|
||||
</div>
|
||||
|
||||
@if (variant !== "customer") {
|
||||
<p-divider align="center"> اطلاعات مشتری </p-divider>
|
||||
@if (invoice.customer) {
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
@if (invoice.customer.type === "INDIVIDUAL") {
|
||||
<app-key-value label="نوع مشتری" value="حقیقی" />
|
||||
<app-key-value label="نام" [value]="invoice.customer.customer_individual?.first_name" />
|
||||
<app-key-value label="نام خانوادگی" [value]="invoice.customer.customer_individual?.last_name" />
|
||||
<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>
|
||||
} @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>
|
||||
|
||||
<p-divider align="center"> اطلاعات صادر کننده </p-divider>
|
||||
<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.name" />
|
||||
<app-key-value label="پایانهی فروش" [value]="invoice()?.pos!.name" />
|
||||
<app-key-value label="ایجاد کننده" [value]="invoice()?.consumer_account?.account?.username" />
|
||||
</div>
|
||||
|
||||
@if (variant !== "customer") {
|
||||
<p-divider align="center"> اطلاعات مشتری </p-divider>
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
@if (invoice()?.customer) {}
|
||||
<!-- <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" /> -->
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</app-card-data>
|
||||
<app-card-data cardTitle="کالاهای خریداری شده" [editable]="false">
|
||||
<app-page-data-list
|
||||
[columns]="columns"
|
||||
[expandColumns]="expandableColumns"
|
||||
[expandable]="true"
|
||||
expandableItemKey="payload"
|
||||
[items]="invoice()?.items"
|
||||
[loading]="loading"
|
||||
pageTitle=""
|
||||
(onRefresh)="refresh()"
|
||||
/>
|
||||
</app-card-data>
|
||||
</div>
|
||||
</app-card-data>
|
||||
<app-card-data cardTitle="کالاهای خریداری شده" [editable]="false">
|
||||
<app-page-data-list
|
||||
[columns]="columns"
|
||||
[expandColumns]="expandableColumns"
|
||||
[expandable]="true"
|
||||
expandableItemKey="payload"
|
||||
[items]="invoice.items"
|
||||
[loading]="loading"
|
||||
pageTitle=""
|
||||
[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>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -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<ISaleInvoiceFullResponse>;
|
||||
@Input() variant: TConsumerSaleInvoice = 'full';
|
||||
|
||||
@Output() onRefresh = new EventEmitter<void>();
|
||||
|
||||
@ViewChild('totalAmount', { static: false }) totalAmount!: TemplateRef<any>;
|
||||
|
||||
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',
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user