2026-04-23 01:22:44 +03:30
|
|
|
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',
|
2026-04-24 02:23:47 +03:30
|
|
|
nestedOption: {
|
|
|
|
|
path: 'good.name',
|
|
|
|
|
},
|
2026-04-23 01:22:44 +03:30
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
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 } = {};
|
|
|
|
|
}
|