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);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ export class ConsumerBusinessActivityListComponent extends AbstractList<IBusines
|
||||
@Input() header: IColumn[] = [
|
||||
{ field: 'id', header: 'شناسه', type: 'id' },
|
||||
{ field: 'name', header: 'عنوان' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedPath: 'name' },
|
||||
{ field: 'guild', header: 'صنف', type: 'nested', nestedPath: 'guild.name' },
|
||||
{
|
||||
field: 'created_at',
|
||||
header: 'تاریخ ایجاد',
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات پایانهی فروش" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreAction>
|
||||
<ng-template #moreActions>
|
||||
<p-button type="button" variant="outlined" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فعالیت اقتصادی" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreAction> </ng-template>
|
||||
<ng-template #moreActions> </ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-3 gap-4 items-center">
|
||||
<app-key-value label="عنوان" [value]="business()?.name" />
|
||||
|
||||
+1
-38
@@ -1,38 +1 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات فاکتور" [editable]="false" [(editMode)]="editMode">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</app-card-data>
|
||||
</div>
|
||||
<consumer-saleInvoice-shared [loading]="loading()" [invoice]="invoice" variant="customer" />
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/shared-saleInvoice.component';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Badge } from 'primeng/badge';
|
||||
import { Divider } from 'primeng/divider';
|
||||
import { ConsumerCustomerStore } from '../../store/customer.store';
|
||||
import { ConsumerCustomerSaleInvoiceStore } from '../../store/saleInvoice.store';
|
||||
|
||||
@Component({
|
||||
selector: 'consumer-customer-saleInvoice',
|
||||
templateUrl: './single.component.html',
|
||||
imports: [AppCardComponent, KeyValueComponent, Divider, Badge],
|
||||
imports: [ConsumerSaleInvoiceSharedComponent],
|
||||
})
|
||||
export class ConsumerCustomerSaleInvoiceComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
@@ -25,6 +23,7 @@ export class ConsumerCustomerSaleInvoiceComponent {
|
||||
editMode = signal<boolean>(false);
|
||||
|
||||
readonly invoice = computed(() => this.store.entity());
|
||||
readonly loading = computed(() => this.store.loading());
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="flex flex-col gap-6">
|
||||
<app-card-data cardTitle="اطلاعات پایانهی فروش" [editable]="true" [(editMode)]="editMode">
|
||||
<ng-template #moreAction>
|
||||
<ng-template #moreActions>
|
||||
<p-button type="button" variant="outlined" (onClick)="toPosLanding()"> ورود به پایانه </p-button>
|
||||
</ng-template>
|
||||
<div class="flex flex-col gap-4">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BreadcrumbService } from '@/core/services';
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/single.component';
|
||||
import { ConsumerSaleInvoiceSharedComponent } from '@/domains/consumer/components/invoices/shared-saleInvoice.component';
|
||||
import pageParamsUtils from '@/utils/page-params.utils';
|
||||
import { Component, computed, effect, inject, signal } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
Reference in New Issue
Block a user