update
This commit is contained in:
+15
-1
@@ -1,5 +1,8 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false" [(editMode)]="editMode">
|
||||
<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" />
|
||||
@@ -46,4 +49,15 @@
|
||||
}
|
||||
</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=""
|
||||
/>
|
||||
</app-card-data>
|
||||
</div>
|
||||
@@ -0,0 +1,87 @@
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import {
|
||||
IColumn,
|
||||
PageDataListComponent,
|
||||
} from '@/shared/components/pageDataList/page-data-list.component';
|
||||
import { getGoodUnitTypeProperties } from '@/utils';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Badge } from 'primeng/badge';
|
||||
import { ButtonDirective } from 'primeng/button';
|
||||
import { Divider } from 'primeng/divider';
|
||||
import { TableModule } from 'primeng/table';
|
||||
|
||||
export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-saleInvoice-shared',
|
||||
templateUrl: './shared-saleInvoice.component.html',
|
||||
imports: [
|
||||
AppCardComponent,
|
||||
KeyValueComponent,
|
||||
Badge,
|
||||
Divider,
|
||||
ButtonDirective,
|
||||
PageDataListComponent,
|
||||
TableModule,
|
||||
],
|
||||
})
|
||||
export class ConsumerSaleInvoiceSharedComponent {
|
||||
@Input({ required: true }) loading!: boolean;
|
||||
@Input({ required: true }) invoice!: any;
|
||||
@Input() variant: TConsumerSaleInvoice = 'full';
|
||||
|
||||
printInvoice = () => {
|
||||
window.print();
|
||||
};
|
||||
|
||||
columns: IColumn[] = [
|
||||
{
|
||||
field: '',
|
||||
header: '',
|
||||
type: 'index',
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
header: 'عنوان',
|
||||
type: 'nested',
|
||||
nestedPath: 'good.name',
|
||||
},
|
||||
{
|
||||
field: 'unit_price',
|
||||
header: 'قیمت واحد',
|
||||
type: 'price',
|
||||
},
|
||||
{
|
||||
field: 'quantity',
|
||||
header: 'مقدار',
|
||||
customDataModel(item) {
|
||||
return `${item.quantity} ${getGoodUnitTypeProperties(item.good.unit_type).quantitySymbolText}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'total_amount',
|
||||
header: 'قیمت نهایی',
|
||||
type: 'price',
|
||||
},
|
||||
];
|
||||
|
||||
expandableColumns: IColumn[] = [
|
||||
{
|
||||
field: 'commission',
|
||||
header: 'کارمزد',
|
||||
type: 'price',
|
||||
},
|
||||
{
|
||||
field: 'profit',
|
||||
header: 'سود',
|
||||
type: 'price',
|
||||
},
|
||||
{
|
||||
field: 'wages',
|
||||
header: 'اجرت',
|
||||
type: 'price',
|
||||
},
|
||||
];
|
||||
|
||||
expandedRows: { [key: string]: boolean } = {};
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { Component, Input, signal } from '@angular/core';
|
||||
import { Badge } from 'primeng/badge';
|
||||
import { Divider } from 'primeng/divider';
|
||||
|
||||
export type TConsumerSaleInvoice = 'full' | 'customer' | 'pos';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-saleInvoice-shared',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [AppCardComponent, KeyValueComponent, Badge, Divider],
|
||||
})
|
||||
export class ConsumerSaleInvoiceSharedComponent {
|
||||
@Input({ required: true }) loading!: boolean;
|
||||
@Input({ required: true }) invoice!: any;
|
||||
@Input() editable = false;
|
||||
@Input() variant: TConsumerSaleInvoice = 'full';
|
||||
|
||||
editMode = signal<boolean>(false);
|
||||
}
|
||||
Reference in New Issue
Block a user