2026-06-11 16:13:48 +03:30
|
|
|
import { Maybe } from '@/core';
|
|
|
|
|
import {
|
|
|
|
|
CatalogInvoiceTypeTagComponent,
|
|
|
|
|
CatalogTaxProviderStatusTagComponent,
|
|
|
|
|
} from '@/shared/catalog';
|
|
|
|
|
import { CatalogInvoiceSettlementTypeTagComponent } from '@/shared/catalog/invoiceSettlementType';
|
|
|
|
|
import { PriceMaskDirective } from '@/shared/directives';
|
|
|
|
|
import { Component, Input } from '@angular/core';
|
|
|
|
|
import { Card } from 'primeng/card';
|
|
|
|
|
import { Divider } from 'primeng/divider';
|
|
|
|
|
import { KeyValueComponent } from '../key-value.component/key-value.component';
|
|
|
|
|
import { IColumn, PageDataListComponent } from '../pageDataList/page-data-list.component';
|
|
|
|
|
import { ISaleInvoiceFullResponse } from './sale-invoice-full-response.model';
|
|
|
|
|
|
|
|
|
|
export type TSaleInvoiceSingleViewVariant = 'full' | 'customer' | 'pos';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'shared-sale-invoice-single-info-card',
|
|
|
|
|
templateUrl: './sale-invoice-single-info-card.component.html',
|
|
|
|
|
imports: [
|
|
|
|
|
Card,
|
|
|
|
|
KeyValueComponent,
|
|
|
|
|
CatalogInvoiceTypeTagComponent,
|
|
|
|
|
CatalogTaxProviderStatusTagComponent,
|
|
|
|
|
Divider,
|
|
|
|
|
CatalogInvoiceSettlementTypeTagComponent,
|
|
|
|
|
PageDataListComponent,
|
|
|
|
|
PriceMaskDirective,
|
|
|
|
|
],
|
|
|
|
|
})
|
|
|
|
|
export class SaleInvoiceSingleInfoCardComponent {
|
|
|
|
|
@Input({ required: true }) loading!: boolean;
|
|
|
|
|
@Input() invoice!: Maybe<ISaleInvoiceFullResponse>;
|
|
|
|
|
@Input() variant: TSaleInvoiceSingleViewVariant = 'full';
|
|
|
|
|
|
|
|
|
|
columns: IColumn[] = [
|
|
|
|
|
{
|
|
|
|
|
field: 'name',
|
|
|
|
|
header: 'عنوان',
|
|
|
|
|
type: 'nested',
|
|
|
|
|
nestedOption: {
|
|
|
|
|
path: 'good_snapshot.name',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'sku_code',
|
|
|
|
|
header: 'شناسه کالا',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'unit_price',
|
|
|
|
|
header: 'قیمت واحد',
|
|
|
|
|
type: 'price',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'quantity',
|
|
|
|
|
header: 'مقدار',
|
|
|
|
|
customDataModel(item) {
|
|
|
|
|
return `${item.quantity} ${item.measure_unit_text}`;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'commission',
|
|
|
|
|
header: 'کارمزد',
|
|
|
|
|
type: 'nested',
|
|
|
|
|
nestedOption: {
|
|
|
|
|
path: 'payload.commission',
|
|
|
|
|
type: 'price',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'wages',
|
|
|
|
|
header: 'اجرت',
|
|
|
|
|
type: 'nested',
|
|
|
|
|
nestedOption: {
|
|
|
|
|
path: 'payload.wages',
|
|
|
|
|
type: 'price',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'profit',
|
|
|
|
|
header: 'سود',
|
|
|
|
|
type: 'nested',
|
|
|
|
|
nestedOption: {
|
|
|
|
|
path: 'payload.profit',
|
|
|
|
|
type: 'price',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'discount_amount',
|
2026-06-14 16:33:51 +03:30
|
|
|
header: 'تخفیف',
|
2026-06-11 16:13:48 +03:30
|
|
|
type: 'price',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'tax_amount',
|
2026-06-14 16:33:51 +03:30
|
|
|
header: 'مالیات',
|
2026-06-11 16:13:48 +03:30
|
|
|
type: 'price',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'total_amount',
|
2026-06-14 16:33:51 +03:30
|
|
|
header: 'قابل پرداخت',
|
2026-06-11 16:13:48 +03:30
|
|
|
type: 'price',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}
|